diff --git a/app/admin/controller/Channel.php b/app/admin/controller/Channel.php index 7bb3645..afa6583 100644 --- a/app/admin/controller/Channel.php +++ b/app/admin/controller/Channel.php @@ -25,6 +25,7 @@ class Channel extends Backend 'settleStats', 'dividendRecordList', 'directBetRecordList', + 'companyBetRecordList', 'settlementBetRecordList', ]; @@ -751,6 +752,7 @@ class Channel extends Backend } } $paidDividendTotal = '0.00'; + $companyTotalBetAmount = '0.00'; if ($channelIdList !== []) { $paidRow = Db::name('agent_commission_record') ->where('channel_id', 'in', $channelIdList) @@ -758,6 +760,12 @@ class Channel extends Backend ->field('SUM(commission_amount) AS s') ->find(); $paidDividendTotal = bcadd(strval(is_array($paidRow) ? ($paidRow['s'] ?? '0') : '0'), '0', 2); + + $companyBetRow = Db::name('game_play_record') + ->where('channel_id', 'in', $channelIdList) + ->field('SUM(total_amount) AS s') + ->find(); + $companyTotalBetAmount = bcadd(strval(is_array($companyBetRow) ? ($companyBetRow['s'] ?? '0') : '0'), '0', 2); } return $this->success('', [ 'channel_total' => $total, @@ -767,6 +775,7 @@ class Channel extends Backend 'carryover_total' => $carryoverTotal, 'carryover_positive_total' => $carryoverPositiveTotal, 'paid_dividend_total' => $paidDividendTotal, + 'company_total_bet_amount' => $companyTotalBetAmount, ]); } @@ -779,7 +788,7 @@ class Channel extends Backend if ($response !== null) { return $response; } - if (!$this->auth->check('channel/viewDividendRecords')) { + if (!$this->auth->check('channel/index')) { return $this->error(__('You have no permission')); } @@ -840,7 +849,7 @@ class Channel extends Backend } /** - * 渠道直属玩家下注记录(直属投注额列点击) + * 渠道直属玩家下注记录(直属投注额列点击;该渠道名下玩家全部注单) */ public function directBetRecordList(WebmanRequest $request): Response { @@ -848,7 +857,7 @@ class Channel extends Backend if ($response !== null) { return $response; } - if (!$this->auth->check('channel/viewDirectBetRecords')) { + if (!$this->auth->check('channel/index')) { return $this->error(__('You have no permission')); } @@ -861,27 +870,31 @@ class Channel extends Backend } /** - * 参与分红口径的下注记录(操作列「查看总投注金额」) + * 公司总投注记录下注明细(顶部公司总投注额点击;含未结算,当前账号可见渠道范围) */ - public function settlementBetRecordList(WebmanRequest $request): Response + public function companyBetRecordList(WebmanRequest $request): Response { $response = $this->initializeBackend($request); if ($response !== null) { return $response; } - if (!$this->auth->check('channel/viewSettlementBetRecords')) { + if (!$this->auth->check('channel/index')) { return $this->error(__('You have no permission')); } - $channelId = (int) ($request->get('channel_id', 0)); - if ($channelId <= 0 || !$this->assertChannelAccessible($channelId)) { - return $this->error(__('You have no permission')); - } - - return $this->success('', $this->fetchChannelPlayRecordListPayload($request, $channelId, true)); + return $this->success('', $this->fetchChannelPlayRecordListPayload($request, 0, false)); } /** + * @deprecated 请使用 companyBetRecordList + */ + public function settlementBetRecordList(WebmanRequest $request): Response + { + return $this->companyBetRecordList($request); + } + + /** + * @param int $channelId 0=当前账号可见全部渠道 * @return array{list: array>, total: int, summary: array{record_count:int,total_bet_amount:string,total_win_amount:string}} */ private function fetchChannelPlayRecordListPayload(WebmanRequest $request, int $channelId, bool $settledOnly): array @@ -1054,8 +1067,21 @@ class Channel extends Backend $query = Db::name('game_play_record')->alias('pr') ->leftJoin('user u', 'u.id = pr.user_id') ->leftJoin('game_record gr', 'gr.id = pr.period_id') - ->leftJoin('channel c', 'c.id = pr.channel_id') - ->where('pr.channel_id', $channelId); + ->leftJoin('channel c', 'c.id = pr.channel_id'); + if ($channelId > 0) { + if (!$this->assertChannelAccessible($channelId)) { + $query->where('pr.channel_id', 0); + return $query; + } + $query->where('pr.channel_id', $channelId); + } else { + $scope = $this->readableChannelIds(); + if ($scope === []) { + $query->where('pr.channel_id', 0); + } elseif ($scope !== null) { + $query->whereIn('pr.channel_id', $scope); + } + } if ($settledOnly) { $query->where('pr.status', 2); } diff --git a/app/admin/controller/admin/AdminWallet.php b/app/admin/controller/admin/AdminWallet.php index 66c0755..433efd6 100644 --- a/app/admin/controller/admin/AdminWallet.php +++ b/app/admin/controller/admin/AdminWallet.php @@ -38,9 +38,9 @@ class AdminWallet extends Backend list($where, $alias, $limit, $order) = $this->queryBuilder(); $table = strtolower($this->model->getTable()); $mainShort = $alias[$table] ?? ''; - if ($mainShort !== '' && $this->auth && !$this->auth->isSuperAdmin()) { - // 非超管仅可查看自己钱包 - $where[] = [$mainShort . '.admin_id', '=', intval($this->auth->id ?? 0)]; + $scopedAdminIds = $this->getManageableScopeAdminIds(); + if ($mainShort !== '' && $scopedAdminIds !== []) { + $where[] = [$mainShort . '.admin_id', 'in', $scopedAdminIds]; } $res = $this->model ->withJoin($this->withJoinTable, $this->withJoinType) diff --git a/app/admin/controller/admin/AdminWalletRecord.php b/app/admin/controller/admin/AdminWalletRecord.php index ccacc14..15af2c6 100644 --- a/app/admin/controller/admin/AdminWalletRecord.php +++ b/app/admin/controller/admin/AdminWalletRecord.php @@ -37,8 +37,9 @@ class AdminWalletRecord extends Backend list($where, $alias, $limit, $order) = $this->queryBuilder(); $table = strtolower($this->model->getTable()); $mainShort = $alias[$table] ?? ''; - if ($mainShort !== '' && $this->auth && !$this->auth->isSuperAdmin()) { - $where[] = [$mainShort . '.admin_id', '=', intval($this->auth->id ?? 0)]; + $scopedAdminIds = $this->getManageableScopeAdminIds(); + if ($mainShort !== '' && $scopedAdminIds !== []) { + $where[] = [$mainShort . '.admin_id', 'in', $scopedAdminIds]; } $res = $this->model diff --git a/app/admin/controller/order/AdminWithdrawOrder.php b/app/admin/controller/order/AdminWithdrawOrder.php index 4d673c6..565cf96 100644 --- a/app/admin/controller/order/AdminWithdrawOrder.php +++ b/app/admin/controller/order/AdminWithdrawOrder.php @@ -42,9 +42,9 @@ class AdminWithdrawOrder extends Backend list($where, $alias, $limit, $order) = $this->queryBuilder(); $table = strtolower($this->model->getTable()); $mainShort = $alias[$table] ?? ''; - $channelScope = $this->readableChannelIds(); - if ($mainShort !== '' && $channelScope !== null) { - $where[] = [$mainShort . '.channel_id', 'in', $channelScope]; + $scopedAdminIds = $this->getManageableScopeAdminIds(); + if ($mainShort !== '' && $scopedAdminIds !== []) { + $where[] = [$mainShort . '.admin_id', 'in', $scopedAdminIds]; } $res = $this->model ->withJoin($this->withJoinTable, $this->withJoinType) @@ -171,9 +171,9 @@ class AdminWithdrawOrder extends Backend return $response; } $query = Db::name('admin_withdraw_order'); - $channelScope = $this->readableChannelIds(); - if ($channelScope !== null) { - $query->where('channel_id', 'in', $channelScope); + $scopedAdminIds = $this->getManageableScopeAdminIds(); + if ($scopedAdminIds !== []) { + $query->where('admin_id', 'in', $scopedAdminIds); } $rows = $query->field(['status', 'amount', 'actual_amount'])->select()->toArray(); $total = count($rows); @@ -232,16 +232,16 @@ class AdminWithdrawOrder extends Backend if ($this->auth->isSuperAdmin() || $this->hasGlobalReadScope()) { return true; } - $channelId = intval($order['channel_id'] ?? 0); - if ($channelId <= 0) { + $adminId = intval($order['admin_id'] ?? 0); + if ($adminId <= 0) { return false; } - $allowed = $this->readableChannelIds(); - if ($allowed === null) { + $scopedAdminIds = $this->getManageableScopeAdminIds(); + if ($scopedAdminIds === []) { return true; } - return in_array($channelId, $allowed, true); + return in_array($adminId, $scopedAdminIds, true); } } diff --git a/app/common/controller/Backend.php b/app/common/controller/Backend.php index 3e8ee14..f1738f5 100644 --- a/app/common/controller/Backend.php +++ b/app/common/controller/Backend.php @@ -7,6 +7,8 @@ namespace app\common\controller; use Throwable; use app\admin\library\Auth; use app\common\service\AdminChannelScopeService; +use app\common\service\AdminCommissionDistributionService; +use support\think\Db; use app\common\library\token\TokenExpirationException; use app\admin\library\traits\Backend as BackendTrait; use support\Response; @@ -542,4 +544,49 @@ class Backend extends Api return array_values(array_unique($paths)); } + + /** + * 角色组管理范围内可见的管理员 ID(本人 + 代理树下级 + 本人所在组及下级组内管理员) + * 超管或全平台只读范围返回空数组表示不限制 + * + * @return int[] + */ + protected function getManageableScopeAdminIds(): array + { + if ($this->auth === null || !$this->auth->isLogin()) { + return [0]; + } + if ($this->auth->isSuperAdmin() || $this->hasGlobalReadScope()) { + return []; + } + + $operatorId = intval($this->auth->id); + $ids = AdminCommissionDistributionService::getVisibleAdminIdsForOperator($operatorId, false); + + $ownGroupIds = Db::name('admin_group_access')->where('uid', $operatorId)->column('group_id'); + $childGroupIds = $this->auth->getAdminChildGroups(); + $groupIds = array_values(array_unique(array_merge( + array_map(static fn($id) => intval(strval($id)), $ownGroupIds), + array_map(static fn($id) => intval(strval($id)), $childGroupIds) + ))); + if ($groupIds !== []) { + $groupAdminIds = Db::name('admin_group_access') + ->where('group_id', 'in', $groupIds) + ->column('uid'); + foreach ($groupAdminIds as $uid) { + $uidInt = intval(strval($uid)); + if ($uidInt > 0) { + $ids[] = $uidInt; + } + } + } + + if ($operatorId > 0) { + $ids[] = $operatorId; + } + + $ids = array_values(array_unique(array_filter($ids, static fn(int $id): bool => $id > 0))); + + return $ids === [] ? [0] : $ids; + } } diff --git a/app/common/lang/en/admin_rule_title.php b/app/common/lang/en/admin_rule_title.php index d7d38bd..84e680d 100644 --- a/app/common/lang/en/admin_rule_title.php +++ b/app/common/lang/en/admin_rule_title.php @@ -124,7 +124,7 @@ return [ 'viewCommissionRecords' => 'View commission records', 'viewDividendRecords' => 'View paid dividend records', 'viewDirectBetRecords' => 'View direct bet records', - 'viewSettlementBetRecords' => 'View settlement-scope bets', + 'viewSettlementBetRecords' => 'View company bet records', 'viewAllChannels' => 'View all channels', // 其它中文按钮文案 diff --git a/app/common/lang/zh-cn/admin_rule_title.php b/app/common/lang/zh-cn/admin_rule_title.php index 91cbd0b..4405215 100644 --- a/app/common/lang/zh-cn/admin_rule_title.php +++ b/app/common/lang/zh-cn/admin_rule_title.php @@ -56,7 +56,7 @@ return [ 'viewCommissionRecords' => '查看代理佣金记录', 'viewDividendRecords' => '查看已分红记录', 'viewDirectBetRecords' => '查看直属投注记录', - 'viewSettlementBetRecords' => '查看总投注金额', + 'viewSettlementBetRecords' => '查看公司总投注记录', 'viewAllChannels' => '查看所有渠道', 'walletAdjust' => '钱包加减点', 'Markdown文档' => 'Markdown文档', diff --git a/docs/en/channel-admin-guide.md b/docs/en/channel-admin-guide.md index 427c254..0d3fbb8 100644 --- a/docs/en/channel-admin-guide.md +++ b/docs/en/channel-admin-guide.md @@ -14,7 +14,8 @@ Documents the **Channel Management** page (`/admin/channel`): summary cards, lis | Enabled | `status = 1` | | Pending dividend (count) | `carryover_balance > 0` | | Pending dividend (amount) | Sum of those balances | -| Paid dividend | Sum of paid `agent_commission_record` in scope; clickable dialog requires `viewDividendRecords` | +| Paid dividend | Sum of paid `agent_commission_record` in scope; clickable dialog requires `channel/index` | +| Company total bet | Total bets in readable scope; clickable records dialog requires `channel/index` | List filters: **All / With balance / No balance / Enabled only / Disabled only** (UI search only). @@ -36,9 +37,7 @@ List filters: **All / With balance / No balance / Enabled only / Disabled only** | Node | Label | Behavior | |------|-------|----------| -| `channel/viewDividendRecords` | Paid dividend records | Top card + dialog | -| `channel/viewDirectBetRecords` | Direct bet records | Direct bet column click | -| `channel/viewSettlementBetRecords` | Settlement-scope bets | Row action | +| `channel/index` | View | List, stat card clicks, bet/dividend record dialogs | | `channel/manualSettle` | Manual settle | Preview + submit (readable channel) | | `channel/batchSettlePending` | Batch settle | Writable enabled channels in scope | @@ -59,8 +58,8 @@ Re-login after role changes to refresh `authNode`. | Entry | API | Data | |-------|-----|------| -| Direct bet amount | `directBetRecordList` | All play records for channel | -| View settlement bets | `settlementBetRecordList` | `status = 2` only | +| Direct bet amount (column) | `directBetRecordList` | All play records for that channel | +| Company total bet (top card) | `companyBetRecordList` | All play records in readable scope | **Filters (GET):** `period_no`, `user_keyword`, `result_number`, `pick_number`, `win_hit` (`won`/`lost`/`pending`), `page`, `limit`. diff --git a/docs/后端.md b/docs/后端.md index 4066fcb..7badd14 100644 --- a/docs/后端.md +++ b/docs/后端.md @@ -79,9 +79,9 @@ * **创建总代/子代账号**:在 **管理员管理**(`/admin/auth/admin`)维护代理树:`parent_admin_id`、`commission_share_rate`(顶级角色组从渠道总佣金分得 %,子代理从上级实得抽取 %)、`channel_id`、邀请码。 * **代理树状图 (Tree View)**:管理员列表以树形展示;非超管仅见本人及全部下级。 * **渠道管理页**(`/admin/channel`): - * 顶部统计:渠道数、待分红、已分红(可点开记录);列表支持分红余额/启用状态筛选。 + * 顶部统计:渠道数、待分红、已分红、**公司总投注额**(可点开全部下注记录);列表支持分红余额/启用状态筛选。 * **数据范围**:`AdminChannelScopeService`;全平台只读条件见 `docs/渠道管理后台说明.md` §3。 - * **操作**:查看总投注金额 / 直属投注记录(弹窗 + 筛选);手动结算(超管或 `channel/manualSettle`)。 + * **操作**:直属投注额列点击 / 公司总投注额卡片(弹窗 + 筛选);手动结算(超管或 `channel/manualSettle`)。 * **渠道佣金结算**: * 按渠道 `agent_mode` 与已结算注单计算渠道总佣金(非充值口径)。 * 按代理树拆分各管理员实得,写入 `agent_commission_record` 并 **即时入账** `admin_wallet`。 diff --git a/docs/渠道管理后台说明.md b/docs/渠道管理后台说明.md index 41cd805..5862f43 100644 --- a/docs/渠道管理后台说明.md +++ b/docs/渠道管理后台说明.md @@ -16,7 +16,8 @@ | 启用渠道 | `status = 1` 的渠道数 | | 待分红渠道 | `carryover_balance > 0` 的渠道数 | | 待分红总额 | 上述渠道 `carryover_balance` 合计 | -| 已分红金额 | 可读范围内渠道下,已发放佣金(`agent_commission_record.status = 1`)合计;**可点击**打开已分红记录弹窗(需 `viewDividendRecords` 权限) | +| 公司总投注额 | 可读范围内全部玩家总投注(含未结算);**可点击**打开全部下注记录(需 `channel/index`) | +| 已分红金额 | 可读范围内渠道下,已发放佣金(`agent_commission_record.status = 1`)合计;**可点击**打开已分红记录弹窗(需 `channel/index`) | 列表上方筛选:**全部 / 有分红余额 / 无分红余额 / 仅启用 / 仅停用**(前端 `search` 条件,不改变数据范围规则)。 @@ -54,17 +55,15 @@ ### 4.1 常用列 - 渠道标识、名称、代理模式、联营负结转、契约编号、结算周期等 -- **直属投注额**:该渠道下 `game_play_record` 投注合计;**可点击**打开直属下注记录弹窗(需 `viewDirectBetRecords`) -- 操作列:**查看总投注金额**、**手动结算**、编辑、删除(后两者受写权限约束) +- **直属投注额**:该渠道名下全部玩家的总投注额(含未结算);**可点击**打开该渠道直属玩家游戏下注记录(需 `channel/index`) +- 顶部统计卡片 **公司总投注额**:当前账号可见渠道范围内的真实码量合计(含未结算);**可点击**打开全部下注记录明细(需 `channel/index`) +- 操作列:**手动结算**、编辑、删除(后两者受写权限约束) ### 4.2 操作按钮权限 | 按钮权限节点 | 名称 | 行为 | |--------------|------|------| -| `channel/index` | 查看 | 列表与详情 | -| `channel/viewDividendRecords` | 查看已分红记录 | 顶部「已分红金额」卡片与弹窗 | -| `channel/viewDirectBetRecords` | 查看直属投注记录 | 「直属投注额」列点击 | -| `channel/viewSettlementBetRecords` | 查看总投注金额 | 操作列;分红口径已结算注单 | +| `channel/index` | 查看 | 列表、统计卡片点击、下注/分红记录弹窗 | | `channel/manualSettle` | 手动结算 | 操作列;预览并提交渠道结算(见 §5) | | `channel/batchSettlePending` | 一键批量结算 | 批量结算当前账号**可写范围**内启用渠道 | | `channel/add` / `edit` / `del` | 增删改 | 须对目标渠道具备写权限 | @@ -91,8 +90,8 @@ | 入口 | 接口 | 数据范围 | |------|------|----------| -| 直属投注额 | `GET /admin/channel/directBetRecordList` | 该渠道全部游玩记录 | -| 查看总投注金额 | `GET /admin/channel/settlementBetRecordList` | 该渠道 **已结算** 记录(`status = 2`,参与分红口径) | +| 直属投注额(列点击) | `GET /admin/channel/directBetRecordList` | 该渠道名下玩家 **全部** 游玩记录(含未结算) | +| 公司总投注额(顶部卡片) | `GET /admin/channel/companyBetRecordList` | 当前账号可见渠道范围内 **全部** 游玩记录(含未结算) | ### 6.1 顶部统计(Card) @@ -124,7 +123,7 @@ ## 7. 已分红记录弹窗 - **接口**:`GET /admin/channel/dividendRecordList` -- **权限**:`channel/viewDividendRecords` +- **权限**:`channel/index` - **字段**:结算单号、渠道名、代理账号、分红金额、结算周期、发放时间等 --- diff --git a/web/src/lang/backend/en/channel.ts b/web/src/lang/backend/en/channel.ts index 379165d..d2d2e03 100644 --- a/web/src/lang/backend/en/channel.ts +++ b/web/src/lang/backend/en/channel.ts @@ -110,11 +110,12 @@ export default { settle_stats_pending_dividend: 'Channels pending dividend', settle_stats_pending_amount: 'Pending dividend amount', settle_stats_paid_dividend: 'Paid dividend amount', + settle_stats_company_total_bet: 'Company total bet', direct_bet_amount: 'Direct bet amount', - view_settlement_bet: 'View settlement bets', + direct_bet_amount_tip: 'Total bets from all players under this channel (including unsettled)', + company_bet_record_dialog_title: 'Company bet records', + direct_bet_record_dialog_title: 'Direct player game bets', dividend_record_dialog_title: 'Paid dividend records', - direct_bet_record_dialog_title: 'Direct player bet records', - settlement_bet_record_dialog_title: 'Dividend-scope bet records', bet_record_period_no: 'Period No.', bet_record_user_username: 'Player', bet_record_total_amount: 'Bet amount', diff --git a/web/src/lang/backend/zh-cn/channel.ts b/web/src/lang/backend/zh-cn/channel.ts index 1e475fe..46bca20 100644 --- a/web/src/lang/backend/zh-cn/channel.ts +++ b/web/src/lang/backend/zh-cn/channel.ts @@ -109,11 +109,12 @@ export default { settle_stats_pending_dividend: '待分红渠道', settle_stats_pending_amount: '待分红总额', settle_stats_paid_dividend: '已分红金额', + settle_stats_company_total_bet: '公司总投注额', direct_bet_amount: '直属投注额', - view_settlement_bet: '查看总投注金额', + direct_bet_amount_tip: '该渠道名下全部玩家的总投注额(含未结算)', + company_bet_record_dialog_title: '公司总投注记录下注明细', + direct_bet_record_dialog_title: '直属玩家游戏下注记录', dividend_record_dialog_title: '已分红记录', - direct_bet_record_dialog_title: '直属玩家下注记录', - settlement_bet_record_dialog_title: '分红口径下注记录', bet_record_period_no: '游戏期号', bet_record_user_username: '玩家名', bet_record_total_amount: '投注金额', diff --git a/web/src/views/backend/channel/index.vue b/web/src/views/backend/channel/index.vue index 0e43a26..4ac441d 100644 --- a/web/src/views/backend/channel/index.vue +++ b/web/src/views/backend/channel/index.vue @@ -27,7 +27,16 @@ +
{{ t('channel.settle_stats_company_total_bet') }}
+
{{ settleStats.company_total_bet_amount }}
+
+
{{ t('channel.settle_stats_paid_dividend') }}
@@ -353,6 +362,7 @@ show-overflow-tooltip /> { } const tableRef = useTemplateRef('tableRef') let optButtons: OptButton[] = [ - { - render: 'tipButton', - name: 'viewSettlementBet', - title: 'channel.view_settlement_bet', - text: '', - type: 'info', - icon: 'fa fa-list-alt', - class: 'table-row-view-settlement-bet', - disabledTip: false, - display: () => auth('viewSettlementBetRecords'), - click: (row: TableRow) => { - void openBetRecordDialog('settlement', row) - }, - }, { render: 'tipButton', name: 'manualSettle', @@ -658,6 +654,7 @@ const settleStats = reactive({ carryover_total: '0.00', carryover_positive_total: '0.00', paid_dividend_total: '0.00', + company_total_bet_amount: '0.00', }) const dividendDialog = reactive({ @@ -680,7 +677,7 @@ const createBetRecordFilters = () => ({ const betRecordDialog = reactive({ visible: false, loading: false, - mode: '' as '' | 'direct' | 'settlement', + mode: '' as '' | 'direct' | 'company', channelId: 0, title: '', page: 1, @@ -952,6 +949,7 @@ const loadSettleStats = async () => { settleStats.carryover_total = String(res.data.carryover_total ?? '0.00') settleStats.carryover_positive_total = String(res.data.carryover_positive_total ?? '0.00') settleStats.paid_dividend_total = String(res.data.paid_dividend_total ?? '0.00') + settleStats.company_total_bet_amount = String(res.data.company_total_bet_amount ?? '0.00') } const loadDividendRecords = async () => { @@ -973,7 +971,7 @@ const loadDividendRecords = async () => { } const onPaidDividendCardClick = () => { - if (!auth('viewDividendRecords')) { + if (!auth('index')) { return } dividendDialog.page = 1 @@ -981,6 +979,18 @@ const onPaidDividendCardClick = () => { void loadDividendRecords() } +const onCompanyTotalBetCardClick = () => { + if (!auth('index')) { + return + } + resetBetRecordDialog() + betRecordDialog.mode = 'company' + betRecordDialog.channelId = 0 + betRecordDialog.title = t('channel.company_bet_record_dialog_title') + betRecordDialog.visible = true + void loadBetRecords() +} + const closeDividendDialog = () => { dividendDialog.visible = false dividendDialog.list = [] @@ -1030,22 +1040,30 @@ const buildBetRecordFilterParams = () => { } const loadBetRecords = async () => { - if (!betRecordDialog.channelId || !betRecordDialog.mode) { + if (!betRecordDialog.mode) { + return + } + if (betRecordDialog.mode === 'direct' && !betRecordDialog.channelId) { return } const url = - betRecordDialog.mode === 'direct' ? '/admin/channel/directBetRecordList' : '/admin/channel/settlementBetRecordList' + betRecordDialog.mode === 'direct' + ? '/admin/channel/directBetRecordList' + : '/admin/channel/companyBetRecordList' betRecordDialog.loading = true try { + const params: Record = { + page: betRecordDialog.page, + limit: betRecordDialog.limit, + ...buildBetRecordFilterParams(), + } + if (betRecordDialog.mode === 'direct') { + params.channel_id = betRecordDialog.channelId + } const res = await createAxios({ url, method: 'get', - params: { - channel_id: betRecordDialog.channelId, - page: betRecordDialog.page, - limit: betRecordDialog.limit, - ...buildBetRecordFilterParams(), - }, + params, }) if (res.code !== 1 || !res.data) { return @@ -1063,9 +1081,8 @@ const loadBetRecords = async () => { } } -const openBetRecordDialog = (mode: 'direct' | 'settlement', row: TableRow) => { - const permission = mode === 'direct' ? 'viewDirectBetRecords' : 'viewSettlementBetRecords' - if (!auth(permission)) { +const openBetRecordDialog = (mode: 'direct' | 'company', row: TableRow) => { + if (!auth('index')) { return } resetBetRecordDialog() @@ -1074,7 +1091,7 @@ const openBetRecordDialog = (mode: 'direct' | 'settlement', row: TableRow) => { betRecordDialog.title = mode === 'direct' ? `${t('channel.direct_bet_record_dialog_title')} - ${row.name ?? row.id}` - : `${t('channel.settlement_bet_record_dialog_title')} - ${row.name ?? row.id}` + : t('channel.company_bet_record_dialog_title') betRecordDialog.visible = true void loadBetRecords() } @@ -1234,8 +1251,8 @@ const baTable = new baTableClass( formatter: formatAmount2, customRenderAttr: { tag: ({ row }: { row: TableRow }) => ({ - class: auth('viewDirectBetRecords') ? 'channel-direct-bet-tag' : '', - onClick: auth('viewDirectBetRecords') ? () => openDirectBetDialog(row) : undefined, + class: auth('index') ? 'channel-direct-bet-tag' : '', + onClick: auth('index') ? () => openDirectBetDialog(row) : undefined, }), }, }, @@ -1382,11 +1399,20 @@ onUnmounted(() => { .channel-stats-cards { display: grid; - grid-template-columns: repeat(5, minmax(0, 1fr)); - gap: 10px; + grid-template-columns: repeat(6, minmax(0, 1fr)); + gap: 8px; margin-bottom: 10px; } +.channel-stats-cards :deep(.el-card__body) { + padding: 10px 8px; +} + +.channel-stat-card { + text-align: center; + min-width: 0; +} + .channel-stat-card-clickable { cursor: pointer; transition: box-shadow 0.2s ease; @@ -1468,15 +1494,18 @@ onUnmounted(() => { } .channel-stat-card .label { - font-size: 12px; + font-size: 11px; color: var(--el-text-color-secondary); + line-height: 1.3; + word-break: break-all; } .channel-stat-card .value { - margin-top: 6px; - font-size: 20px; + margin-top: 4px; + font-size: 17px; font-weight: 600; color: var(--el-text-color-primary); + line-height: 1.2; } .channel-action-row {