diff --git a/app/admin/controller/Dashboard.php b/app/admin/controller/Dashboard.php index 1aed884..7f21365 100644 --- a/app/admin/controller/Dashboard.php +++ b/app/admin/controller/Dashboard.php @@ -2,19 +2,270 @@ namespace app\admin\controller; +use app\admin\model\MoneyLogHistory; +use app\admin\model\User; +use app\admin\model\UserMoneyLog; use app\common\controller\Backend; +use app\admin\model\Bank; +use think\exception\ValidateException; +use think\facade\Db; +use think\facade\Request; +use Throwable; class Dashboard extends Backend { + /** + * @var object + * @phpstan-var Bank + */ + protected object $bank; public function initialize(): void { parent::initialize(); + $this->bank = new Bank(); } public function index(): void { + $rawStart = request()->param('start/s'); + $start = $rawStart ? strtotime($rawStart) : strtotime('today'); + $rawEnd = request()->param('end/s'); + $end = $rawEnd ? strtotime("$rawEnd +1 day") : strtotime('tomorrow'); + if ($start > $end) { + list($start, $end) = [$end, $start]; + } + $bankList = Bank::field([ + 'id', 'bank_name', 'bank_account', 'current_balance', 'safe_alert', 'label_color', 'weigh', + // 子查询:入款总额 + "(SELECT SUM(money/100) FROM ba_user_money_log WHERE bank_id = ba_bank.id AND type = 1 and create_time BETWEEN {$start} AND {$end}) AS total_fund_in", + // 子查询:出款总额 + "(SELECT SUM(money/100) FROM ba_user_money_log WHERE bank_id = ba_bank.id AND type = 2 and create_time BETWEEN {$start} AND {$end}) AS total_fund_out", + // 子查询:入款次数 + "(SELECT COUNT(*) FROM ba_user_money_log WHERE bank_id = ba_bank.id AND type = 1 and create_time BETWEEN {$start} AND {$end}) AS count_fund_in", + // 子查询:出款次数 + "(SELECT COUNT(*) FROM ba_user_money_log WHERE bank_id = ba_bank.id AND type = 2 and create_time BETWEEN {$start} AND {$end}) AS count_fund_out", + ]) + ->where('status', 1) + ->order('weigh', 'desc') + ->order('id', 'desc') + ->select() + ->toArray(); + + foreach ($bankList as &$bank) { + $bank['total_fund_in'] = (float)$bank['total_fund_in']; + $bank['total_fund_out'] = (float)$bank['total_fund_out']; + $bank['count_fund_in'] = (int)$bank['count_fund_in']; + $bank['count_fund_out'] = (int)$bank['count_fund_out']; + } + unset($bank); + $customer = Db::name('user_money_log')->field([ + // 1. 总进款 (type = 1) + 'ROUND(SUM(CASE WHEN type = 1 THEN money/100 ELSE 0 END), 2) AS total_deposit', + // 2. 总出款 (type = 2) + 'ROUND(SUM(CASE WHEN type = 2 THEN money/100 ELSE 0 END), 2) AS total_withdraw', + // 3. 总进款次数 (type = 1 的记录总数) + 'COUNT(CASE WHEN type = 1 THEN 1 END) AS count_deposit', + // 4. 总出款次数 (type = 2 的记录总数) + 'COUNT(CASE WHEN type = 2 THEN 1 END) AS count_withdraw', + // 5. 活跃玩家数 (去重计算有多少个不同的 user_id 产生了流水) + 'COUNT(DISTINCT user_id) AS active_player', + //6. 首次充值 + 'COUNT(CASE WHEN label = 1 THEN 1 END) AS first_deposit', + 'ROUND(SUM(CASE WHEN label = 2 THEN money/100 ELSE 0 END), 2) AS unclaim_amount', + 'COUNT(CASE WHEN label = 2 THEN 1 END) AS unclaim_receipt', + ]) + ->whereBetweenTime('create_time', $start, $end) + ->whereNull('created_by') + ->find(); + $customerData = [ + 'total_deposit' => (float)($customer['total_deposit'] ?? 0), + 'total_withdraw' => (float)($customer['total_withdraw'] ?? 0), + 'count_deposit' => (int)($customer['count_deposit'] ?? 0), + 'count_withdraw' => (int)($customer['count_withdraw'] ?? 0), + 'active_player' => (int)($customer['active_player'] ?? 0), + 'first_deposit' => (int)($customer['first_deposit'] ?? 0), + 'unclaim_amount' => (float)($customer['unclaim_amount'] ?? 0), + 'unclaim_receipt' => (int)($customer['unclaim_receipt'] ?? 0), + ]; + $limit = request()->param('limit/d') ?? 15; + $bindFields = [ + 'user' => ['jk_username'], + 'bank' => ['bank_name'], + 'admin' => ['id', 'username'], + ]; + $transaction = UserMoneyLog::withJoin($bindFields, 'left') + ->with([ + 'scoreLog' => function($query) { + $query->field(['money_log_id', 'game_type', 'score']); + } + ]) + ->whereBetweenTime('user_money_log.create_time', $start, $end) + ->order('id', 'desc') + ->paginate($limit); + $transactionList = $transaction->items(); + foreach ($transactionList as &$item) { + $item['user_name'] = $item['user']['jk_username'] ?? ''; + $item['bank_name'] = $item['bank']['bank_name'] ?? ''; + $item['created_by'] = $item['admin']['username'] ?? 'WEBHOOK'; + unset($item['user'], $item['bank'], $item['admin']); + } + unset($item); + $transactionTotal = Db::name('user_money_log')->field([ + // 1. 总进款 (type = 1) + 'ROUND(SUM(CASE WHEN type = 1 THEN money/100 ELSE 0 END), 2) AS total_fund_in', + // 2. 总出款 (type = 2) + 'ROUND(SUM(CASE WHEN type = 2 THEN money/100 ELSE 0 END), 2) AS total_fund_out', + ]) + ->whereBetweenTime('create_time', $start, $end) + ->find(); $this->success('', [ - 'remark' => get_route_remark() + 'bank' => $bankList, + 'customer' => $customerData, + 'transaction'=> [ + 'list' => $transactionList, + 'count' => $transaction->total(), + 'current_page' => $transaction->currentPage(), + 'last_page' => $transaction->lastPage(), + 'total_deposit' => (float)($transactionTotal['total_fund_in'] ?? 0), + 'total_withdraw' => (float)($transactionTotal['total_fund_out'] ?? 0), + ], ]); } + + public function bankTransact(): void + { + $data = $this->request->post(); + if (!$data) { + $this->error(__('Parameter %s can not be empty', [''])); + } + + $money = isset($data['money']) ? (int)$data['money'] : 0; + $bankFromId = isset($data['bank_from']) ? (int)$data['bank_from'] : 0; + $bankToId = isset($data['bank_to']) ? (int)$data['bank_to'] : 0; + if ($money <= 0) { + $this->error(__('转账金额必须大于 0')); + } + if ($bankFromId === $bankToId) { + $this->error(__('转出银行和转入银行不能相同')); + } + $adminId = $this->auth->getInfo()['id'] ?? null; + \think\facade\Db::startTrans(); + try { + $bankFrom = Bank::where('id', $bankFromId)->where('status', 1)->lock(true)->find(); + if (!$bankFrom) { + throw new ValidateException('转出银行账户不存在或已被禁用'); + } + if ($bankFrom->current_balance < $money) { + throw new ValidateException("转出银行【{$bankFrom->bank_name}】余额不足"); + } + + $bankTo = Bank::where('id', $bankToId)->where('status', 1)->lock(true)->find(); + if (!$bankTo) { + throw new ValidateException('转入银行账户不存在或已被禁用'); + } + + // 5. 更新转出银行账户余额 + $bankFrom->current_balance -= $money; + $bankFrom->save(); + + $logFrom = new UserMoneyLog(); + $logFrom->save([ + 'user_id' => 0, + 'money' => -$money, + 'before' => $bankFrom->current_balance + $money, + 'after' => $bankFrom->current_balance, + 'type' => 4, + 'bank_id' => $bankFromId, + 'created_by' => $adminId, + 'memo' => $data['remark'], + 'category' => 2, + 'create_time' => time() + ]); + + $bankTo->current_balance += $money; + $bankTo->save(); + + $logTo = new UserMoneyLog(); + $logTo->save([ + 'user_id' => 0, + 'money' => $money, + 'before' => $bankTo->current_balance - $money, + 'after' => $bankTo->current_balance, + 'type' => 3, + 'bank_id' => $bankToId, + 'created_by' => $adminId, + 'memo' => $data['remark'], + 'category' => 2, + 'create_time' => time() + ]); + + \think\facade\Db::commit(); + $isCommitSuccess = true; + } catch (ValidateException $e) { + \think\facade\Db::rollback(); + $this->error($e->getMessage()); + } catch (Throwable $e) { + \think\facade\Db::rollback(); + trace($e->getMessage(), 'error'); + $this->error(__('No rows were added')); + } + if ($isCommitSuccess) { + $this->success(__('Added successfully')); + } + } + + public function newTransact(): void + { + if ($this->request->isPost()) { + $data = $this->request->post(); + if (!$data) { + $this->error(__('Parameter %s can not be empty', [''])); + } + $result = false; + $data = $this->excludeFields($data); + + if ($data['type'] == 2) { + $data['money'] = -$data['money']; + } + $user_id = User::where('jk_username', $data['user_name'])->value('id'); + if (!$user_id) { + $this->error(__("The user can't find it", [''])); + } + $data['user_id'] = $user_id; + $userMoneyLog = new UserMoneyLog(); + $userMoneyLog->startTrans(); + try { + $data['created_by'] = $this->auth->getInfo()['id']; + $result = $userMoneyLog->save($data); + $userMoneyLog->commit(); + } catch (Throwable $e) { + $userMoneyLog->rollback(); + $this->error($e->getMessage()); + } + if ($result !== false) { + $this->success(__('Added successfully')); + } else { + $this->error(__('No rows were added')); + } + } + } + + + public function logHistory($id): void + { + $bindFields = [ + 'admin' => ['id','username'], + ]; + $history = MoneyLogHistory::withJoin($bindFields, 'left') + ->where('money_log_id', $id) + ->select(); + if (!empty($history)) { + foreach ($history as &$item) { + $item['admin_name'] = $item['admin']['username'] ?? ''; + unset($item['admin']); + } + unset($item); + } + $this->success('', $history); + } } \ No newline at end of file diff --git a/app/admin/controller/user/MoneyLog.php b/app/admin/controller/user/MoneyLog.php index 97d61e6..34e8204 100644 --- a/app/admin/controller/user/MoneyLog.php +++ b/app/admin/controller/user/MoneyLog.php @@ -2,7 +2,7 @@ namespace app\admin\controller\user; -use app\common\service\Jk8Services; +use app\admin\model\MoneyLogHistory; use Throwable; use app\admin\model\User; use app\admin\model\UserMoneyLog; @@ -16,19 +16,17 @@ class MoneyLog extends Backend */ protected object $model; - protected array $withJoinTable = ['user', 'admin']; + protected array $withJoinTable = ['user', 'admin', 'bank']; protected array $withTable = ['scoreLog']; // 排除字段 protected string|array $preExcludeFields = ['create_time']; protected string|array $quickSearchField = ['user.username', 'user.nickname']; - protected $jk8Services; public function initialize(): void { parent::initialize(); - $this->jk8Services = app(Jk8Services::class); $this->model = new UserMoneyLog(); } @@ -88,27 +86,13 @@ class MoneyLog extends Backend $result = false; $data = $this->excludeFields($data); - $user = User::where('id', $data['user_id'])->find(); if ($data['type'] == 2) { $data['money'] = -$data['money']; } - if ($user->money + $data['money'] < 0) { - $this->error(__('Insufficient Credit')); - } - - try { - // 模型验证 - $this->validateModelData($data, 'add'); - $transactionId = $this->jk8Services->setScore($user['jk_username'], $data['money']); - } catch (Throwable $e) { - $this->error($e->getMessage()); - } $this->model->startTrans(); try { - $data['transaction_id'] = $transactionId; $data['created_by'] = $this->auth->getInfo()['id']; -// $data['type'] = $data['money'] > 0 ? 1 : 2; $result = $this->model->save($data); $this->model->commit(); } catch (Throwable $e) { @@ -143,15 +127,49 @@ class MoneyLog extends Backend if (!$row) { $this->error(__('Record not found')); } - $user = User::where('id', $row['user_id'])->find(); + if ($this->request->isPost()) { - parent::edit(); + $data = $this->request->post(); + if (!$data) { + $this->error(__('Parameter %s can not be empty', [''])); + } + + $result = false; + $this->model->startTrans(); + try { + $result = $row->save($data); + $this->model->commit(); + } catch (Throwable $e) { + $this->model->rollback(); + $this->error($e->getMessage()); + } + if ($result !== false) { + $this->success(__('Update successful')); + } else { + $this->error(__('No rows updated')); + } return; } - $row['username'] = $user['username']; - $row['nickname'] = $user['nickname']; $this->success('', [ 'row' => $row ]); } + + public function logHistory($id): void + { + $bindFields = [ + 'admin' => ['id','username'], + ]; + $history = MoneyLogHistory::withJoin($bindFields, 'left') + ->where('money_log_id', $id) + ->select(); + if (!empty($history)) { + foreach ($history as &$item) { + $item['admin_name'] = $item['admin']['username'] ?? ''; + unset($item['admin']); + } + unset($item); + } + $this->success('', $history); + } } \ No newline at end of file diff --git a/app/admin/model/Bank.php b/app/admin/model/Bank.php index f0dcf2c..9b2f98f 100644 --- a/app/admin/model/Bank.php +++ b/app/admin/model/Bank.php @@ -3,6 +3,7 @@ namespace app\admin\model; use think\Model; +use think\model\relation\HasMany; /** * Bank @@ -46,4 +47,9 @@ class Bank extends Model { return is_null($value) ? null : (float)$value; } + + public function MoneyLog(): hasMany + { + return $this->hasMany(UserMoneyLog::class, 'bank_id'); + } } \ No newline at end of file diff --git a/app/admin/model/MoneyLogHistory.php b/app/admin/model/MoneyLogHistory.php new file mode 100644 index 0000000..4ddedef --- /dev/null +++ b/app/admin/model/MoneyLogHistory.php @@ -0,0 +1,34 @@ +belongsTo(UserMoneyLog::class, 'money_log_id'); + } + + public function admin(): BelongsTo + { + return $this->belongsTo(Admin::class, 'created_by'); + } + +} \ No newline at end of file diff --git a/app/admin/model/UserMoneyLog.php b/app/admin/model/UserMoneyLog.php index 99cbe02..44e47ac 100644 --- a/app/admin/model/UserMoneyLog.php +++ b/app/admin/model/UserMoneyLog.php @@ -2,10 +2,10 @@ namespace app\admin\model; +use app\admin\library\Auth; use think\model\relation\HasMany; use Throwable; use think\model; -use think\Exception; use think\model\relation\BelongsTo; /** @@ -22,23 +22,29 @@ class UserMoneyLog extends model * 入库前 * @throws Throwable */ - public static function onBeforeInsert($model): void +// public static function onAfterInsert($model): void +// { +// $new = new MoneyLogHistory(); +// $new->money_log_id = $model->id; +// $new->bank_befter = ''; +// $new->bank_after = $model->bank->bank_name; +// $new->create_time = time(); +// $new->save(); +// +// } + + public static function onAfterUpdate($model): void { - $user = User::where('id', $model->user_id)->lock(true)->find(); - if (!$user) { - throw new Exception("The user can't find it"); - } - if (!$model->memo) { - throw new Exception("Change note cannot be blank"); - } - $model->before = $user->money; + $history = MoneyLogHistory::where('money_log_id', $model->id)->find(); + $new = new MoneyLogHistory(); + $new->money_log_id = $model->id; + $new->bank_befter = $history->bank_after ?? ''; + $new->bank_after = $model->bank->bank_name; + $new->created_by = Auth::instance()->getInfo()['id']; + $new->create_time = time(); + $new->save(); - $user->money += $model->money; - $user->save(); - - $model->after = $user->money; } - public static function onBeforeDelete(): bool { return false; @@ -88,4 +94,9 @@ class UserMoneyLog extends model { return $this->hasMany(UserScoreLog::class, 'money_log_id'); } + + public function bank(): BelongsTo + { + return $this->belongsTo(Bank::class, 'bank_id'); + } } \ No newline at end of file diff --git a/app/admin/model/UserScoreLog.php b/app/admin/model/UserScoreLog.php index 5882029..57f6155 100644 --- a/app/admin/model/UserScoreLog.php +++ b/app/admin/model/UserScoreLog.php @@ -17,6 +17,13 @@ class UserScoreLog extends model protected $autoWriteTimestamp = true; protected $updateTime = false; + const GAME_TYPE_LIST = [ + 1001 => 'Lucky Wheel', // 大转盘 + 1002 => 'Golden Eggs', // 砸金蛋 + 1003 => 'Daily Mission', // 每日任务 + 1004 => 'Plinko Ball', // 普林科弹球 + ]; + public static function onBeforeDelete(): bool { return false; @@ -26,4 +33,17 @@ class UserScoreLog extends model { return $this->belongsTo(User::class, 'user_id'); } + + public function getGameTypeTextAttr($value, $data) + { + $gameType = $data['game_type'] ?? 0; + + // 如果需要严格的多语言,可以在这里根据 $lang 切换,或者直接配合系统的 lang() 助手函数 + // 这里我们先直接返回对应的标准国际化名称 + return self::GAME_TYPE_LIST[$gameType] ?? 'Unknown Game'; + } + + // 3. 别忘了把获取器追加到模型的可见输出数组里 + protected $append = ['game_type_text']; + } \ No newline at end of file diff --git a/app/api/controller/External.php b/app/api/controller/External.php new file mode 100644 index 0000000..f092e35 --- /dev/null +++ b/app/api/controller/External.php @@ -0,0 +1,35 @@ +success(__('Mail sent successfully~')); + } +} \ No newline at end of file diff --git a/app/api/route/app.php b/app/api/route/app.php new file mode 100644 index 0000000..248a37c --- /dev/null +++ b/app/api/route/app.php @@ -0,0 +1,18 @@ +middleware(ApiAuth::class); \ No newline at end of file diff --git a/app/common/middleware/ApiAuth.php b/app/common/middleware/ApiAuth.php new file mode 100644 index 0000000..fdbfc99 --- /dev/null +++ b/app/common/middleware/ApiAuth.php @@ -0,0 +1,71 @@ + +// +---------------------------------------------------------------------- +declare (strict_types=1); + +namespace app\common\middleware; + +use app\common\model\Config; +use Closure; +use think\facade\Cache; +use think\exception\HttpException; + +class ApiAuth +{ + protected $apps; + public function handle($request, Closure $next) + { + $this->apps = Config::whereIn('name', ['appKey', 'appSecret'])->column('value', 'name'); + $params = $request->param(); + $appKey = $request->header('X-Api-AppKey'); + $timestamp = $request->header('X-Api-Timestamp'); + $nonce = $request->header('X-Api-Nonce'); + $signature = $request->header('X-Api-Signature'); + + // 1. 基础检查 + if (!$signature || !$appKey || !$timestamp || !$nonce) { + throw new HttpException(401, '缺少必要的签名参数'); + } + + // 2. 检查 AppKey 是否合法 + if ($this->apps['appKey'] != $appKey) { + throw new HttpException(401, '无效的 AppKey'); + } + + // 3. 检查时间戳(防重放攻击,允许 60 秒误差) + if (abs(time() - $timestamp) > 60) { +// throw new HttpException(401, '请求已超时'); + } + + // 4. 检查随机字符串 + $cacheKey = "api_nonce:" . $nonce; + if (Cache::has($cacheKey)) { +// throw new HttpException(401, '重复请求'); + } + Cache::setex($cacheKey, 60, 1); + + // 5. 验证签名 + if (!$this->checkSignature($params, $timestamp, $nonce, $signature)) { + throw new HttpException(401, '签名验证失败'); + } + + return $next($request); + } + + protected function checkSignature($params, $timestamp, $nonce, $signature) + { + $appSecret = $this->apps['appSecret']; + unset($params['/']); + ksort($params); + $stringToBeSigned = http_build_query($params) . '&app_secret=' . $appSecret . '×tamp=' . $timestamp . '&nonce=' . $nonce; + $serverSig = hash('sha256', $stringToBeSigned); + return hash_equals($serverSig, $signature); + } +} diff --git a/config/cache.php b/config/cache.php index a8d69d2..6eac323 100644 --- a/config/cache.php +++ b/config/cache.php @@ -6,7 +6,7 @@ return [ // 默认缓存驱动 - 'default' => env('cache.driver', 'file'), + 'default' => env('cache.driver', 'redis'), // 缓存连接方式配置 'stores' => [ @@ -25,5 +25,12 @@ return [ 'serialize' => [], ], // 更多的缓存连接 + // redis缓存 + 'redis' => [ + // 驱动方式 + 'type' => 'redis', + // 服务器地址 + 'host' => '127.0.0.1', + ], ], ]; diff --git a/config/jk8.php b/config/jk8.php index 93032a3..3b84bee 100644 --- a/config/jk8.php +++ b/config/jk8.php @@ -1,7 +1,7 @@ 'https://1xace.n9686b.com/api/v1/index.php/', - 'access_id' => 23873027, - 'token' => 'fee0e83b784c61210287168af714bca61f29db688c0fa08e7659c2f7d8b729c2', + 'domain' => 'https://pms99.as6868.com/api/v1/index.php/', + 'access_id' => 366068146, + 'token' => '882311d5b502cb8e28898c402112643d0c693a45432e4406ea7a629a22c5577b', ]; diff --git a/web/src/lang/backend/en/user/moneyLog.ts b/web/src/lang/backend/en/user/moneyLog.ts index 20c7ed6..edebf64 100644 --- a/web/src/lang/backend/en/user/moneyLog.ts +++ b/web/src/lang/backend/en/user/moneyLog.ts @@ -26,5 +26,6 @@ export default { 1002 : 'Golden Eggs', 1003 : 'Daily Mission', 1004 : 'Plinko Ball' - } + }, + 'bank_id': 'Bank Account', } diff --git a/web/src/lang/backend/zh-cn/user/moneyLog.ts b/web/src/lang/backend/zh-cn/user/moneyLog.ts index 3128766..c9d81ef 100644 --- a/web/src/lang/backend/zh-cn/user/moneyLog.ts +++ b/web/src/lang/backend/zh-cn/user/moneyLog.ts @@ -26,5 +26,6 @@ export default { 1002 : 'Golden Eggs', 1003 : 'Daily Mission', 1004 : 'Plinko Ball' - } + }, + 'bank_id': '银行账户', } diff --git a/web/src/views/backend/user/moneyLog/index.vue b/web/src/views/backend/user/moneyLog/index.vue index ddeee99..524dbe6 100644 --- a/web/src/views/backend/user/moneyLog/index.vue +++ b/web/src/views/backend/user/moneyLog/index.vue @@ -72,9 +72,8 @@ const baTable = new baTableClass( operatorPlaceholder: t('Fuzzy query'), }, { label: t('user.moneyLog.Change balance'), prop: 'money', align: 'center', operator: 'RANGE', sortable: 'custom' }, - { label: t('user.moneyLog.Before change'), prop: 'before', align: 'center', operator: 'RANGE', sortable: 'custom' }, - { label: t('user.moneyLog.After change'), prop: 'after', align: 'center', operator: 'RANGE', sortable: 'custom' }, - { label: t('user.moneyLog.Transaction id'), prop: 'transaction_id', align: 'center', operator: 'RANGE', sortable: 'custom' }, + { label: t('user.moneyLog.bank_id'), prop: 'bank.bank_name', align: 'center', operator: 'LIKE', operatorPlaceholder: t('Fuzzy query') }, + { label: t('user.moneyLog.Transaction id'), prop: 'transaction_id', align: 'center', operator: 'RANGE' }, { label: t('user.moneyLog.Game Ticket'), prop: 'scoreLog', diff --git a/web/src/views/backend/user/moneyLog/popupForm.vue b/web/src/views/backend/user/moneyLog/popupForm.vue index 0e07918..3793d07 100644 --- a/web/src/views/backend/user/moneyLog/popupForm.vue +++ b/web/src/views/backend/user/moneyLog/popupForm.vue @@ -40,31 +40,29 @@ disabled: baTable.form.operate == 'Edit' }" /> - - - - - - - - - - + + + +
+ {{ item.bank_name }} + {{ item.bank_account }} +
+
+
- - - - - { + state.bankLoading = true + createAxios({ + url: '/admin/Bank/index', + method: 'GET', + params: { + // BuildAdmin 后端标准的搜索与分页格式 + quickSearch: query, + limit: 20 + } + }).then((res) => { + // BuildAdmin 列表的标准返回结构是 res.data.list + state.bankOptions = res.data.list || [] + }).finally(() => { + state.bankLoading = false + }) +} const config = useConfig() const { t } = useI18n() const baTable = inject('baTable') as baTableClass const rules: Partial> = reactive({ - user_id: [buildValidatorData({ name: 'required', message: t('Please select field', { field: t('user.moneyLog.User') }) })], + bank_id: [buildValidatorData({ name: 'required', message: t('Please select field', { field: t('user.moneyLog.bank_id') }) })], type: [buildValidatorData({ name: 'required', message: t('Please select field', { field: t('user.moneyLog.type') }) })], money: [ buildValidatorData({ name: 'required', title: t('user.moneyLog.Change amount') }), @@ -162,9 +162,13 @@ const formRef = useTemplateRef('formRef') const state: { userInfo: anyObj after: number + bankOptions: any[] // 新增:存放银行下拉选项 + bankLoading: boolean // 新增:下拉框加载状态 } = reactive({ userInfo: {}, after: 0, + bankOptions: [], // 初始化 + bankLoading: false }) const getAdd = () => { diff --git a/web/src/views/backend/user/user/popupForm.vue b/web/src/views/backend/user/user/popupForm.vue index 38ba38c..18cda78 100644 --- a/web/src/views/backend/user/user/popupForm.vue +++ b/web/src/views/backend/user/user/popupForm.vue @@ -99,13 +99,6 @@ :placeholder="t('Please select field', { field: t('user.user.birthday') })" /> - - - - -