diff --git a/app/admin/controller/beforehand_order/BeforehandOrderController.php b/app/admin/controller/beforehand_order/BeforehandOrderController.php index d4c07c6d..4c7b9783 100644 --- a/app/admin/controller/beforehand_order/BeforehandOrderController.php +++ b/app/admin/controller/beforehand_order/BeforehandOrderController.php @@ -292,4 +292,35 @@ class BeforehandOrderController extends BaseAdminController $file_path = BeforehandOrderLogic::ReturnSupplier($params); return $this->success('导出成功', ['url' => $file_path]); } + + public function settle() + { + $params = $this->request->post(); + BeforehandOrderLogic::settleOrder($params); + return $this->success('确认成功'); + } + + public function logList() + { + $params = $this->request->get(); + $result = BeforehandOrderLogic::logList($params); + return $this->data($result); + } + + public function saveLog() + { + $params = $this->request->post(); + $params['submit_admin_id'] = $this->adminId; + BeforehandOrderLogic::saveLog($params); + return $this->success('保存成功'); + } + + public function confirmLog() + { + $params = $this->request->post(); + $params['confirm_admin_id'] = $this->adminId; + BeforehandOrderLogic::confirmLog($params); + return $this->success('确认成功'); + } + } diff --git a/app/admin/lists/beforehand_order/BeforehandOrderLists.php b/app/admin/lists/beforehand_order/BeforehandOrderLists.php index a3346928..e5d8f225 100644 --- a/app/admin/lists/beforehand_order/BeforehandOrderLists.php +++ b/app/admin/lists/beforehand_order/BeforehandOrderLists.php @@ -81,7 +81,7 @@ class BeforehandOrderLists extends BaseAdminDataLists implements ListsSearchInte $oid=WarehouseOrder::where('financial_pm',0)->where('code','like','%'.$order_ck)->column('id'); $this->searchWhere[] = ['outbound_id','in',$oid]; } - $file=['id','uid', 'order_id', 'order_sn','store_id', 'order_type', 'total_num', 'total_price', 'outbound_id', 'admin_id', 'create_time', 'status', 'mark', 'warehousing_id', 'file','other_data']; + $file=['id','uid', 'order_id', 'order_sn','store_id', 'order_type', 'total_num', 'total_price', 'outbound_id', 'admin_id', 'create_time', 'status', 'mark', 'warehousing_id', 'file','other_data', 'audit_status']; return BeforehandOrder::where($this->searchWhere) ->field($file) ->limit($this->limitOffset, $this->limitLength) diff --git a/app/admin/logic/beforehand_order/BeforehandOrderLogic.php b/app/admin/logic/beforehand_order/BeforehandOrderLogic.php index 687ae305..c9bb6ffe 100644 --- a/app/admin/logic/beforehand_order/BeforehandOrderLogic.php +++ b/app/admin/logic/beforehand_order/BeforehandOrderLogic.php @@ -9,6 +9,7 @@ use app\api\logic\order\OrderLogic; use app\common\model\beforehand_order\BeforehandOrder; use app\common\logic\BaseLogic; use app\common\model\auth\Admin; +use app\common\model\beforehand_order\BeforehandOrderLog; use app\common\model\beforehand_order_cart_info\BeforehandOrderCartInfo; use app\common\model\beforehand_order_record\BeforehandOrderRecord; use app\common\model\purchase_product_offer\PurchaseProductOffer; @@ -909,4 +910,42 @@ class BeforehandOrderLogic extends BaseLogic $file_path = $order_info->export($data, $order, $other_data, 2); return $file_path; } + + public static function settleOrder($params) + { + $order = BeforehandOrder::where('id', $params['id'])->find(); + if ($order->status != 0) { + throw new BusinessException('该订单已完结'); + } + $order->audit_status = 1; + $order->save(); + } + + public static function logList($params) + { + $auditStatus = BeforehandOrder::where('id', $params['order_id'])->value('audit_status'); + $list = BeforehandOrderLog::with('admin')->where('order_id', $params['order_id'])->select()->toArray(); + return [ + 'audit_status' => $auditStatus, + 'list' => $list, + ]; + } + + public static function saveLog($params) + { + $model = new BeforehandOrderLog(); + $model->setAttrs($params); + $model->save(); + } + + public static function confirmLog($params) + { + $model = BeforehandOrderLog::where('id', $params['id'])->find(); + if ($model->status != 0) { + throw new BusinessException('该审核已完成'); + } + $model->status = 1; + $model->save(); + } + } diff --git a/app/common/model/beforehand_order/BeforehandOrderLog.php b/app/common/model/beforehand_order/BeforehandOrderLog.php new file mode 100644 index 00000000..7ab576df --- /dev/null +++ b/app/common/model/beforehand_order/BeforehandOrderLog.php @@ -0,0 +1,29 @@ +hasOne(Admin::class, 'id', 'admin_id')->field('id,name'); + } + +} \ No newline at end of file