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) }