diff --git a/src/views/moneyManage/receiveDetail/receiveFinance.vue b/src/views/moneyManage/receiveDetail/receiveFinance.vue index 76e3427..d69eb51 100644 --- a/src/views/moneyManage/receiveDetail/receiveFinance.vue +++ b/src/views/moneyManage/receiveDetail/receiveFinance.vue @@ -907,6 +907,11 @@ const getlist = async () => { ElMessage.error('请输入正确的精网号') return; } + // 增加精网号长度限制,防止后端400错误 + if (searchData.value.jwcode.length > 8) { + ElMessage.error('精网号长度不能超过8位') + return; + } } const result = await request({ url: '/cashCollection/selectCollection', @@ -956,6 +961,16 @@ const submitRefund = async () => { if (!refundFormData.value.refundReason) { return ElMessage.error('请输入退款原因'); } + // 验证精网号格式和长度 + if (refundFormData.value.jwcode) { + const isPositiveInteger = /^[1-9]\d*$/.test(refundFormData.value.jwcode); + if (!isPositiveInteger) { + return ElMessage.error('请输入正确的精网号'); + } + if (refundFormData.value.jwcode.length > 8) { + return ElMessage.error('精网号长度不能超过8位'); + } + } if (refundFormData.value.refundModel == 0) { refundFormData.value.partRefundGold = refundFormData.value.permanentGold, refundFormData.value.partRefundFree = refundFormData.value.freeGold diff --git a/src/views/moneyManage/receiveDetail/receiveHead.vue b/src/views/moneyManage/receiveDetail/receiveHead.vue index 4224f4c..eee4d63 100644 --- a/src/views/moneyManage/receiveDetail/receiveHead.vue +++ b/src/views/moneyManage/receiveDetail/receiveHead.vue @@ -783,6 +783,11 @@ const getlist = async () => { ElMessage.error('请输入正确的精网号') return; } + // 添加长度验证,超过8位提示错误 + if (searchData.value.jwcode.length > 8) { + ElMessage.error('精网号长度不能超过8位') + return; + } } // if (searchData.value.jwcode && !isNumber(searchData.value.jwcode)) { @@ -829,7 +834,6 @@ const resetRefund = () => { const submitRefund = async () => { try { if (refundFormData.value.goodsName != '金币充值') { - return ElMessage.error('线上数据仅支持金币充值退款'); } if (!refundFormData.value.refundModel) { @@ -838,6 +842,16 @@ const submitRefund = async () => { if (!refundFormData.value.refundReason) { return ElMessage.error('请输入退款原因'); } + // 添加精网号验证 + if (refundFormData.value.jwcode) { + const isPositiveInteger = /^[1-9]\d*$/.test(refundFormData.value.jwcode); + if (!isPositiveInteger) { + return ElMessage.error('精网号格式不正确,必须为正整数'); + } + if (refundFormData.value.jwcode.length > 20) { + return ElMessage.error('精网号长度不能超过20位'); + } + } if (refundFormData.value.refundModel == 0) { refundFormData.value.partRefundGold = refundFormData.value.permanentGold, refundFormData.value.partRefundFree = refundFormData.value.freeGold diff --git a/src/views/moneyManage/receiveDetail/receiveManage.vue b/src/views/moneyManage/receiveDetail/receiveManage.vue index 76e3427..159d089 100644 --- a/src/views/moneyManage/receiveDetail/receiveManage.vue +++ b/src/views/moneyManage/receiveDetail/receiveManage.vue @@ -907,6 +907,11 @@ const getlist = async () => { ElMessage.error('请输入正确的精网号') return; } + // 添加长度验证,超过8位提示错误 + if (searchData.value.jwcode.length > 8) { + ElMessage.error('精网号长度不能超过8位') + return; + } } const result = await request({ url: '/cashCollection/selectCollection', diff --git a/src/views/moneyManage/receiveDetail/receiveService.vue b/src/views/moneyManage/receiveDetail/receiveService.vue index 7ce9682..46fec5f 100644 --- a/src/views/moneyManage/receiveDetail/receiveService.vue +++ b/src/views/moneyManage/receiveDetail/receiveService.vue @@ -525,6 +525,11 @@ const getlist = async () => { ElMessage.error('请输入正确的精网号') return; } + // 添加精网号长度验证 + if (searchData.value.jwcode.length > 8) { + ElMessage.error('精网号长度不能超过8位') + return; + } } // if (searchData.value.jwcode && !isNumber(searchData.value.jwcode)) { @@ -984,6 +989,19 @@ const submitRefund = async () => { return } } + + // 添加精网号验证 + if (refundFormData.value.jwcode) { + const isPositiveInteger = /^[1-9]\d*$/.test(refundFormData.value.jwcode); + if (!isPositiveInteger) { + ElMessage.error('请输入正确的精网号') + return; + } + if (refundFormData.value.jwcode.length > 8) { + ElMessage.error('精网号长度不能超过8位') + return; + } + } const result = await request({ url: '/Money/add', data: {