增加原价字段

This commit is contained in:
苏尹岚
2020-08-26 16:07:45 +08:00
parent 6118c7394e
commit fa0d029f79
2 changed files with 8 additions and 3 deletions

View File

@@ -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=当前客户购买的数量)时以当时价抢购

View File

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