Commit 3d0c8d74 by 张立顺

feat 战败下单新增其他精品

1 parent 0635594a
...@@ -18,7 +18,7 @@ export const appId = 'wx570d9331f9ace0bd' ...@@ -18,7 +18,7 @@ export const appId = 'wx570d9331f9ace0bd'
* 4预发布 * 4预发布
* 5cdptest * 5cdptest
*/ */
let index = 4 let index = 1
const accountInfo = wx.getAccountInfoSync() const accountInfo = wx.getAccountInfoSync()
const systemInfo = wx.getSystemInfoSync() const systemInfo = wx.getSystemInfoSync()
const envName = accountInfo.miniProgram.envVersion const envName = accountInfo.miniProgram.envVersion
......
...@@ -11,7 +11,7 @@ var isIncludesItem = function (list, item) { ...@@ -11,7 +11,7 @@ var isIncludesItem = function (list, item) {
return list.indexOf(item) != -1 return list.indexOf(item) != -1
} }
var subStatus = function (constructionStatus) { var subStatus = function (constructionStatus) {
console.log(constructionStatus) // console.log(constructionStatus)
switch (constructionStatus) { switch (constructionStatus) {
case 1: case 1:
case 2: case 2:
......
...@@ -19,11 +19,16 @@ Page({ ...@@ -19,11 +19,16 @@ Page({
IMG_URL: ImgUrl, IMG_URL: ImgUrl,
scanIcon: scanIcon:
'https://img02.glsx.com.cn/weapp/resource/dj-car-boutique-work-wechat/ocr_icon.png', 'https://img02.glsx.com.cn/weapp/resource/dj-car-boutique-work-wechat/ocr_icon.png',
skylight: "https://img02.glsx.com.cn/weapp/resource/dj-car-boutique-work-wechat/miniProgram/skylight.png", skylight:
tricorn: "https://img02.glsx.com.cn/weapp/resource/dj-car-boutique-work-wechat/miniProgram/tricorn.png", 'https://img02.glsx.com.cn/weapp/resource/dj-car-boutique-work-wechat/miniProgram/skylight.png',
windshield: "https://img02.glsx.com.cn/weapp/resource/dj-car-boutique-work-wechat/miniProgram/windshield.png", tricorn:
sideIcorn: "https://img02.glsx.com.cn/weapp/resource/dj-car-boutique-work-wechat/miniProgram/sideIcon.png", 'https://img02.glsx.com.cn/weapp/resource/dj-car-boutique-work-wechat/miniProgram/tricorn.png',
afterIcorn: "https://img02.glsx.com.cn/weapp/resource/dj-car-boutique-work-wechat/miniProgram/afterIcon.png", windshield:
'https://img02.glsx.com.cn/weapp/resource/dj-car-boutique-work-wechat/miniProgram/windshield.png',
sideIcorn:
'https://img02.glsx.com.cn/weapp/resource/dj-car-boutique-work-wechat/miniProgram/sideIcon.png',
afterIcorn:
'https://img02.glsx.com.cn/weapp/resource/dj-car-boutique-work-wechat/miniProgram/afterIcon.png',
name: 'createdOrder', name: 'createdOrder',
shortcutList: [], shortcutList: [],
phoneShow: false, phoneShow: false,
...@@ -71,6 +76,7 @@ Page({ ...@@ -71,6 +76,7 @@ Page({
skylightArr: [], // 天窗 skylightArr: [], // 天窗
sideBeforeRearGearArr: [], // 前侧窗玻璃 sideBeforeRearGearArr: [], // 前侧窗玻璃
sideAfterRearGearArr: [], // 后档 sideAfterRearGearArr: [], // 后档
otherGoodsArr: [],
customerInfoBox: false, customerInfoBox: false,
baseConfigData: {} baseConfigData: {}
}, },
...@@ -136,7 +142,7 @@ Page({ ...@@ -136,7 +142,7 @@ Page({
experienceFlag: detail.customer.experienceFlag || 'Y' experienceFlag: detail.customer.experienceFlag || 'Y'
}, },
[prop + '.customerCouponCode']: detail.customerCoupon?.customerCouponCode, [prop + '.customerCouponCode']: detail.customerCoupon?.customerCouponCode,
[prop + '.customerCouponId']: detail?.customerCouponId, // 客户券id [prop + '.customerCouponId']: detail?.customerCouponId // 客户券id
}) })
}, },
showCustomPop(e) { showCustomPop(e) {
...@@ -332,11 +338,44 @@ Page({ ...@@ -332,11 +338,44 @@ Page({
}, },
showPopup(e) { showPopup(e) {
let { copyGoodsData, baseConfigData } = this.data let { copyGoodsData, baseConfigData } = this.data
let { showName, index, type, positionnnum: positionNum } = e.currentTarget.dataset let {
showName,
index,
type,
positionnnum: positionNum
} = e.currentTarget.dataset
let arr = [] let arr = []
if (showName == 'goodsBox') { if (showName == 'goodsBox') {
// type 产品类型 1前挡 2侧后挡 3天窗 根据类型过滤显示商品弹窗数据 // type 产品类型 1前挡 2侧后挡 3天窗 根据类型过滤显示商品弹窗数据
copyGoodsData?.forEach((val, index) => { copyGoodsData?.forEach((val, index) => {
// 精品 4是其他商品 goodsType 是1 和自定义都是精品,剩下就是其他精品
// val.goodsType == 1 || val.goodsType == baseConfigData?.selfBuildFilmType
if (type == 4) {
// debugger
console.log(val, 'val')
// debugger
if (
val.goodsType != 1 &&
val.goodsType != baseConfigData?.selfBuildFilmType
) {
// let otherFlag = [1, baseConfigData?.selfBuildFilmType].includes(val.goodsType)
let upgradeGoodsList = val?.upgradeGoodsList.map(val => {
// val, (otherFlag = true)
return {
...val,
otherFlag: true
}
})
arr.push({
goodsType: val.goodsType,
goodsTypeName: val.goodsTypeName,
upgradeGoodsList: upgradeGoodsList || []
})
console.log('其他商品', arr)
}
} else {
// console.log('精品', val)
if ( if (
val.goodsType == 1 || val.goodsType == 1 ||
val.goodsType == baseConfigData?.selfBuildFilmType val.goodsType == baseConfigData?.selfBuildFilmType
...@@ -346,82 +385,52 @@ Page({ ...@@ -346,82 +385,52 @@ Page({
goodsTypeName: val.goodsTypeName, goodsTypeName: val.goodsTypeName,
upgradeGoodsList: [] upgradeGoodsList: []
}) })
}
console.log('精品商品', arr)
for (var i = 0; i < arr?.length; i++) { for (var i = 0; i < arr?.length; i++) {
let arr2 = []; let arr2 = []
val?.upgradeGoodsList?.forEach((subVal, subInd) => { val?.upgradeGoodsList?.forEach((subVal, subInd) => {
if (type == 1 && [1].includes(subVal.merchantGoodsPosition)) { if (type == 1 && [1].includes(subVal.merchantGoodsPosition)) {
arr2.push(subVal); arr2.push(subVal)
if ( if (
subVal?.goodsInfo?.goodsType == arr[i]?.goodsType || subVal?.goodsInfo?.goodsType == arr[i]?.goodsType ||
subVal?.upgradeGoodsType == arr[i]?.goodsType subVal?.upgradeGoodsType == arr[i]?.goodsType
) )
arr[i].upgradeGoodsList = arr2; arr[i].upgradeGoodsList = arr2
} }
console.log([positionNum], [positionNum].includes(subVal.merchantGoodsPosition)); // console.log(
// [positionNum],
// [positionNum].includes(subVal.merchantGoodsPosition)
// )
if ( if (
type == 2 && type == 2 &&
[Number(positionNum)].includes(subVal.merchantGoodsPosition) [Number(positionNum)].includes(subVal.merchantGoodsPosition)
) { ) {
arr2.push(subVal); arr2.push(subVal)
if ( if (
subVal?.goodsInfo?.goodsType == arr[i]?.goodsType || subVal?.goodsInfo?.goodsType == arr[i]?.goodsType ||
subVal?.upgradeGoodsType == arr[i]?.goodsType subVal?.upgradeGoodsType == arr[i]?.goodsType
) )
arr[i].upgradeGoodsList = arr2; arr[i].upgradeGoodsList = arr2
} }
if ( if (
type == 3 && type == 3 &&
[5, 6, 7].includes(subVal.merchantGoodsPosition) [5, 6, 7].includes(subVal.merchantGoodsPosition)
) { ) {
arr2.push(subVal); arr2.push(subVal)
if ( if (
subVal?.goodsInfo?.goodsType == arr[i]?.goodsType || subVal?.goodsInfo?.goodsType == arr[i]?.goodsType ||
subVal?.upgradeGoodsType == arr[i]?.goodsType subVal?.upgradeGoodsType == arr[i]?.goodsType
) )
arr[i].upgradeGoodsList = arr2; arr[i].upgradeGoodsList = arr2
} }
}); })
if (!arr[i]?.upgradeGoodsList?.length) arr.splice(i, 1); if (!arr[i]?.upgradeGoodsList?.length) arr.splice(i, 1)
} }
// for (var i = 0; i < arr?.length; i++) {
// let arr2 = []
// val?.upgradeGoodsList?.forEach((subVal, subInd) => {
// if (type == 1 && [1].includes(subVal.merchantGoodsPosition)) {
// arr2.push(subVal)
// if (
// subVal?.goodsInfo?.goodsType == arr[i]?.goodsType ||
// subVal?.upgradeGoodsType == arr[i]?.goodsType
// )
// arr[i].upgradeGoodsList = arr2
// }
// if (
// type == 2 &&
// [2, 3, 4].includes(subVal.merchantGoodsPosition)
// ) {
// arr2.push(subVal)
// if (
// subVal?.goodsInfo?.goodsType == arr[i]?.goodsType ||
// subVal?.upgradeGoodsType == arr[i]?.goodsType
// )
// arr[i].upgradeGoodsList = arr2
// }
// if (
// type == 3 &&
// [5, 6, 7].includes(subVal.merchantGoodsPosition)
// ) {
// arr2.push(subVal)
// if (
// subVal?.goodsInfo?.goodsType == arr[i]?.goodsType ||
// subVal?.upgradeGoodsType == arr[i]?.goodsType
// )
// arr[i].upgradeGoodsList = arr2
// }
// })
// if (!arr[i]?.upgradeGoodsList?.length) arr.splice(i, 1)
// }
} }
}) })
} }
console.log(arr, 'arr')
this.setData({ this.setData({
[showName]: true, [showName]: true,
goodsData: arr, goodsData: arr,
...@@ -455,7 +464,8 @@ Page({ ...@@ -455,7 +464,8 @@ Page({
sideBeforeRearGearArr, // 前侧窗玻璃 sideBeforeRearGearArr, // 前侧窗玻璃
sideRearGearArr, // 侧后挡 sideRearGearArr, // 侧后挡
sideAfterRearGearArr, // 后档 sideAfterRearGearArr, // 后档
skylightArr // 天窗 skylightArr, // 天窗
otherGoodsArr
} = this.data } = this.data
this.setData({ this.setData({
positionTypeList, positionTypeList,
...@@ -470,17 +480,16 @@ Page({ ...@@ -470,17 +480,16 @@ Page({
let { code, data, message } = res let { code, data, message } = res
if (code == 0) { if (code == 0) {
wx.hideLoading() wx.hideLoading()
// 筛选出太阳膜商品 goodsType 1太阳膜 自建商品-太阳膜 // 筛选出太阳膜商品 goodsType 1太阳膜 自建商品-太阳膜 其他精品也带上
let arrData = [] let arrData = []
data?.forEach(val => { data?.forEach(val => {
if ([1, baseConfigData?.selfBuildFilmType].includes(val.goodsType)) // [1, baseConfigData?.selfBuildFilmType].includes(val.goodsType)
arrData.push(val) arrData.push(val)
val?.upgradeGoodsList?.forEach(subVal => { val?.upgradeGoodsList?.forEach(subVal => {
subVal.merchantGoodsId = subVal.id subVal.merchantGoodsId = subVal.id
if ([1].includes(subVal.merchantGoodsPosition)) { if ([1].includes(subVal.merchantGoodsPosition)) {
frontGearArr.push(subVal) frontGearArr.push(subVal)
} }
if ([2].includes(subVal.merchantGoodsPosition)) { if ([2].includes(subVal.merchantGoodsPosition)) {
sideBeforeRearGearArr.push(subVal) sideBeforeRearGearArr.push(subVal)
} }
...@@ -493,6 +502,9 @@ Page({ ...@@ -493,6 +502,9 @@ Page({
if ([5, 6, 7].includes(subVal.merchantGoodsPosition)) { if ([5, 6, 7].includes(subVal.merchantGoodsPosition)) {
skylightArr.push(subVal) skylightArr.push(subVal)
} }
if ([1, baseConfigData?.selfBuildFilmType].includes(val.goodsType)) {
otherGoodsArr.push(subVal)
}
}) })
}) })
let goodsData = arrData let goodsData = arrData
...@@ -521,6 +533,7 @@ Page({ ...@@ -521,6 +533,7 @@ Page({
sideAfterRearGearArr, sideAfterRearGearArr,
sideRearGearArr, sideRearGearArr,
skylightArr, skylightArr,
otherGoodsArr,
copyGoodsData: goodsData copyGoodsData: goodsData
}) })
// 仅有一件商品 默认选中 // 仅有一件商品 默认选中
...@@ -534,12 +547,15 @@ Page({ ...@@ -534,12 +547,15 @@ Page({
}, },
defaultChoose(index) { defaultChoose(index) {
let { frontGearArr, sideRearGearArr, skylightArr } = this.data let { frontGearArr, sideRearGearArr, skylightArr, sideBeforeRearGearArr, sideAfterRearGearArr, otherGoodsArr } = this.data
// 仅有一个商品直接选中 // 仅有一个商品直接选中
let arr = [].concat( let arr = [].concat(
sideRearGearArr.length == 1 ? sideRearGearArr : [], sideRearGearArr.length == 1 ? sideRearGearArr : [],
frontGearArr.length == 1 ? frontGearArr : [], frontGearArr.length == 1 ? frontGearArr : [],
skylightArr.length == 1 ? skylightArr : [] skylightArr.length == 1 ? skylightArr : [],
sideBeforeRearGearArr.length == 1 ? sideBeforeRearGearArr : [],
sideAfterRearGearArr.length == 1 ? sideAfterRearGearArr : [],
otherGoodsArr.length == 1 ? otherGoodsArr : [],
) )
arr.forEach(val => { arr.forEach(val => {
val.count = 1 val.count = 1
...@@ -919,8 +935,8 @@ Page({ ...@@ -919,8 +935,8 @@ Page({
console.log(orderObj) console.log(orderObj)
// 去除优惠券 参数 // 去除优惠券 参数
delete orderObj.customerCouponId; delete orderObj.customerCouponId
delete orderObj.couponName; delete orderObj.couponName
// 使用优惠券的merchantId 避免优惠券和店区不一致的情况 // 使用优惠券的merchantId 避免优惠券和店区不一致的情况
if (!orderObj.merchantId) if (!orderObj.merchantId)
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!