1
This commit is contained in:
@@ -9,3 +9,15 @@ export function submitPublicOrder(data) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 强制提交公开订单(带forceGenerate参数)
|
||||||
|
export function submitPublicOrderWithForce(data) {
|
||||||
|
return request({
|
||||||
|
url: '/public/order/submit',
|
||||||
|
method: 'post',
|
||||||
|
data: {
|
||||||
|
...data,
|
||||||
|
forceGenerate: true
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -84,11 +84,43 @@
|
|||||||
</el-collapse>
|
</el-collapse>
|
||||||
</div>
|
</div>
|
||||||
</el-card>
|
</el-card>
|
||||||
|
|
||||||
|
<!-- 地址重复验证码弹窗 -->
|
||||||
|
<el-dialog
|
||||||
|
title="地址重复验证"
|
||||||
|
:visible.sync="verifyDialogVisible"
|
||||||
|
width="400px"
|
||||||
|
:close-on-click-modal="false"
|
||||||
|
:close-on-press-escape="false"
|
||||||
|
>
|
||||||
|
<div style="text-align: center;">
|
||||||
|
<el-alert
|
||||||
|
:title="verifyMessage"
|
||||||
|
type="warning"
|
||||||
|
:closable="false"
|
||||||
|
style="margin-bottom: 20px;"
|
||||||
|
/>
|
||||||
|
<div style="font-size: 24px; font-weight: bold; color: #409EFF; margin: 20px 0;">
|
||||||
|
{{ verifyCode }}
|
||||||
|
</div>
|
||||||
|
<el-input
|
||||||
|
v-model="verifyInput"
|
||||||
|
placeholder="请输入上方四位数字验证码"
|
||||||
|
maxlength="4"
|
||||||
|
style="width: 200px;"
|
||||||
|
@keyup.enter.native="handleVerify"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<div slot="footer" class="dialog-footer">
|
||||||
|
<el-button @click="verifyDialogVisible = false">取消</el-button>
|
||||||
|
<el-button type="primary" @click="handleVerify" :loading="verifyLoading">确认</el-button>
|
||||||
|
</div>
|
||||||
|
</el-dialog>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { submitPublicOrder } from '@/api/public/order'
|
import { submitPublicOrder, submitPublicOrderWithForce } from '@/api/public/order'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'PublicOrderSubmit',
|
name: 'PublicOrderSubmit',
|
||||||
@@ -96,7 +128,14 @@ export default {
|
|||||||
return {
|
return {
|
||||||
form: { command: '' },
|
form: { command: '' },
|
||||||
loading: false,
|
loading: false,
|
||||||
resultList: []
|
resultList: [],
|
||||||
|
// 验证码相关
|
||||||
|
verifyDialogVisible: false,
|
||||||
|
verifyCode: '',
|
||||||
|
verifyInput: '',
|
||||||
|
verifyMessage: '',
|
||||||
|
verifyLoading: false,
|
||||||
|
pendingCommand: '' // 待执行的命令(验证通过后执行)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
@@ -176,6 +215,13 @@ ${today} 001
|
|||||||
this.resultList = []
|
this.resultList = []
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 检查是否是地址重复错误
|
||||||
|
if (this.checkAddressDuplicate(this.resultList)) {
|
||||||
|
// 显示验证码弹窗
|
||||||
|
this.showVerifyDialog(cmd)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
// 检查是否有警告信息
|
// 检查是否有警告信息
|
||||||
this.checkWarningAlert(this.resultList)
|
this.checkWarningAlert(this.resultList)
|
||||||
|
|
||||||
@@ -194,6 +240,71 @@ ${today} 001
|
|||||||
this.resultList = []
|
this.resultList = []
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
// 检查是否是地址重复错误
|
||||||
|
checkAddressDuplicate(resultList) {
|
||||||
|
if (!resultList || resultList.length === 0) return false
|
||||||
|
for (let i = 0; i < resultList.length; i++) {
|
||||||
|
const result = resultList[i]
|
||||||
|
if (typeof result === 'string' && result.startsWith('ERROR_CODE:ADDRESS_DUPLICATE')) {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
},
|
||||||
|
// 显示验证码弹窗
|
||||||
|
showVerifyDialog(command) {
|
||||||
|
// 生成四位随机数字验证码
|
||||||
|
this.verifyCode = String(Math.floor(1000 + Math.random() * 9000))
|
||||||
|
this.verifyInput = ''
|
||||||
|
this.verifyMessage = '检测到地址重复,请输入验证码以强制生成表单'
|
||||||
|
this.pendingCommand = command
|
||||||
|
this.verifyDialogVisible = true
|
||||||
|
},
|
||||||
|
// 处理验证码验证
|
||||||
|
handleVerify() {
|
||||||
|
if (!this.verifyInput || this.verifyInput.length !== 4) {
|
||||||
|
this.$message.error('请输入四位数字验证码')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (this.verifyInput !== this.verifyCode) {
|
||||||
|
this.$message.error('验证码错误,请重新输入')
|
||||||
|
this.verifyInput = ''
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// 验证通过,使用forceGenerate参数重新提交
|
||||||
|
this.verifyLoading = true
|
||||||
|
submitPublicOrderWithForce({ command: this.pendingCommand }).then(res => {
|
||||||
|
this.verifyLoading = false
|
||||||
|
this.verifyDialogVisible = false
|
||||||
|
if (res && (res.code === 200 || res.msg === '操作成功')) {
|
||||||
|
const data = res.data
|
||||||
|
if (Array.isArray(data)) {
|
||||||
|
this.resultList = data
|
||||||
|
} else if (typeof data === 'string') {
|
||||||
|
this.resultList = data ? [data] : []
|
||||||
|
} else {
|
||||||
|
this.resultList = []
|
||||||
|
}
|
||||||
|
|
||||||
|
// 检查是否有警告信息
|
||||||
|
this.checkWarningAlert(this.resultList)
|
||||||
|
|
||||||
|
// 如果没有警告,显示成功提示
|
||||||
|
if (!this.hasWarning(this.resultList)) {
|
||||||
|
this.$message.success('订单提交成功(已强制生成)')
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
this.$message.error(res && res.msg ? res.msg : '提交失败')
|
||||||
|
this.resultList = []
|
||||||
|
}
|
||||||
|
}).catch(error => {
|
||||||
|
this.verifyLoading = false
|
||||||
|
const errorMsg = error.response?.data?.msg || error.message || '提交失败,请稍后重试'
|
||||||
|
this.$message.error(errorMsg)
|
||||||
|
this.resultList = []
|
||||||
|
})
|
||||||
|
},
|
||||||
clearAll() {
|
clearAll() {
|
||||||
this.form.command = ''
|
this.form.command = ''
|
||||||
this.resultList = []
|
this.resultList = []
|
||||||
|
|||||||
Reference in New Issue
Block a user