diff --git a/app/api/lists/product/ProductLists.php b/app/api/lists/product/ProductLists.php index 22d92843d..fa097f086 100644 --- a/app/api/lists/product/ProductLists.php +++ b/app/api/lists/product/ProductLists.php @@ -112,13 +112,17 @@ class ProductLists extends BaseAdminDataLists implements ListsSearchInterface } } - $where[]=['store_id','=',$store_id]; + 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 } } - $where[]=['store_id','=',$store_id]; - + 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){ diff --git a/app/api/logic/order/OrderLogic.php b/app/api/logic/order/OrderLogic.php index 06d8175df..512f9abaf 100644 --- a/app/api/logic/order/OrderLogic.php +++ b/app/api/logic/order/OrderLogic.php @@ -202,6 +202,9 @@ class OrderLogic extends BaseLogic $_order['user_phone'] = $address['phone']; $_order['user_address'] = $address['detail']; } + }else{ + //没有地址时,默认为门店自提 + $_order['status']=1; } Db::startTrans(); diff --git a/app/common/logic/PayNotifyLogic.php b/app/common/logic/PayNotifyLogic.php index ea4fe7755..439fa8e10 100644 --- a/app/common/logic/PayNotifyLogic.php +++ b/app/common/logic/PayNotifyLogic.php @@ -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);