Merge branch 'dev' of https://gitea.lihaink.cn/mkm/multi-store into dev
This commit is contained in:
commit
2f756f10d7
@ -11,6 +11,7 @@ use app\common\model\dict\DictType;
|
|||||||
use app\common\model\store_branch_product\StoreBranchProduct;
|
use app\common\model\store_branch_product\StoreBranchProduct;
|
||||||
use app\common\model\store_product_attr_value\StoreProductAttrValue;
|
use app\common\model\store_product_attr_value\StoreProductAttrValue;
|
||||||
use app\common\model\store_product_unit\StoreProductUnit;
|
use app\common\model\store_product_unit\StoreProductUnit;
|
||||||
|
use app\common\model\user\User;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 购物车列表
|
* 购物车列表
|
||||||
@ -21,6 +22,7 @@ class CartList extends BaseAdminDataLists implements ListsSearchInterface, Lists
|
|||||||
{
|
{
|
||||||
|
|
||||||
protected $total_price = 0;
|
protected $total_price = 0;
|
||||||
|
protected $activity_price = 0;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -59,17 +61,26 @@ class CartList extends BaseAdminDataLists implements ListsSearchInterface, Lists
|
|||||||
})
|
})
|
||||||
->toArray();
|
->toArray();
|
||||||
// $check = DictType::where('type', 'activities')->find();
|
// $check = DictType::where('type', 'activities')->find();
|
||||||
|
$user = User::where('id', $userId)->find();
|
||||||
foreach ($list as $key => &$item) {
|
foreach ($list as $key => &$item) {
|
||||||
|
|
||||||
$find = StoreBranchProduct::where(['product_id' => $item['product_id'],'store_id' => $item['store_id']])
|
$find = StoreBranchProduct::where(['product_id' => $item['product_id'],'store_id' => $item['store_id']])
|
||||||
->field('product_id,image,price,cost,store_name,unit,delete_time')
|
->field('product_id,image,price,cost,store_name,unit,delete_time,vip_price')
|
||||||
->withTrashed()
|
->withTrashed()
|
||||||
->find();
|
->find();
|
||||||
// if (isset($check) && $check['status'] == 1) {
|
|
||||||
// $find['price'] = $find['cost'];
|
|
||||||
// }
|
|
||||||
if ($find) {
|
if ($find) {
|
||||||
|
if ($user && $user['user_ship'] == 1) {
|
||||||
|
//更新 会员为1的时候原价减去会员价
|
||||||
|
$deduction_price_count=bcmul(bcsub($find['price'], $find['vip_price'], 2),$item['cart_num'],2);
|
||||||
|
$this->activity_price = bcadd($this->activity_price, $deduction_price_count, 2);
|
||||||
|
}elseif ($user && $user['user_ship'] == 4) {
|
||||||
|
//更新 为4商户的时候减去商户价格
|
||||||
|
$deduction_price_count=bcmul(bcsub($find['price'], $find['cost'], 2),$item['cart_num'],2);
|
||||||
|
$this->activity_price = bcadd( $this->activity_price, $deduction_price_count, 2);
|
||||||
|
}else{
|
||||||
|
$this->activity_price =0;
|
||||||
|
}
|
||||||
$item['goods_total_price'] = bcmul($item['cart_num'], $find['price'], 2);
|
$item['goods_total_price'] = bcmul($item['cart_num'], $find['price'], 2);
|
||||||
$this->total_price = bcadd($this->total_price, $item['goods_total_price'], 2);
|
$this->total_price = bcadd($this->total_price, $item['goods_total_price'], 2);
|
||||||
$item['imgs'] = $find['image'];
|
$item['imgs'] = $find['image'];
|
||||||
@ -100,6 +111,10 @@ class CartList extends BaseAdminDataLists implements ListsSearchInterface, Lists
|
|||||||
|
|
||||||
public function extend()
|
public function extend()
|
||||||
{
|
{
|
||||||
return ['total_price' => $this->total_price];
|
return [
|
||||||
|
'total_price' => $this->total_price,
|
||||||
|
'activity_price' => $this->activity_price,
|
||||||
|
'pay_price'=> bcsub($this->total_price, $this->activity_price, 2)
|
||||||
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -131,7 +131,7 @@ class OrderLogic extends BaseLogic
|
|||||||
}
|
}
|
||||||
//加支付方式限制
|
//加支付方式限制
|
||||||
$pay_type = isset($params['pay_type'])?$params['pay_type']:0;
|
$pay_type = isset($params['pay_type'])?$params['pay_type']:0;
|
||||||
if ($user && $user['user_ship'] == 1 && $pay_type !=17) {
|
if ($user && $user['user_ship'] == 1 && $pay_type ==17) {
|
||||||
$pay_price = self::$pay_price;
|
$pay_price = self::$pay_price;
|
||||||
}else{
|
}else{
|
||||||
$pay_price =bcsub(self::$pay_price, self::$activity_price, 2); //减去活动优惠金额
|
$pay_price =bcsub(self::$pay_price, self::$activity_price, 2); //减去活动优惠金额
|
||||||
|
Loading…
x
Reference in New Issue
Block a user