diff --git a/src/views/moneyManage/receiveDetail/receiveService.vue b/src/views/moneyManage/receiveDetail/receiveService.vue index 4e6fa06..5e54dd3 100644 --- a/src/views/moneyManage/receiveDetail/receiveService.vue +++ b/src/views/moneyManage/receiveDetail/receiveService.vue @@ -615,7 +615,6 @@ const openAddForm = (row) => { addOrEdit.value = 2 addFormData.value = { ...row, - activity: row.activityId } jwcodeSeachMarket() ifGold() @@ -637,25 +636,26 @@ const closeAddForm = () => { } const testGold = () => { // 转换为数字(处理字符串类型的数字) - - if (addFormData.value.permanentGold == null) { - addFormData.value.permanentGold = 0 - } - if (addFormData.value.freeGold == null) { - addFormData.value.freeGold = 0 - } - const permanentGold = Number(addFormData.value.permanentGold); - const freeNum = Number(addFormData.value.freeGold); - // 正则:仅允许0-999999的正整数(包括0) - const reg = /^[0-9]{1,6}$/; - if (!reg.test(permanentGold) || permanentGold < 0) { - return { valid: false, message: '请检查永久金币格式' }; - } - if (!reg.test(freeNum) || freeNum < 0) { - return { valid: false, message: '请检查免费金币格式' }; - } - if (permanentGold == 0 && freeNum == 0) { - return { valid: false, message: '永久金币或免费金币不能同为0' }; + if (addFormData.value.goodsName == '金币充值') { + if (addFormData.value.permanentGold == null) { + addFormData.value.permanentGold = 0 + } + if (addFormData.value.freeGold == null) { + addFormData.value.freeGold = 0 + } + const permanentGold = Number(addFormData.value.permanentGold); + const freeNum = Number(addFormData.value.freeGold); + // 正则:仅允许0-999999的正整数(包括0) + const reg = /^[0-9]{1,6}$/; + if (!reg.test(permanentGold) || permanentGold < 0) { + return { valid: false, message: '请检查永久金币格式' }; + } + if (!reg.test(freeNum) || freeNum < 0) { + return { valid: false, message: '请检查免费金币格式' }; + } + if (permanentGold == 0 && freeNum == 0) { + return { valid: false, message: '永久金币或免费金币不能同为0' }; + } } return { valid: true }; } @@ -718,7 +718,8 @@ const handleEditForm = async () => { goodNum: addFormData.value.goodNum || 0, paymentCurrency: CurrencyForId(addFormData.value.paymentCurrency) || '', receivedMarket: MarketNameForId(addFormData.value.receivedMarket) || '', - paymentAmount: (addFormData.value.paymentAmount) * 100 + paymentAmount: (addFormData.value.paymentAmount) * 100, + activity: addFormData.value.activityId, } }) if (result.code == 200) { @@ -898,7 +899,7 @@ const submitRefund = async () => { refundFormData.value.partRefundGold = refundFormData.value.permanentGold, refundFormData.value.partRefundFree = refundFormData.value.freeGold } else if (refundFormData.value.refundModel == 1) { - if(refundFormData.value.partRefundGold > refundFormData.value.permanentGold || refundFormData.value.partRefundFree > refundFormData.value.freeGold){ + if (refundFormData.value.partRefundGold > refundFormData.value.permanentGold || refundFormData.value.partRefundFree > refundFormData.value.freeGold) { ElMessage.error('退款金额不能大于订单金额') return } diff --git a/src/views/moneyManage/receiveDetail/utils/recriveFormRules.js b/src/views/moneyManage/receiveDetail/utils/recriveFormRules.js index 23ca657..9e8f4b1 100644 --- a/src/views/moneyManage/receiveDetail/utils/recriveFormRules.js +++ b/src/views/moneyManage/receiveDetail/utils/recriveFormRules.js @@ -23,6 +23,11 @@ export const addFormRule = { // 产品数量:0-100纯数字 goodNum: [ { required: true, message: '请输入产品数量', trigger: 'blur' }, + { + pattern: /^[1-9]\d*$/, + message: '请输入正整数', + trigger: 'blur' + } ], // 付款币种:必填 paymentCurrency: [ diff --git a/src/views/moneyManage/receiveDetail/utils/staticData.js b/src/views/moneyManage/receiveDetail/utils/staticData.js index 1f53114..0f2c098 100644 --- a/src/views/moneyManage/receiveDetail/utils/staticData.js +++ b/src/views/moneyManage/receiveDetail/utils/staticData.js @@ -187,8 +187,8 @@ export const productList = [ "label": "博股会员" }, { - "value": "Hc信息费", - "label": "Hc信息费" + "value": "HC信息费", + "label": "HC信息费" } ] }