|
@@ -313,7 +313,7 @@ class OrderCreate
|
|
|
$current_goods_amount = bcmul($buyInfo['current_sku_price']->price, $buyInfo['goods_num'], 2);
|
|
|
$this->orderData['goods_amount'] = bcadd($this->orderData['goods_amount'], $current_goods_amount, 2);
|
|
|
|
|
|
- //当前商品的善豆抵扣价,商品没有就拿分类
|
|
|
+ //当前商品的善豆抵扣比例,商品没有就拿分类,最大100%
|
|
|
$bean_rate = floatval($goods->bean_rate) > 0 ? $goods->bean_rate : 0;
|
|
|
if($bean_rate == 0){
|
|
|
$bean_rate = Db::name('shopro_category')->where('id',$goods->category_ids)->value('bean_rate');
|
|
@@ -999,7 +999,11 @@ class OrderCreate
|
|
|
|
|
|
//最终使用善豆
|
|
|
$this->orderData['goods_bean_amount'] = $this->bean;
|
|
|
- $temp_remain_pay_fee = bcsub($this->orderData['pay_fee'], $this->bean, 2);
|
|
|
+// $temp_remain_pay_fee = bcsub($this->orderData['pay_fee'], $this->bean, 2);
|
|
|
+
|
|
|
+ //善豆不算钱,所以这里pay_fee也降低
|
|
|
+ $this->orderData['pay_fee'] = bcsub($this->orderData['pay_fee'], $this->bean, 2);
|
|
|
+ $temp_remain_pay_fee = $this->orderData['pay_fee'];
|
|
|
|
|
|
//商品里的善豆也要等比例修改,方便售后退回
|
|
|
foreach ($this->goodsList as $key => &$buyInfo) {
|
|
@@ -1286,7 +1290,8 @@ class OrderCreate
|
|
|
$orderItem->discount_fee = bcadd(bcadd($buyInfo['promo_discount_fee'], $buyInfo['coupon_discount_fee'], 2), $buyInfo['dispatch_discount_fee'], 2); // 当前商品所享受的折扣 (promo_discount_fee + coupon_discount_fee + dispatch_discount_fee)
|
|
|
|
|
|
$pay_fee = bcsub($buyInfo['goods_amount'], bcadd($buyInfo['promo_discount_fee'], $buyInfo['coupon_discount_fee'], 2), 2); // 商品总金额(不算运费),减去(活动优惠(不包含包邮优惠) + 优惠券优惠)
|
|
|
- $orderItem->pay_fee = $pay_fee; // 平均计算单件商品不算运费,算折扣时候的金额
|
|
|
+// $orderItem->pay_fee = $pay_fee; // 平均计算单件商品不算运费,算折扣时候的金额
|
|
|
+ $orderItem->pay_fee = bcsub($pay_fee,$buyInfo['goods_bean_amount'],2); // 平均计算单件商品不算运费,算折扣时候的金额
|
|
|
$orderItem->dispatch_status = 0;
|
|
|
$orderItem->dispatch_fee = $buyInfo['dispatch_amount']; // 运费模板中商品自动合并后的加权平均运费,没有扣除包邮优惠
|
|
|
$orderItem->dispatch_type = $buyInfo['dispatch_type'];
|