From ec71741e53d9571d1a80e8a44901abffdb45bcda Mon Sep 17 00:00:00 2001 From: mkm <727897186@qq.com> Date: Thu, 6 Jun 2024 10:33:58 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E8=AE=A2=E5=8D=95=E5=88=97=E8=A1=A8?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E4=BA=A7=E5=93=81=E5=BA=97=E9=93=BA=E4=BF=A1?= =?UTF-8?q?=E6=81=AF=E5=B1=95=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../StoreCashFinanceFlowController.php | 95 +++++++++++++++++++ .../StoreCashFinanceFlowLists.php | 65 +++++++++++++ .../lists/store_order/StoreOrderLists.php | 7 +- .../StoreCashFinanceFlowLogic.php | 94 ++++++++++++++++++ .../StoreCashFinanceFlowValidate.php | 82 ++++++++++++++++ .../StoreCashFinanceFlow.php | 22 +++++ 6 files changed, 364 insertions(+), 1 deletion(-) create mode 100644 app/admin/controller/store_cash_finance_flow/StoreCashFinanceFlowController.php create mode 100644 app/admin/lists/store_cash_finance_flow/StoreCashFinanceFlowLists.php create mode 100644 app/admin/logic/store_cash_finance_flow/StoreCashFinanceFlowLogic.php create mode 100644 app/admin/validate/store_cash_finance_flow/StoreCashFinanceFlowValidate.php create mode 100644 app/common/model/store_cash_finance_flow/StoreCashFinanceFlow.php diff --git a/app/admin/controller/store_cash_finance_flow/StoreCashFinanceFlowController.php b/app/admin/controller/store_cash_finance_flow/StoreCashFinanceFlowController.php new file mode 100644 index 00000000..fc010cfa --- /dev/null +++ b/app/admin/controller/store_cash_finance_flow/StoreCashFinanceFlowController.php @@ -0,0 +1,95 @@ +dataLists(new StoreCashFinanceFlowLists()); + } + + + /** + * @notes 添加现金流水 + * @return \think\response\Json + * @author admin + * @date 2024/06/06 10:29 + */ + public function add() + { + $params = (new StoreCashFinanceFlowValidate())->post()->goCheck('add'); + $result = StoreCashFinanceFlowLogic::add($params); + if (true === $result) { + return $this->success('添加成功', [], 1, 1); + } + return $this->fail(StoreCashFinanceFlowLogic::getError()); + } + + + /** + * @notes 编辑现金流水 + * @return \think\response\Json + * @author admin + * @date 2024/06/06 10:29 + */ + public function edit() + { + $params = (new StoreCashFinanceFlowValidate())->post()->goCheck('edit'); + $result = StoreCashFinanceFlowLogic::edit($params); + if (true === $result) { + return $this->success('编辑成功', [], 1, 1); + } + return $this->fail(StoreCashFinanceFlowLogic::getError()); + } + + + /** + * @notes 删除现金流水 + * @return \think\response\Json + * @author admin + * @date 2024/06/06 10:29 + */ + public function delete() + { + $params = (new StoreCashFinanceFlowValidate())->post()->goCheck('delete'); + StoreCashFinanceFlowLogic::delete($params); + return $this->success('删除成功', [], 1, 1); + } + + + /** + * @notes 获取现金流水详情 + * @return \think\response\Json + * @author admin + * @date 2024/06/06 10:29 + */ + public function detail() + { + $params = (new StoreCashFinanceFlowValidate())->goCheck('detail'); + $result = StoreCashFinanceFlowLogic::detail($params); + return $this->data($result); + } + + +} \ No newline at end of file diff --git a/app/admin/lists/store_cash_finance_flow/StoreCashFinanceFlowLists.php b/app/admin/lists/store_cash_finance_flow/StoreCashFinanceFlowLists.php new file mode 100644 index 00000000..8caa4c2a --- /dev/null +++ b/app/admin/lists/store_cash_finance_flow/StoreCashFinanceFlowLists.php @@ -0,0 +1,65 @@ + ['store_id', 'create_time'], + ]; + } + + + /** + * @notes 获取现金流水列表 + * @return array + * @throws \think\db\exception\DataNotFoundException + * @throws \think\db\exception\DbException + * @throws \think\db\exception\ModelNotFoundException + * @author admin + * @date 2024/06/06 10:29 + */ + public function lists(): array + { + return StoreCashFinanceFlow::where($this->searchWhere) + ->field(['id', 'store_id', 'cash_price', 'receivable', 'receipts', 'admin_id', 'file', 'remark', 'status']) + ->limit($this->limitOffset, $this->limitLength) + ->order(['id' => 'desc']) + ->select() + ->toArray(); + } + + + /** + * @notes 获取现金流水数量 + * @return int + * @author admin + * @date 2024/06/06 10:29 + */ + public function count(): int + { + return StoreCashFinanceFlow::where($this->searchWhere)->count(); + } + +} \ No newline at end of file diff --git a/app/admin/lists/store_order/StoreOrderLists.php b/app/admin/lists/store_order/StoreOrderLists.php index 441200b8..99c6f2ec 100644 --- a/app/admin/lists/store_order/StoreOrderLists.php +++ b/app/admin/lists/store_order/StoreOrderLists.php @@ -8,7 +8,7 @@ use app\common\enum\OrderEnum; use app\common\enum\PayEnum; use app\common\model\store_order\StoreOrder; use app\common\lists\ListsSearchInterface; - +use app\common\model\store_branch_product\StoreBranchProduct; /** * 订单列表列表 @@ -65,6 +65,11 @@ class StoreOrderLists extends BaseAdminDataLists implements ListsSearchInterface ->select()->each(function ($item) { $item['pay_time'] = $item['pay_time'] > 0 ? date('Y-m-d H:i:s', $item['pay_time']) : ''; $item['status_name'] = OrderEnum::getOrderType($item['status']) ?? ''; + for($i=0;$i<3;$i++){ + $find= StoreBranchProduct::where('id',$item['product'][$i]['product_id'])->field('store_name,image')->find(); + $item['product'][$i]['store_name']=$find['store_name']; + $item['product'][$i]['image']=$find['image']; + } return $item; }) diff --git a/app/admin/logic/store_cash_finance_flow/StoreCashFinanceFlowLogic.php b/app/admin/logic/store_cash_finance_flow/StoreCashFinanceFlowLogic.php new file mode 100644 index 00000000..a3291685 --- /dev/null +++ b/app/admin/logic/store_cash_finance_flow/StoreCashFinanceFlowLogic.php @@ -0,0 +1,94 @@ +getMessage()); + return false; + } + } + + + /** + * @notes 编辑现金流水 + * @param array $params + * @return bool + * @author admin + * @date 2024/06/06 10:29 + */ + public static function edit(array $params): bool + { + Db::startTrans(); + try { + StoreCashFinanceFlow::where('id', $params['id'])->update([ + 'file' => $params['file'] + ]); + + Db::commit(); + return true; + } catch (\Exception $e) { + Db::rollback(); + self::setError($e->getMessage()); + return false; + } + } + + + /** + * @notes 删除现金流水 + * @param array $params + * @return bool + * @author admin + * @date 2024/06/06 10:29 + */ + public static function delete(array $params): bool + { + return StoreCashFinanceFlow::destroy($params['id']); + } + + + /** + * @notes 获取现金流水详情 + * @param $params + * @return array + * @author admin + * @date 2024/06/06 10:29 + */ + public static function detail($params): array + { + return StoreCashFinanceFlow::findOrEmpty($params['id'])->toArray(); + } +} \ No newline at end of file diff --git a/app/admin/validate/store_cash_finance_flow/StoreCashFinanceFlowValidate.php b/app/admin/validate/store_cash_finance_flow/StoreCashFinanceFlowValidate.php new file mode 100644 index 00000000..402b3af6 --- /dev/null +++ b/app/admin/validate/store_cash_finance_flow/StoreCashFinanceFlowValidate.php @@ -0,0 +1,82 @@ + 'require', + ]; + + + /** + * 参数描述 + * @var string[] + */ + protected $field = [ + 'id' => 'id', + ]; + + + /** + * @notes 添加场景 + * @return StoreCashFinanceFlowValidate + * @author admin + * @date 2024/06/06 10:29 + */ + public function sceneAdd() + { + return $this->remove('id', true); + } + + + /** + * @notes 编辑场景 + * @return StoreCashFinanceFlowValidate + * @author admin + * @date 2024/06/06 10:29 + */ + public function sceneEdit() + { + return $this->only(['id']); + } + + + /** + * @notes 删除场景 + * @return StoreCashFinanceFlowValidate + * @author admin + * @date 2024/06/06 10:29 + */ + public function sceneDelete() + { + return $this->only(['id']); + } + + + /** + * @notes 详情场景 + * @return StoreCashFinanceFlowValidate + * @author admin + * @date 2024/06/06 10:29 + */ + public function sceneDetail() + { + return $this->only(['id']); + } + +} \ No newline at end of file diff --git a/app/common/model/store_cash_finance_flow/StoreCashFinanceFlow.php b/app/common/model/store_cash_finance_flow/StoreCashFinanceFlow.php new file mode 100644 index 00000000..9f41f7ee --- /dev/null +++ b/app/common/model/store_cash_finance_flow/StoreCashFinanceFlow.php @@ -0,0 +1,22 @@ +