|
@ -78,7 +78,7 @@ const rules = reactive({ |
|
|
{ required: true, message: '请输入付费金豆数', trigger: 'change' }, |
|
|
{ required: true, message: '请输入付费金豆数', trigger: 'change' }, |
|
|
{ |
|
|
{ |
|
|
validator: (rule, value, callback) => { |
|
|
validator: (rule, value, callback) => { |
|
|
if(!value){ |
|
|
|
|
|
|
|
|
if (!value) { |
|
|
value = 0 |
|
|
value = 0 |
|
|
} |
|
|
} |
|
|
// 检查是否为非负整数 |
|
|
// 检查是否为非负整数 |
|
@ -102,7 +102,7 @@ const rules = reactive({ |
|
|
{ required: true, message: '请输入免费金豆数', trigger: 'change' }, |
|
|
{ required: true, message: '请输入免费金豆数', trigger: 'change' }, |
|
|
{ |
|
|
{ |
|
|
validator: (rule, value, callback) => { |
|
|
validator: (rule, value, callback) => { |
|
|
if(!value){ |
|
|
|
|
|
|
|
|
if (!value) { |
|
|
value = 0 |
|
|
value = 0 |
|
|
} |
|
|
} |
|
|
// 检查是否为非负整数 |
|
|
// 检查是否为非负整数 |
|
@ -128,21 +128,15 @@ const rules = reactive({ |
|
|
|
|
|
|
|
|
//重置表单 |
|
|
//重置表单 |
|
|
const deleteConsumeForm = function () { |
|
|
const deleteConsumeForm = function () { |
|
|
consumeForm.value = { |
|
|
|
|
|
jwcode: '', |
|
|
|
|
|
permanentBean: '', |
|
|
|
|
|
freeBean: '', |
|
|
|
|
|
remark: '', |
|
|
|
|
|
adminName: '' |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
formRef.value.resetFields(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
const handleConsumeForm = async () => { |
|
|
const handleConsumeForm = async () => { |
|
|
try { |
|
|
try { |
|
|
if(!consumeForm.value.permanentBean ){ |
|
|
|
|
|
|
|
|
if (!consumeForm.value.permanentBean) { |
|
|
consumeForm.value.permanentBean = 0 |
|
|
consumeForm.value.permanentBean = 0 |
|
|
} |
|
|
} |
|
|
if(!consumeForm.value.freeBean ){ |
|
|
|
|
|
|
|
|
if (!consumeForm.value.freeBean) { |
|
|
consumeForm.value.freeBean = 0 |
|
|
consumeForm.value.freeBean = 0 |
|
|
} |
|
|
} |
|
|
await new Promise((resolve, reject) => { |
|
|
await new Promise((resolve, reject) => { |
|
@ -171,7 +165,7 @@ const handleConsumeForm = async () => { |
|
|
// if (inputFreeBean > userFreeBean) { |
|
|
// if (inputFreeBean > userFreeBean) { |
|
|
// throw new Error('免费金豆数量超过用户当前所拥有'); |
|
|
// throw new Error('免费金豆数量超过用户当前所拥有'); |
|
|
// } |
|
|
// } |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await ElMessageBox.confirm( |
|
|
await ElMessageBox.confirm( |
|
|
'确认消耗吗?', |
|
|
'确认消耗吗?', |
|
|
'提示', |
|
|
'提示', |
|
@ -196,15 +190,9 @@ const handleConsumeForm = async () => { |
|
|
addDisabled.value = false |
|
|
addDisabled.value = false |
|
|
if (result.code == 200) { |
|
|
if (result.code == 200) { |
|
|
ElMessage.success('新增成功') |
|
|
ElMessage.success('新增成功') |
|
|
consumeForm.value = { |
|
|
|
|
|
jwcode: "", |
|
|
|
|
|
permanentBean: '', |
|
|
|
|
|
freeBean: '', |
|
|
|
|
|
remark: '', |
|
|
|
|
|
adminName: '' |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
deleteConsumeForm() |
|
|
user.value = {} |
|
|
user.value = {} |
|
|
}else{ |
|
|
|
|
|
|
|
|
} else { |
|
|
ElMessage.error(result.msg) |
|
|
ElMessage.error(result.msg) |
|
|
} |
|
|
} |
|
|
} catch (error) { |
|
|
} catch (error) { |
|
@ -218,7 +206,8 @@ const throttledHandleConsumeFormt = _.throttle(handleConsumeForm, 5000, { |
|
|
</script> |
|
|
</script> |
|
|
<template> |
|
|
<template> |
|
|
<div> |
|
|
<div> |
|
|
<el-form :model="consumeForm" :rules="rules" ref="formRef" label-width="auto" style="max-width: 600px" class="consume-form"> |
|
|
|
|
|
|
|
|
<el-form :model="consumeForm" :rules="rules" ref="formRef" label-width="auto" style="max-width: 600px" |
|
|
|
|
|
class="consume-form"> |
|
|
<el-form-item prop="jwcode" label="精网号" label-position="left"> |
|
|
<el-form-item prop="jwcode" label="精网号" label-position="left"> |
|
|
<el-input v-model="consumeForm.jwcode" style="width: 220px" /> |
|
|
<el-input v-model="consumeForm.jwcode" style="width: 220px" /> |
|
|
<el-button type="primary" @click="getUser(consumeForm.jwcode)" style="margin-left: 20px">查询</el-button> |
|
|
<el-button type="primary" @click="getUser(consumeForm.jwcode)" style="margin-left: 20px">查询</el-button> |
|
@ -264,7 +253,7 @@ const throttledHandleConsumeFormt = _.throttle(handleConsumeForm, 5000, { |
|
|
</el-row> |
|
|
</el-row> |
|
|
|
|
|
|
|
|
<!-- 第二行:精网号 + 免费金豆 --> |
|
|
<!-- 第二行:精网号 + 免费金豆 --> |
|
|
<el-row > |
|
|
|
|
|
|
|
|
<el-row> |
|
|
<el-col :span="9"> |
|
|
<el-col :span="9"> |
|
|
<el-form-item label="精网号"> |
|
|
<el-form-item label="精网号"> |
|
|
<p style="color: #2fa1ff; margin-right: 5px">{{ user.jwcode }}</p> |
|
|
<p style="color: #2fa1ff; margin-right: 5px">{{ user.jwcode }}</p> |
|
@ -286,7 +275,7 @@ const throttledHandleConsumeFormt = _.throttle(handleConsumeForm, 5000, { |
|
|
</el-col> |
|
|
</el-col> |
|
|
<el-col :span="9"> |
|
|
<el-col :span="9"> |
|
|
<el-form-item label="消耗金豆总数"> |
|
|
<el-form-item label="消耗金豆总数"> |
|
|
<p style="color: #2fa1ff; margin-right: 5px" v-if="user.consumeSum!=null">{{ user.consumeSum }}</p> |
|
|
|
|
|
|
|
|
<p style="color: #2fa1ff; margin-right: 5px" v-if="user.consumeSum != null">{{ user.consumeSum }}</p> |
|
|
<p style="color: #2fa1ff; margin-right: 5px" v-else>{{ 0 }}</p> |
|
|
<p style="color: #2fa1ff; margin-right: 5px" v-else>{{ 0 }}</p> |
|
|
</el-form-item> |
|
|
</el-form-item> |
|
|
</el-col> |
|
|
</el-col> |
|
|