Commit 5ce60b15 by 张立顺

Merge branch 'dev_v4.16.0' of http://192.168.3.233:8090/saas_plus/dj-car-boutiqu…

…e-work-wechat into dev_v4.16.0
2 parents fe3eb404 f2e242e9
...@@ -27,12 +27,15 @@ Component({ ...@@ -27,12 +27,15 @@ Component({
// 校验历史订单二级流量方是否在配置的二级流量方数据中包含 不包含清空二级流量方重新选择 // 校验历史订单二级流量方是否在配置的二级流量方数据中包含 不包含清空二级流量方重新选择
let hasSubShopMerchantId = subShopMerchantList.some(item=> item.subMerchantId == orderObj.subShopMerchantId) let hasSubShopMerchantId = subShopMerchantList.some(item=> item.subMerchantId == orderObj.subShopMerchantId)
if (!hasSubShopMerchantId && subShopMerchantList.length) { if (!hasSubShopMerchantId && subShopMerchantList.length) {
delete orderObj.subShopMerchantId delete orderObj?.subShopMerchantId
delete orderObj.subShopMerchantName delete orderObj?.subShopMerchantName
} }
thisPage.setData({ thisPage.setData({
orderObj orderObj
}) })
this.setData({
orderObj: {}
})
} }
} }
}, },
...@@ -76,7 +79,7 @@ Component({ ...@@ -76,7 +79,7 @@ Component({
if (code == '0') { if (code == '0') {
// 有二级流量方数据 添加必填二级流量方字段 // 有二级流量方数据 添加必填二级流量方字段
if (data?.length) { if (data?.length) {
if (requiredList.indexOf('subShopMerchantId') < 0) requiredList.push('subShopMerchantId') if (!requiredList.includes('subShopMerchantId')) requiredList.unshift('subShopMerchantId')
data.map(i => { data.map(i => {
i.active = false i.active = false
if (i.subMerchantId == orderObj.subShopMerchantId) { if (i.subMerchantId == orderObj.subShopMerchantId) {
...@@ -87,8 +90,8 @@ Component({ ...@@ -87,8 +90,8 @@ Component({
// 校验历史订单二级流量方是否在配置的二级流量方数据中包含 不包含清空二级流量方重新选择 // 校验历史订单二级流量方是否在配置的二级流量方数据中包含 不包含清空二级流量方重新选择
let hasSubShopMerchantId = data.some(item=> item.subMerchantId == orderObj.subShopMerchantId) let hasSubShopMerchantId = data.some(item=> item.subMerchantId == orderObj.subShopMerchantId)
if (!hasSubShopMerchantId) { if (!hasSubShopMerchantId) {
delete orderObj.subShopMerchantId delete orderObj?.subShopMerchantId
delete orderObj.subShopMerchantName delete orderObj?.subShopMerchantName
} }
thisPage.setData({ thisPage.setData({
requiredList, requiredList,
...@@ -97,12 +100,13 @@ Component({ ...@@ -97,12 +100,13 @@ Component({
}) })
this.setData({ this.setData({
subShopMerchantList: data, subShopMerchantList: data,
orderObj: {}
}) })
} else { } else {
// 无二级流量方字段时 清空选择的二级流量方字段 // 无二级流量方字段时 清空选择的二级流量方字段
delete orderObj.subShopMerchantId delete orderObj?.subShopMerchantId
delete orderObj.subShopMerchantName delete orderObj?.subShopMerchantName
requiredList.indexOf('subShopMerchantId') > -1 && requiredList.splice(requiredList.indexOf('subShopMerchantId'), 1) if (requiredList.includes('subShopMerchantId')) requiredList.splice(requiredList.indexOf('subShopMerchantId'), 1)
thisPage.setData({ thisPage.setData({
isShowSubShopMerchant: false, isShowSubShopMerchant: false,
requiredList, requiredList,
...@@ -121,19 +125,19 @@ Component({ ...@@ -121,19 +125,19 @@ Component({
subShopMerchantId: item.subMerchantId, subShopMerchantId: item.subMerchantId,
subShopMerchantName: item.subMerchantName subShopMerchantName: item.subMerchantName
} }
orderObj = Object.assign(orderObj, selectedSubShopMerchantObj) orderObj = (orderObj || selectedSubShopMerchantObj) ? Object.assign(orderObj, selectedSubShopMerchantObj) : selectedSubShopMerchantObj
subShopMerchantList.map(i => (i.active = false)) subShopMerchantList.map(i => (i.active = false))
subShopMerchantList[index].active = true subShopMerchantList[index].active = true
this.setData({ this.setData({
subShopMerchantList, subShopMerchantList,
...orderObj orderObj
}) })
}, },
async confirm() { async confirm() {
let data = this.data.orderObj let data = this.data.orderObj
let thisPage = wx.$router.getPageInstance() let thisPage = wx.$router.getPageInstance()
let { orderObj } = thisPage.data let { orderObj } = thisPage.data
orderObj = Object.assign(orderObj, data) orderObj = (orderObj || data) ? Object.assign(orderObj, data) : orderObj
thisPage.setData({ thisPage.setData({
orderObj orderObj
}) })
......
...@@ -328,7 +328,7 @@ ...@@ -328,7 +328,7 @@
show="{{subShopMerchantBox}}" show="{{subShopMerchantBox}}"
title="选择二级流量方" title="选择二级流量方"
selectedSelesMerchantId="{{orderObj.merchantId}}" selectedSelesMerchantId="{{orderObj.merchantId}}"
selectedCustomerInfo="{{orderObj.customer.customerName}}" selectedCustomerInfo="{{orderObj.customer.customerId}}"
selectedSubShopMerchantId="{{orderObj.subShopMerchantId}}"/> selectedSubShopMerchantId="{{orderObj.subShopMerchantId}}"/>
<car-brands <car-brands
show="{{carBrandBox}}" show="{{carBrandBox}}"
......
...@@ -370,7 +370,7 @@ ...@@ -370,7 +370,7 @@
show="{{subShopMerchantBox}}" show="{{subShopMerchantBox}}"
title="选择二级流量方" title="选择二级流量方"
selectedSelesMerchantId="{{orderObj.merchantId}}" selectedSelesMerchantId="{{orderObj.merchantId}}"
selectedCustomerInfo="{{orderObj.customer.customerName}}" selectedCustomerInfo="{{orderObj.customer.customerId}}"
selectedSubShopMerchantId="{{orderObj.subShopMerchantId}}"/> selectedSubShopMerchantId="{{orderObj.subShopMerchantId}}"/>
<car-brands <car-brands
show="{{carBrandBox}}" show="{{carBrandBox}}"
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!