This commit is contained in:
richboo111
2022-09-20 17:49:32 +08:00
parent eaab50c8b2
commit e95886f47d

View File

@@ -164,9 +164,9 @@ func PayByBalance(ctx *jxcontext.Context, orderID string, isChoose, payType int,
//}
//快递混合支付
if orderInfo.OrderType == model.OrderTypeDelivery {
// (3)使用余额且 余额大于支付金额
if isChoose == model.PayChooseBalance {
if userBill.AccountBalance > 0 && userBill.AccountBalance > orderInfo.PayPrice {
// (3)使用余额且 余额大于支付金额
if userBill.AccountBalance > orderInfo.PayPrice {
globals.SugarLogger.Debug("进入余额支付部分")
txDB, _ := dao.Begin(db)
defer func() {
@@ -216,7 +216,6 @@ func PayByBalance(ctx *jxcontext.Context, orderID string, isChoose, payType int,
return nil, "order/user_vendor_order更新状态出错", nil
}
} else {
//else if isChoose == model.PayChooseBalance && userBill.AccountBalance < orderInfo.PayPrice {
//1用户选中余额 但余额<订单总价 需混合微信支付
if userBill.AccountBalance == 0 {
WxPayParam, err := Pay(ctx, orderInfo.OrderID, payType, vendorPayType, appID, orderInfo.PayPrice)
@@ -226,15 +225,14 @@ func PayByBalance(ctx *jxcontext.Context, orderID string, isChoose, payType int,
return WxPayParam, "", err
} else if userBill.AccountBalance > 0 {
//2用户使用余额剩余微信支付
totalPrice := orderInfo.PayPrice //订单原价
if userBill.AccountBalance > 0 && userBill.AccountBalance < orderInfo.PayPrice {
needPay := totalPrice - userBill.AccountBalance //需支付金额
WxPayParam, err := Pay(ctx, orderInfo.OrderID, payType, vendorPayType, appID, needPay)
if err != nil {
return nil, "微信支付失败:", err
}
return WxPayParam, "", err
totalPrice := orderInfo.PayPrice //订单原价
needPay := totalPrice - userBill.AccountBalance //需支付金额
globals.SugarLogger.Debug("totalprice=====,needpay=====", totalPrice, needPay)
WxPayParam, err := Pay(ctx, orderInfo.OrderID, payType, vendorPayType, appID, needPay)
if err != nil {
return nil, "微信支付失败:", err
}
return WxPayParam, "", err
}
}
}