|
|
@@ -8,7 +8,7 @@
|
|
|
show-icon
|
|
|
>
|
|
|
<template slot="title">
|
|
|
- 公司盈亏计算方式:【总存款 减去 总提款 减去 总加送金额 减去 总优惠 减去 总红包 减去 总活动彩金 减去 总返水】 其中未包含【手动加/扣款】
|
|
|
+ 公司盈亏计算方式:【总存款 减去 总提款 减去 优惠/加送 减去 返水】 其中未包含【手动加/扣款】
|
|
|
</template>
|
|
|
</el-alert>
|
|
|
|
|
|
@@ -24,13 +24,7 @@
|
|
|
v-model="query.agent_account"
|
|
|
placeholder="代理账号"
|
|
|
clearable
|
|
|
- />
|
|
|
- </el-form-item>
|
|
|
- <el-form-item label="真实姓名" prop="real_name">
|
|
|
- <el-input
|
|
|
- v-model="query.real_name"
|
|
|
- placeholder="真实姓名"
|
|
|
- clearable
|
|
|
+ @keyup.enter.native="handleSearch"
|
|
|
/>
|
|
|
</el-form-item>
|
|
|
<el-form-item label="时间" prop="date_range">
|
|
|
@@ -43,11 +37,12 @@
|
|
|
end-placeholder="结束日期"
|
|
|
value-format="yyyy-MM-dd"
|
|
|
:picker-options="disableFutureDate"
|
|
|
+ :clearable="false"
|
|
|
/>
|
|
|
</el-form-item>
|
|
|
<el-form-item class="search-actions">
|
|
|
<el-button @click="handleSearch">查询</el-button>
|
|
|
- <el-button type="primary" plain @click="handleExport">导出Excel</el-button>
|
|
|
+ <el-button type="primary" plain :loading="exportLoading" @click="handleExport">导出Excel</el-button>
|
|
|
</el-form-item>
|
|
|
</el-form>
|
|
|
|
|
|
@@ -58,23 +53,28 @@
|
|
|
height="calc(100vh - 305px)"
|
|
|
class="report-table"
|
|
|
>
|
|
|
- <el-table-column prop="id" label="ID" width="54" align="center" fixed="left" />
|
|
|
+ <el-table-column prop="id" label="ID" width="70" align="center" fixed="left" />
|
|
|
<el-table-column label="代理自身" align="center">
|
|
|
- <el-table-column prop="agent_account" label="账号" min-width="82" align="center" />
|
|
|
- <el-table-column prop="real_name" label="真实姓名" min-width="82" align="center" />
|
|
|
- <el-table-column prop="balance" label="账户余额" min-width="82" align="center">
|
|
|
+ <el-table-column prop="agent_account" label="账号" min-width="110" align="center" />
|
|
|
+ <el-table-column prop="real_name" label="真实姓名" min-width="100" align="center">
|
|
|
+ <template slot-scope="{ row }">{{ row.real_name || '--' }}</template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column prop="parent_username" label="上级代理" min-width="110" align="center">
|
|
|
+ <template slot-scope="{ row }">{{ row.parent_username || '--' }}</template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column prop="balance" label="账户余额" min-width="100" align="center">
|
|
|
<template slot-scope="{ row }">
|
|
|
{{ formatMoney(row.balance) }}
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
- <el-table-column prop="locked_wallet" label="锁定钱包" min-width="82" align="center">
|
|
|
+ <el-table-column prop="frozen_balance" label="冻结余额" min-width="100" align="center">
|
|
|
<template slot-scope="{ row }">
|
|
|
- {{ formatMoney(row.locked_wallet) }}
|
|
|
+ {{ formatMoney(row.frozen_balance) }}
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
</el-table-column>
|
|
|
<el-table-column label="下级数量" align="center">
|
|
|
- <el-table-column prop="sub_count" label="代理数/会员数" min-width="90" align="center">
|
|
|
+ <el-table-column prop="sub_count" label="代理数/会员数" min-width="110" align="center">
|
|
|
<template slot-scope="{ row }">
|
|
|
<span class="count-blue">({{ row.agent_count }})</span>
|
|
|
<span> / </span>
|
|
|
@@ -83,85 +83,76 @@
|
|
|
</el-table-column>
|
|
|
</el-table-column>
|
|
|
<el-table-column label="下级金额" align="center">
|
|
|
- <el-table-column prop="member_balance" label="会员余额" min-width="82" align="center">
|
|
|
+ <el-table-column prop="member_balance" label="会员余额" min-width="100" align="center">
|
|
|
<template slot-scope="{ row }">
|
|
|
{{ formatMoney(row.member_balance) }}
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
- <el-table-column prop="total_deposit" label="总存款" min-width="82" align="center">
|
|
|
+ <el-table-column prop="deposit_amount" label="总存款" min-width="100" align="center">
|
|
|
<template slot-scope="{ row }">
|
|
|
- <span class="amount-red">{{ formatMoney(row.total_deposit) }}</span>
|
|
|
+ <span class="amount-red">{{ formatMoney(row.deposit_amount) }}</span>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
- <el-table-column prop="total_bonus" label="总加送金额" min-width="82" align="center">
|
|
|
+ <el-table-column prop="withdraw_amount" label="总提款" min-width="100" align="center">
|
|
|
<template slot-scope="{ row }">
|
|
|
- {{ formatMoney(row.total_bonus) }}
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- <el-table-column prop="total_withdraw" label="总提款" min-width="82" align="center">
|
|
|
- <template slot-scope="{ row }">
|
|
|
- {{ formatMoney(row.total_withdraw) }}
|
|
|
+ {{ formatMoney(row.withdraw_amount) }}
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
</el-table-column>
|
|
|
<el-table-column label="加/扣款" align="center">
|
|
|
- <el-table-column prop="total_add" label="总加款" min-width="82" align="center">
|
|
|
+ <el-table-column prop="manual_credit" label="人工充值" min-width="100" align="center">
|
|
|
<template slot-scope="{ row }">
|
|
|
- {{ formatMoney(row.total_add) }}
|
|
|
+ {{ formatMoney(row.manual_credit) }}
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
- <el-table-column prop="total_subtract" label="总扣款" min-width="82" align="center">
|
|
|
+ <el-table-column prop="manual_debit" label="人工扣款" min-width="100" align="center">
|
|
|
<template slot-scope="{ row }">
|
|
|
- {{ formatMoney(row.total_subtract) }}
|
|
|
+ {{ formatMoney(row.manual_debit) }}
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
</el-table-column>
|
|
|
- <el-table-column label="下级红利" align="center">
|
|
|
- <el-table-column prop="total_discount" label="总优惠" min-width="82" align="center">
|
|
|
- <template slot-scope="{ row }">
|
|
|
- {{ formatMoney(row.total_discount) }}
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- <el-table-column prop="total_red_packet" label="总红包" min-width="82" align="center">
|
|
|
+ <el-table-column label="优惠返水" align="center">
|
|
|
+ <el-table-column prop="bonus_amount" label="优惠金额" min-width="100" align="center">
|
|
|
<template slot-scope="{ row }">
|
|
|
- {{ formatMoney(row.total_red_packet) }}
|
|
|
+ {{ formatMoney(row.bonus_amount) }}
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
- <el-table-column prop="total_activity_bonus" label="总活动彩金" min-width="82" align="center">
|
|
|
+ <el-table-column prop="rebate_amount" label="返水金额" min-width="100" align="center">
|
|
|
<template slot-scope="{ row }">
|
|
|
- {{ formatMoney(row.total_activity_bonus) }}
|
|
|
+ {{ formatMoney(row.rebate_amount) }}
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
- <el-table-column prop="total_rebate" label="总返水" min-width="82" align="center">
|
|
|
+ <el-table-column prop="commission_amount" label="代理佣金" min-width="100" align="center">
|
|
|
<template slot-scope="{ row }">
|
|
|
- {{ formatMoney(row.total_rebate) }}
|
|
|
+ {{ formatMoney(row.commission_amount) }}
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
</el-table-column>
|
|
|
<el-table-column label="下级投注" align="center">
|
|
|
- <el-table-column prop="total_bet" label="总投注" min-width="82" align="center">
|
|
|
+ <el-table-column prop="bet_count" label="注单数" min-width="90" align="center" />
|
|
|
+ <el-table-column prop="bet_amount" label="总投注" min-width="100" align="center">
|
|
|
<template slot-scope="{ row }">
|
|
|
- {{ formatMoney(row.total_bet) }}
|
|
|
+ {{ formatMoney(row.bet_amount) }}
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
- <el-table-column prop="total_valid_bet" label="总有效投注" min-width="82" align="center">
|
|
|
+ <el-table-column prop="valid_bet_amount" label="有效投注" min-width="100" align="center">
|
|
|
<template slot-scope="{ row }">
|
|
|
- {{ formatMoney(row.total_valid_bet) }}
|
|
|
+ {{ formatMoney(row.valid_bet_amount) }}
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
- <el-table-column prop="total_win" label="总输赢" min-width="82" align="center">
|
|
|
+ <el-table-column prop="win_loss" label="会员输赢" min-width="100" align="center">
|
|
|
<template slot-scope="{ row }">
|
|
|
<el-tag
|
|
|
size="mini"
|
|
|
- :type="Number(row.total_win) < 0 ? 'danger' : 'info'"
|
|
|
+ :type="Number(row.win_loss) < 0 ? 'danger' : 'info'"
|
|
|
effect="plain"
|
|
|
>
|
|
|
- {{ formatMoney(row.total_win) }}
|
|
|
+ {{ formatMoney(row.win_loss) }}
|
|
|
</el-tag>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
</el-table-column>
|
|
|
- <el-table-column prop="company_profit" label="公司盈亏" min-width="82" align="center" fixed="right">
|
|
|
+ <el-table-column prop="company_profit" label="公司盈亏" min-width="110" align="center" fixed="right">
|
|
|
<template slot-scope="{ row }">
|
|
|
{{ formatMoney(row.company_profit) }}
|
|
|
</template>
|
|
|
@@ -174,7 +165,7 @@
|
|
|
layout="total, sizes, prev, pager, next, jumper"
|
|
|
:current-page="page"
|
|
|
:page-size="limit"
|
|
|
- :page-sizes="[10, 20, 50, 100]"
|
|
|
+ :page-sizes="[10, 20]"
|
|
|
:total="total"
|
|
|
@size-change="handleSizeChange"
|
|
|
@current-change="handleCurrentChange"
|
|
|
@@ -184,279 +175,204 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
+import exportExcel from '@/components/Table2Excel/exportExcel'
|
|
|
+import { getAgentReportList } from '@/api/data'
|
|
|
import { disableFutureDate } from '@/utils/index'
|
|
|
+
|
|
|
+const pad = value => String(value).padStart(2, '0')
|
|
|
+const formatDate = date => `${date.getFullYear()}-${pad(date.getMonth() + 1)}-${pad(date.getDate())}`
|
|
|
+const EXPORT_LIMIT = 20
|
|
|
+
|
|
|
export default {
|
|
|
name: 'AgentReport',
|
|
|
data() {
|
|
|
return {
|
|
|
loading: false,
|
|
|
+ exportLoading: false,
|
|
|
query: {
|
|
|
agent_account: '',
|
|
|
- real_name: '',
|
|
|
- date_range: []
|
|
|
+ date_range: this.getDefaultDateRange()
|
|
|
},
|
|
|
page: 1,
|
|
|
limit: 10,
|
|
|
total: 0,
|
|
|
tableData: [],
|
|
|
- disableFutureDate,
|
|
|
+ disableFutureDate
|
|
|
}
|
|
|
},
|
|
|
created() {
|
|
|
this.getList()
|
|
|
},
|
|
|
methods: {
|
|
|
- getMockRows() {
|
|
|
- return [
|
|
|
- {
|
|
|
- id: 1,
|
|
|
- agent_account: 'agent',
|
|
|
- real_name: 'agent',
|
|
|
- balance: 1234,
|
|
|
- locked_wallet: 0,
|
|
|
- agent_count: 14,
|
|
|
- member_count: 3,
|
|
|
- member_balance: 6105645.33,
|
|
|
- total_deposit: 0,
|
|
|
- total_bonus: 0,
|
|
|
- total_withdraw: 999800,
|
|
|
- total_add: 7127344,
|
|
|
- total_subtract: 21899,
|
|
|
- total_discount: 0,
|
|
|
- total_red_packet: 0,
|
|
|
- total_activity_bonus: 0,
|
|
|
- total_rebate: 0.1115,
|
|
|
- total_bet: 398.8,
|
|
|
- total_valid_bet: 398.8,
|
|
|
- total_win: -138,
|
|
|
- company_profit: -999800.11
|
|
|
- },
|
|
|
- {
|
|
|
- id: 2,
|
|
|
- agent_account: 'zxc123',
|
|
|
- real_name: 'zxc123',
|
|
|
- balance: 0.33,
|
|
|
- locked_wallet: 0,
|
|
|
- agent_count: 1,
|
|
|
- member_count: 0,
|
|
|
- member_balance: 0,
|
|
|
- total_deposit: 0,
|
|
|
- total_bonus: 0,
|
|
|
- total_withdraw: 0,
|
|
|
- total_add: 0,
|
|
|
- total_subtract: 0,
|
|
|
- total_discount: 0,
|
|
|
- total_red_packet: 0,
|
|
|
- total_activity_bonus: 0,
|
|
|
- total_rebate: 0,
|
|
|
- total_bet: 0,
|
|
|
- total_valid_bet: 0,
|
|
|
- total_win: 0,
|
|
|
- company_profit: 0
|
|
|
- },
|
|
|
- {
|
|
|
- id: 3,
|
|
|
- agent_account: 'a112411',
|
|
|
- real_name: '',
|
|
|
- balance: 0.03,
|
|
|
- locked_wallet: 0,
|
|
|
- agent_count: 0,
|
|
|
- member_count: 0,
|
|
|
- member_balance: 0,
|
|
|
- total_deposit: 0,
|
|
|
- total_bonus: 0,
|
|
|
- total_withdraw: 0,
|
|
|
- total_add: 0,
|
|
|
- total_subtract: 0,
|
|
|
- total_discount: 0,
|
|
|
- total_red_packet: 0,
|
|
|
- total_activity_bonus: 0,
|
|
|
- total_rebate: 0,
|
|
|
- total_bet: 0,
|
|
|
- total_valid_bet: 0,
|
|
|
- total_win: 0,
|
|
|
- company_profit: 0
|
|
|
- },
|
|
|
- {
|
|
|
- id: 4,
|
|
|
- agent_account: '112411',
|
|
|
- real_name: '',
|
|
|
- balance: 0,
|
|
|
- locked_wallet: 0,
|
|
|
- agent_count: 0,
|
|
|
- member_count: 0,
|
|
|
- member_balance: 0,
|
|
|
- total_deposit: 0,
|
|
|
- total_bonus: 0,
|
|
|
- total_withdraw: 0,
|
|
|
- total_add: 0,
|
|
|
- total_subtract: 0,
|
|
|
- total_discount: 0,
|
|
|
- total_red_packet: 0,
|
|
|
- total_activity_bonus: 0,
|
|
|
- total_rebate: 0,
|
|
|
- total_bet: 0,
|
|
|
- total_valid_bet: 0,
|
|
|
- total_win: 0,
|
|
|
- company_profit: 0
|
|
|
- },
|
|
|
- {
|
|
|
- id: 5,
|
|
|
- agent_account: '112400',
|
|
|
- real_name: '',
|
|
|
- balance: 0,
|
|
|
- locked_wallet: 0,
|
|
|
- agent_count: 0,
|
|
|
- member_count: 0,
|
|
|
- member_balance: 0,
|
|
|
- total_deposit: 0,
|
|
|
- total_bonus: 0,
|
|
|
- total_withdraw: 0,
|
|
|
- total_add: 0,
|
|
|
- total_subtract: 0,
|
|
|
- total_discount: 0,
|
|
|
- total_red_packet: 0,
|
|
|
- total_activity_bonus: 0,
|
|
|
- total_rebate: 0,
|
|
|
- total_bet: 0,
|
|
|
- total_valid_bet: 0,
|
|
|
- total_win: 0,
|
|
|
- company_profit: 0
|
|
|
- },
|
|
|
- {
|
|
|
- id: 6,
|
|
|
- agent_account: 'zxc1122',
|
|
|
- real_name: '',
|
|
|
- balance: 122122,
|
|
|
- locked_wallet: 0,
|
|
|
- agent_count: 0,
|
|
|
- member_count: 1,
|
|
|
- member_balance: 5000,
|
|
|
- total_deposit: 0,
|
|
|
- total_bonus: 0,
|
|
|
- total_withdraw: 0,
|
|
|
- total_add: 100000,
|
|
|
- total_subtract: 95000,
|
|
|
- total_discount: 0,
|
|
|
- total_red_packet: 0,
|
|
|
- total_activity_bonus: 0,
|
|
|
- total_rebate: 0,
|
|
|
- total_bet: 0,
|
|
|
- total_valid_bet: 0,
|
|
|
- total_win: 0,
|
|
|
- company_profit: 0
|
|
|
- },
|
|
|
- {
|
|
|
- id: 7,
|
|
|
- agent_account: 'zxc123456',
|
|
|
- real_name: '',
|
|
|
- balance: 100,
|
|
|
- locked_wallet: 0,
|
|
|
- agent_count: 0,
|
|
|
- member_count: 0,
|
|
|
- member_balance: 0,
|
|
|
- total_deposit: 0,
|
|
|
- total_bonus: 0,
|
|
|
- total_withdraw: 0,
|
|
|
- total_add: 0,
|
|
|
- total_subtract: 0,
|
|
|
- total_discount: 0,
|
|
|
- total_red_packet: 0,
|
|
|
- total_activity_bonus: 0,
|
|
|
- total_rebate: 0,
|
|
|
- total_bet: 0,
|
|
|
- total_valid_bet: 0,
|
|
|
- total_win: 0,
|
|
|
- company_profit: 0
|
|
|
- },
|
|
|
- {
|
|
|
- id: 8,
|
|
|
- agent_account: 'admin',
|
|
|
- real_name: '',
|
|
|
- balance: 9999999,
|
|
|
- locked_wallet: 0,
|
|
|
- agent_count: 0,
|
|
|
- member_count: 0,
|
|
|
- member_balance: 0,
|
|
|
- total_deposit: 0,
|
|
|
- total_bonus: 0,
|
|
|
- total_withdraw: 0,
|
|
|
- total_add: 0,
|
|
|
- total_subtract: 0,
|
|
|
- total_discount: 0,
|
|
|
- total_red_packet: 0,
|
|
|
- total_activity_bonus: 0,
|
|
|
- total_rebate: 0,
|
|
|
- total_bet: 0,
|
|
|
- total_valid_bet: 0,
|
|
|
- total_win: 0,
|
|
|
- company_profit: 0
|
|
|
- },
|
|
|
- {
|
|
|
- id: 9,
|
|
|
- agent_account: 'abc123',
|
|
|
- real_name: '',
|
|
|
- balance: 1222,
|
|
|
- locked_wallet: 0,
|
|
|
- agent_count: 0,
|
|
|
- member_count: 0,
|
|
|
- member_balance: 0,
|
|
|
- total_deposit: 0,
|
|
|
- total_bonus: 0,
|
|
|
- total_withdraw: 0,
|
|
|
- total_add: 0,
|
|
|
- total_subtract: 0,
|
|
|
- total_discount: 0,
|
|
|
- total_red_packet: 0,
|
|
|
- total_activity_bonus: 0,
|
|
|
- total_rebate: 0,
|
|
|
- total_bet: 0,
|
|
|
- total_valid_bet: 0,
|
|
|
- total_win: 0,
|
|
|
- company_profit: 0
|
|
|
- },
|
|
|
- {
|
|
|
- id: 10,
|
|
|
- agent_account: 'abc1233',
|
|
|
- real_name: '',
|
|
|
- balance: 1999,
|
|
|
- locked_wallet: 0,
|
|
|
- agent_count: 0,
|
|
|
- member_count: 0,
|
|
|
- member_balance: 0,
|
|
|
- total_deposit: 0,
|
|
|
- total_bonus: 0,
|
|
|
- total_withdraw: 0,
|
|
|
- total_add: 0,
|
|
|
- total_subtract: 0,
|
|
|
- total_discount: 0,
|
|
|
- total_red_packet: 0,
|
|
|
- total_activity_bonus: 0,
|
|
|
- total_rebate: 0,
|
|
|
- total_bet: 0,
|
|
|
- total_valid_bet: 0,
|
|
|
- total_win: 0,
|
|
|
- company_profit: 0
|
|
|
- }
|
|
|
- ]
|
|
|
+ getDefaultDateRange() {
|
|
|
+ const end = new Date()
|
|
|
+ const start = new Date()
|
|
|
+ start.setDate(start.getDate() - 29)
|
|
|
+ return [formatDate(start), formatDate(end)]
|
|
|
+ },
|
|
|
+ normalizeRow(row = {}) {
|
|
|
+ return Object.assign({}, row, {
|
|
|
+ agent_account: row.username || ''
|
|
|
+ })
|
|
|
+ },
|
|
|
+ getReportParams(page = this.page, limit = this.limit) {
|
|
|
+ const [startDate, endDate] = this.query.date_range || []
|
|
|
+ return {
|
|
|
+ page,
|
|
|
+ limit,
|
|
|
+ username: this.query.agent_account || undefined,
|
|
|
+ start_date: startDate,
|
|
|
+ end_date: endDate
|
|
|
+ }
|
|
|
+ },
|
|
|
+ validateDateRange() {
|
|
|
+ const [startDate, endDate] = this.query.date_range || []
|
|
|
+ if (!startDate || !endDate) {
|
|
|
+ this.$message.error('请选择统计时间')
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ return true
|
|
|
},
|
|
|
getList() {
|
|
|
+ if (!this.validateDateRange()) return
|
|
|
+
|
|
|
this.loading = true
|
|
|
- const rows = this.getMockRows().filter(item => {
|
|
|
- const accountMatched = !this.query.agent_account || item.agent_account.indexOf(this.query.agent_account) > -1
|
|
|
- const realNameMatched = !this.query.real_name || item.real_name.indexOf(this.query.real_name) > -1
|
|
|
- return accountMatched && realNameMatched
|
|
|
- })
|
|
|
- this.total = rows.length
|
|
|
- this.tableData = rows.slice((this.page - 1) * this.limit, this.page * this.limit)
|
|
|
- this.loading = false
|
|
|
+ getAgentReportList(this.getReportParams())
|
|
|
+ .then(res => {
|
|
|
+ const data = res.data || {}
|
|
|
+ this.total = Number(data.total) || 0
|
|
|
+ this.page = Number(data.page) || this.page
|
|
|
+ this.limit = Number(data.limit) || this.limit
|
|
|
+ this.tableData = (data.list || []).map(this.normalizeRow)
|
|
|
+ })
|
|
|
+ .finally(() => {
|
|
|
+ this.loading = false
|
|
|
+ })
|
|
|
},
|
|
|
handleSearch() {
|
|
|
this.page = 1
|
|
|
this.getList()
|
|
|
},
|
|
|
- handleExport() {
|
|
|
- this.$message.success('导出任务已创建')
|
|
|
+ async handleExport() {
|
|
|
+ if (!this.validateDateRange() || this.exportLoading) return
|
|
|
+
|
|
|
+ this.exportLoading = true
|
|
|
+ try {
|
|
|
+ const rows = await this.fetchAllReportRows()
|
|
|
+ if (!rows.length) {
|
|
|
+ this.$message.warning('暂无可导出的数据')
|
|
|
+ return
|
|
|
+ }
|
|
|
+ exportExcel({
|
|
|
+ theadMap: [
|
|
|
+ {
|
|
|
+ ID: { r: 1, c: 1 },
|
|
|
+ 账号: { r: 1, c: 1 },
|
|
|
+ 真实姓名: { r: 1, c: 1 },
|
|
|
+ 上级代理: { r: 1, c: 1 },
|
|
|
+ 账户余额: { r: 1, c: 1 },
|
|
|
+ 冻结余额: { r: 1, c: 1 },
|
|
|
+ 下级代理数: { r: 1, c: 1 },
|
|
|
+ 会员数: { r: 1, c: 1 },
|
|
|
+ 会员余额: { r: 1, c: 1 },
|
|
|
+ 总存款: { r: 1, c: 1 },
|
|
|
+ 总提款: { r: 1, c: 1 },
|
|
|
+ 人工充值: { r: 1, c: 1 },
|
|
|
+ 人工扣款: { r: 1, c: 1 },
|
|
|
+ 优惠金额: { r: 1, c: 1 },
|
|
|
+ 返水金额: { r: 1, c: 1 },
|
|
|
+ 注单数: { r: 1, c: 1 },
|
|
|
+ 总投注: { r: 1, c: 1 },
|
|
|
+ 有效投注: { r: 1, c: 1 },
|
|
|
+ 会员输赢: { r: 1, c: 1 },
|
|
|
+ 代理佣金: { r: 1, c: 1 },
|
|
|
+ 公司盈亏: { r: 1, c: 1 }
|
|
|
+ }
|
|
|
+ ],
|
|
|
+ theadProps: this.getExportTheadProps(),
|
|
|
+ tableData: rows.map(this.normalizeExportRow),
|
|
|
+ tfootData: [],
|
|
|
+ baseApi: '',
|
|
|
+ dataName: this.getExportFileName()
|
|
|
+ })
|
|
|
+ this.$message.success('导出成功')
|
|
|
+ } finally {
|
|
|
+ this.exportLoading = false
|
|
|
+ }
|
|
|
+ },
|
|
|
+ fetchAllReportRows() {
|
|
|
+ return getAgentReportList(this.getReportParams(1, EXPORT_LIMIT)).then(res => {
|
|
|
+ const data = res.data || {}
|
|
|
+ const total = Number(data.total) || 0
|
|
|
+ const firstRows = data.list || []
|
|
|
+ const pageCount = Math.ceil(total / EXPORT_LIMIT)
|
|
|
+ if (pageCount <= 1) return firstRows.map(this.normalizeRow)
|
|
|
+
|
|
|
+ const requests = []
|
|
|
+ for (let page = 2; page <= pageCount; page += 1) {
|
|
|
+ requests.push(getAgentReportList(this.getReportParams(page, EXPORT_LIMIT)))
|
|
|
+ }
|
|
|
+ return Promise.all(requests).then(results => {
|
|
|
+ return results.reduce((rows, item) => {
|
|
|
+ const pageData = item.data || {}
|
|
|
+ return rows.concat(pageData.list || [])
|
|
|
+ }, firstRows).map(this.normalizeRow)
|
|
|
+ })
|
|
|
+ })
|
|
|
+ },
|
|
|
+ getExportTheadProps() {
|
|
|
+ return {
|
|
|
+ id: {},
|
|
|
+ agent_account: {},
|
|
|
+ real_name: {},
|
|
|
+ parent_username: {},
|
|
|
+ balance: {},
|
|
|
+ frozen_balance: {},
|
|
|
+ agent_count: {},
|
|
|
+ member_count: {},
|
|
|
+ member_balance: {},
|
|
|
+ deposit_amount: {},
|
|
|
+ withdraw_amount: {},
|
|
|
+ manual_credit: {},
|
|
|
+ manual_debit: {},
|
|
|
+ bonus_amount: {},
|
|
|
+ rebate_amount: {},
|
|
|
+ bet_count: {},
|
|
|
+ bet_amount: {},
|
|
|
+ valid_bet_amount: {},
|
|
|
+ win_loss: {},
|
|
|
+ commission_amount: {},
|
|
|
+ company_profit: {}
|
|
|
+ }
|
|
|
+ },
|
|
|
+ normalizeExportRow(row) {
|
|
|
+ return {
|
|
|
+ id: row.id,
|
|
|
+ agent_account: row.agent_account,
|
|
|
+ real_name: row.real_name || '',
|
|
|
+ parent_username: row.parent_username || '',
|
|
|
+ balance: this.formatMoney(row.balance),
|
|
|
+ frozen_balance: this.formatMoney(row.frozen_balance),
|
|
|
+ agent_count: row.agent_count || 0,
|
|
|
+ member_count: row.member_count || 0,
|
|
|
+ member_balance: this.formatMoney(row.member_balance),
|
|
|
+ deposit_amount: this.formatMoney(row.deposit_amount),
|
|
|
+ withdraw_amount: this.formatMoney(row.withdraw_amount),
|
|
|
+ manual_credit: this.formatMoney(row.manual_credit),
|
|
|
+ manual_debit: this.formatMoney(row.manual_debit),
|
|
|
+ bonus_amount: this.formatMoney(row.bonus_amount),
|
|
|
+ rebate_amount: this.formatMoney(row.rebate_amount),
|
|
|
+ bet_count: row.bet_count || 0,
|
|
|
+ bet_amount: this.formatMoney(row.bet_amount),
|
|
|
+ valid_bet_amount: this.formatMoney(row.valid_bet_amount),
|
|
|
+ win_loss: this.formatMoney(row.win_loss),
|
|
|
+ commission_amount: this.formatMoney(row.commission_amount),
|
|
|
+ company_profit: this.formatMoney(row.company_profit)
|
|
|
+ }
|
|
|
+ },
|
|
|
+ getExportFileName() {
|
|
|
+ const [startDate, endDate] = this.query.date_range || []
|
|
|
+ return `代理报表_${startDate}_${endDate}.xls`
|
|
|
},
|
|
|
handleSizeChange(val) {
|
|
|
this.limit = val
|
|
|
@@ -470,7 +386,7 @@ export default {
|
|
|
formatMoney(value) {
|
|
|
const numberValue = Number(value)
|
|
|
if (Number.isNaN(numberValue)) return value || 0
|
|
|
- return Number.isInteger(numberValue) ? numberValue : numberValue.toFixed(2)
|
|
|
+ return numberValue.toFixed(2)
|
|
|
}
|
|
|
}
|
|
|
}
|