Commit 75c5c677 by cen

feat: 增强订单类型处理逻辑

- 在 CreateOrder 和其他相关组件中添加默认订单类型设置,确保新建订单时自动选择“正常订单”
- 优化异常订单锁单检查逻辑,提升用户体验
- 更新订单类型回显逻辑,确保表单中正确显示订单类型名称
1 parent 31a7abfb
...@@ -650,6 +650,12 @@ export default { ...@@ -650,6 +650,12 @@ export default {
this.lockReason = res.lockReason this.lockReason = res.lockReason
return return
} }
const { abnormalOrderNum, lockOrderFlag } = await this.getAbnormalOrderLock()
if (abnormalOrderNum > 0 && lockOrderFlag === 'Y') {
this.showErrorOrderPopup = true
this.abnormalOrderCount = abnormalOrderNum
return
}
} }
if (await this.checkDailyReport(sceneType != 7)) return if (await this.checkDailyReport(sceneType != 7)) return
} }
......
...@@ -120,17 +120,20 @@ export default { ...@@ -120,17 +120,20 @@ export default {
Object.assign(this.orderObj, Object.fromEntries(baseFields.map(field => [field, rest[field]]))) Object.assign(this.orderObj, Object.fromEntries(baseFields.map(field => [field, rest[field]])))
// 回显订单类型 // 回显订单类型
const orderTypeMap = {
'1': '正常订单',
'2': '打折策略',
'3': '买赠策略',
'4': '冲量活动',
'5': '组合付款'
}
if (rest.djOrderType !== undefined && rest.djOrderType !== null) { if (rest.djOrderType !== undefined && rest.djOrderType !== null) {
this.orderObj.orderTypeCode = String(rest.djOrderType) this.orderObj.orderTypeCode = String(rest.djOrderType)
// 根据 orderTypeCode 找到对应的订单类型名称
const orderTypeMap = {
'1': '正常订单',
'2': '打折策略',
'3': '买赠策略',
'4': '冲量活动',
'5': '组合付款'
}
this.orderObj.djOrderType = orderTypeMap[this.orderObj.orderTypeCode] || '' this.orderObj.djOrderType = orderTypeMap[this.orderObj.orderTypeCode] || ''
} else {
// 如果没有订单类型,默认设置为正常订单
this.orderObj.orderTypeCode = '1'
this.orderObj.djOrderType = orderTypeMap['1'] || '正常订单'
} }
// 设置支付类型 // 设置支付类型
...@@ -184,11 +187,9 @@ export default { ...@@ -184,11 +187,9 @@ export default {
formUpdates.forEach(([index, field, value]) => updateFormCell(index, field, value)) formUpdates.forEach(([index, field, value]) => updateFormCell(index, field, value))
// 更新订单类型字段显示 // 更新订单类型字段显示
if (this.orderObj.djOrderType) { const orderTypeCell = this.formList[2].find(item => item.value === 'djOrderType')
const orderTypeCell = this.formList[2].find(item => item.value === 'djOrderType') if (orderTypeCell && this.orderObj.djOrderType) {
if (orderTypeCell) { orderTypeCell.current = this.orderObj.djOrderType
orderTypeCell.current = this.orderObj.djOrderType
}
} }
// 商品回显,在获取商品列表之后 // 商品回显,在获取商品列表之后
this.subOrderList = rest.subOrderList this.subOrderList = rest.subOrderList
...@@ -205,6 +206,8 @@ export default { ...@@ -205,6 +206,8 @@ export default {
experienceFlag: 'Y', experienceFlag: 'Y',
payeeType: 1, payeeType: 1,
salesType: '0', salesType: '0',
orderTypeCode: '1', // 默认正常订单
djOrderType: '正常订单', // 默认正常订单
frontGear: null, // 1 ,回显upgradeGoodsPosition == 1 frontGear: null, // 1 ,回显upgradeGoodsPosition == 1
frontWindow: null, // 2 frontWindow: null, // 2
rearWindow: null, // 3 rearWindow: null, // 3
...@@ -232,6 +235,7 @@ export default { ...@@ -232,6 +235,7 @@ export default {
experienceFlag: 'Y', experienceFlag: 'Y',
payeeType: 1, payeeType: 1,
salesType: '0', salesType: '0',
orderTypeCode: '1', // 默认正常订单
frontGear: null, // 1 ,回显upgradeGoodsPosition == 1 frontGear: null, // 1 ,回显upgradeGoodsPosition == 1
frontWindow: null, // 2 frontWindow: null, // 2
rearWindow: null, // 3 rearWindow: null, // 3
...@@ -542,6 +546,13 @@ export default { ...@@ -542,6 +546,13 @@ export default {
this.getConfig() this.getConfig()
} }
} }
// 设置订单类型表单显示(新建订单时)
if (!this.orderObj.id && this.orderObj.djOrderType) {
const orderTypeCell = this.formList[2].find(item => item.value === 'djOrderType')
if (orderTypeCell) {
orderTypeCell.current = this.orderObj.djOrderType
}
}
// this.getEmployeeList() // this.getEmployeeList()
this.getSelectOrderGoodsList() this.getSelectOrderGoodsList()
this.getPositionList() this.getPositionList()
...@@ -916,16 +927,11 @@ export default { ...@@ -916,16 +927,11 @@ export default {
return return
} }
// 日报 / 异常订单锁单校验 // 日报校验
const hasInterception = await this.checkDailyReport() const hasInterception = await this.checkDailyReport()
if(hasInterception) { if(hasInterception) {
return return
} }
const { abnormalOrderNum, lockOrderFlag } = await this.getAbnormalOrderLock()
if (abnormalOrderNum > 0 && lockOrderFlag === 'Y') {
uni.$emit('showErrorOrderPopup', { abnormalOrderNum })
return
}
const { orderCreateType } = this const { orderCreateType } = this
const obj = utils.deepClone(this.orderObj) const obj = utils.deepClone(this.orderObj)
......
...@@ -134,6 +134,8 @@ export default { ...@@ -134,6 +134,8 @@ export default {
mode: 1, mode: 1,
payee: 0, // 收款方式 payee: 0, // 收款方式
payType: 1, // 支付方式 payType: 1, // 支付方式
orderTypeCode: '1', // 默认正常订单
djOrderType: '正常订单', // 默认正常订单
insurancePrice: '', insurancePrice: '',
skuGoods: [], //商品列表 skuGoods: [], //商品列表
referrerId: '', //销售顾问id referrerId: '', //销售顾问id
...@@ -194,22 +196,20 @@ export default { ...@@ -194,22 +196,20 @@ export default {
orderObj.quotedPriceUpdate = this.divideByHundred(quotedPriceUpdate) orderObj.quotedPriceUpdate = this.divideByHundred(quotedPriceUpdate)
// 回显订单类型(orderType:1 正常订单,2 打折策略,3 买赠策略,4 冲量活动,5 组合付款) // 回显订单类型(orderType:1 正常订单,2 打折策略,3 买赠策略,4 冲量活动,5 组合付款)
const orderTypeCode = data.orderType ? String(data.orderType) : this.orderObj.orderTypeCode || '' const orderTypeMap = {
if (orderTypeCode) { '1': '正常订单',
const orderTypeMap = { '2': '打折策略',
'1': '正常订单', '3': '买赠策略',
'2': '打折策略', '4': '冲量活动',
'3': '买赠策略', '5': '组合付款'
'4': '冲量活动', }
'5': '组合付款' const orderTypeCode = data.orderType ? String(data.orderType) : (this.orderObj.orderTypeCode || '1')
} orderObj.orderTypeCode = orderTypeCode
orderObj.orderTypeCode = orderTypeCode orderObj.djOrderType = orderTypeMap[orderTypeCode] || '正常订单'
orderObj.djOrderType = orderTypeMap[orderTypeCode] || '' // 回显表单中“订单类型”这一行的展示文案
// 回显表单中“订单类型”这一行的展示文案 const orderTypeCell = this.formList[3]?.find(item => item.value === 'djOrderType')
const orderTypeCell = this.formList[3]?.find(item => item.value === 'djOrderType') if (orderTypeCell) {
if (orderTypeCell) { orderTypeCell.current = orderObj.djOrderType
orderTypeCell.current = orderObj.djOrderType
}
} }
if (!data.vdQuotationGoodsList) data.vdQuotationGoodsList = [] if (!data.vdQuotationGoodsList) data.vdQuotationGoodsList = []
...@@ -415,6 +415,13 @@ export default { ...@@ -415,6 +415,13 @@ export default {
// 埋点 // 埋点
// uni.$track.add({ eventCode: 'app_create_order' }) // uni.$track.add({ eventCode: 'app_create_order' })
const { paramsData } = this const { paramsData } = this
// 设置订单类型表单显示(新建订单时)
if (!paramsData.id && this.orderObj.djOrderType) {
const orderTypeCell = this.formList[3]?.find(item => item.value === 'djOrderType')
if (orderTypeCell) {
orderTypeCell.current = this.orderObj.djOrderType
}
}
this.getSelectOrderGoodsList() this.getSelectOrderGoodsList()
if (!paramsData.id) this.getConfig() if (!paramsData.id) this.getConfig()
...@@ -796,13 +803,6 @@ export default { ...@@ -796,13 +803,6 @@ export default {
async submit() { async submit() {
if (!this.checkRequired() || (await this.checkDailyReport())) return if (!this.checkRequired() || (await this.checkDailyReport())) return
// 检查是否锁单:如果有异常订单锁单,触发 HomeFrame 的错误订单弹窗
const { abnormalOrderNum,lockOrderFlag } = await this.getAbnormalOrderLock()
if (abnormalOrderNum > 0&&lockOrderFlag == 'Y') {
uni.$emit('showErrorOrderPopup', { abnormalOrderNum })
return
}
if (!this.checkOrderStrategyAndTotal()) return if (!this.checkOrderStrategyAndTotal()) return
this.handleSecondConfirmCheck(true) this.handleSecondConfirmCheck(true)
}, },
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!