feat(ProductLists): 修改商品列表逻辑,支持不同门店商品展示与自提

This commit is contained in:
mkm 2024-06-09 14:42:59 +08:00
parent 130129091b
commit dac95c1e0c
3 changed files with 22 additions and 6 deletions

View File

@ -112,13 +112,17 @@ class ProductLists extends BaseAdminDataLists implements ListsSearchInterface
}
}
if($store_id){
$where[]=['store_id','=',$store_id];
}else{
$where[]=['store_id','=',2];
}
$M_store_id=$this->request->__get('store_id');
if($M_store_id){
$where[]=['store_id','=',$M_store_id];
$data = StoreBranchProduct::where($this->searchWhere)->where($where)
->field(['id', 'product_id','cate_id','store_name', 'store_id','price', 'bar_code','image','sales','store_info','delete_time','unit'])
->field(['id', 'product_id','cate_id','store_name', 'cost','store_id','price', 'bar_code','image','sales','store_info','delete_time','unit'])
->limit($this->limitOffset, $this->limitLength)
->with(['className','unitName'])
->order($order)
@ -127,7 +131,7 @@ class ProductLists extends BaseAdminDataLists implements ListsSearchInterface
}else{
$data = StoreBranchProduct::where($this->searchWhere)->where($where)
->field(['id', 'product_id','cate_id','store_name', 'store_id','price', 'bar_code','image','sales','store_info','delete_time','unit'])
->field(['id', 'product_id','cate_id','store_name','cost', 'store_id','price', 'bar_code','image','sales','store_info','delete_time','unit'])
->limit($this->limitOffset, $this->limitLength)
->with(['className','unitName'])
->order($order)
@ -138,7 +142,9 @@ 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['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){
@ -188,8 +194,11 @@ class ProductLists extends BaseAdminDataLists implements ListsSearchInterface
}
}
if($store_id){
$where[]=['store_id','=',$store_id];
}else{
$where[]=['store_id','=',2];
}
$M_store_id=$this->request->__get('store_id');
if($M_store_id){

View File

@ -202,6 +202,9 @@ class OrderLogic extends BaseLogic
$_order['user_phone'] = $address['phone'];
$_order['user_address'] = $address['detail'];
}
}else{
//没有地址时,默认为门店自提
$_order['status']=1;
}
Db::startTrans();

View File

@ -71,6 +71,10 @@ class PayNotifyLogic extends BaseLogic
if (!$order->save()) {
throw new \Exception('订单保存出错');
}
// 减去余额
$user->now_money = bcsub($user['now_money'], $order['pay_price'], 2);
$user->save();
$capitalFlowDao = new CapitalFlowLogic($user);
$capitalFlowDao->userExpense('user_order_pay', 'order', $order['id'], $order['pay_price']);
self::afterPay($order);