From b6032b854722d6e63ce1dbc30bd7ab768a47e54c Mon Sep 17 00:00:00 2001 From: wucongxing8150 <815046773@qq.com> Date: Thu, 13 Jun 2024 13:39:13 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E4=BA=86=E4=BC=98=E6=83=A0?= =?UTF-8?q?=E9=87=91=E9=A2=9D=E8=BF=94=E5=9B=9E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/dto/OrderProduct.go | 1 + api/service/orderProduct.go | 3 +++ 2 files changed, 4 insertions(+) diff --git a/api/dto/OrderProduct.go b/api/dto/OrderProduct.go index e4e37b1..203bcd3 100644 --- a/api/dto/OrderProduct.go +++ b/api/dto/OrderProduct.go @@ -60,6 +60,7 @@ type OrderProductDto struct { OrderInquiryCase *OrderInquiryCaseDto `json:"order_inquiry_case"` // 问诊病例 OrderProductCoupon *OrderProductCouponDto `json:"order_product_coupon"` // 优惠卷 ProductName string `json:"product_name"` // 药品数据 + DiscountAmount float64 `json:"discount_amount"` // 优惠金额 } // OrderProductConsigneeDto 药品订单收货人数据 diff --git a/api/service/orderProduct.go b/api/service/orderProduct.go index 5cba44d..c92b03f 100644 --- a/api/service/orderProduct.go +++ b/api/service/orderProduct.go @@ -86,6 +86,9 @@ func (r *OrderProductService) GetOrderProduct(orderProductId int64) (g *dto.Orde // 加载药品订单优惠卷数据 g.LoadOrderProductCoupon(orderProductCoupon) + // 计算优惠金额 + g.DiscountAmount = orderProduct.AmountTotal + orderProduct.LogisticsFee - orderProduct.CouponAmountTotal - orderProduct.PaymentAmountTotal + return g, nil }