diff --git a/app/admin/lists/purchase_product_offer/PurchaseProductOfferLists.php b/app/admin/lists/purchase_product_offer/PurchaseProductOfferLists.php index 4f0242308..164d8c362 100644 --- a/app/admin/lists/purchase_product_offer/PurchaseProductOfferLists.php +++ b/app/admin/lists/purchase_product_offer/PurchaseProductOfferLists.php @@ -28,7 +28,7 @@ class PurchaseProductOfferLists extends BaseAdminDataLists implements ListsSearc public function setSearch(): array { return [ - '=' => ['supplier_id', 'order_id', 'product_id', 'price', 'nums', 'unit', 'is_buyer', 'buyer_confirm', 'is_storage', 'is_stream', 'need_num', 'notes', 'buyer_id', 'status', 'stream_admin_id', 'stream_time', 'storage_admin_id'], + '=' => [], ]; } @@ -45,7 +45,7 @@ class PurchaseProductOfferLists extends BaseAdminDataLists implements ListsSearc public function lists(): array { return PurchaseProductOffer::where($this->searchWhere) - ->field(['id', 'supplier_id', 'order_id', 'product_id', 'price', 'nums', 'unit', 'is_buyer', 'buyer_confirm', 'is_storage', 'is_stream', 'need_num', 'notes', 'buyer_id', 'status', 'stream_admin_id', 'stream_time', 'storage_admin_id']) + ->field(['id', 'supplier_id', 'order_id', 'product_id', 'price', 'buyer_nums', 'unit', 'is_buyer', 'buyer_confirm', 'is_storage', 'is_stream', 'need_num', 'notes', 'buyer_id', 'status', 'stream_admin_id', 'stream_time', 'storage_admin_id']) ->limit($this->limitOffset, $this->limitLength) ->order(['id' => 'desc']) ->select()->each(function($item){ @@ -59,7 +59,7 @@ class PurchaseProductOfferLists extends BaseAdminDataLists implements ListsSearc $item->is_buyer_name='无须采购'; } if($item->buyer_id>0){ - $item->buyer_name=DeliveryService::where('id',$item->buyer_id)->value('nickname'); + $item->buyer_name=DeliveryService::where('uid',$item->buyer_id)->value('nickname'); if($item->buyer_confirm==0){ $item->buyer_confirm_name='采购中'; }else{ diff --git a/app/api/controller/purchase_product_offer/PurchaseProductOfferController.php b/app/api/controller/purchase_product_offer/PurchaseProductOfferController.php index 4bd1a484c..658a806f7 100644 --- a/app/api/controller/purchase_product_offer/PurchaseProductOfferController.php +++ b/app/api/controller/purchase_product_offer/PurchaseProductOfferController.php @@ -5,6 +5,7 @@ namespace app\api\controller\purchase_product_offer; use app\api\lists\purchase_product_offer\PurchaseProductOfferLists; use app\api\controller\BaseApiController; +use app\common\model\purchase_product_offer\PurchaseProductOffer; @@ -27,4 +28,21 @@ class PurchaseProductOfferController extends BaseApiController { return $this->dataLists(new PurchaseProductOfferLists()); } + + public function offer_update(){ + $params=$this->request->post(); + $data=[ + 'buyer_nums'=>$params['nums'], + 'price'=>$params['price'], + 'total_price'=>$params['total_price'], + 'buyer_confirm'=>1, + ]; + $res=PurchaseProductOffer::where('id',$params['id'])->where('buyer_id',$this->userId)->update($data); + if($res){ + return $this->success('提交成功'); + }else{ + return $this->fail('提交失败'); + } + + } } \ No newline at end of file diff --git a/app/api/controller/user/UserController.php b/app/api/controller/user/UserController.php index 60b84c443..744a3d57d 100644 --- a/app/api/controller/user/UserController.php +++ b/app/api/controller/user/UserController.php @@ -324,8 +324,9 @@ class UserController extends BaseApiController $capitalFlowDao = new CapitalFlowLogic($find); $capitalFlowDao->userExpense('user_withdrawal', 'withdrawal', $res['id'], $money); User::where('id', $this->userId)->dec('now_money', $money)->update(); + Db::commit(); return $this->success('申请成功,等待审核'); - } catch (\Exception $e) { + } catch (\Throwable $e) { Db::rollback(); return $this->success('申请失败'); } diff --git a/app/api/lists/purchase_product_offer/PurchaseProductOfferLists.php b/app/api/lists/purchase_product_offer/PurchaseProductOfferLists.php index b2e63a8f5..d80f67758 100644 --- a/app/api/lists/purchase_product_offer/PurchaseProductOfferLists.php +++ b/app/api/lists/purchase_product_offer/PurchaseProductOfferLists.php @@ -28,7 +28,7 @@ class PurchaseProductOfferLists extends BaseApiDataLists implements ListsSearchI public function setSearch(): array { return [ - '=' => ['supplier_id', 'order_id', 'product_id', 'price', 'nums', 'unit', 'is_buyer', 'buyer_confirm', 'is_storage', 'is_stream', 'need_num', 'notes', 'buyer_id', 'status', 'stream_admin_id', 'stream_time', 'storage_admin_id'], + '=' => [], ]; } @@ -45,13 +45,14 @@ class PurchaseProductOfferLists extends BaseApiDataLists implements ListsSearchI public function lists(): array { return PurchaseProductOffer::where($this->searchWhere) - ->field(['id', 'supplier_id', 'order_id', 'product_id', 'price', 'nums', 'unit', 'is_buyer', 'buyer_confirm', 'is_storage', 'is_stream', 'need_num', 'notes', 'buyer_id', 'status', 'stream_admin_id', 'stream_time', 'storage_admin_id']) + ->field(['id', 'order_id', 'product_id', 'price', 'buyer_nums', 'unit', 'is_buyer', 'buyer_confirm','need_num', 'buyer_id', 'status', ]) ->limit($this->limitOffset, $this->limitLength) ->order(['id' => 'desc']) ->select()->each(function($item){ $find=StoreProduct::where('id',$item->product_id)->find(); $item->store_name=$find->store_name; $item->image=$find->image; + $item->store_info=$find->store_info; $item->unit_name=StoreProductUnit::where('id',$item->unit)->value('name'); if($item->is_buyer==1){ $item->is_buyer_name='需要采购'; diff --git a/app/api/logic/user/UserLogic.php b/app/api/logic/user/UserLogic.php index eafd5c873..661efec57 100644 --- a/app/api/logic/user/UserLogic.php +++ b/app/api/logic/user/UserLogic.php @@ -131,6 +131,7 @@ class UserLogic extends BaseLogic $data['share_name']= $share_name.'No.'.preg_replace('/4/','*', $data['id']); $data['system_store_id']=SystemStoreStaff::where('uid',$uid)->value('store_id'); + $data['delivery_service_id']=DeliveryService::where('uid',$uid)->value('id'); }else{ $data = []; }