Commit e51fb371 by zhangxw

战败下单修改

1 parent 9c6e4a0d
...@@ -90,7 +90,7 @@ Component({ ...@@ -90,7 +90,7 @@ Component({
wx.$util.showToast(message) wx.$util.showToast(message)
} }
this.getCustomerCouponList(n) this.getCustomerCouponList(n)
this.getCouponList(this.data.merchantId) this.getCouponList(this.data.merchantId, !(data && Object.keys(data)?.length))
}) })
} else { } else {
this.getCustomerCouponList(n) this.getCustomerCouponList(n)
...@@ -102,7 +102,8 @@ Component({ ...@@ -102,7 +102,8 @@ Component({
returnFun: Boolean, returnFun: Boolean,
pageName: { pageName: {
type: String type: String
} },
filmOrder: String // 下单类型
}, },
lifetimes: { lifetimes: {
attached() {} attached() {}
...@@ -154,9 +155,10 @@ Component({ ...@@ -154,9 +155,10 @@ Component({
} }
}) })
}, },
getCouponList(merchantId, refresh) { getCouponList(merchantId, setCoupon) {
let { let {
yqMerchantId yqMerchantId,
filmOrder
} = this.data } = this.data
// console.log(merchantId, yqMerchantId, 'yqMerchantId'); // console.log(merchantId, yqMerchantId, 'yqMerchantId');
// 解决 yqMerchantId 为0 请求空数据的问题 // 解决 yqMerchantId 为0 请求空数据的问题
...@@ -175,11 +177,16 @@ Component({ ...@@ -175,11 +177,16 @@ Component({
if (code == 0) { if (code == 0) {
let couponTypeList = Array.from(new Set([...data.map(e => e.couponInfo.couponType)])) let couponTypeList = Array.from(new Set([...data.map(e => e.couponInfo.couponType)]))
// console.log(couponTypeList) // console.log(couponTypeList)
// 精品升级 过滤掉太阳膜礼券
if (filmOrder == '1') {
let index = couponTypeList.findIndex(v => v == 1)
index > -1 && couponTypeList.splice(index, 1)
}
let thisPage = wx.$router.getPageInstance() let thisPage = wx.$router.getPageInstance()
let { let {
orderObj orderObj
} = thisPage.data } = thisPage.data
let couponList = couponTypeList.map(e => { let couponList = couponTypeList.map((e, index) => {
let list = [] let list = []
let title = '' let title = ''
data.map(i => { data.map(i => {
...@@ -188,17 +195,27 @@ Component({ ...@@ -188,17 +195,27 @@ Component({
list.push(i) list.push(i)
title = i.couponInfo.couponTypeName title = i.couponInfo.couponTypeName
} }
if (e == 1 && list.length && !orderObj?.customer.customerPhone) { // 太阳膜礼券 无客户默认选择第一张太阳膜礼券 if (setCoupon) {
orderObj = { if (e == 1 && list.length) { // 太阳膜礼券 无客户默认选择第一张太阳膜礼券
...orderObj, list[0].active = true
couponName: list[0]?.couponName, orderObj = {
customerCouponCode: list[0]?.merchantCouponCode, ...orderObj,
merchantCouponId: list[0]?.id, couponName: list[0]?.couponName,
merchantId: list[0]?.merchantId customerCouponCode: list[0]?.merchantCouponCode,
merchantCouponId: list[0]?.id,
merchantId: list[0]?.merchantId
}
} else if (filmOrder == '1' && index == 0 && list.length) { // 精品升级礼券 默认选择第一张
let objProp = list[0]
objProp.active = true
orderObj = {
...orderObj,
couponName: objProp?.couponName,
customerCouponCode: objProp?.merchantCouponCode,
merchantCouponId: objProp?.id,
merchantId: objProp?.merchantId
}
} }
thisPage.setData({
orderObj
})
} }
}) })
return { return {
...@@ -206,12 +223,15 @@ Component({ ...@@ -206,12 +223,15 @@ Component({
list list
} }
}) })
thisPage.setData({
orderObj
})
this.setData({ this.setData({
couponList couponList
}) })
this.checkCoupon() this.checkCoupon()
} else { } else {
if (refresh) wx.$util.showToast(message) wx.$util.showToast(message)
} }
}) })
}, },
......
...@@ -52,7 +52,8 @@ Page({ ...@@ -52,7 +52,8 @@ Page({
copyGoodsData: [], copyGoodsData: [],
frontGearArr: [], frontGearArr: [],
sideRearGearArr: [], sideRearGearArr: [],
skylightArr: [] skylightArr: [],
customerInfoBox: false,
}, },
routerBack() { routerBack() {
wx.$router.back() wx.$router.back()
...@@ -80,6 +81,33 @@ Page({ ...@@ -80,6 +81,33 @@ Page({
[subOrderListProp]: arr [subOrderListProp]: arr
}) })
}, },
chooseCustomerInfo(e) {
let { detail } = e
let { selectCustomIndex } = this.data
let prop = `notUpgradeOrderList[${selectCustomIndex}].customer`
this.setData({
[prop]: {
customerName: detail.customer.customerName,
customerSex: detail.customer.customerSex,
customerPhone: detail.customer.customerPhone,
carBrandId: detail.customer.carBrandId,
carBrand: detail.customer.carBrand,
carChildsBrandId: detail.customer.carChildsBrandId,
carChildsBrandName: detail.customer.carChildsBrandName,
carSeriesId: detail.customer.carSeriesId,
carSeriesName: detail.customer.carSeriesName,
standNo: detail.customer.standNo,
plateNumber: detail.customer.plateNumber
}
})
},
showCustomPop(e) {
let { index } = e.currentTarget.dataset
this.setData({
customerInfoBox: true,
selectCustomIndex: index
})
},
addUserItem() { addUserItem() {
let { notUpgradeOrderList, copyGoodsData } = this.data let { notUpgradeOrderList, copyGoodsData } = this.data
notUpgradeOrderList.push({ notUpgradeOrderList.push({
......
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
"usingComponents": { "usingComponents": {
"car-brands": "/components/CarBrands/CarBrands", "car-brands": "/components/CarBrands/CarBrands",
"merchant-seles": "/components/Merchant-Seles/Merchant-Seles", "merchant-seles": "/components/Merchant-Seles/Merchant-Seles",
"goods": "/components/Goods/Goods" "goods": "/components/Goods/Goods",
"customerInfo": "/components/CustomerInfo/CustomerInfo"
} }
} }
\ No newline at end of file \ No newline at end of file
...@@ -101,8 +101,11 @@ ...@@ -101,8 +101,11 @@
border border
valueAlign="right" valueAlign="right"
label="车主姓名" label="车主姓名"
titleBtn="客户档案"
bindtitleClick="showCustomPop"
data-index="{{ind}}"
requiredAfter requiredAfter
labelWidth="140rpx" labelWidth="290rpx"
required> required>
<input <input
placeholder="点击输入" placeholder="点击输入"
...@@ -378,7 +381,7 @@ ...@@ -378,7 +381,7 @@
</view> </view>
</view> </view>
</block> </block>
<view class="addBtn" bindtap="addUserItem" id="addBtn"> <view class="addBtn" bindtap="addUserItem" id="addBtn" wx:if="{{notUpgradeOrderList.length <= 10}}">
<image class="addIcon" src="../../images/addIcon.png" mode="scaleToFill|aspectFit|aspectFill|widthFix" /> <image class="addIcon" src="../../images/addIcon.png" mode="scaleToFill|aspectFit|aspectFill|widthFix" />
<text class="text">新增客户</text> <text class="text">新增客户</text>
</view> </view>
...@@ -408,4 +411,5 @@ ...@@ -408,4 +411,5 @@
/> />
<merchant-seles show="{{ salesmanBox }}" isDefault="{{ isDefault }}" title="选择园区店" sub-title="选择转化人员" userInfo="{{ userInfo }}" type="2" /> <merchant-seles show="{{ salesmanBox }}" isDefault="{{ isDefault }}" title="选择园区店" sub-title="选择转化人员" userInfo="{{ userInfo }}" type="2" />
<goods show="{{ goodsBox }}" bindconfirm="chooseGoods" goodsData="{{ goodsData }}" chooseGoodsList="{{ notUpgradeOrderList[selectCustomIndex].subOrderList || [] }}" isSolarFilm="{{true}}"/> <goods show="{{ goodsBox }}" bindconfirm="chooseGoods" goodsData="{{ goodsData }}" chooseGoodsList="{{ notUpgradeOrderList[selectCustomIndex].subOrderList || [] }}" isSolarFilm="{{true}}"/>
<customerInfo show="{{ customerInfoBox }}" bindconfirm="chooseCustomerInfo" />
...@@ -353,6 +353,7 @@ ...@@ -353,6 +353,7 @@
selectPayType="{{orderObj.selectPayType}}" selectPayType="{{orderObj.selectPayType}}"
returnFun="{{ returnFun }}" returnFun="{{ returnFun }}"
phoneShow="{{ !phoneShow}}" phoneShow="{{ !phoneShow}}"
filmOrder="1"
/> />
<goods show="{{ goodsBox }}" bindconfirm="chooseGoods" goodsData="{{ goodsData }}" chooseGoodsList="{{ goodsList }}" /> <goods show="{{ goodsBox }}" bindconfirm="chooseGoods" goodsData="{{ goodsData }}" chooseGoodsList="{{ goodsList }}" />
<customerInfo show="{{ customerInfoBox }}" bindconfirm="chooseCustomerInfo" /> <customerInfo show="{{ customerInfoBox }}" bindconfirm="chooseCustomerInfo" />
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!