|
@@ -319,6 +319,9 @@ class OrderCreate
|
|
|
$bean_rate = Db::name('shopro_category')->where('id',$goods->category_ids)->value('bean_rate');
|
|
|
$bean_rate = floatval($bean_rate) > 0 ? $bean_rate : 0;
|
|
|
}
|
|
|
+ if($bean_rate > 100){
|
|
|
+ $bean_rate = 100;
|
|
|
+ }
|
|
|
|
|
|
//善豆理论最大金额
|
|
|
$current_goods_bean_amount = bcdiv(bcmul($current_goods_amount,$bean_rate,2),100,2);
|
|
@@ -326,6 +329,9 @@ class OrderCreate
|
|
|
|
|
|
//能让利百分比
|
|
|
$back_rate = floatval($goods->back_rate) > 0 ? $goods->back_rate : 0;
|
|
|
+ if($back_rate > 100){
|
|
|
+ $back_rate = 100;
|
|
|
+ }
|
|
|
|
|
|
//让利金额
|
|
|
$current_goods_back_amount = bcdiv(bcmul($current_goods_amount,$back_rate,2),100,2);
|
|
@@ -1005,10 +1011,10 @@ class OrderCreate
|
|
|
'goods_old_amount' => $this->orderData['goods_old_amount'],
|
|
|
'goods_amount' => $this->orderData['goods_amount'],
|
|
|
|
|
|
- 'goods_bean_amount' => $this->orderData['goods_bean_amount'], //最大可抵扣善豆
|
|
|
+ 'goods_bean_amount' => $this->orderData['goods_bean_amount'], //抵扣善豆
|
|
|
'goods_back_amount' => $this->orderData['goods_back_amount'], //让利金额
|
|
|
'user_bean_amount' => $user_bean, //用户善豆余额
|
|
|
- 'min_bean_amount' => config('site.shopro_min_bean_amount'), //最小可使用善豆数量
|
|
|
+ 'min_bean_amount' => config('site.shopro_min_bean_amount'), //最小可使用善豆数量,未加入计算
|
|
|
|
|
|
'dispatch_amount' => $this->orderData['dispatch_amount'],
|
|
|
'real_dispatch_amount' => $this->orderData['real_dispatch_amount'],
|
|
@@ -1157,7 +1163,8 @@ class OrderCreate
|
|
|
$orderData['score_amount'] = $result['score_amount'];
|
|
|
$orderData['pay_fee'] = $result['pay_fee'];
|
|
|
$orderData['original_pay_fee'] = $result['pay_fee']; // 记录支付总金额,后面可能会订单改价
|
|
|
- $orderData['remain_pay_fee'] = $result['pay_fee']; // 这里还是显示应支付总金额,扣除动作放到实际支付时
|
|
|
+// $orderData['remain_pay_fee'] = $result['pay_fee']; // 这里还是显示应支付总金额,扣除动作放到实际支付时
|
|
|
+ $orderData['remain_pay_fee'] = $result['temp_remain_pay_fee']; // 这里提现扣除善豆
|
|
|
$orderData['total_discount_fee'] = $result['total_discount_fee'];
|
|
|
$orderData['coupon_discount_fee'] = $result['coupon_discount_fee'];
|
|
|
$orderData['promo_discount_fee'] = $result['promo_discount_fee'];
|
|
@@ -1235,6 +1242,12 @@ class OrderCreate
|
|
|
$result['coupon']->allowField(true)->save();
|
|
|
}
|
|
|
|
|
|
+ // 将善豆扣掉
|
|
|
+ $walletService = new Wallet();
|
|
|
+ if (!$walletService->change($this->user->id, -$result['goods_bean_amount'], 'bean', 131, '商城购物抵扣', 'shopro_order', $order->id)) {
|
|
|
+ error_stop($walletService->getMessage());
|
|
|
+ }
|
|
|
+
|
|
|
//bill表args
|
|
|
$bill_args = [];
|
|
|
|