[代理与结算]代理结算周期
This commit is contained in:
32
app/admin/controller/agent/SettlementPeriod.php
Normal file
32
app/admin/controller/agent/SettlementPeriod.php
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace app\admin\controller\agent;
|
||||||
|
|
||||||
|
use app\common\controller\Backend;
|
||||||
|
use support\Response;
|
||||||
|
use Webman\Http\Request as WebmanRequest;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 代理结算周期
|
||||||
|
*/
|
||||||
|
class SettlementPeriod extends Backend
|
||||||
|
{
|
||||||
|
protected ?object $model = null;
|
||||||
|
|
||||||
|
protected string|array $preExcludeFields = ['id', 'create_time', 'update_time'];
|
||||||
|
|
||||||
|
protected string|array $quickSearchField = ['id', 'settlement_no', 'remark'];
|
||||||
|
|
||||||
|
protected string|array $defaultSortField = ['id' => 'desc'];
|
||||||
|
|
||||||
|
protected string|array $orderGuarantee = ['id' => 'desc'];
|
||||||
|
|
||||||
|
protected bool $modelValidate = false;
|
||||||
|
|
||||||
|
protected function initController(WebmanRequest $request): ?Response
|
||||||
|
{
|
||||||
|
$this->model = new \app\common\model\AgentSettlementPeriod();
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
24
app/common/model/AgentSettlementPeriod.php
Normal file
24
app/common/model/AgentSettlementPeriod.php
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace app\common\model;
|
||||||
|
|
||||||
|
use support\think\Model;
|
||||||
|
|
||||||
|
class AgentSettlementPeriod extends Model
|
||||||
|
{
|
||||||
|
protected $name = 'agent_settlement_period';
|
||||||
|
|
||||||
|
protected $autoWriteTimestamp = true;
|
||||||
|
|
||||||
|
protected $type = [
|
||||||
|
'create_time' => 'integer',
|
||||||
|
'update_time' => 'integer',
|
||||||
|
'period_start_at' => 'integer',
|
||||||
|
'period_end_at' => 'integer',
|
||||||
|
'total_bet_amount' => 'string',
|
||||||
|
'total_payout_amount' => 'string',
|
||||||
|
'platform_profit_amount' => 'string',
|
||||||
|
'status' => 'integer',
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
19
web/src/lang/backend/en/agent/settlementPeriod.ts
Normal file
19
web/src/lang/backend/en/agent/settlementPeriod.ts
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
export default {
|
||||||
|
'quick Search Fields': 'ID/Settlement No./Remark',
|
||||||
|
id: 'ID',
|
||||||
|
settlement_no: 'Settlement No.',
|
||||||
|
period_start_at: 'Period start',
|
||||||
|
period_end_at: 'Period end',
|
||||||
|
total_bet_amount: 'Total bet amount',
|
||||||
|
total_payout_amount: 'Total payout amount',
|
||||||
|
platform_profit_amount: 'Platform profit',
|
||||||
|
status: 'Status',
|
||||||
|
'status 0': 'Pending',
|
||||||
|
'status 1': 'Processing',
|
||||||
|
'status 2': 'Completed',
|
||||||
|
'status 3': 'Closed',
|
||||||
|
remark: 'Remark',
|
||||||
|
create_time: 'Created',
|
||||||
|
update_time: 'Updated',
|
||||||
|
}
|
||||||
|
|
||||||
19
web/src/lang/backend/zh-cn/agent/settlementPeriod.ts
Normal file
19
web/src/lang/backend/zh-cn/agent/settlementPeriod.ts
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
export default {
|
||||||
|
'quick Search Fields': 'ID/结算周期号/备注',
|
||||||
|
id: 'ID',
|
||||||
|
settlement_no: '结算周期号',
|
||||||
|
period_start_at: '周期开始',
|
||||||
|
period_end_at: '周期结束',
|
||||||
|
total_bet_amount: '总投注额',
|
||||||
|
total_payout_amount: '总派彩额',
|
||||||
|
platform_profit_amount: '平台盈亏',
|
||||||
|
status: '状态',
|
||||||
|
'status 0': '待结算',
|
||||||
|
'status 1': '结算中',
|
||||||
|
'status 2': '已完成',
|
||||||
|
'status 3': '已关闭',
|
||||||
|
remark: '备注',
|
||||||
|
create_time: '创建时间',
|
||||||
|
update_time: '更新时间',
|
||||||
|
}
|
||||||
|
|
||||||
79
web/src/views/backend/agent/settlementPeriod/index.vue
Normal file
79
web/src/views/backend/agent/settlementPeriod/index.vue
Normal file
@@ -0,0 +1,79 @@
|
|||||||
|
<template>
|
||||||
|
<div class="default-main ba-table-box">
|
||||||
|
<el-alert class="ba-table-alert" v-if="baTable.table.remark" :title="baTable.table.remark" type="info" show-icon />
|
||||||
|
|
||||||
|
<TableHeader
|
||||||
|
:buttons="['refresh', 'add', 'edit', 'delete', 'comSearch', 'quickSearch', 'columnDisplay']"
|
||||||
|
:quick-search-placeholder="t('Quick search placeholder', { fields: t('agent.settlementPeriod.quick Search Fields') })"
|
||||||
|
></TableHeader>
|
||||||
|
|
||||||
|
<Table ref="tableRef"></Table>
|
||||||
|
<PopupForm />
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts">
|
||||||
|
import { onMounted, provide, useTemplateRef } from 'vue'
|
||||||
|
import { useI18n } from 'vue-i18n'
|
||||||
|
import PopupForm from './popupForm.vue'
|
||||||
|
import { baTableApi } from '/@/api/common'
|
||||||
|
import { defaultOptButtons } from '/@/components/table'
|
||||||
|
import TableHeader from '/@/components/table/header/index.vue'
|
||||||
|
import Table from '/@/components/table/index.vue'
|
||||||
|
import baTableClass from '/@/utils/baTable'
|
||||||
|
|
||||||
|
defineOptions({
|
||||||
|
name: 'agent/settlementPeriod',
|
||||||
|
})
|
||||||
|
|
||||||
|
const { t } = useI18n()
|
||||||
|
const tableRef = useTemplateRef('tableRef')
|
||||||
|
const optButtons: OptButton[] = defaultOptButtons(['edit', 'delete'])
|
||||||
|
|
||||||
|
const baTable = new baTableClass(
|
||||||
|
new baTableApi('/admin/agent.SettlementPeriod/'),
|
||||||
|
{
|
||||||
|
pk: 'id',
|
||||||
|
column: [
|
||||||
|
{ type: 'selection', align: 'center', operator: false },
|
||||||
|
{ label: t('agent.settlementPeriod.id'), prop: 'id', align: 'center', width: 80, operator: 'RANGE', sortable: 'custom' },
|
||||||
|
{ label: t('agent.settlementPeriod.settlement_no'), prop: 'settlement_no', align: 'center', minWidth: 160, operator: 'LIKE', operatorPlaceholder: t('Fuzzy query') },
|
||||||
|
{ label: t('agent.settlementPeriod.period_start_at'), prop: 'period_start_at', align: 'center', render: 'datetime', operator: 'RANGE', comSearchRender: 'datetime', width: 170, sortable: 'custom', timeFormat: 'yyyy-mm-dd hh:MM:ss' },
|
||||||
|
{ label: t('agent.settlementPeriod.period_end_at'), prop: 'period_end_at', align: 'center', render: 'datetime', operator: 'RANGE', comSearchRender: 'datetime', width: 170, sortable: 'custom', timeFormat: 'yyyy-mm-dd hh:MM:ss' },
|
||||||
|
{ label: t('agent.settlementPeriod.total_bet_amount'), prop: 'total_bet_amount', align: 'center', operator: 'RANGE', minWidth: 120 },
|
||||||
|
{ label: t('agent.settlementPeriod.total_payout_amount'), prop: 'total_payout_amount', align: 'center', operator: 'RANGE', minWidth: 120 },
|
||||||
|
{ label: t('agent.settlementPeriod.platform_profit_amount'), prop: 'platform_profit_amount', align: 'center', operator: 'RANGE', minWidth: 120 },
|
||||||
|
{
|
||||||
|
label: t('agent.settlementPeriod.status'),
|
||||||
|
prop: 'status',
|
||||||
|
align: 'center',
|
||||||
|
width: 100,
|
||||||
|
operator: 'eq',
|
||||||
|
render: 'tag',
|
||||||
|
replaceValue: { '0': t('agent.settlementPeriod.status 0'), '1': t('agent.settlementPeriod.status 1'), '2': t('agent.settlementPeriod.status 2'), '3': t('agent.settlementPeriod.status 3') },
|
||||||
|
},
|
||||||
|
{ label: t('agent.settlementPeriod.remark'), prop: 'remark', align: 'center', minWidth: 160, operator: 'LIKE', operatorPlaceholder: t('Fuzzy query'), showOverflowTooltip: true },
|
||||||
|
{ label: t('agent.settlementPeriod.create_time'), prop: 'create_time', align: 'center', render: 'datetime', operator: 'RANGE', comSearchRender: 'datetime', width: 170, sortable: 'custom', timeFormat: 'yyyy-mm-dd hh:MM:ss' },
|
||||||
|
{ label: t('agent.settlementPeriod.update_time'), prop: 'update_time', align: 'center', render: 'datetime', operator: 'RANGE', comSearchRender: 'datetime', width: 170, sortable: 'custom', timeFormat: 'yyyy-mm-dd hh:MM:ss' },
|
||||||
|
{ label: t('Operate'), align: 'center', width: 100, render: 'buttons', buttons: optButtons, operator: false, fixed: 'right' },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
defaultItems: { status: 0 },
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
provide('baTable', baTable)
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
baTable.table.ref = tableRef.value
|
||||||
|
baTable.mount()
|
||||||
|
baTable.getData()?.then(() => {
|
||||||
|
baTable.initSort()
|
||||||
|
baTable.dragSort()
|
||||||
|
})
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped lang="scss"></style>
|
||||||
|
|
||||||
48
web/src/views/backend/agent/settlementPeriod/popupForm.vue
Normal file
48
web/src/views/backend/agent/settlementPeriod/popupForm.vue
Normal file
@@ -0,0 +1,48 @@
|
|||||||
|
<template>
|
||||||
|
<el-dialog class="ba-operate-dialog" :close-on-click-modal="false" :model-value="['Add', 'Edit'].includes(baTable.form.operate!)" @close="baTable.toggleForm">
|
||||||
|
<template #header>
|
||||||
|
<div class="title" v-drag="['.ba-operate-dialog', '.el-dialog__header']" v-zoom="'.ba-operate-dialog'">{{ baTable.form.operate ? t(baTable.form.operate) : '' }}</div>
|
||||||
|
</template>
|
||||||
|
<el-scrollbar v-loading="baTable.form.loading" class="ba-table-form-scrollbar">
|
||||||
|
<div class="ba-operate-form" :class="'ba-' + baTable.form.operate + '-form'" :style="config.layout.shrink ? '' : 'width: calc(100% - ' + baTable.form.labelWidth! / 2 + 'px)'">
|
||||||
|
<el-form v-if="!baTable.form.loading" ref="formRef" @submit.prevent="" @keyup.enter="baTable.onSubmit(formRef)" :model="baTable.form.items" :label-position="config.layout.shrink ? 'top' : 'right'" :label-width="baTable.form.labelWidth + 'px'" :rules="rules">
|
||||||
|
<FormItem :label="t('agent.settlementPeriod.settlement_no')" type="string" v-model="baTable.form.items!.settlement_no" prop="settlement_no" />
|
||||||
|
<FormItem :label="t('agent.settlementPeriod.period_start_at')" type="datetime" v-model="baTable.form.items!.period_start_at" prop="period_start_at" />
|
||||||
|
<FormItem :label="t('agent.settlementPeriod.period_end_at')" type="datetime" v-model="baTable.form.items!.period_end_at" prop="period_end_at" />
|
||||||
|
<FormItem :label="t('agent.settlementPeriod.total_bet_amount')" type="number" v-model="baTable.form.items!.total_bet_amount" prop="total_bet_amount" :input-attr="{ min: 0, precision: 4, step: 0.0001 }" />
|
||||||
|
<FormItem :label="t('agent.settlementPeriod.total_payout_amount')" type="number" v-model="baTable.form.items!.total_payout_amount" prop="total_payout_amount" :input-attr="{ min: 0, precision: 4, step: 0.0001 }" />
|
||||||
|
<FormItem :label="t('agent.settlementPeriod.platform_profit_amount')" type="number" v-model="baTable.form.items!.platform_profit_amount" prop="platform_profit_amount" :input-attr="{ precision: 4, step: 0.0001 }" />
|
||||||
|
<FormItem :label="t('agent.settlementPeriod.status')" type="radio" v-model="baTable.form.items!.status" prop="status" :input-attr="{ content: { '0': t('agent.settlementPeriod.status 0'), '1': t('agent.settlementPeriod.status 1'), '2': t('agent.settlementPeriod.status 2'), '3': t('agent.settlementPeriod.status 3') } }" />
|
||||||
|
<FormItem :label="t('agent.settlementPeriod.remark')" type="textarea" v-model="baTable.form.items!.remark" prop="remark" :input-attr="{ rows: 2 }" />
|
||||||
|
</el-form>
|
||||||
|
</div>
|
||||||
|
</el-scrollbar>
|
||||||
|
<template #footer>
|
||||||
|
<div :style="'width: calc(100% - ' + baTable.form.labelWidth! / 1.8 + 'px)'">
|
||||||
|
<el-button @click="baTable.toggleForm()">{{ t('Cancel') }}</el-button>
|
||||||
|
<el-button v-blur :loading="baTable.form.submitLoading" @click="baTable.onSubmit(formRef)" type="primary">{{ baTable.form.operateIds && baTable.form.operateIds.length > 1 ? t('Save and edit next item') : t('Save') }}</el-button>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</el-dialog>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts">
|
||||||
|
import type { FormItemRule } from 'element-plus'
|
||||||
|
import { inject, reactive, useTemplateRef } from 'vue'
|
||||||
|
import { useI18n } from 'vue-i18n'
|
||||||
|
import FormItem from '/@/components/formItem/index.vue'
|
||||||
|
import { useConfig } from '/@/stores/config'
|
||||||
|
import type baTableClass from '/@/utils/baTable'
|
||||||
|
|
||||||
|
const config = useConfig()
|
||||||
|
const formRef = useTemplateRef('formRef')
|
||||||
|
const baTable = inject('baTable') as baTableClass
|
||||||
|
const { t } = useI18n()
|
||||||
|
|
||||||
|
const rules: Partial<Record<string, FormItemRule[]>> = reactive({
|
||||||
|
settlement_no: [{ required: true, message: t('Please input field', { field: t('agent.settlementPeriod.settlement_no') }) }],
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped lang="scss"></style>
|
||||||
|
|
||||||
Reference in New Issue
Block a user