From db0e7c6068caa8f8232cf560860043f5d983c82c Mon Sep 17 00:00:00 2001 From: lewis <604446095@qq.com> Date: Thu, 9 Jan 2025 14:56:45 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E9=A2=84=E8=AE=A2?= =?UTF-8?q?=E5=8D=95=E6=97=A5=E5=BF=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../BeforehandOrderController.php | 31 +++++++++++++++ .../beforehand_order/BeforehandOrderLists.php | 2 +- .../beforehand_order/BeforehandOrderLogic.php | 39 +++++++++++++++++++ .../beforehand_order/BeforehandOrderLog.php | 29 ++++++++++++++ 4 files changed, 100 insertions(+), 1 deletion(-) create mode 100644 app/common/model/beforehand_order/BeforehandOrderLog.php diff --git a/app/admin/controller/beforehand_order/BeforehandOrderController.php b/app/admin/controller/beforehand_order/BeforehandOrderController.php index d4c07c6d1..4c7b97832 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 a33469285..e5d8f2251 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 687ae305e..c9bb6ffe8 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 000000000..7ab576dfa --- /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 From 3d897d5ddafecd1ada922502c3515ba3a2b0ebd4 Mon Sep 17 00:00:00 2001 From: mkm <727897186@qq.com> Date: Thu, 9 Jan 2025 15:10:00 +0800 Subject: [PATCH 2/2] =?UTF-8?q?feat(admin):=20=E4=BC=98=E5=8C=96=E4=BA=A7?= =?UTF-8?q?=E5=93=81=E6=90=9C=E7=B4=A2=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 在 StoreProductGroupPriceLists 中添加按产品名称搜索的功能 - 使用 $request->get() 获取 store_name 参数,实现模糊搜索 - 在 IndexController 中添加注释,便于后续开发调试 --- .../StoreProductGroupPriceLists.php | 11 ++++++----- app/api/controller/IndexController.php | 10 ++++++++++ 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/app/admin/lists/store_product_group_price/StoreProductGroupPriceLists.php b/app/admin/lists/store_product_group_price/StoreProductGroupPriceLists.php index 7fbbb9103..9bd49c77f 100644 --- a/app/admin/lists/store_product_group_price/StoreProductGroupPriceLists.php +++ b/app/admin/lists/store_product_group_price/StoreProductGroupPriceLists.php @@ -44,11 +44,11 @@ class StoreProductGroupPriceLists extends BaseAdminDataLists implements ListsSea public function lists(): array { $query = StoreProduct::field('id,store_name,purchase,cost,vip_price,price,unit'); - if ($this->params['product_id']) { - $query->where('id|store_name', $this->params['product_id']); + $store_name=$this->request->get('store_name',''); + if ($store_name!='') { + $query->where('store_name', 'like', '%'.$store_name.'%'); } return $query->limit($this->limitOffset, $this->limitLength) - ->field('id,store_name,purchase,cost,vip_price,price,unit') ->order(['id' => 'desc']) ->select()->each(function ($item) { $item['lists'] =StoreProductGroupPrice::where('product_id',$item['id'])->field('id,group_id,price') @@ -75,8 +75,9 @@ class StoreProductGroupPriceLists extends BaseAdminDataLists implements ListsSea public function count(): int { $query = StoreProduct::field('id,store_name,purchase,cost,vip_price,price,unit'); - if ($this->params['product_id']) { - $query->where('id|store_name', $this->params['product_id']); + $store_name=$this->request->get('store_name',''); + if ($store_name!='') { + $query->where('store_name', 'like', '%'.$store_name.'%'); } return $query->count(); } diff --git a/app/api/controller/IndexController.php b/app/api/controller/IndexController.php index 2aa3f0e1c..1cded3f70 100644 --- a/app/api/controller/IndexController.php +++ b/app/api/controller/IndexController.php @@ -9,11 +9,13 @@ use app\admin\logic\store_product\StoreProductLogic; use app\admin\validate\tools\GenerateTableValidate; use app\admin\logic\tools\GeneratorLogic; use app\api\lists\purchase_product_offer\PurchaseProductOfferListsTwo; +use app\api\logic\DemoLogic; use app\api\logic\order\OrderLogic as OrderOrderLogic; use app\common\cache\ExportCache; use app\common\logic\ChangeLogLogic; use app\common\logic\PayNotifyLogic; use app\common\logic\store_order\StoreOrderLogic; +use app\common\model\beforehand_order_cart_info\BeforehandOrderCartInfo; use app\common\model\beforehand_order_record\BeforehandOrderRecord; use app\common\model\Config as ModelConfig; use app\common\model\purchase_product_offer\PurchaseProductOffer; @@ -59,6 +61,14 @@ class IndexController extends BaseApiController public function index() { + // $arr=BeforehandOrderCartInfo::where('bhoid',1284)->select(); + // foreach ($arr as $k=>$v){ + // $product_id=StoreBranchProduct::where('id',$v['product_id'])->value('product_id'); + // BeforehandOrderCartInfo::where('id',$v['id'])->update(['product_id'=>$product_id]); + // } + // $a=StoreOrderCartInfo::where('store_id',2)->whereBetweenTime('create_time','2025-01-01','2025-01-8')->select()->toArray(); + // d($a); + // DemoLogic::test(); d(1); $arr = Db::name('ceshi_copy')->select(); foreach ($arr as $k => $v) {