|
|
@ -142,6 +142,19 @@ const handleConsumeForm = async () => { |
|
|
|
}); |
|
|
|
console.log('adminData', adminData.value); |
|
|
|
|
|
|
|
// 新增验证逻辑,判断输入数量是否超过用户拥有数量 |
|
|
|
const inputPermanentBean = Number(consumeForm.value.permanentBean); |
|
|
|
const inputFreeBean = Number(consumeForm.value.freeBean); |
|
|
|
const userPermanentBean = Number(user.value.permanentBean) || 0; |
|
|
|
const userFreeBean = Number(user.value.freeBean) || 0; |
|
|
|
|
|
|
|
if (inputPermanentBean > userPermanentBean) { |
|
|
|
throw new Error('付费金豆数量超过用户当前所拥有'); |
|
|
|
} |
|
|
|
if (inputFreeBean > userFreeBean) { |
|
|
|
throw new Error('免费金豆数量超过用户当前所拥有'); |
|
|
|
} |
|
|
|
|
|
|
|
await ElMessageBox.confirm( |
|
|
|
'确认消耗吗?', |
|
|
|
'提示', |
|
|
@ -252,8 +265,8 @@ const throttledHandleConsumeFormt = _.throttle(handleConsumeForm, 5000, { |
|
|
|
</el-form-item> |
|
|
|
</el-col> |
|
|
|
<el-col :span="9"> |
|
|
|
<el-form-item label="消费次数"> |
|
|
|
<p style="color: #2fa1ff; margin-right: 5px" v-if="user.consumeNum!=null">{{ user.consumeNum }}</p> |
|
|
|
<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-else>{{ 0 }}</p> |
|
|
|
</el-form-item> |
|
|
|
</el-col> |
|
|
|