From 21d449ef00242bf1751d3e298887ea18f84dcfef Mon Sep 17 00:00:00 2001 From: ZhangYong Date: Thu, 21 Aug 2025 10:41:01 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=EF=BC=8C=E6=B6=88=E8=80=97?= =?UTF-8?q?=E5=90=8E=E6=9C=89=E6=A0=A1=E9=AA=8C=E6=AE=8B=E7=95=99=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/consume/bean/addBeanConsume.vue | 35 ++++++++++------------------- src/views/recharge/bean/addBeanRecharge.vue | 16 ++----------- src/views/recharge/gold/addCoinRecharge.vue | 1 + 3 files changed, 15 insertions(+), 37 deletions(-) diff --git a/src/views/consume/bean/addBeanConsume.vue b/src/views/consume/bean/addBeanConsume.vue index 9b16c24..228a59e 100644 --- a/src/views/consume/bean/addBeanConsume.vue +++ b/src/views/consume/bean/addBeanConsume.vue @@ -78,7 +78,7 @@ const rules = reactive({ { required: true, message: '请输入付费金豆数', trigger: 'change' }, { validator: (rule, value, callback) => { - if(!value){ + if (!value) { value = 0 } // 检查是否为非负整数 @@ -102,7 +102,7 @@ const rules = reactive({ { required: true, message: '请输入免费金豆数', trigger: 'change' }, { validator: (rule, value, callback) => { - if(!value){ + if (!value) { value = 0 } // 检查是否为非负整数 @@ -128,21 +128,15 @@ const rules = reactive({ //重置表单 const deleteConsumeForm = function () { - consumeForm.value = { - jwcode: '', - permanentBean: '', - freeBean: '', - remark: '', - adminName: '' - } + formRef.value.resetFields(); } const handleConsumeForm = async () => { try { - if(!consumeForm.value.permanentBean ){ + if (!consumeForm.value.permanentBean) { consumeForm.value.permanentBean = 0 } - if(!consumeForm.value.freeBean ){ + if (!consumeForm.value.freeBean) { consumeForm.value.freeBean = 0 } await new Promise((resolve, reject) => { @@ -171,7 +165,7 @@ const handleConsumeForm = async () => { // if (inputFreeBean > userFreeBean) { // throw new Error('免费金豆数量超过用户当前所拥有'); // } - + await ElMessageBox.confirm( '确认消耗吗?', '提示', @@ -196,15 +190,9 @@ const handleConsumeForm = async () => { addDisabled.value = false if (result.code == 200) { ElMessage.success('新增成功') - consumeForm.value = { - jwcode: "", - permanentBean: '', - freeBean: '', - remark: '', - adminName: '' - } + deleteConsumeForm() user.value = {} - }else{ + } else { ElMessage.error(result.msg) } } catch (error) { @@ -218,7 +206,8 @@ const throttledHandleConsumeFormt = _.throttle(handleConsumeForm, 5000, {