dataLists(new OpurchaseclassLists()); } /** * @notes 获取采购订单详情 * @return \think\response\Json * @author likeadmin * @date 2024/04/27 11:26 */ public function detail() { $params = (new OpurchaseclassValidate())->goCheck('detail'); $result = OpurchaseclassLogic::detail($params); return $this->data($result); } /** * @notes 采购子订单详情 */ public function sub_orders() { $id = $this->request->get('id'); $is_mer = 1; $page_no = $this->request->get('page_no', 1); $result = OpurchaseclassLogic::sub_detail($id,$is_mer,$page_no); return $this->data($result); } /** * @notes 采购订单总商品列表 */ public function opurchaseinfo_list() { $id = $this->request->get('id'); $page_no = $this->request->get('page_no', 1); $res = Opurchaseinfo::where('pid', $id)->page($page_no, 25)->select()->each(function ($item) { $find = Goods::where('id', $item['goods'])->with('unitName')->find(); if($find){ $item['goods_name'] = $find['name']; $item['unit_name'] = $find['unit_name']; } }); $data['count'] = Opurchaseinfo::where('pid', $id)->count(); $data['lists'] = $res?->toArray(); $data['page_no'] = $page_no; $data['page_siz'] = 15; return $this->success('ok', $data); } public function checkOrder(){ $params=$this->request->get(); $res=OrderLogic::cartIdByPurchaseOrderInfo($this->request->userInfo,$params); if($res==false){ return $this->fail(OrderLogic::getError()); } return $this->data($res); } /** * @notes 创建购货订单 */ public function createOrder(){ $params=$this->request->post(); $order=OrderLogic::createOpurchaseOrder(request()->userInfo,$params); if($order==false){ return $this->fail(OrderLogic::getError()); }else{ PayNotifyLogic::handle('opurchaseclass', $order['number']); //推送队列 Redis::send('push-supplier-products', ['order_id'=>$order['id']]); return $this->success('支付成功'); } } }