diff --git a/app/admin/controller/store_order/StoreOrderController.php b/app/admin/controller/store_order/StoreOrderController.php index 22e3a8229..0a9e54087 100644 --- a/app/admin/controller/store_order/StoreOrderController.php +++ b/app/admin/controller/store_order/StoreOrderController.php @@ -5,6 +5,7 @@ namespace app\admin\controller\store_order; use app\admin\controller\BaseAdminController; use app\admin\lists\store_order\StoreOrderLists; +use app\admin\lists\store_order\StoreRefundOrderLists; use app\admin\logic\store_order\StoreOrderLogic; use app\admin\validate\store_order\StoreOrderValidate; @@ -29,7 +30,16 @@ class StoreOrderController extends BaseAdminController return $this->dataLists(new StoreOrderLists()); } - + /** + * @notes 获取退款订单列表 + * @return \think\response\Json + * @author admin + * @date 2024/05/31 16:02 + */ + public function refund_order() + { + return $this->dataLists(new StoreRefundOrderLists()); + } /** * @notes 添加订单列表 * @return \think\response\Json diff --git a/app/admin/controller/user_recharge/UserRechargeController.php b/app/admin/controller/user_recharge/UserRechargeController.php new file mode 100644 index 000000000..27a48b982 --- /dev/null +++ b/app/admin/controller/user_recharge/UserRechargeController.php @@ -0,0 +1,95 @@ +dataLists(new UserRechargeLists()); + } + + + /** + * @notes 添加充值记录 + * @return \think\response\Json + * @author admin + * @date 2024/06/06 14:29 + */ + public function add() + { + $params = (new UserRechargeValidate())->post()->goCheck('add'); + $result = UserRechargeLogic::add($params); + if (true === $result) { + return $this->success('添加成功', [], 1, 1); + } + return $this->fail(UserRechargeLogic::getError()); + } + + + /** + * @notes 编辑充值记录 + * @return \think\response\Json + * @author admin + * @date 2024/06/06 14:29 + */ + public function edit() + { + $params = (new UserRechargeValidate())->post()->goCheck('edit'); + $result = UserRechargeLogic::edit($params); + if (true === $result) { + return $this->success('编辑成功', [], 1, 1); + } + return $this->fail(UserRechargeLogic::getError()); + } + + + /** + * @notes 删除充值记录 + * @return \think\response\Json + * @author admin + * @date 2024/06/06 14:29 + */ + public function delete() + { + $params = (new UserRechargeValidate())->post()->goCheck('delete'); + UserRechargeLogic::delete($params); + return $this->success('删除成功', [], 1, 1); + } + + + /** + * @notes 获取充值记录详情 + * @return \think\response\Json + * @author admin + * @date 2024/06/06 14:29 + */ + public function detail() + { + $params = (new UserRechargeValidate())->goCheck('detail'); + $result = UserRechargeLogic::detail($params); + return $this->data($result); + } + + +} \ No newline at end of file diff --git a/app/admin/lists/store_finance_flow/StoreFinanceFlowLists.php b/app/admin/lists/store_finance_flow/StoreFinanceFlowLists.php index f6aeaee32..67d5ac86d 100644 --- a/app/admin/lists/store_finance_flow/StoreFinanceFlowLists.php +++ b/app/admin/lists/store_finance_flow/StoreFinanceFlowLists.php @@ -73,7 +73,7 @@ class StoreFinanceFlowLists extends BaseAdminDataLists implements ListsSearchInt $item['nickname'] = '游客'; } else { $id = $item['user_id']; - $item['nickname'] = User::where('id', $item['user_id'])->value('nickname') . "($id)"; + $item['nickname'] = User::where('id', $item['user_id'])->value('nickname') . "|$id"; } if (!empty($this->request->adminInfo['store_id'])) { $item['financial_pm'] = $item['financial_pm'] == 0 ? 1 : 0; diff --git a/app/admin/lists/store_order/StoreRefundOrderLists.php b/app/admin/lists/store_order/StoreRefundOrderLists.php new file mode 100644 index 000000000..3516ce817 --- /dev/null +++ b/app/admin/lists/store_order/StoreRefundOrderLists.php @@ -0,0 +1,68 @@ + ['order_id', 'refund_type'], + 'between_time' => 'create_time', + ]; + } + + + /** + * @notes 获取订单列表列表 + * @return array + * @throws \think\db\exception\DataNotFoundException + * @throws \think\db\exception\DbException + * @throws \think\db\exception\ModelNotFoundException + * @author admin + * @date 2024/05/31 16:02 + */ + public function lists(): array + { + $this->searchWhere['refund_status'] = ['>', 0]; + return StoreOrder::with(['user', 'staff', 'product' => function ($query) { + $query->field(['id', 'oid', 'product_id', 'cart_info']); + }]) + ->where($this->searchWhere) + ->field(['id', 'store_id', 'staff_id', 'order_id', 'pay_price', 'pay_time', 'pay_type', 'status', 'uid', 'refund_status', 'refund_type', 'refund_reason_wap', 'refund_reason_time', 'refund_reason_wap_explain', 'refund_reason_wap_img', 'refund_reason']) + ->limit($this->limitOffset, $this->limitLength) + ->order(['id' => 'desc']) + ->select()->each(function ($item) { + $item['pay_time'] = $item['pay_time'] > 0 ? date('Y-m-d H:i:s', $item['pay_time']) : ''; + $item['refund_status_name'] = OrderEnum::refundStatus($item['refund_status']) ?? ''; + $item['refund_type_name'] = OrderEnum::refundType($item['refund_type']) ?? ''; + return $item; + }) + ->toArray(); + } + + + /** + * @notes 获取订单列表数量 + * @return int + * @author admin + * @date 2024/05/31 16:02 + */ + public function count(): int + { + return StoreOrder::where($this->searchWhere)->count(); + } +} diff --git a/app/admin/lists/system_store/SystemStoreLists.php b/app/admin/lists/system_store/SystemStoreLists.php index 6fa15c6e3..791210a99 100644 --- a/app/admin/lists/system_store/SystemStoreLists.php +++ b/app/admin/lists/system_store/SystemStoreLists.php @@ -44,7 +44,7 @@ class SystemStoreLists extends BaseAdminDataLists implements ListsSearchInterfac public function lists(): array { return SystemStore::where($this->searchWhere) - ->field(['id', 'name', 'phone', 'detailed_address', 'image', 'is_show']) + ->field(['id', 'name', 'phone', 'detailed_address', 'image', 'is_show','day_start','day_end']) ->limit($this->limitOffset, $this->limitLength) ->order(['id' => 'desc']) ->select() diff --git a/app/admin/lists/user_recharge/UserRechargeLists.php b/app/admin/lists/user_recharge/UserRechargeLists.php new file mode 100644 index 000000000..6a64019b7 --- /dev/null +++ b/app/admin/lists/user_recharge/UserRechargeLists.php @@ -0,0 +1,65 @@ + ['paid', 'pay_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 14:29 + */ + public function lists(): array + { + return UserRecharge::where($this->searchWhere) + ->field(['id', 'uid', 'order_id', 'price', 'recharge_type', 'paid', 'pay_time']) + ->limit($this->limitOffset, $this->limitLength) + ->order(['id' => 'desc']) + ->select() + ->toArray(); + } + + + /** + * @notes 获取充值记录数量 + * @return int + * @author admin + * @date 2024/06/06 14:29 + */ + public function count(): int + { + return UserRecharge::where($this->searchWhere)->count(); + } + +} \ No newline at end of file diff --git a/app/admin/logic/user_recharge/UserRechargeLogic.php b/app/admin/logic/user_recharge/UserRechargeLogic.php new file mode 100644 index 000000000..27fb78dc4 --- /dev/null +++ b/app/admin/logic/user_recharge/UserRechargeLogic.php @@ -0,0 +1,94 @@ +getMessage()); + return false; + } + } + + + /** + * @notes 编辑充值记录 + * @param array $params + * @return bool + * @author admin + * @date 2024/06/06 14:29 + */ + public static function edit(array $params): bool + { + Db::startTrans(); + try { + UserRecharge::where('id', $params['id'])->update([ + + ]); + + 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 14:29 + */ + public static function delete(array $params): bool + { + return UserRecharge::destroy($params['id']); + } + + + /** + * @notes 获取充值记录详情 + * @param $params + * @return array + * @author admin + * @date 2024/06/06 14:29 + */ + public static function detail($params): array + { + return UserRecharge::findOrEmpty($params['id'])->toArray(); + } +} \ No newline at end of file diff --git a/app/admin/validate/user_recharge/UserRechargeValidate.php b/app/admin/validate/user_recharge/UserRechargeValidate.php new file mode 100644 index 000000000..4abccd2d6 --- /dev/null +++ b/app/admin/validate/user_recharge/UserRechargeValidate.php @@ -0,0 +1,82 @@ + 'require', + ]; + + + /** + * 参数描述 + * @var string[] + */ + protected $field = [ + 'id' => 'id', + ]; + + + /** + * @notes 添加场景 + * @return UserRechargeValidate + * @author admin + * @date 2024/06/06 14:29 + */ + public function sceneAdd() + { + return $this->remove('id', true); + } + + + /** + * @notes 编辑场景 + * @return UserRechargeValidate + * @author admin + * @date 2024/06/06 14:29 + */ + public function sceneEdit() + { + return $this->only(['id']); + } + + + /** + * @notes 删除场景 + * @return UserRechargeValidate + * @author admin + * @date 2024/06/06 14:29 + */ + public function sceneDelete() + { + return $this->only(['id']); + } + + + /** + * @notes 详情场景 + * @return UserRechargeValidate + * @author admin + * @date 2024/06/06 14:29 + */ + public function sceneDetail() + { + return $this->only(['id']); + } + +} \ No newline at end of file diff --git a/app/common/model/user_recharge/UserRecharge.php b/app/common/model/user_recharge/UserRecharge.php new file mode 100644 index 000000000..a90d160a9 --- /dev/null +++ b/app/common/model/user_recharge/UserRecharge.php @@ -0,0 +1,22 @@ +