Commit 6ad2a16d by 胡悦

fix: 修复CreateOrder组件中onConfirm方法的商品筛选逻辑

添加flag参数以区分不同场景下的商品筛选,确保正确过滤出单件商品和组合商品
1 parent 7e99eaef
...@@ -297,8 +297,8 @@ export default { ...@@ -297,8 +297,8 @@ export default {
} }
}, },
// 弹窗确认回调 // 弹窗确认回调
onConfirm(val) { onConfirm(val, flag) {
console.log(val, 'onConfirm') console.log(val,flag, 'onConfirm')
this.externalData = [] this.externalData = []
// const { chooseContent } = val // const { chooseContent } = val
const chooseContent = utils.deepClone(val.chooseContent) const chooseContent = utils.deepClone(val.chooseContent)
...@@ -331,7 +331,9 @@ export default { ...@@ -331,7 +331,9 @@ export default {
} else { } else {
// 过滤出已选的goodFlag为2的对象 // 过滤出已选的goodFlag为2的对象
const selectedGoods = this.orderObj[_typeValue.key].filter(item => item.goodsFlag === 2) const selectedGoods = this.orderObj[_typeValue.key].filter(item => item.goodsFlag === 2)
const singleGoods = chooseContent.filter(item => item.goodsFlag === 1) const singleGoods = flag ?
this.orderObj[_typeValue.key].filter(item => item.goodsFlag === 1) :
chooseContent.filter(item => item.goodsFlag === 1)
const moreGoods = chooseContent const moreGoods = chooseContent
.filter(item => item.goodsFlag === 2) .filter(item => item.goodsFlag === 2)
.filter(item => { .filter(item => {
...@@ -358,6 +360,7 @@ export default { ...@@ -358,6 +360,7 @@ export default {
console.log(e, val) console.log(e, val)
this.orderObj.customer[val.value] = this.orderObj[val.value] this.orderObj.customer[val.value] = this.orderObj[val.value]
}, },
// 校验必填等规则
checkRequired() { checkRequired() {
const phoneRex = /^[1]([3-9])[0-9]{9}$/ const phoneRex = /^[1]([3-9])[0-9]{9}$/
// 把formList中所有required为true的对象放到一个数组中 // 把formList中所有required为true的对象放到一个数组中
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!