From 6bca5947698b60d459418da7c1d33aac28920b12 Mon Sep 17 00:00:00 2001 From: zhenhui <1276357500@qq.com> Date: Wed, 15 Apr 2026 17:46:14 +0800 Subject: [PATCH] =?UTF-8?q?[=E8=AE=A2=E5=8D=95=E7=AE=A1=E7=90=86]=E5=85=85?= =?UTF-8?q?=E5=80=BC=E8=AE=A2=E5=8D=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/admin/controller/order/DepositOrder.php | 86 ++++++++++ app/common/model/DepositOrder.php | 30 ++++ web/src/lang/backend/en/order/depositOrder.ts | 20 +++ .../lang/backend/zh-cn/order/depositOrder.ts | 20 +++ .../backend/order/depositOrder/index.vue | 153 ++++++++++++++++++ .../backend/order/depositOrder/popupForm.vue | 48 ++++++ 6 files changed, 357 insertions(+) create mode 100644 app/admin/controller/order/DepositOrder.php create mode 100644 app/common/model/DepositOrder.php create mode 100644 web/src/lang/backend/en/order/depositOrder.ts create mode 100644 web/src/lang/backend/zh-cn/order/depositOrder.ts create mode 100644 web/src/views/backend/order/depositOrder/index.vue create mode 100644 web/src/views/backend/order/depositOrder/popupForm.vue diff --git a/app/admin/controller/order/DepositOrder.php b/app/admin/controller/order/DepositOrder.php new file mode 100644 index 0000000..38496d0 --- /dev/null +++ b/app/admin/controller/order/DepositOrder.php @@ -0,0 +1,86 @@ + 'desc']; + + protected string|array $orderGuarantee = ['id' => 'desc']; + + protected array $withJoinTable = ['user', 'channel']; + + protected function initController(WebmanRequest $request): ?Response + { + $this->model = new \app\common\model\DepositOrder(); + return null; + } + + protected function _index(): Response + { + if ($this->request && $this->request->get('select')) { + return $this->select($this->request); + } + + list($where, $alias, $limit, $order) = $this->queryBuilder(); + $table = strtolower($this->model->getTable()); + $mainShort = $alias[$table] ?? ''; + if ($mainShort !== '' && $this->auth && !$this->auth->isSuperAdmin()) { + $channelIds = $this->getScopedChannelIdsForFilter(); + $where[] = [$mainShort . '.channel_id', 'in', $channelIds !== [] ? $channelIds : [0]]; + } + + $res = $this->model + ->withJoin($this->withJoinTable, $this->withJoinType) + ->with($this->withJoinTable) + ->visible([ + 'user' => ['username', 'phone'], + 'channel' => ['name'], + ]) + ->alias($alias) + ->where($where) + ->order($order) + ->paginate($limit); + + return $this->success('', [ + 'list' => $res->items(), + 'total' => $res->total(), + 'remark' => get_route_remark(), + ]); + } + + /** + * @return int[] + */ + private function getScopedChannelIdsForFilter(): array + { + if (!$this->auth) { + return [0]; + } + if ($this->auth->isSuperAdmin()) { + return []; + } + $admin = Db::name('admin')->field(['id', 'channel_id'])->where('id', $this->auth->id)->find(); + $ids = []; + if ($admin && !empty($admin['channel_id'])) { + $ids[] = $admin['channel_id']; + } + $owned = Db::name('channel')->where('top_admin_id', $this->auth->id)->column('id'); + $created = Db::name('channel')->where('admin_id', $this->auth->id)->column('id'); + return array_values(array_unique(array_merge($ids, $owned, $created))); + } +} diff --git a/app/common/model/DepositOrder.php b/app/common/model/DepositOrder.php new file mode 100644 index 0000000..0ab5f62 --- /dev/null +++ b/app/common/model/DepositOrder.php @@ -0,0 +1,30 @@ + 'integer', + 'update_time' => 'integer', + 'pay_time' => 'integer', + 'amount' => 'string', + 'status' => 'integer', + ]; + + public function user(): \think\model\relation\BelongsTo + { + return $this->belongsTo(User::class, 'user_id', 'id'); + } + + public function channel(): \think\model\relation\BelongsTo + { + return $this->belongsTo(Channel::class, 'channel_id', 'id'); + } +} diff --git a/web/src/lang/backend/en/order/depositOrder.ts b/web/src/lang/backend/en/order/depositOrder.ts new file mode 100644 index 0000000..8022dbf --- /dev/null +++ b/web/src/lang/backend/en/order/depositOrder.ts @@ -0,0 +1,20 @@ +export default { + 'quick Search Fields': 'Order No./User ID/Pay channel', + id: 'ID', + order_no: 'Order No.', + user_id: 'User ID', + channel_id: 'Channel ID', + amount: 'Amount', + status: 'Status', + 'status 0': 'Pending', + 'status 1': 'Success', + 'status 2': 'Failed', + 'status 3': 'Canceled', + pay_channel: 'Pay channel', + pay_time: 'Pay time', + remark: 'Remark', + create_time: 'Created', + update_time: 'Updated', + user_username: 'Username', + channel_name: 'Channel', +} diff --git a/web/src/lang/backend/zh-cn/order/depositOrder.ts b/web/src/lang/backend/zh-cn/order/depositOrder.ts new file mode 100644 index 0000000..3e202f6 --- /dev/null +++ b/web/src/lang/backend/zh-cn/order/depositOrder.ts @@ -0,0 +1,20 @@ +export default { + 'quick Search Fields': '订单号/用户ID/支付通道', + id: 'ID', + order_no: '订单号', + user_id: '用户ID', + user_username: '用户名', + channel_id: '渠道ID', + channel_name: '渠道', + amount: '金额', + status: '状态', + 'status 0': '待处理', + 'status 1': '成功', + 'status 2': '失败', + 'status 3': '已取消', + pay_channel: '支付通道', + pay_time: '支付时间', + remark: '备注', + create_time: '创建时间', + update_time: '更新时间', +} diff --git a/web/src/views/backend/order/depositOrder/index.vue b/web/src/views/backend/order/depositOrder/index.vue new file mode 100644 index 0000000..16246d8 --- /dev/null +++ b/web/src/views/backend/order/depositOrder/index.vue @@ -0,0 +1,153 @@ + + + + + diff --git a/web/src/views/backend/order/depositOrder/popupForm.vue b/web/src/views/backend/order/depositOrder/popupForm.vue new file mode 100644 index 0000000..201f453 --- /dev/null +++ b/web/src/views/backend/order/depositOrder/popupForm.vue @@ -0,0 +1,48 @@ + + + + +