Commit e51fb371 by zhangxw

战败下单修改

1 parent 9c6e4a0d
......@@ -90,7 +90,7 @@ Component({
wx.$util.showToast(message)
}
this.getCustomerCouponList(n)
this.getCouponList(this.data.merchantId)
this.getCouponList(this.data.merchantId, !(data && Object.keys(data)?.length))
})
} else {
this.getCustomerCouponList(n)
......@@ -102,7 +102,8 @@ Component({
returnFun: Boolean,
pageName: {
type: String
}
},
filmOrder: String // 下单类型
},
lifetimes: {
attached() {}
......@@ -154,9 +155,10 @@ Component({
}
})
},
getCouponList(merchantId, refresh) {
getCouponList(merchantId, setCoupon) {
let {
yqMerchantId
yqMerchantId,
filmOrder
} = this.data
// console.log(merchantId, yqMerchantId, 'yqMerchantId');
// 解决 yqMerchantId 为0 请求空数据的问题
......@@ -175,11 +177,16 @@ Component({
if (code == 0) {
let couponTypeList = Array.from(new Set([...data.map(e => e.couponInfo.couponType)]))
// 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 {
orderObj
} = thisPage.data
let couponList = couponTypeList.map(e => {
let couponList = couponTypeList.map((e, index) => {
let list = []
let title = ''
data.map(i => {
......@@ -188,17 +195,27 @@ Component({
list.push(i)
title = i.couponInfo.couponTypeName
}
if (e == 1 && list.length && !orderObj?.customer.customerPhone) { // 太阳膜礼券 无客户默认选择第一张太阳膜礼券
orderObj = {
...orderObj,
couponName: list[0]?.couponName,
customerCouponCode: list[0]?.merchantCouponCode,
merchantCouponId: list[0]?.id,
merchantId: list[0]?.merchantId
if (setCoupon) {
if (e == 1 && list.length) { // 太阳膜礼券 无客户默认选择第一张太阳膜礼券
list[0].active = true
orderObj = {
...orderObj,
couponName: list[0]?.couponName,
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 {
......@@ -206,12 +223,15 @@ Component({
list
}
})
thisPage.setData({
orderObj
})
this.setData({
couponList
})
this.checkCoupon()
} else {
if (refresh) wx.$util.showToast(message)
wx.$util.showToast(message)
}
})
},
......
......@@ -52,7 +52,8 @@ Page({
copyGoodsData: [],
frontGearArr: [],
sideRearGearArr: [],
skylightArr: []
skylightArr: [],
customerInfoBox: false,
},
routerBack() {
wx.$router.back()
......@@ -80,6 +81,33 @@ Page({
[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() {
let { notUpgradeOrderList, copyGoodsData } = this.data
notUpgradeOrderList.push({
......
......@@ -3,6 +3,7 @@
"usingComponents": {
"car-brands": "/components/CarBrands/CarBrands",
"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
......@@ -101,8 +101,11 @@
border
valueAlign="right"
label="车主姓名"
titleBtn="客户档案"
bindtitleClick="showCustomPop"
data-index="{{ind}}"
requiredAfter
labelWidth="140rpx"
labelWidth="290rpx"
required>
<input
placeholder="点击输入"
......@@ -378,7 +381,7 @@
</view>
</view>
</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" />
<text class="text">新增客户</text>
</view>
......@@ -408,4 +411,5 @@
/>
<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}}"/>
<customerInfo show="{{ customerInfoBox }}" bindconfirm="chooseCustomerInfo" />
......@@ -353,6 +353,7 @@
selectPayType="{{orderObj.selectPayType}}"
returnFun="{{ returnFun }}"
phoneShow="{{ !phoneShow}}"
filmOrder="1"
/>
<goods show="{{ goodsBox }}" bindconfirm="chooseGoods" goodsData="{{ goodsData }}" chooseGoodsList="{{ goodsList }}" />
<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!