[渠道管理]-优化样式,新增手动结算
This commit is contained in:
@@ -10,14 +10,61 @@
|
||||
<Table ref="tableRef"></Table>
|
||||
|
||||
<PopupForm />
|
||||
|
||||
<el-dialog class="ba-operate-dialog" :close-on-click-modal="false" :model-value="manualSettle.visible" @close="closeManualSettleDialog">
|
||||
<template #header>
|
||||
<div class="title">{{ t('channel.manual_settle') }}</div>
|
||||
</template>
|
||||
<div v-loading="manualSettle.previewLoading" class="manual-settle-dialog-body">
|
||||
<el-form :model="manualSettle.form" label-width="140px">
|
||||
<el-form-item :label="t('channel.manual_settle_settlement_no')">
|
||||
<el-input v-model="manualSettle.form.settlement_no" readonly />
|
||||
</el-form-item>
|
||||
<el-form-item :label="t('channel.manual_settle_period_start')">
|
||||
<el-input v-model="manualSettle.form.period_start_at" readonly />
|
||||
</el-form-item>
|
||||
<el-form-item :label="t('channel.manual_settle_period_end')">
|
||||
<el-input v-model="manualSettle.form.period_end_at" readonly />
|
||||
</el-form-item>
|
||||
<el-form-item :label="t('channel.manual_settle_total_bet')">
|
||||
<el-input v-model="manualSettle.form.total_bet_amount" readonly />
|
||||
</el-form-item>
|
||||
<el-form-item :label="t('channel.manual_settle_total_payout')">
|
||||
<el-input v-model="manualSettle.form.total_payout_amount" readonly />
|
||||
</el-form-item>
|
||||
<el-form-item :label="t('channel.manual_settle_platform_profit')">
|
||||
<el-input v-model="manualSettle.form.platform_profit_amount" readonly />
|
||||
</el-form-item>
|
||||
<el-form-item :label="t('channel.manual_settle_commission_rate')">
|
||||
<el-input v-model="manualSettle.form.commission_rate" readonly />
|
||||
</el-form-item>
|
||||
<el-form-item :label="t('channel.manual_settle_calc_base')">
|
||||
<el-input v-model="manualSettle.form.calc_base_amount" readonly />
|
||||
</el-form-item>
|
||||
<el-form-item :label="t('channel.manual_settle_commission_amount')">
|
||||
<el-input v-model="manualSettle.form.commission_amount" readonly />
|
||||
</el-form-item>
|
||||
<el-form-item :label="t('channel.manual_settle_remark')">
|
||||
<el-input v-model="manualSettle.form.remark" type="textarea" :rows="2" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</div>
|
||||
<template #footer>
|
||||
<el-button @click="closeManualSettleDialog">{{ t('Cancel') }}</el-button>
|
||||
<el-button type="primary" :disabled="manualSettle.previewLoading" :loading="manualSettle.loading" @click="submitManualSettle">
|
||||
{{ t('Save') }}
|
||||
</el-button>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { onMounted, provide, useTemplateRef } from 'vue'
|
||||
import { onMounted, provide, reactive, useTemplateRef } from 'vue'
|
||||
import { useI18n } from 'vue-i18n'
|
||||
import PopupForm from './popupForm.vue'
|
||||
import { baTableApi } from '/@/api/common'
|
||||
import { auth } from '/@/utils/common'
|
||||
import { defaultOptButtons } from '/@/components/table'
|
||||
import TableHeader from '/@/components/table/header/index.vue'
|
||||
import Table from '/@/components/table/index.vue'
|
||||
@@ -32,23 +79,17 @@ const { t } = useI18n()
|
||||
const tableRef = useTemplateRef('tableRef')
|
||||
let optButtons: OptButton[] = [
|
||||
{
|
||||
render: 'confirmButton',
|
||||
render: 'tipButton',
|
||||
name: 'manualSettle',
|
||||
title: 'channel.manual_settle',
|
||||
text: '',
|
||||
type: 'warning',
|
||||
icon: 'el-icon-Clock',
|
||||
class: 'table-row-manual-settle',
|
||||
popconfirm: {
|
||||
confirmButtonText: t('channel.manual_settle'),
|
||||
cancelButtonText: t('Cancel'),
|
||||
confirmButtonType: 'warning',
|
||||
title: t('channel.manual_settle_confirm'),
|
||||
},
|
||||
disabledTip: false,
|
||||
click: async (row: TableRow) => {
|
||||
await createAxios({ url: '/admin/channel/manualSettle', method: 'post', data: { id: row.id } }, { showSuccessMessage: true })
|
||||
baTable.onTableHeaderAction('refresh', { event: 'manual-settle' })
|
||||
display: () => auth('manualSettle'),
|
||||
click: (row: TableRow) => {
|
||||
void openManualSettleDialog(row)
|
||||
},
|
||||
},
|
||||
]
|
||||
@@ -65,6 +106,110 @@ const formatAmountInt = (_row: any, _column: any, cellValue: number | string | n
|
||||
if (Number.isNaN(num)) return '-'
|
||||
return `${num}`
|
||||
}
|
||||
const formatSettleDay = (row: anyObj) => {
|
||||
if (row.settle_cycle === 'weekly') {
|
||||
return t(`channel.weekday ${row.settle_weekday ?? 1}`)
|
||||
}
|
||||
if (row.settle_cycle === 'monthly') {
|
||||
return `${row.settle_monthday ?? 1}${t('channel.day_suffix')}`
|
||||
}
|
||||
return t('channel.settle_day_daily')
|
||||
}
|
||||
|
||||
const manualSettle = reactive({
|
||||
visible: false,
|
||||
loading: false,
|
||||
previewLoading: false,
|
||||
channelId: 0,
|
||||
form: {
|
||||
settlement_no: '',
|
||||
period_start_at: '',
|
||||
period_end_at: '',
|
||||
total_bet_amount: '',
|
||||
total_payout_amount: '',
|
||||
platform_profit_amount: '',
|
||||
commission_rate: '',
|
||||
calc_base_amount: '',
|
||||
commission_amount: '',
|
||||
remark: '',
|
||||
},
|
||||
})
|
||||
|
||||
const resetManualSettleForm = () => {
|
||||
manualSettle.form.settlement_no = ''
|
||||
manualSettle.form.period_start_at = ''
|
||||
manualSettle.form.period_end_at = ''
|
||||
manualSettle.form.total_bet_amount = ''
|
||||
manualSettle.form.total_payout_amount = ''
|
||||
manualSettle.form.platform_profit_amount = ''
|
||||
manualSettle.form.commission_rate = ''
|
||||
manualSettle.form.calc_base_amount = ''
|
||||
manualSettle.form.commission_amount = ''
|
||||
manualSettle.form.remark = ''
|
||||
}
|
||||
|
||||
const closeManualSettleDialog = () => {
|
||||
manualSettle.visible = false
|
||||
resetManualSettleForm()
|
||||
}
|
||||
|
||||
const openManualSettleDialog = async (row: TableRow) => {
|
||||
manualSettle.channelId = row.id
|
||||
resetManualSettleForm()
|
||||
manualSettle.visible = true
|
||||
manualSettle.previewLoading = true
|
||||
try {
|
||||
const res = await createAxios(
|
||||
{
|
||||
url: '/admin/channel/manualSettlePreview',
|
||||
method: 'get',
|
||||
params: { id: row.id },
|
||||
},
|
||||
{ showErrorMessage: true }
|
||||
)
|
||||
if (res.code !== 1 || !res.data) {
|
||||
manualSettle.visible = false
|
||||
return
|
||||
}
|
||||
const d = res.data as anyObj
|
||||
manualSettle.form.settlement_no = d.settlement_no ?? ''
|
||||
manualSettle.form.period_start_at = d.period_start_at ?? ''
|
||||
manualSettle.form.period_end_at = d.period_end_at ?? ''
|
||||
manualSettle.form.total_bet_amount = d.total_bet_amount ?? ''
|
||||
manualSettle.form.total_payout_amount = d.total_payout_amount ?? ''
|
||||
manualSettle.form.platform_profit_amount = d.platform_profit_amount ?? ''
|
||||
manualSettle.form.commission_rate = d.commission_rate ?? ''
|
||||
manualSettle.form.calc_base_amount = d.calc_base_amount ?? ''
|
||||
manualSettle.form.commission_amount = d.commission_amount ?? ''
|
||||
manualSettle.form.remark = `${t('channel.manual_settle')}-CH${row.id}`
|
||||
} catch {
|
||||
manualSettle.visible = false
|
||||
} finally {
|
||||
manualSettle.previewLoading = false
|
||||
}
|
||||
}
|
||||
|
||||
const submitManualSettle = async () => {
|
||||
if (!manualSettle.channelId) return
|
||||
manualSettle.loading = true
|
||||
try {
|
||||
await createAxios(
|
||||
{
|
||||
url: '/admin/channel/manualSettle',
|
||||
method: 'post',
|
||||
data: {
|
||||
id: manualSettle.channelId,
|
||||
remark: manualSettle.form.remark,
|
||||
},
|
||||
},
|
||||
{ showSuccessMessage: true }
|
||||
)
|
||||
closeManualSettleDialog()
|
||||
baTable.onTableHeaderAction('refresh', { event: 'manual-settle' })
|
||||
} finally {
|
||||
manualSettle.loading = false
|
||||
}
|
||||
}
|
||||
|
||||
const baTable = new baTableClass(
|
||||
new baTableApi('/admin/channel/'),
|
||||
@@ -169,22 +314,12 @@ const baTable = new baTableClass(
|
||||
},
|
||||
{
|
||||
label: t('channel.settle_weekday'),
|
||||
prop: 'settle_weekday',
|
||||
prop: 'settle_day',
|
||||
align: 'center',
|
||||
width: 110,
|
||||
operator: 'eq',
|
||||
operator: false,
|
||||
sortable: false,
|
||||
render: 'tag',
|
||||
custom: { '1': 'info', '2': 'info', '3': 'info', '4': 'info', '5': 'info', '6': 'success', '7': 'success' },
|
||||
replaceValue: {
|
||||
'1': t('channel.weekday 1'),
|
||||
'2': t('channel.weekday 2'),
|
||||
'3': t('channel.weekday 3'),
|
||||
'4': t('channel.weekday 4'),
|
||||
'5': t('channel.weekday 5'),
|
||||
'6': t('channel.weekday 6'),
|
||||
'7': t('channel.weekday 7'),
|
||||
},
|
||||
formatter: (row: anyObj) => formatSettleDay(row),
|
||||
},
|
||||
{
|
||||
label: t('channel.settle_time'),
|
||||
@@ -301,12 +436,19 @@ const baTable = new baTableClass(
|
||||
width: 160,
|
||||
timeFormat: 'yyyy-mm-dd hh:MM:ss',
|
||||
},
|
||||
{ label: t('Operate'), align: 'center', width: 80, render: 'buttons', buttons: optButtons, operator: false, fixed: 'right' },
|
||||
{ label: t('Operate'), align: 'center', width: 120, render: 'buttons', buttons: optButtons, operator: false, fixed: 'right' },
|
||||
],
|
||||
dblClickNotEditColumn: [undefined, 'status'],
|
||||
},
|
||||
{
|
||||
defaultItems: { status: '1', agent_mode: 'turnover' },
|
||||
defaultItems: {
|
||||
status: '1',
|
||||
agent_mode: 'turnover',
|
||||
settle_cycle: 'weekly',
|
||||
settle_weekday: 1,
|
||||
settle_monthday: 1,
|
||||
settle_time: '02:00:00',
|
||||
},
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user