|
|
@ -53,6 +53,36 @@ interface FormData { |
|
|
|
remark: string |
|
|
|
} |
|
|
|
|
|
|
|
const validate_range = (rule: any, value: any, callback: (arg0: Error | undefined) => void) => { |
|
|
|
const { lower_rate, upper_rate } = data.form |
|
|
|
// 检查 lower_rate 是否为空 |
|
|
|
if (lower_rate === '') { |
|
|
|
callback(new Error('下限值不能为空')) |
|
|
|
return |
|
|
|
} |
|
|
|
|
|
|
|
// 检查 upper_rate 是否为空 |
|
|
|
if (upper_rate === '') { |
|
|
|
callback(new Error('上限值不能为空')) |
|
|
|
return |
|
|
|
} |
|
|
|
|
|
|
|
// 检查是否为数字 |
|
|
|
if (isNaN(lower_rate as number) || isNaN(upper_rate as number)) { |
|
|
|
callback(new Error('必须输入数字')) |
|
|
|
return |
|
|
|
} |
|
|
|
|
|
|
|
// 检查 lower_rate 是否小于 upper_rate |
|
|
|
if (parseFloat(lower_rate as string) >= parseFloat(upper_rate as string)) { |
|
|
|
callback(new Error('下限值必须小于上限值')) |
|
|
|
return |
|
|
|
} |
|
|
|
|
|
|
|
// 验证通过 |
|
|
|
callback(undefined) |
|
|
|
} |
|
|
|
|
|
|
|
const data = reactive({ |
|
|
|
page: initPage, |
|
|
|
result: [] as any, |
|
|
@ -64,7 +94,7 @@ const data = reactive({ |
|
|
|
rules: { |
|
|
|
remark: [{ required: true, message: '数值不能为空', trigger: 'blur' }], |
|
|
|
point_coin: [{ required: true, message: '数值不能为空', trigger: 'blur' }], |
|
|
|
lower_rate: [{ required: true, message: '数值不能为空', trigger: 'blur' }], |
|
|
|
lower_rate: [{ validator: validate_range, trigger: 'blur' }], |
|
|
|
refresh_times: [{ required: true, message: '数值不能为空', trigger: 'blur' }], |
|
|
|
}, |
|
|
|
options: { |
|
|
@ -84,17 +114,17 @@ const data = reactive({ |
|
|
|
channel: [] as any, |
|
|
|
}, |
|
|
|
special_condition: { |
|
|
|
'today_winlose': '今日输赢', |
|
|
|
'total_winlose': '总输赢', |
|
|
|
'today_deposit': '今日充值', |
|
|
|
'total_deposit': '总充值', |
|
|
|
'today_withdraw': '今日提现', |
|
|
|
'total_withdraw': '总提现', |
|
|
|
'today_surplus': '今日充提差', |
|
|
|
'total_surplus': '总提差', |
|
|
|
'device_num': '设备账号数量', |
|
|
|
'ip_num': 'IP账号数量', |
|
|
|
'vip': 'VIP等级', |
|
|
|
today_winlose: '今日输赢', |
|
|
|
total_winlose: '总输赢', |
|
|
|
today_deposit: '今日充值', |
|
|
|
total_deposit: '总充值', |
|
|
|
today_withdraw: '今日提现', |
|
|
|
total_withdraw: '总提现', |
|
|
|
today_surplus: '今日充提差', |
|
|
|
total_surplus: '总提差', |
|
|
|
device_num: '设备账号数量', |
|
|
|
ip_num: 'IP账号数量', |
|
|
|
vip: 'VIP等级', |
|
|
|
}, |
|
|
|
}) |
|
|
|
|
|
|
@ -217,23 +247,9 @@ const submitData = async () => { |
|
|
|
return |
|
|
|
} |
|
|
|
|
|
|
|
//数值不能小于0 |
|
|
|
let isTrue = true |
|
|
|
Object.keys(data.form).forEach((key) => { |
|
|
|
if (key.includes('values')) { |
|
|
|
if ((data.form as any)[key] < 0) { |
|
|
|
isTrue = false |
|
|
|
return |
|
|
|
} |
|
|
|
} |
|
|
|
}) |
|
|
|
if (!isTrue || parseInt(data.form.refresh_times as string) < 0) { |
|
|
|
ElMessage.error('数值不能小于0') |
|
|
|
return |
|
|
|
} |
|
|
|
|
|
|
|
const params: any = {} |
|
|
|
params.id = data.form.id |
|
|
|
params.new_register_status = encodeStatus(data.form.new_register_status, data.form.new_register_type) |
|
|
|
params.channel_status = data.form.channel_status |
|
|
|
params.channel_values = JSON.stringify(data.form.channel_values) |
|
|
|
params.point_gear = data.form.point_gear |
|
|
@ -253,8 +269,16 @@ const submitData = async () => { |
|
|
|
|
|
|
|
let values = [] |
|
|
|
for (const v of (data.form as any)[values_key]) { |
|
|
|
if (v < 0) { |
|
|
|
ElMessage.error('数值不能小于0') |
|
|
|
return |
|
|
|
} |
|
|
|
values.push(parseInt(v as string)) |
|
|
|
} |
|
|
|
if ((data.form as any)[status_key] == 1 && values.length == 0) { |
|
|
|
ElMessage.error('条件数值不能为空') |
|
|
|
return |
|
|
|
} |
|
|
|
params[values_key] = JSON.stringify(values) |
|
|
|
} |
|
|
|
|
|
|
@ -271,6 +295,11 @@ const submitData = async () => { |
|
|
|
getRecord() |
|
|
|
} |
|
|
|
|
|
|
|
const changeSwitch = (key: string) => { |
|
|
|
;(data.form as any)[key + '_type'] = 0 |
|
|
|
;(data.form as any)[key + '_values'] = [] |
|
|
|
} |
|
|
|
|
|
|
|
const encodeStatus = (status: number, type: number) => { |
|
|
|
return (status << 3) | type |
|
|
|
} |
|
|
@ -378,7 +407,12 @@ onMounted(async () => { |
|
|
|
<el-form-item :label="v" label-width="130" prop="" v-for="(v, k) in data.special_condition"> |
|
|
|
<el-row class="full-select" justify="space-between"> |
|
|
|
<el-col :span="3"> |
|
|
|
<el-switch v-model="(data.form as any)[`${k}_status`]" :active-value="1" :inactive-value="0"></el-switch> |
|
|
|
<el-switch |
|
|
|
v-model="(data.form as any)[`${k}_status`]" |
|
|
|
:active-value="1" |
|
|
|
:inactive-value="0" |
|
|
|
@change="changeSwitch(k)" |
|
|
|
></el-switch> |
|
|
|
</el-col> |
|
|
|
|
|
|
|
<template v-if="(data.form as any)[`${k}_status`] == 1"> |
|
|
@ -413,7 +447,12 @@ onMounted(async () => { |
|
|
|
<el-form-item label="来源渠道" label-width="130" prop=""> |
|
|
|
<el-row class="full-select" justify="space-between"> |
|
|
|
<el-col :span="3"> |
|
|
|
<el-switch v-model="data.form.channel_status" :active-value="1" :inactive-value="0"></el-switch> |
|
|
|
<el-switch |
|
|
|
v-model="data.form.channel_status" |
|
|
|
:active-value="1" |
|
|
|
:inactive-value="0" |
|
|
|
@change="changeSwitch('channel')" |
|
|
|
></el-switch> |
|
|
|
</el-col> |
|
|
|
<template v-if="data.form.channel_status == 1"> |
|
|
|
<el-col :span="10"> |
|
|
|