refactor(CartList, ProductLists): 重构商品列表逻辑,移除活动特价计算,修改成本计算方式
This commit is contained in:
parent
617be65057
commit
9e240a5488
@ -58,15 +58,15 @@ class CartList extends BaseAdminDataLists implements ListsSearchInterface, Lists
|
||||
return $item;
|
||||
})
|
||||
->toArray();
|
||||
$check = DictType::where('type', 'activities')->find();
|
||||
// $check = DictType::where('type', 'activities')->find();
|
||||
|
||||
foreach ($list as $key => &$item) {
|
||||
$find = StoreBranchProduct::where(['id' => $item['product_id']])
|
||||
->field('product_id,image,price,cost,store_name,unit')
|
||||
->find();
|
||||
if (isset($check) && $check['status'] == 1) {
|
||||
$find['price'] = $find['cost'];
|
||||
}
|
||||
// if (isset($check) && $check['status'] == 1) {
|
||||
// $find['price'] = $find['cost'];
|
||||
// }
|
||||
if ($find) {
|
||||
$item['goods_total_price'] = bcmul($item['cart_num'], $find['price'], 2);
|
||||
$this->total_price = bcadd($this->total_price, $item['goods_total_price'], 2);
|
||||
|
@ -140,17 +140,17 @@ class ProductLists extends BaseAdminDataLists implements ListsSearchInterface
|
||||
|
||||
}
|
||||
$check = DictType::where('type','activities')->find();
|
||||
foreach ($data as &$value){
|
||||
if(isset($check) && $check['status'] == 1){
|
||||
// $value['price'] = StoreProduct::where('id',$value['product_id'])->value('ot_price');
|
||||
$value['ot_price'] = $value['price'];
|
||||
$value['price'] = $value['cost'];
|
||||
}
|
||||
$value['is_default'] = 0;
|
||||
if($store_id == 2){
|
||||
$value['is_default'] = 1;
|
||||
}
|
||||
}
|
||||
// foreach ($data as &$value){
|
||||
// if(isset($check) && $check['status'] == 1){
|
||||
// // $value['price'] = StoreProduct::where('id',$value['product_id'])->value('ot_price');
|
||||
// $value['ot_price'] = $value['price'];
|
||||
// $value['price'] = $value['cost'];
|
||||
// }
|
||||
// $value['is_default'] = 0;
|
||||
// if($store_id == 2){
|
||||
// $value['is_default'] = 1;
|
||||
// }
|
||||
// }
|
||||
return $data;
|
||||
// return StoreProduct::where($this->searchWhere)->where($where)
|
||||
// ->field(['id', 'cate_id','store_name','unit', 'ot_price', 'bar_code','image','sales','store_info'])
|
||||
|
Loading…
x
Reference in New Issue
Block a user