This commit is contained in:
Leo
2025-11-14 23:48:23 +08:00
parent f67002ecfb
commit 1cd54adb06

View File

@@ -247,15 +247,22 @@ export default {
this.$modal.msgError('执行失败,请稍后重试') this.$modal.msgError('执行失败,请稍后重试')
}) })
}, },
// 检查是否是地址重复错误 // 检查是否是地址重复或订单编号重复错误
checkAddressDuplicate(resultList) { checkAddressDuplicate(resultList) {
if (!resultList || resultList.length === 0) return false if (!resultList || resultList.length === 0) return false
for (let i = 0; i < resultList.length; i++) { for (let i = 0; i < resultList.length; i++) {
const result = resultList[i] const result = resultList[i]
if (typeof result === 'string' && result.startsWith('ERROR_CODE:ADDRESS_DUPLICATE')) { if (typeof result === 'string') {
// 检查是否包含地址重复或订单编号重复错误码
if (result.includes('ERROR_CODE:ADDRESS_DUPLICATE') ||
result.includes('ERROR_CODE:ORDER_NUMBER_DUPLICATE') ||
result.startsWith('ERROR_CODE:ADDRESS_DUPLICATE') ||
result.startsWith('ERROR_CODE:ORDER_NUMBER_DUPLICATE')) {
console.log('检测到重复错误:', result)
return true return true
} }
} }
}
return false return false
}, },
// 显示验证码弹窗 // 显示验证码弹窗
@@ -263,7 +270,29 @@ export default {
// 生成四位随机数字验证码 // 生成四位随机数字验证码
this.verifyCode = String(Math.floor(1000 + Math.random() * 9000)) this.verifyCode = String(Math.floor(1000 + Math.random() * 9000))
this.verifyInput = '' this.verifyInput = ''
// 根据错误类型设置提示信息
let hasOrderNumberDuplicate = false
let hasAddressDuplicate = false
if (this.resultList && this.resultList.length > 0) {
for (let i = 0; i < this.resultList.length; i++) {
const result = this.resultList[i]
if (typeof result === 'string') {
if (result.includes('ERROR_CODE:ORDER_NUMBER_DUPLICATE')) {
hasOrderNumberDuplicate = true
}
if (result.includes('ERROR_CODE:ADDRESS_DUPLICATE')) {
hasAddressDuplicate = true
}
}
}
}
if (hasOrderNumberDuplicate && hasAddressDuplicate) {
this.verifyMessage = '检测到订单编号和地址重复,请输入验证码以强制生成表单'
} else if (hasOrderNumberDuplicate) {
this.verifyMessage = '检测到订单编号重复,请输入验证码以强制生成表单'
} else {
this.verifyMessage = '检测到地址重复,请输入验证码以强制生成表单' this.verifyMessage = '检测到地址重复,请输入验证码以强制生成表单'
}
this.pendingCommand = command this.pendingCommand = command
this.verifyDialogVisible = true this.verifyDialogVisible = true
}, },