From fa0d029f7960189312378d1a27c46ef7cd6b07d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Wed, 26 Aug 2020 16:07:45 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=8E=9F=E4=BB=B7=E5=AD=97?= =?UTF-8?q?=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/model/order.go | 1 + business/partner/purchase/jx/localjx/order.go | 10 +++++++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/business/model/order.go b/business/model/order.go index b85518644..93fcfbd00 100644 --- a/business/model/order.go +++ b/business/model/order.go @@ -392,6 +392,7 @@ type PriceDefendOrder struct { AddressID int64 `orm:"column(address_id)" json:"addressID"` Count int `json:"count"` DefendPrice int64 `json:"defendPrice"` //守的价格 + OriginPrice int64 `json:"originPrice"` //商品原价 ActualPayPrice int64 `json:"actualPayPrice"` //单位为分 顾客实际支付 RealPrice int64 `json:"realPrice"` //实际成交价 IsBuyNowPrice int `json:"isBuyNowPrice"` //库存剩x(x=当前客户购买的数量)时以当时价抢购 diff --git a/business/partner/purchase/jx/localjx/order.go b/business/partner/purchase/jx/localjx/order.go index 4c7fbab95..f10728068 100644 --- a/business/partner/purchase/jx/localjx/order.go +++ b/business/partner/purchase/jx/localjx/order.go @@ -64,6 +64,8 @@ type JxSkuInfo struct { Name string `json:"name"` Weight int `json:"weight"` GroupSign bool `json:"groupSign"` + + DefendPrice int64 `json:"defendPrice"` //守价 } type JxSkuInfo2 struct { @@ -274,14 +276,15 @@ func buildDefendPriceOrder(ctx *jxcontext.Context, jxOrder *JxOrderInfo, address SkuID: jxOrder.Skus[0].SkuID, AddressID: addressID, Count: jxOrder.Skus[0].Count, - DefendPrice: jxOrder.Skus[0].Price, + DefendPrice: jxOrder.Skus[0].DefendPrice, + OriginPrice: jxOrder.Skus[0].Price, IsBuyNowPrice: jxOrder.IsBuyNowPrice, Issue: issue, IsSuccess: model.NO, //默认是不成功 IsPay: model.NO, } dao.WrapAddIDCULDEntity(priceDefendOrder, ctx.GetUserName()) - priceDefendOrder.ActualPayPrice = int64(priceDefendOrder.Count)*priceDefendOrder.DefendPrice + jxOrder.FreightPrice + priceDefendOrder.ActualPayPrice = int64(priceDefendOrder.Count)*jxOrder.Skus[0].Price + jxOrder.FreightPrice dao.CreateEntity(db, priceDefendOrder) return priceDefendOrder.VendorOrderID } @@ -2017,7 +2020,8 @@ func SettleDiscountActByPriceDefend(ctx *jxcontext.Context, order *model.PriceDe refundID := order.VendorOrderID if orderPay.PayType == model.PayTypeTL { if !isFull { - _, err = RefundOrderByTL(ctx, orderPay, refundID, int(order.ActualPayPrice-order.RealPrice), settleDiscountActRefundReason) + minusPrice := int(order.OriginPrice - order.RealPrice) + _, err = RefundOrderByTL(ctx, orderPay, refundID, order.Count*minusPrice, settleDiscountActRefundReason) } else { _, err = RefundOrderByTL(ctx, orderPay, refundID, int(order.ActualPayPrice), settleDiscountActRefundReason) }