|
|
@@ -91,18 +91,15 @@ func (self *PayController) payExchange(oId, payWay, tradPwd, returnUrl, source,
|
|
|
storeMap := make(map[int64]int64)
|
|
|
|
|
|
//支付方式判断
|
|
|
- if (order.OrderType == order_model.ORDER_TYPE_SEKILL || order.OrderType == order_model.ORDER_TYPE_SHOP) && payWay == pay_model.PAYWAY_BALANCE {
|
|
|
- self.ReturnError(403, apps.NotRightPayWay, "", nil)
|
|
|
- }
|
|
|
-
|
|
|
- //普通订单总价大于pv只支持微信支付
|
|
|
- if order.OrderType == order_model.ORDER_TYPE_NORMAL && useCoupon && order.Pv < order.TotalPrice {
|
|
|
+ if order.OrderType == order_model.ORDER_TYPE_SHOP && payWay == pay_model.PAYWAY_BALANCE {
|
|
|
self.ReturnError(403, apps.NotRightPayWay, "", nil)
|
|
|
}
|
|
|
|
|
|
//获取购物商品明细
|
|
|
buy_price_total := int64(0)
|
|
|
total_price := int64(0)
|
|
|
+ total_quan := int64(0)
|
|
|
+ total_weixin := int64(0)
|
|
|
list := order_model.GetAllDetailsOrderId(order.OrderId, false)
|
|
|
for _, item := range list {
|
|
|
//商品状态
|
|
|
@@ -140,6 +137,10 @@ func (self *PayController) payExchange(oId, payWay, tradPwd, returnUrl, source,
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+ //微信支付金额统计
|
|
|
+ if product.Pv >= product.Price {
|
|
|
+ total_quan += product.Price * item.Count
|
|
|
+ }
|
|
|
buy_price_total += product.BuyPrice * item.Count
|
|
|
total_price += product.Price * item.Count
|
|
|
SaleNumsMap[product.Id] = item.Count
|
|
|
@@ -183,14 +184,18 @@ func (self *PayController) payExchange(oId, payWay, tradPwd, returnUrl, source,
|
|
|
freight = int64(0)
|
|
|
}
|
|
|
tp += freight
|
|
|
- if order.OrderType != order_model.ORDER_TYPE_SEKILL && useCoupon {
|
|
|
- if userLeftBalanceCount < tp {
|
|
|
+ total_quan += freight
|
|
|
+ if useCoupon {
|
|
|
+ if userLeftBalanceCount < total_quan {
|
|
|
totalCoupon = userLeftBalanceCount
|
|
|
} else {
|
|
|
- needWx = false
|
|
|
- totalCoupon = tp
|
|
|
+ totalCoupon = total_quan
|
|
|
}
|
|
|
}
|
|
|
+ total_weixin = tp - totalCoupon
|
|
|
+ if total_weixin > 0 {
|
|
|
+ needWx = true
|
|
|
+ }
|
|
|
order.Freight = freight
|
|
|
order.PickDept = pick_dept_id
|
|
|
order.PickWay = pick_way
|
|
|
@@ -231,7 +236,7 @@ func (self *PayController) payExchange(oId, payWay, tradPwd, returnUrl, source,
|
|
|
order.Contact = concat
|
|
|
order.Tel = tel
|
|
|
order.Address = addr
|
|
|
- order.PaiedPrice = tp - totalCoupon
|
|
|
+ order.PaiedPrice = total_weixin
|
|
|
order.Source = source
|
|
|
order.Save()
|
|
|
if source == order_model.SOURCE_XCX { //小程序微信支付
|