Commit ee354f1b by Lin

Merge branch 'SAAS+V5.6.1' of http://192.168.3.233:8090/saas_plus/dj-car-boutiqu…

…e-work-wechat into SAAS+V5.6.1
2 parents 9dcd2599 11f20609
Showing 23 changed files with 4709 additions and 2336 deletions
...@@ -231,7 +231,8 @@ Component({ ...@@ -231,7 +231,8 @@ Component({
if (s.goods.goodsId == e.goods.goodsId) { if (s.goods.goodsId == e.goods.goodsId) {
e.active = true e.active = true
e.count = s.count e.count = s.count
e.goods.sellPrice = s.goods.sellPrice // e.goods.sellPrice = s.goods.sellPrice
Object.assign(e.goods, s.goods)
} }
} }
//初始化进来不显示标识 //初始化进来不显示标识
...@@ -246,6 +247,15 @@ Component({ ...@@ -246,6 +247,15 @@ Component({
e.multipleSpecificationsGoods.id e.multipleSpecificationsGoods.id
) { ) {
e.count = s.count e.count = s.count
if (
s.multipleSpecificationsGoods.goods &&
e.multipleSpecificationsGoods.goods
) {
Object.assign(
e.multipleSpecificationsGoods.goods,
s.multipleSpecificationsGoods.goods
)
}
// e.active=s.acitve // e.active=s.acitve
} }
} }
...@@ -283,17 +293,27 @@ Component({ ...@@ -283,17 +293,27 @@ Component({
console.log(arr, 'removeDuplicates') console.log(arr, 'removeDuplicates')
var uniqueArray = [] var uniqueArray = []
for (var i = 0; i < arr.length; i++) { for (var i = 0; i < arr.length; i++) {
let goodsType = let goodsType = ''
arr[i].goodsFlag == 1 ? 'goods' : 'multipleSpecificationsGoods.goods' if (arr[i].goodsFlag == 1) {
goodsType = 'goods'
} else if (arr[i].goodsFlag == 2) {
goodsType = 'multipleSpecificationsGoods.goods'
} else if (arr[i].goodsFlag == 3) {
goodsType = 'packageGoods'
}
let value = this.circulation(arr[i], goodsType)[property] let value = this.circulation(arr[i], goodsType)[property]
// 兼容套餐 // 兼容套餐
let result = uniqueArray.some(item => { let result = uniqueArray.some(item => {
let key = let key = ''
item.goodsFlag == 1 if (item.goodsFlag == 1) {
? 'goods' key = 'goods'
: item.goodsFlag == 2 } else if (item.goodsFlag == 2) {
? 'multipleSpecificationsGoods.goods' key = 'multipleSpecificationsGoods.goods'
: '' } else if (item.goodsFlag == 3) {
key = 'packageGoods'
}
let deepValue = this.circulation(item, key) let deepValue = this.circulation(item, key)
return deepValue ? deepValue[property] === value : false return deepValue ? deepValue[property] === value : false
}) })
...@@ -354,7 +374,7 @@ Component({ ...@@ -354,7 +374,7 @@ Component({
if (chooseGoodsList.length > 0) { if (chooseGoodsList.length > 0) {
chooseGoodsList.map(x => { chooseGoodsList.map(x => {
if (x.goods && x.goods.goodsId == c.goods.goodsId) { if (x.goods && x.goods.goodsId == c.goods.goodsId) {
c.goods.price = x.goods.price || 0 Object.assign(c.goods, x.goods)
} }
}) })
} }
...@@ -373,14 +393,27 @@ Component({ ...@@ -373,14 +393,27 @@ Component({
x.multipleSpecificationsGoods.goods.goodsId == x.multipleSpecificationsGoods.goods.goodsId ==
c.multipleSpecificationsGoods.goods.goodsId c.multipleSpecificationsGoods.goods.goodsId
) { ) {
c.multipleSpecificationsGoods.goods.price = Object.assign(
x.multipleSpecificationsGoods.goods.price || 0 c.multipleSpecificationsGoods.goods,
x.multipleSpecificationsGoods.goods
)
} }
} }
}) })
} }
} }
} }
if (c.packageGoods) {
if (chooseGoodsList.length > 0) {
chooseGoodsList.map(x => {
if (x.goodsFlag == 3 && x.packageGoods) {
if (x.packageGoods.goodsId == c.packageGoods.goodsId) {
Object.assign(c.packageGoods, x.packageGoods)
}
}
})
}
}
} }
}) })
return arr return arr
......
...@@ -6,42 +6,39 @@ Component({ ...@@ -6,42 +6,39 @@ Component({
properties: { properties: {
//1:精品升级 0 会员权益 //1:精品升级 0 会员权益
sceneType: { sceneType: {
type: String, type: String
}, },
show: { show: {
type: Boolean, type: Boolean,
observer: function (n) { } observer: function (n) {}
}, },
goodsData: { goodsData: {
type: Object, type: Object,
observer: function (n) { observer: function (n) {
console.log(n, '999', this.data.chooseGoodsList) console.log(n, '999', this.data.chooseGoodsList)
this.setGoodsActive(); this.setGoodsActive()
} }
}, },
chooseGoodsList: { chooseGoodsList: {
type: Array, type: Array,
observer: function (n) { observer: function (n) {
// this.setGoodsActive(); // this.setGoodsActive();
}, }
}, }
}, },
observers: { observers: {
'show': function (value, old) { show: function (value, old) {
console.log(value, old, 'show'); console.log(value, old, 'show')
let thisPage = wx.$router.getPageInstance() let thisPage = wx.$router.getPageInstance()
thisPage.setData({ thisPage.setData({
scrollDisabled: value scrollDisabled: value
}) })
} }
}, },
/** /**
* 组件的初始数据 * 组件的初始数据
*/ */
data: { data: {},
},
/** /**
* 组件的方法列表 * 组件的方法列表
...@@ -49,25 +46,30 @@ Component({ ...@@ -49,25 +46,30 @@ Component({
methods: { methods: {
setGoodsActive() { setGoodsActive() {
//同步数量 //同步数量
let { let { chooseGoodsList, goodsData } = this.data
chooseGoodsList, if (
goodsData goodsData &&
} = this.data; goodsData.multipleSpecificationsGoods &&
goodsData.multipleSpecificationsGoods.skuGoodsList
) {
goodsData.multipleSpecificationsGoods.skuGoodsList.forEach(c => { goodsData.multipleSpecificationsGoods.skuGoodsList.forEach(c => {
if (chooseGoodsList.length > 0) { if (chooseGoodsList && chooseGoodsList.length > 0) {
chooseGoodsList.map(x => { chooseGoodsList.map(x => {
if (x.goodsFlag == 2) { if (x.goodsFlag == 2) {
if (x.multipleSpecificationsGoods.goods && x.multipleSpecificationsGoods.goods.goodsId == c.goodsId) { if (
x.multipleSpecificationsGoods.goods &&
x.multipleSpecificationsGoods.goods.goodsId == c.goodsId
) {
c.count = x.count || 0 c.count = x.count || 0
} }
} }
}) })
} }
}) })
this.setData({ this.setData({
goodsData goodsData
}) })
}
}, },
hidePopup() { hidePopup() {
this.setData({ this.setData({
...@@ -76,34 +78,23 @@ Component({ ...@@ -76,34 +78,23 @@ Component({
this.triggerEvent('cancel') this.triggerEvent('cancel')
}, },
choose(e) { choose(e) {
let { let { item, index } = e.currentTarget.dataset
item, let { goodsData } = this.data
index let { active } = item
} = e.currentTarget.dataset
let {
goodsData
} = this.data
let {
active
} = item
//全部取消选择 //全部取消选择
goodsData.multipleSpecificationsGoods.skuGoodsList.forEach(item => item.active = false) goodsData.multipleSpecificationsGoods.skuGoodsList.forEach(
item => (item.active = false)
)
goodsData.multipleSpecificationsGoods.skuGoodsList[index].active = !active goodsData.multipleSpecificationsGoods.skuGoodsList[index].active = !active
this.setData({ this.setData({
goodsData goodsData
}) })
}, },
input(e) { input(e) {
let { let { index } = e.currentTarget.dataset
index let { goodsData } = this.data
} = e.currentTarget.dataset
let {
goodsData
} = this.data
console.log(e) console.log(e)
let { let { value } = e.detail
value
} = e.detail
if (value < 1) value = 1 if (value < 1) value = 1
if (value > 999) value = 999 if (value > 999) value = 999
goodsData.multipleSpecificationsGoods.skuGoodsList[index].count = value goodsData.multipleSpecificationsGoods.skuGoodsList[index].count = value
...@@ -117,10 +108,7 @@ Component({ ...@@ -117,10 +108,7 @@ Component({
}) })
}, },
getChooseList() { getChooseList() {
let { let { chooseGoodsList, goodsData } = this.data
chooseGoodsList,
goodsData
} = this.data;
console.log(chooseGoodsList, goodsData) console.log(chooseGoodsList, goodsData)
let chooseList = [], let chooseList = [],
selectList = [] selectList = []
...@@ -134,10 +122,13 @@ Component({ ...@@ -134,10 +122,13 @@ Component({
goodsFlag: 2, goodsFlag: 2,
isFlag: true, isFlag: true,
multipleSpecificationsGoods: { multipleSpecificationsGoods: {
baseGoodsName: goodsData.multipleSpecificationsGoods.baseGoodsName, baseGoodsName:
goodsData.multipleSpecificationsGoods.baseGoodsName,
id: goodsData.multipleSpecificationsGoods.id, id: goodsData.multipleSpecificationsGoods.id,
specificationGoodsMap: goodsData.multipleSpecificationsGoods.specificationGoodsMap, specificationGoodsMap:
specificationList: goodsData.multipleSpecificationsGoods.specificationList, goodsData.multipleSpecificationsGoods.specificationGoodsMap,
specificationList:
goodsData.multipleSpecificationsGoods.specificationList,
goods: c goods: c
} }
}) })
...@@ -148,43 +139,57 @@ Component({ ...@@ -148,43 +139,57 @@ Component({
if (selectList.length) { if (selectList.length) {
selectList.forEach(c => { selectList.forEach(c => {
if (!c.count) c.count = 1 if (!c.count) c.count = 1
c.multipleSpecificationsGoods.goods.price = c.multipleSpecificationsGoods.goods.sellPrice || 0 c.multipleSpecificationsGoods.goods.price =
c.multipleSpecificationsGoods.goods.sellPrice || 0
if (chooseGoodsList.length > 0) { if (chooseGoodsList.length > 0) {
chooseGoodsList.map(x => { chooseGoodsList.map(x => {
if (x.goodsFlag == 2 && x.multipleSpecificationsGoods) { if (x.goodsFlag == 2 && x.multipleSpecificationsGoods) {
console.log(x.multipleSpecificationsGoods.goods && x.multipleSpecificationsGoods.goods.goodsId == c.multipleSpecificationsGoods.goods.goodsId, 'x.multipleSpecificationsGoods.goods && x.multipleSpecificationsGoods.goods.goodsId == c.multipleSpecificationsGoods.goods.goodsId') console.log(
if (x.multipleSpecificationsGoods.goods && x.multipleSpecificationsGoods.goods.goodsId == c.multipleSpecificationsGoods.goods.goodsId) { x.multipleSpecificationsGoods.goods &&
x.multipleSpecificationsGoods.goods.goodsId ==
c.multipleSpecificationsGoods.goods.goodsId,
'x.multipleSpecificationsGoods.goods && x.multipleSpecificationsGoods.goods.goodsId == c.multipleSpecificationsGoods.goods.goodsId'
)
if (
x.multipleSpecificationsGoods.goods &&
x.multipleSpecificationsGoods.goods.goodsId ==
c.multipleSpecificationsGoods.goods.goodsId
) {
console.log(c) console.log(c)
//精品升级需要处理数量,会员权益不需要 //精品升级需要处理数量,会员权益不需要
x.count = c.multipleSpecificationsGoods.goods.count || 0 x.count = c.multipleSpecificationsGoods.goods.count || 0
} }
} }
}) })
let arr = chooseGoodsList.filter(item => item.multipleSpecificationsGoods && item.multipleSpecificationsGoods.goods) let arr = chooseGoodsList.filter(
item =>
item.multipleSpecificationsGoods &&
item.multipleSpecificationsGoods.goods
)
console.log(arr) console.log(arr)
selectList.forEach(oldval => { selectList.forEach(oldval => {
if (oldval.multipleSpecificationsGoods) { if (oldval.multipleSpecificationsGoods) {
if (!arr.some(newVal => newVal.multipleSpecificationsGoods.goods.goodsId == oldval.multipleSpecificationsGoods.goods.goodsId)) { if (
!arr.some(
newVal =>
newVal.multipleSpecificationsGoods.goods.goodsId ==
oldval.multipleSpecificationsGoods.goods.goodsId
)
) {
chooseList.push(oldval) chooseList.push(oldval)
} }
} }
}) })
} else { } else {
chooseList = selectList chooseList = selectList
} }
}) })
} }
console.log(chooseList, 'chooseList') console.log(chooseList, 'chooseList')
chooseList = chooseList.concat(chooseGoodsList) chooseList = chooseList.concat(chooseGoodsList)
console.log(chooseList, 'chooseList') console.log(chooseList, 'chooseList')
return [selectList, chooseList] return [selectList, chooseList]
}, },
confirm() { confirm() {
let [selectList, chooseList] = this.getChooseList() let [selectList, chooseList] = this.getChooseList()
...@@ -194,22 +199,25 @@ Component({ ...@@ -194,22 +199,25 @@ Component({
let thisPage = wx.$router.getPageInstance() let thisPage = wx.$router.getPageInstance()
if (this.data.sceneType == 1) { if (this.data.sceneType == 1) {
thisPage.setData({ thisPage.setData({
goodsList: chooseList, goodsList: chooseList
}); })
thisPage?.setGoodsTotal && thisPage.setGoodsTotal(chooseList); thisPage?.setGoodsTotal && thisPage.setGoodsTotal(chooseList)
} else { } else {
thisPage.setData({ thisPage.setData(
{
['orderInfo.vdQuotationGoodsList']: chooseList ['orderInfo.vdQuotationGoodsList']: chooseList
}, () => { },
() => {
//会员权益 //会员权益
thisPage.totalFee() thisPage.totalFee()
}) }
)
} }
this.setData({ this.setData({
show: false show: false
}) })
}, }
}, },
lifetimes: { lifetimes: {
attached() { attached() {
...@@ -219,5 +227,4 @@ Component({ ...@@ -219,5 +227,4 @@ Component({
}) })
} }
} }
}) })
...@@ -574,12 +574,36 @@ Component({ ...@@ -574,12 +574,36 @@ Component({
if (!chooseList.length) return wx.$util.showToast('请勾选商品') if (!chooseList.length) return wx.$util.showToast('请勾选商品')
this.triggerEvent('confirm', chooseList) this.triggerEvent('confirm', chooseList)
let thisPage = wx.$router.getPageInstance() let thisPage = wx.$router.getPageInstance()
// let total = 0
// chooseList.map(i => (total += i.count * i.price)) let oldList = thisPage.data.orderInfo.vdQuotationGoodsList || []
let mergedList = chooseList.map(newItem => {
let oldItem = oldList.find(oldItem => {
if (newItem.goods && oldItem.goods) {
return newItem.goods.goodsId == oldItem.goods.goodsId
}
if (newItem.packageGoods && oldItem.packageGoods) {
return newItem.packageGoods.packageCode == oldItem.packageGoods.packageCode
}
if (newItem.multipleSpecificationsGoods && oldItem.multipleSpecificationsGoods) {
if (newItem.multipleSpecificationsGoods.goods && oldItem.multipleSpecificationsGoods.goods) {
return newItem.multipleSpecificationsGoods.goods.goodsId == oldItem.multipleSpecificationsGoods.goods.goodsId
}
}
return false
})
if (oldItem) {
let count = newItem.count || 1
return {
...oldItem,
count: count
}
}
return newItem
})
thisPage.setData({ thisPage.setData({
['orderInfo.vdQuotationGoodsList']: chooseList, ['orderInfo.vdQuotationGoodsList']: mergedList,
// ['orderInfo.total']: wx.$util.decimal(total, 2)
}, () => { }, () => {
// console.log(thisPage); // console.log(thisPage);
thisPage.totalFee() thisPage.totalFee()
......
// packageEquity/pages/carEquity/components/SecondStep/SecondStep.js // packageEquity/pages/carEquity/components/SecondStep/SecondStep.js
import data from "../constant/stepData"; import data from '../constant/stepData'
// import fn from '../constant/ruleFn' // import fn from '../constant/ruleFn'
import { priceCounter } from '~/packageEquity/api'
import { import {
priceCounter getProductStrategy,
} from "~/packageEquity/api"; DISCOUNT_TYPE,
import NP from "number-precision"; ORDER_TYPE
const defaultLabelWidth = "var(--fontSize140)"; } from '../../createOrderCarQuotationSimple/productStrategy'
const djPayTypeList = [{ import NP from 'number-precision'
const defaultLabelWidth = 'var(--fontSize140)'
const djPayTypeList = [
{
value: 1, value: 1,
name: "线上支付", name: '线上支付'
}, },
{ {
value: 6, value: 6,
name: "对公转账", name: '对公转账'
}, },
{ {
value: 7, value: 7,
name: "其它收款", name: '其它收款'
}, }
] ]
const merchantPayTypeList = [{ const merchantPayTypeList = [
{
value: 2, value: 2,
name: "门店收款", name: '门店收款'
}] }
]
Component({ Component({
options: { options: {
// styleIsolation: 'apply-shared' // styleIsolation: 'apply-shared'
styleIsolation: "shared", styleIsolation: 'shared'
}, },
// behaviors: ['wx://component-export'], // behaviors: ['wx://component-export'],
attached() { attached() {
console.log("component attached"); console.log('component attached')
this.makeYear(); this.makeYear()
}, },
/** /**
...@@ -42,12 +48,12 @@ Component({ ...@@ -42,12 +48,12 @@ Component({
attached: function () { attached: function () {
// 在组件实例进入页面节点树时执行 // 在组件实例进入页面节点树时执行
}, },
hide: function () {}, hide: function () {}
}, },
properties: { properties: {
serviceInfo: { serviceInfo: {
type: Object, type: Object,
value: () => {}, value: () => {}
}, },
orderInfo: { orderInfo: {
type: Object, type: Object,
...@@ -63,45 +69,58 @@ Component({ ...@@ -63,45 +69,58 @@ Component({
// disable: false // disable: false
// }) // })
// } // }
}, }
}, },
quotationGoodsList: { quotationGoodsList: {
type: Array, type: Array,
value: () => {}, value: () => {}
}, },
paymentMethod: Number paymentMethod: Number,
totalFee: {
type: Number,
value: 0
}
}, },
observers: { observers: {
"orderInfo.outTradeNo": function (value) { 'orderInfo.outTradeNo': function (value) {
// console.log(value, 'outTradeNo') // console.log(value, 'outTradeNo')
// if (value) { // if (value) {
value && value &&
this.setData({ this.setData({
textNameObj: { textNameObj: {
confirmName: "确认", confirmName: '确认',
cancelName: "放弃", cancelName: '放弃'
}, }
}); })
// } // }
}, },
"orderInfo.payType": function (paytype) { 'orderInfo.payType': function (paytype) {
// if (value) { // if (value) {
paytype && if (paytype) {
this.setData({ let { orderInfo } = this.data
["textNameObj.confirmName"]: paytype == 1 ? "下一步·去支付(1/2)" : "下一步·上传凭证", let updateData = {
payTypeList: paytype == 2 ? merchantPayTypeList : djPayTypeList payTypeList: paytype == 2 ? merchantPayTypeList : djPayTypeList
}); }
if (!orderInfo?.resetOrder && !orderInfo?.outTradeNo) {
updateData['textNameObj.confirmName'] =
paytype == 1 ? '下一步·去支付(1/2)' : '下一步·上传凭证'
}
this.setData(updateData)
}
// } // }
}, },
"orderInfo.resetOrder": function (value) { 'orderInfo.resetOrder': function (value) {
// console.log(value, 'outTradeNo') // console.log(value, 'outTradeNo')
// if (value) { // if (value) {
value && value &&
this.setData({ this.setData({
["textNameObj.cancelName"]: "放弃", textNameObj: {
}); confirmName: '确认',
cancelName: '放弃'
}
})
// } // }
}, }
}, },
/** /**
* 组件的初始数据 * 组件的初始数据
...@@ -117,444 +136,547 @@ Component({ ...@@ -117,444 +136,547 @@ Component({
// 默认当前年份 // 默认当前年份
currentIndex: new Date().getFullYear() - (new Date().getFullYear() - 25), currentIndex: new Date().getFullYear() - (new Date().getFullYear() - 25),
currentName: new Date().getFullYear() + "年", currentName: new Date().getFullYear() + '年',
popupShow: false, popupShow: false,
popupInputShow: false, popupInputShow: false,
// customInput: true, // customInput: true,
// secondObj: data.secondObj, // secondObj: data.secondObj,
formRule: data.formRule, formRule: data.formRule,
textNameObj: { textNameObj: {
confirmName: "下一步·去支付(1/2)", confirmName: '下一步·去支付(1/2)',
// editName: '修改', // editName: '修改',
cancelName: "存草稿", cancelName: '存草稿'
}, },
// '1', '2', '3', // '1', '2', '3',
activeNames: ["1", "2", "3", "4"], activeNames: ['1', '2', '3', '4'],
goodsBox: false, goodsBox: false,
skuGoodsBox: false, skuGoodsBox: false,
showPicker: false, showPicker: false,
// optionsSelect: Object.freeze(optionsSelect), // optionsSelect: Object.freeze(optionsSelect),
popObj: { popObj: {
popValue: "", popValue: ''
}, },
popInputObj: { popInputObj: {
type: "add", type: 'add'
}, },
showError: false, showError: false,
insuranceCheck: false, insuranceCheck: false,
testQuotedPriceUpdate: 0, testQuotedPriceUpdate: 0,
payeeList: [{ payeeList: [
{
name: '嘀加收款', name: '嘀加收款',
value: 0 value: 0
}, { },
{
name: '4S店收款', name: '4S店收款',
value: 1 value: 1
}], }
],
payTypeList: djPayTypeList, payTypeList: djPayTypeList,
successDateTime: "", successDateTime: '',
skuGoodsData: { skuGoodsData: {}, //多规格商品数据
}, //多规格商品数据
payTypeObj: { payTypeObj: {
1: '线上支付', 1: '线上支付',
2: '门店收款', 2: '门店收款',
5: '嘀加收款', 5: '嘀加收款',
6: '对公转账', 6: '对公转账',
7: '其它收款' 7: '其它收款'
},
orderTypeList: [
{
text: '正常订单',
value: 1
},
{
text: '打折策略',
value: 2
},
{
text: '买赠策略',
value: 3
},
{
text: '冲量活动',
value: 4
},
{
text: '组合付款',
value: 5
} }
],
orderTypeName: '正常订单',
orderTypeBox: false
}, },
/** /**
* 组件的方法列表 * 组件的方法列表
*/ */
methods: { methods: {
tipsEvent() {
this.triggerEvent('showTips')
},
// 打开订单类型选择
openOrderType() {
this.setData({
orderTypeBox: true
})
},
onCloseOrderType() {
this.setData({
orderTypeBox: false
})
},
onConfirmOrderType(e) {
const { value } = e.detail
let thisPage = wx.$router.getPageInstance()
let { orderInfo } = thisPage.data
let { vdQuotationGoodsList } = orderInfo
// 如果订单类型改变,重置所有商品的折扣信息
if (orderInfo.orderType !== value.value) {
vdQuotationGoodsList.forEach(item => {
const strategy = getProductStrategy(item)
if (strategy) {
// 重置为无折扣
strategy.resetDiscount()
}
})
thisPage.setData({
['orderInfo.vdQuotationGoodsList']: vdQuotationGoodsList
})
this.setGoodsListTotal()
}
thisPage.setData({
'orderInfo.orderType': value.value
})
this.setData({
orderTypeName: value.text,
orderTypeBox: false
})
},
changeProductDiscountType(e) {
console.log(e, 'e')
// Use currentTarget.dataset for bindtap
const { index, gindex, type } = e.currentTarget.dataset
let thisPage = wx.$router.getPageInstance()
let { orderInfo } = thisPage.data
let { vdQuotationGoodsList } = orderInfo
const discountType = parseInt(type)
const item = vdQuotationGoodsList[index]
const strategy = getProductStrategy(item)
if (strategy) {
// 如果是套餐子商品
if (gindex !== undefined && strategy.updateSubItemDiscount) {
strategy.updateSubItemDiscount(gindex, discountType, '') // Reset to empty string
} else {
strategy.setDiscount(discountType, '') // Reset value when type changes
}
thisPage.setData({
['orderInfo.vdQuotationGoodsList']: vdQuotationGoodsList
})
this.setGoodsListTotal()
}
},
toggleGift(e) {
const { index, gindex } = e.currentTarget.dataset
const value = e.detail.value // "1" or "0"
const discountType = value === '1' ? 4 : 3 // 4 is Gift, 3 is No Discount
let thisPage = wx.$router.getPageInstance()
let { orderInfo } = thisPage.data
let { vdQuotationGoodsList } = orderInfo
const item = vdQuotationGoodsList[index]
const strategy = getProductStrategy(item)
if (strategy) {
if (gindex !== undefined && strategy.updateSubItemDiscount) {
strategy.updateSubItemDiscount(gindex, discountType, '')
} else {
strategy.setDiscount(discountType, '')
}
thisPage.setData({
['orderInfo.vdQuotationGoodsList']: vdQuotationGoodsList
})
this.setGoodsListTotal()
}
},
inputDiscountValue(e) {
const { index, gindex } = e.currentTarget.dataset
let { value } = e.detail
let thisPage = wx.$router.getPageInstance()
let { orderInfo } = thisPage.data
let { vdQuotationGoodsList } = orderInfo
const item = vdQuotationGoodsList[index]
const strategy = getProductStrategy(item)
if (strategy) {
// 获取当前的 discountType
let currentType
let basePrice
if (gindex !== undefined && strategy.getSubItemData) {
currentType = strategy.getSubItemData(gindex).discountType
basePrice = strategy.getSubItemBasePrice(gindex)
} else {
currentType = strategy.getData().discountType
basePrice = strategy.getBasePrice()
}
// 1:默认值为空不是为0
if (value === '') {
// Allow empty value
} else {
// Remove non-digit and non-dot characters
value = value.replace(/[^\d.]/g, '')
// Ensure only one dot
const parts = value.split('.')
if (parts.length > 2) {
value = parts[0] + '.' + parts.slice(1).join('')
}
if (currentType == 1) {
// 折扣比例
// 2:是折扣比例的话,最多只能输入1位整数和两个小数
const dotIndex = value.indexOf('.')
if (dotIndex !== -1) {
let integerPart = value.substring(0, dotIndex)
let decimalPart = value.substring(dotIndex + 1)
if (integerPart.length > 1) {
integerPart = integerPart.slice(0, 1)
}
if (decimalPart.length > 2) {
decimalPart = decimalPart.slice(0, 2)
}
value = integerPart + '.' + decimalPart
} else {
if (value.length > 1) {
value = value.slice(0, 1)
}
}
} else if (currentType == 2) {
// 折扣金额
// 3:是折扣金额的话,最大值不能超过 item.goods.sellPrice 的值,超过取 item.goods.sellPrice,输入最多不超过两个小数
const dotIndex = value.indexOf('.')
if (dotIndex !== -1) {
let integerPart = value.substring(0, dotIndex)
let decimalPart = value.substring(dotIndex + 1)
if (decimalPart.length > 2) {
decimalPart = decimalPart.slice(0, 2)
}
value = integerPart + '.' + decimalPart
}
if (parseFloat(value) > parseFloat(basePrice)) {
value = basePrice.toString()
}
}
}
if (gindex !== undefined && strategy.updateSubItemDiscount) {
strategy.updateSubItemDiscount(gindex, currentType, value)
} else {
strategy.setDiscount(currentType, value)
}
thisPage.setData({
['orderInfo.vdQuotationGoodsList']: vdQuotationGoodsList
})
this.setGoodsListTotal()
}
},
changePrice(e) { changePrice(e) {
let { let { value } = e.detail
value let { index, item: datasetItem } = e.currentTarget.dataset
} = e.detail; let thisPage = wx.$router.getPageInstance()
let { let { orderInfo } = thisPage.data
index, let item = orderInfo.vdQuotationGoodsList[index]
item
} = e.currentTarget.dataset; let number = wx.$util.removeLeadingZerosAndEnsureNonNegative(value)
console.log(item, "item");
let thisPage = wx.$router.getPageInstance(); const strategy = getProductStrategy(item)
let target = `orderInfo.vdQuotationGoodsList[${index}].goods.price`; if (strategy) {
// value = value || 0 strategy.setBasePrice(number)
// let [number, decimal] = value.split('.') // Sync price for display
// if (decimal != undefined) { item.goods.price = number
// decimal = decimal.substring(0, 2)
// number += `.${decimal}`
// }
// console.log(item.shopMinPrice||0,'item?.shopMinPrice||0');
console.log(value, "value");
let number = wx.$util.removeLeadingZerosAndEnsureNonNegative(value);
thisPage.setData({ thisPage.setData({
[target]: number, [`orderInfo.vdQuotationGoodsList[${index}]`]: item
}); })
// if (item.goods?.validMinSellPrice == 'Y' && (item.goods.minSellPrice || 0) > number) { }
// thisPage.setData({ this.setGoodsListTotal()
// [target]: item.goods.minSellPrice
// })
// wx.$util.showToast('价格不可低于商品最低价')
// }
this.setGoodsListTotal();
}, },
//多规格单价修改 //多规格单价修改
changeSpecific(e) { changeSpecific(e) {
let { let { value } = e.detail
value let { index, item: datasetItem } = e.currentTarget.dataset
} = e.detail; let thisPage = wx.$router.getPageInstance()
let { let { orderInfo } = thisPage.data
index, let item = orderInfo.vdQuotationGoodsList[index]
item
} = e.currentTarget.dataset; let number = wx.$util.removeLeadingZerosAndEnsureNonNegative(value)
console.log(item, "item");
let thisPage = wx.$router.getPageInstance(); const strategy = getProductStrategy(item)
let target = `orderInfo.vdQuotationGoodsList[${index}].multipleSpecificationsGoods.goods.price`; if (strategy) {
let number = wx.$util.removeLeadingZerosAndEnsureNonNegative(value); strategy.setBasePrice(number)
// Sync price for display
item.multipleSpecificationsGoods.goods.price = strategy.getPrice()
thisPage.setData({ thisPage.setData({
[target]: number, [`orderInfo.vdQuotationGoodsList[${index}]`]: item
}); })
this.setGoodsListTotal(); }
this.setGoodsListTotal()
}, },
changePricePackage(e) { changePricePackage(e) {
let { let { value } = e.detail
value let { index, childind } = e.currentTarget.dataset
} = e.detail; let thisPage = wx.$router.getPageInstance()
let { let { orderInfo } = thisPage.data
index, let item = orderInfo.vdQuotationGoodsList[index]
item,
childind let number = wx.$util.removeLeadingZerosAndEnsureNonNegative(value)
} = e.currentTarget.dataset;
// console.log(item, 'item'); const strategy = getProductStrategy(item)
let thisPage = wx.$router.getPageInstance(); if (strategy) {
let { strategy.updateSubItemPrice(childind, number)
orderInfo: {
vdQuotationGoodsList // Sync price for display
}, const subItem = item.packageGoods.goodsList[childind]
} = thisPage.data; subItem.price = subItem.basePrice
// console.log(childind, 'childind');
// console.log(thisPage.data.orderInfo.vdQuotationGoodsList[index].packageGoods.goodsList[childind], 'orderInfo.vdQuotationGoodsList[${index}].packageGoods[${childind}]');
let target = `orderInfo.vdQuotationGoodsList[${index}].packageGoods.goodsList[${childind}].price`;
let packagePriceStr = `orderInfo.vdQuotationGoodsList[${index}].price`;
// value = value || 0
// let [number, decimal] = value.split('.')
// if (decimal != undefined) {
// decimal = decimal.substring(0, 2)
// number += `.${decimal}`
// }
// console.log(item.shopMinPrice||0,'item?.shopMinPrice||0');
// if ((item.shopMinPrice||0) > value) {
// wx.$util.showToast('单价不可低于商品最低价')
// }
let number = wx.$util.removeLeadingZerosAndEnsureNonNegative(value);
let minSellPric = parseInt(
vdQuotationGoodsList[index].packageGoods.goodsList[childind]
.minSellPric || 0
);
// console.log((minSellPric || 0) > number);
// if ((minSellPric || 0) > number) {
// number = minSellPric
// wx.$util.showToast('价格不可低于商品最低价')
// }
vdQuotationGoodsList[index].packageGoods.goodsList[childind].price =
number;
let packagePrice = vdQuotationGoodsList[
index
].packageGoods.goodsList.reduce((num, item) => {
// num = num + parseFloat(item.price || 0)
num = NP.plus(num, parseFloat(item.price || 0));
// num = num + parseFloat(item.price || 0)
return num;
}, 0);
// console.log(packagePrice);
thisPage.setData({ thisPage.setData({
[target]: number, [`orderInfo.vdQuotationGoodsList[${index}]`]: item
[packagePriceStr]: packagePrice, })
}); }
// if (item.packageGoods?.goodsList[childind]?.validMinSellPrice == 'Y' && (item.packageGoods.goodsList[childind].minSellPrice || 0) > number) { this.setGoodsListTotal()
// wx.$util.showToast('价格不可低于商品最低价')
// thisPage.setData({
// [target]: item.packageGoods.goodsList[childind].minSellPrice
// })
// packagePrice = thisPage.data.orderInfo?.vdQuotationGoodsList[index].packageGoods.goodsList.reduce((num, item) => {
// num = num + parseFloat(item.price || 0)
// return num
// }, 0)
// thisPage.setData({
// [packagePriceStr]: packagePrice
// })
// }
this.setGoodsListTotal();
}, },
delGoodsList(e) { delGoodsList(e) {
let { let { index } = e.currentTarget.dataset
index let thisPage = wx.$router.getPageInstance()
} = e.currentTarget.dataset; let { orderInfo } = thisPage.data
let thisPage = wx.$router.getPageInstance();
let {
orderInfo
} = thisPage.data;
// console.log(orderInfo,'orderInfo'); // console.log(orderInfo,'orderInfo');
orderInfo.vdQuotationGoodsList.splice(index, 1); orderInfo.vdQuotationGoodsList.splice(index, 1)
thisPage.setData({ thisPage.setData({
["orderInfo.vdQuotationGoodsList"]: orderInfo.vdQuotationGoodsList, ['orderInfo.vdQuotationGoodsList']: orderInfo.vdQuotationGoodsList
// ['orderInfo.total']:wx.$util.decimal(total, 2) // ['orderInfo.total']:wx.$util.decimal(total, 2)
}); })
this.setGoodsListTotal(); this.setGoodsListTotal()
}, },
setGoodsListTotal() { setGoodsListTotal() {
let thisPage = wx.$router.getPageInstance(); let thisPage = wx.$router.getPageInstance()
let { let { orderInfo } = thisPage.data
orderInfo let total = 0
} = thisPage.data; orderInfo.vdQuotationGoodsList.forEach(item => {
console.log(orderInfo, 'orderInfo'); const strategy = getProductStrategy(item)
let total = 0; if (strategy) {
orderInfo.vdQuotationGoodsList.map((i) => { strategy.performValidation()
if (i.goods) { total = NP.plus(total, strategy.calculateSubtotal())
// total += parseFloat(i.goods.count || 1) * parseFloat(i.goods.price)
total = NP.plus( // Sync package price if it's a package
total, if (item.packageGoods) {
NP.times(parseFloat(i.count || 1), parseFloat(i.goods.price)) item.price = item.packageGoods.price
); }
} }
})
if (i.packageGoods) {
i.packageGoods.goodsList.map((ele) => {
// total += parseFloat(ele.count || 1) * parseFloat(ele.price)
total = NP.plus(
total,
NP.times(parseFloat(i.count || 1), parseFloat(ele.price))
);
});
}
//多规格
if (i.multipleSpecificationsGoods) {
if (i.multipleSpecificationsGoods.goods) {
// total += parseFloat(i.goods.count || 1) * parseFloat(i.goods.price)
total = NP.plus(
total,
NP.times(parseFloat(i.count || 1), parseFloat(i.multipleSpecificationsGoods.goods.price))
);
}
}
});
console.log(total, "total");
thisPage.setData({ thisPage.setData({
["orderInfo.total"]: wx.$util.decimal(total, 2), ['orderInfo.total']: wx.$util.decimal(total, 2),
}); ['orderInfo.vdQuotationGoodsList']: orderInfo.vdQuotationGoodsList
})
}, },
chooseGoods(e) { chooseGoods(e) {
console.log(e); console.log(e)
// let {} // let {}
this.setData({ this.setData({
chooseGoods: e.detail, chooseGoods: e.detail
}); })
// chooseGoods // chooseGoods
}, },
showPopup(e) { showPopup(e) {
let { let { quotationGoodsList } = this.data
quotationGoodsList let { showName } = e.currentTarget.dataset
} = this.data; if (showName == 'goodsBox' && quotationGoodsList.length < 1) {
let {
showName
} = e.currentTarget.dataset;
if (showName == "goodsBox" && quotationGoodsList.length < 1) {
// if (!data.length) // if (!data.length)
return wx.showModal({ return wx.showModal({
title: "温馨提示", title: '温馨提示',
content: "商品已下架或计算规则未配置,请联系客服处理。", content: '商品已下架或计算规则未配置,请联系客服处理。',
showCancel: false, showCancel: false,
confirmText: "确定", confirmText: '确定',
confirmColor: "#347BFF", confirmColor: '#347BFF'
}); })
// return wx.$util.showToast( '门店无配置商品') // return wx.$util.showToast( '门店无配置商品')
} }
console.log(showName, "showName"); console.log(showName, 'showName')
if (showName == "goodsBox") { if (showName == 'goodsBox') {
this.setData({ this.setData({
[showName]: false, [showName]: false
}); })
} }
this.setData({ this.setData({
[showName]: true, [showName]: true
}); })
}, },
onChangeInsurance(e) { onChangeInsurance(e) {
console.log(e); console.log(e)
let { let { detail } = e
detail let { id } = e.currentTarget.dataset
} = e; if (!detail) return false
let { let thisPage = wx.$router.getPageInstance()
id
} = e.currentTarget.dataset;
if (!detail) return false;
let thisPage = wx.$router.getPageInstance();
// console.log(detail, 'detail') // console.log(detail, 'detail')
let { let { quotationGoodsList } = this.data
quotationGoodsList let goodsItem = quotationGoodsList.find(item => item.id == id)
} = this.data;
let goodsItem = quotationGoodsList.find((item) => item.id == id);
let params = thisPage.getInsurance(); let params = thisPage.getInsurance()
let owner = thisPage.getOwnerInfo(); let owner = thisPage.getOwnerInfo()
// const owner = wx.$util.deepClone(thisPage.data.owner) // const owner = wx.$util.deepClone(thisPage.data.owner)
owner.salesType = owner.salesType == "售后" ? 1 : 0; owner.salesType = owner.salesType == '售后' ? 1 : 0
params.owner = owner; params.owner = owner
params.goodsId = goodsItem.id; params.goodsId = goodsItem.id
params.goodsName = goodsItem.goodsName; params.goodsName = goodsItem.goodsName
// params.owner = owner // params.owner = owner
// params.owner.price = this.multipliedByHundred(orderInfo.owner?.price) || '' // params.owner.price = this.multipliedByHundred(orderInfo.owner?.price) || ''
// console.log(thisPage) // console.log(thisPage)
if (params.owner?.buyCarTime) { if (params.owner?.buyCarTime) {
delete params.owner.buyCarTime; delete params.owner.buyCarTime
} }
// quotedPriceUpdate // quotedPriceUpdate
delete params?.quotedPriceUpdate; delete params?.quotedPriceUpdate
// if (params?.quotedPriceUpdate) { // if (params?.quotedPriceUpdate) {
// } // }
wx.$util.showLoading(); wx.$util.showLoading()
// console.log(params, 'params') // console.log(params, 'params')
priceCounter(params) priceCounter(params)
.then((result) => { .then(result => {
wx.hideLoading(); wx.hideLoading()
console.log("result", result); console.log('result', result)
let { let { data, code, message } = result
data,
code,
message
} = result;
if (code) { if (code) {
let thisPage = wx.$router.getPageInstance(); let thisPage = wx.$router.getPageInstance()
// thisPage.setData({ // thisPage.setData({
// // ['orderInfo.quotedPriceUpdate']: data.quotedPriceUpdate // // ['orderInfo.quotedPriceUpdate']: data.quotedPriceUpdate
// }) // })
// 如果是补录订单,还要做一个订单最低价格对比 // 如果是补录订单,还要做一个订单最低价格对比
let { let { orderInfo, totalFee } = thisPage.data
orderInfo, let minEquityPrice = wx.$util.divideByHundred(data.minEquityPrice)
totalFee
} = thisPage.data;
let minEquityPrice = wx.$util.divideByHundred(data.minEquityPrice);
// debugger // debugger
if (orderInfo.outTradeNo && data.minEquityPrice > totalFee) { if (orderInfo.outTradeNo && data.minEquityPrice > totalFee) {
wx.$util.showToast("选择商品的最低价格不能大于补录价格"); wx.$util.showToast('选择商品的最低价格不能大于补录价格')
return; return
} }
thisPage.setData({ thisPage.setData({
["orderInfo.quotedPriceUpdate"]: wx.$util.divideByHundred( ['orderInfo.quotedPriceUpdate']: wx.$util.divideByHundred(
orderInfo?.outTradeNo ? totalFee : data.quotedPriceUpdate orderInfo?.outTradeNo ? totalFee : data.quotedPriceUpdate
), ),
["orderInfo.minEquityPrice"]: minEquityPrice, ['orderInfo.minEquityPrice']: minEquityPrice,
["orderInfo.goodsId"]: goodsItem.id, ['orderInfo.goodsId']: goodsItem.id,
["orderInfo.goodsName"]: goodsItem.goodsName, ['orderInfo.goodsName']: goodsItem.goodsName
}); })
// return // return
this.setData({ this.setData({
// insuranceCheck: true, // insuranceCheck: true,
showError: false, showError: false,
testQuotedPriceUpdate: wx.$util.divideByHundred( testQuotedPriceUpdate: wx.$util.divideByHundred(
data.quotedPriceUpdate data.quotedPriceUpdate
), )
}); })
} else { } else {
wx.$util.showToast({ wx.$util.showToast({
title: message || "获取报价失败", title: message || '获取报价失败',
icon: "error", icon: 'error'
}); })
} }
}) })
.catch((err) => {}); .catch(err => {})
}, },
//--------自定义方法---------- //--------自定义方法----------
// 选择年份的区域,弹出弹窗框 // 选择年份的区域,弹出弹窗框
chooseYear() { chooseYear() {
console.log("选择年份"); console.log('选择年份')
this.setData({ this.setData({
showYear: true, showYear: true
}); })
}, },
// 弹出框确认事件 // 弹出框确认事件
onConfirm(e) { onConfirm(e) {
// console.log(e, 1111) // console.log(e, 1111)
let { let { value } = e.detail
value let thisPage = wx.$router.getPageInstance()
} = e.detail; console.log(value, 'value')
let thisPage = wx.$router.getPageInstance();
console.log(value, "value");
thisPage.setData({ thisPage.setData({
// ['orderInfo' + '.' + attrtype + '.' + attrname]: value // ['orderInfo' + '.' + attrtype + '.' + attrname]: value
["orderInfo.vehiclesAndVessels.compensation"]: value + "年", ['orderInfo.vehiclesAndVessels.compensation']: value + '年'
}); })
this.setData({ this.setData({
showYear: false, showYear: false
}); })
this.cancelInsuranceCheck(); this.cancelInsuranceCheck()
}, },
cancelInsuranceCheck() { cancelInsuranceCheck() {
let thisPage = wx.$router.getPageInstance(); let thisPage = wx.$router.getPageInstance()
thisPage.setData({ thisPage.setData({
["orderInfo.quotedPriceUpdate"]: "", ['orderInfo.quotedPriceUpdate']: '',
["orderInfo.goodsId"]: "", ['orderInfo.goodsId']: '',
["orderInfo.goodsName"]: "", ['orderInfo.goodsName']: '',
["orderInfo.valueAddedVehicleLoss"]: { ['orderInfo.valueAddedVehicleLoss']: {
appreciation: "", appreciation: '',
goodsName: "", goodsName: '',
type: 3, type: 3
}, }
}); })
this.setData({ this.setData({
insuranceCheck: false, insuranceCheck: false
}); })
}, },
// 取消选择年份的弹框 // 取消选择年份的弹框
onCancel() { onCancel() {
let that = this; let that = this
that.setData({ that.setData({
showYear: false, showYear: false
}); })
}, },
// 对选择时间进行单独的处理 // 对选择时间进行单独的处理
makeYear() { makeYear() {
// console.log('makeYear') // console.log('makeYear')
let year = []; let year = []
let currentDate = new Date(); let currentDate = new Date()
console.log(currentDate.getFullYear()); console.log(currentDate.getFullYear())
for ( for (
let j = currentDate.getFullYear() - 25; j < currentDate.getFullYear(); j++ let j = currentDate.getFullYear() - 25;
j < currentDate.getFullYear();
j++
) { ) {
year.push(j); year.push(j)
} }
for ( for (
let i = currentDate.getFullYear(); i <= currentDate.getFullYear() + 25; i++ let i = currentDate.getFullYear();
i <= currentDate.getFullYear() + 25;
i++
) { ) {
year.push(i); year.push(i)
} }
// console.log(year, 'year') // console.log(year, 'year')
this.setData({ this.setData({
columns: year, columns: year
}); })
}, },
handlePopupShow(e) { handlePopupShow(e) {
// console.log(e) // console.log(e)
let { let { disable } = this.data
disable if (disable) return false //修改权益价时,不可修改
} = this.data;
if (disable) return false; //修改权益价时,不可修改
// let { attrtype, attrname, typename } = e.target.dataset // let { attrtype, attrname, typename } = e.target.dataset
let { let { attrtype, attrname, typename } = e.currentTarget.dataset
attrtype, console.log(attrtype, attrname, typename, 'attrType, attrName')
attrname, let thisPage = wx.$router.getPageInstance()
typename let popValue = thisPage.data.orderInfo?.[attrtype]?.[attrname] || ''
} = e.currentTarget.dataset;
console.log(attrtype, attrname, typename, "attrType, attrName");
let thisPage = wx.$router.getPageInstance();
let popValue = thisPage.data.orderInfo?.[attrtype]?.[attrname] || "";
this.setData({ this.setData({
popupShow: true, popupShow: true,
// popValue // popValue
...@@ -562,203 +684,180 @@ Component({ ...@@ -562,203 +684,180 @@ Component({
attrtype, attrtype,
attrname, attrname,
popValue, popValue,
typename, typename
}, }
}); })
}, },
handlePopInputShow(e) { handlePopInputShow(e) {
// console.log(e) // console.log(e)
let { let { disable } = this.data
disable if (disable) return false //修改权益价时,不可修改
} = this.data;
if (disable) return false; //修改权益价时,不可修改
let { let { handletype, index } = e.target.dataset
handletype, console.log(handletype, index, 'type, index')
index let thisPage = wx.$router.getPageInstance()
} = e.target.dataset; let popValue = ''
console.log(handletype, index, "type, index"); if (handletype == 'edit') {
let thisPage = wx.$router.getPageInstance();
let popValue = "";
if (handletype == "edit") {
popValue = popValue =
thisPage.data.orderInfo?.["otherInsuranceList"]?.[index] || ""; thisPage.data.orderInfo?.['otherInsuranceList']?.[index] || ''
} }
console.log(popValue, "popValue"); console.log(popValue, 'popValue')
this.setData({ this.setData({
popupInputShow: true, popupInputShow: true,
popInputObj: { popInputObj: {
handletype, handletype,
index, index,
...popValue, ...popValue
}, }
}); })
}, },
btnTap(e) { btnTap(e) {
// console.log(e) // console.log(e)
let { let { name } = e.detail
name
} = e.detail;
// debugger // debugger
// let { attrtype, attrname, typename } = this.data.tableObj // let { attrtype, attrname, typename } = this.data.tableObj
let { let { showError, insuranceCheck, orderInfo, successDateTime } = this.data
showError,
insuranceCheck,
orderInfo,
successDateTime
} = this.data;
if (successDateTime && !orderInfo.resetOrder) { if (successDateTime && !orderInfo.resetOrder) {
let thisPage = wx.$router.getPageInstance(); let thisPage = wx.$router.getPageInstance()
const _temp = new Date(successDateTime).format("yyyy-MM-dd hh:mm:ss"); const _temp = new Date(successDateTime).format('yyyy-MM-dd hh:mm:ss')
thisPage.setData({ thisPage.setData({
["orderInfo.pay2Time"]: _temp, ['orderInfo.pay2Time']: _temp
}); })
} }
if (showError) return wx.$util.showToast("权益价不能小于最低权益价"); if (showError) return wx.$util.showToast('权益价不能小于最低权益价')
// 校验商品最低价 // 校验商品最低价
let goodsError = []; let goodsError = []
orderInfo?.vdQuotationGoodsList?.forEach((val) => { orderInfo?.vdQuotationGoodsList?.forEach(val => {
if (val.goods) { if (val.goods) {
val.goods.checkError = false; val.goods.checkError = false
if ( if (
val.goods?.price < val.goods.minSellPrice && val.goods?.price < val.goods.minSellPrice &&
val.goods?.validMinSellPrice == "Y" val.goods?.validMinSellPrice == 'Y'
) { ) {
val.goods.checkError = true; val.goods.checkError = true
goodsError.push(val.goods); goodsError.push(val.goods)
} }
} }
if (val.packageGoods) { if (val.packageGoods) {
val.packageGoods?.goodsList.forEach((subV) => { val.packageGoods?.goodsList.forEach(subV => {
subV.checkError = false; subV.checkError = false
if ( if (
subV?.price < subV?.minSellPrice && subV?.price < subV?.minSellPrice &&
subV?.validMinSellPrice == "Y" subV?.validMinSellPrice == 'Y'
) { ) {
subV.checkError = true; subV.checkError = true
goodsError.push(val.goods); goodsError.push(val.goods)
} }
}); })
} }
if (val.multipleSpecificationsGoods) { if (val.multipleSpecificationsGoods) {
val.multipleSpecificationsGoods.goods.checkError = false; val.multipleSpecificationsGoods.goods.checkError = false
if ( if (
val.multipleSpecificationsGoods.goods?.price < val.multipleSpecificationsGoods.goods.minSellPrice && val.multipleSpecificationsGoods.goods?.price <
val.multipleSpecificationsGoods.goods?.validMinSellPrice == "Y" val.multipleSpecificationsGoods.goods.minSellPrice &&
val.multipleSpecificationsGoods.goods?.validMinSellPrice == 'Y'
) { ) {
val.multipleSpecificationsGoods.goods.checkError = true; val.multipleSpecificationsGoods.goods.checkError = true
goodsError.push(val.multipleSpecificationsGoods.goods); goodsError.push(val.multipleSpecificationsGoods.goods)
} }
} }
}); })
this.setData({ this.setData({
orderInfo, orderInfo
}); })
if (goodsError?.length) if (goodsError?.length)
return wx.$util.showToast("价格不可低于商品最低价"); return wx.$util.showToast('价格不可低于商品最低价')
if (name == "confirm") { if (name == 'confirm') {
// 不是修改报价时,需要勾选保险 // 不是修改报价时,需要勾选保险
// if (!insuranceCheck && !orderInfo.modifyEquityQuotation) return wx.$util.showToast('请先勾选保险') // if (!insuranceCheck && !orderInfo.modifyEquityQuotation) return wx.$util.showToast('请先勾选保险')
this.triggerEvent("confirm"); this.triggerEvent('confirm')
} else { } else {
this.triggerEvent("editSave"); this.triggerEvent('editSave')
} }
}, },
// 切换收款方式 // 切换收款方式
changePayee(e) { changePayee(e) {
let { let { payee } = e.currentTarget.dataset
payee let { orderInfo } = this.data
} = e.currentTarget.dataset
let {
orderInfo
} = this.data
if (orderInfo.resetOrder || orderInfo.outTradeArr) return if (orderInfo.resetOrder || orderInfo.outTradeArr) return
let thisPage = wx.$router.getPageInstance() let thisPage = wx.$router.getPageInstance()
thisPage.setData({ thisPage.setData({
["orderInfo.payee"]: payee ['orderInfo.payee']: payee
}) })
if (payee == 1) { if (payee == 1) {
this.setData({ this.setData({
payTypeList: merchantPayTypeList payTypeList: merchantPayTypeList
}) })
thisPage.setData({ thisPage.setData({
["orderInfo.payType"]: 2 ['orderInfo.payType']: 2
}) })
} else { } else {
this.setData({ this.setData({
payTypeList: djPayTypeList payTypeList: djPayTypeList
}) })
thisPage.setData({ thisPage.setData({
["orderInfo.payType"]: 1 ['orderInfo.payType']: 1
}) })
} }
}, },
// 切换支付方式 // 切换支付方式
changePayType(e) { changePayType(e) {
console.log(e); console.log(e)
let { let { paytype } = e.currentTarget.dataset
paytype let thisPage = wx.$router.getPageInstance()
} = e.currentTarget.dataset;
let thisPage = wx.$router.getPageInstance();
thisPage.setData({ thisPage.setData({
// ['orderInfo.quotedPriceUpdate']: '', // ['orderInfo.quotedPriceUpdate']: '',
["orderInfo.payType"]: paytype, ['orderInfo.payType']: paytype
}); })
// this.setData({ // this.setData({
// ['textNameObj.confirmName']: paytype == 1?'下一步·去支付(1/2)':'下一步·上传凭证' // ['textNameObj.confirmName']: paytype == 1?'下一步·去支付(1/2)':'下一步·上传凭证'
// }) // })
}, },
handleInput(e) { handleInput(e) {
let value = e.detail; let value = e.detail
console.log(e); console.log(e)
let { let { attrname, attrtype, type } = e.currentTarget.dataset
attrname,
attrtype,
type
} = e.currentTarget.dataset;
value = type == "number" ? wx.$util.numberFixedDigit(value) : value; value = type == 'number' ? wx.$util.numberFixedDigit(value) : value
if (type == "number") { if (type == 'number') {
value = parseFloat(value) > 2000000 ? 2000000 : value; value = parseFloat(value) > 2000000 ? 2000000 : value
} }
let thisPage = wx.$router.getPageInstance(); let thisPage = wx.$router.getPageInstance()
console.log(attrtype); console.log(attrtype)
// onChangeInsurance // onChangeInsurance
// onChangeInsurance // onChangeInsurance
if (attrname == "quotedPriceUpdate") { if (attrname == 'quotedPriceUpdate') {
let { let { orderInfo } = this.data
orderInfo let showError = orderInfo.minEquityPrice <= value ? false : true
} = this.data;
let showError = orderInfo.minEquityPrice <= value ? false : true;
this.setData({ this.setData({
showError, showError
}); })
if (showError) return false; if (showError) return false
} }
// ['orderInfo' + '.' + attrType] // ['orderInfo' + '.' + attrType]
// console.log(['orderInfo' + '.' + attrType], '2') // console.log(['orderInfo' + '.' + attrType], '2')
thisPage.setData({ thisPage.setData({
["orderInfo" + "." + attrtype + "." + attrname]: value, ['orderInfo' + '.' + attrtype + '.' + attrname]: value
}); })
attrname != "quotedPriceUpdate" && this.cancelInsuranceCheck(); attrname != 'quotedPriceUpdate' && this.cancelInsuranceCheck()
// console.log(thisPage.data) // console.log(thisPage.data)
}, },
onChanteSuccessDate(e) { onChanteSuccessDate(e) {
this.setData({ this.setData({
successDateTime: e.detail, successDateTime: e.detail,
showDateSelect: false, showDateSelect: false
}); })
}, },
toSelectDate() { toSelectDate() {
this.setData({ this.setData({
showDateSelect: true, showDateSelect: true
}); })
}, },
closeDateModal() { closeDateModal() {
this.setData({ this.setData({
showDateSelect: false, showDateSelect: false
}); })
}, }
// onChange (e){ // onChange (e){
// console.log(e); // console.log(e);
...@@ -771,5 +870,5 @@ Component({ ...@@ -771,5 +870,5 @@ Component({
// this.number= e.target.value // this.number= e.target.value
// }) // })
// }, // },
},
});
\ No newline at end of file \ No newline at end of file
}
})
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
"popup-input": "../PopupInput/PopupInput", "popup-input": "../PopupInput/PopupInput",
"goods": "../GoodsPackage/Goods", "goods": "../GoodsPackage/Goods",
"sku-goods": "/components/SkuGoods/Goods", "sku-goods": "/components/SkuGoods/Goods",
"date-select":"/components/DateSelect/dateSelect" "date-select":"/components/DateSelect/dateSelect",
"van-picker": "@vant/weapp/picker/index"
} }
} }
\ No newline at end of file \ No newline at end of file
...@@ -265,63 +265,129 @@ ...@@ -265,63 +265,129 @@
} }
.goods-box .goods { .goods-box .goods {
min-height: var(--fontSize118); // background: #F7F8FA;
border-bottom: var(--fontSize2) solid rgba(195, 195, 195, .3); background: #f7f8fa;
border-radius: var(--fontSize16);
margin: var(--fontSize16) var(--fontSize0);
display: flex; display: flex;
align-items: center; // flex-direction: column;
padding: 20rpx var(--fontSize28) 20rpx var(--fontSize90); padding: var(--fontSize24);
justify-content: space-between; justify-content: space-between;
font-size: var(--fontSize28); font-size: var(--fontSize28);
background: #F5F5F7;
position: relative; position: relative;
color: #222222; /* align-items: center; */
} }
.goods-box .goods { .goods-box .goods+.goods {
margin-top: 16rpx;
}
.goods-box .goods .icon {
width: var(--fontSize40);
height: var(--fontSize40);
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: space-between; justify-content: center;
min-height: var(--fontSize118); margin-right: var(--fontSize20);
border-bottom: var(--fontSize2) solid rgba(195, 195, 195, .3); flex-shrink: 0;
padding: 20rpx var(--fontSize28) 20rpx var(--fontSize90);
font-size: var(--fontSize28);
background: #F5F5F7;
position: relative;
color: #222222;
} }
.goods .package { .goods-box .goods .icon image {
background: #fff; width: 100%;
height: 100%;
} }
.goods.total-box { .goods-box .goods .goods-content {
background: #fff; flex: 1;
} display: flex;
flex-direction: column;
overflow: hidden;
.goods .icon { .alias {
position: absolute; font-size: 12px;
top: 50%; color: #222222 !important;
left: var(--fontSize40); margin-bottom: 8rpx;
width: var(--fontSize40); }
height: var(--fontSize40);
transform: translateY(-50%);
} }
.goods-box .goods .name { .goods-box .goods .name {
color: #FF6601; color: #FF6601;
max-width: var(--fontSize450); width: 100%;
// margin-bottom: var(--fontSize8);
word-break: break-all;
}
.goods-box .goods .bottom_box {
display: flex;
align-items: center;
justify-content: space-between;
}
.goods-box .goods .bottom_box .left {
display: flex;
flex-direction: column;
flex: 1;
margin-right: var(--fontSize20);
}
.goods-box .goods .bottom_box .right {
display: flex;
align-items: center;
justify-content: flex-start;
}
.goods-box .goods .package {
display: flex;
align-items: center;
justify-content: space-between;
width: 100%;
}
.goods-box .goods .package .name {
width: auto;
margin-bottom: 0;
flex: 1;
padding-right: var(--fontSize20);
}
.goods-box .goods .package .package-price {
font-weight: 600;
color: #333333;
}
.goods-box .goods .packageBox {
width: 100%;
margin-top: var(--fontSize20);
}
.goods-box .goods .packageBox .itemSty {
margin-bottom: var(--fontSize24);
padding-bottom: var(--fontSize24);
border-bottom: 1px dashed #eeeeee;
}
.goods-box .goods .packageBox .itemSty:last-child {
margin-bottom: 0;
padding-bottom: 0;
border-bottom: none;
} }
.goods-box .goods .price-box { .goods-box .goods .price-box {
width: var(--fontSize240); // width: var(--fontSize240);
height: var(--fontSize64); height: var(--fontSize64);
background: #FFFFFF; background: #FFFFFF;
border: var(--fontSize2) solid #E6E6E6; border: var(--fontSize2) solid #E6E6E6;
border-radius: var(--fontSize8); border-radius: var(--fontSize8);
position: relative; position: relative;
margin-right: var(--fontSize32); margin-right: var(--fontSize32);
margin-left: auto; max-width: 160rpx;
min-width: 160rpx; }
.serveName {
width: 100%;
white-space: pre-wrap;
word-wrap: break-word;
overflow-wrap: break-word;
} }
.price-box-Modify { .price-box-Modify {
...@@ -331,8 +397,8 @@ ...@@ -331,8 +397,8 @@
font-weight: 400; font-weight: 400;
font-size: 28rpx; font-size: 28rpx;
color: #333333; color: #333333;
width: var(--fontSize240); // width: var(--fontSize240);
min-width: 160rpx; min-width: 140rpx;
height: var(--fontSize64); height: var(--fontSize64);
margin-right: var(--fontSize32); margin-right: var(--fontSize32);
} }
...@@ -347,12 +413,13 @@ ...@@ -347,12 +413,13 @@
.goods-box .goods .price input { .goods-box .goods .price input {
box-sizing: border-box; box-sizing: border-box;
width: 100%; width: 160rpx;
height: var(--fontSize64); height: var(--fontSize64);
min-height: 100%; min-height: 100%;
font-size: var(--fontSize28); font-size: var(--fontSize28);
padding: 0 var(--fontSize16) 0 var(--fontSize50); padding: 0 var(--fontSize16) 0 var(--fontSize50);
color: #333333; color: #333333;
text-align: end;
} }
.goods-box .goods .price input.error { .goods-box .goods .price input.error {
...@@ -366,11 +433,17 @@ ...@@ -366,11 +433,17 @@
} }
.goods-box .total-box { .goods-box .total-box {
padding: 0 var(--fontSize40); color: #222222;
font-size: 28rpx;
background-color: #fff;
// padding: 0 var(--fontSize40);
} }
.goods-box .goods .total { .goods-box .goods .total {
color: #F24724; // color: #F24724;
color: #eb4e4e;
font-size: 28rpx;
font-weight: 600;
} }
.switch-box { .switch-box {
...@@ -436,6 +509,117 @@ ...@@ -436,6 +509,117 @@
} }
} }
/* Strategy Box Styles */
.strategy-box {
margin-top: 10rpx;
padding-top: 10rpx;
border-top: 1rpx solid #eee;
.discount-types {
display: flex;
align-items: center;
justify-content: space-between;
margin-bottom: 10rpx;
.discount-tabs {
display: flex;
align-items: center;
background: #e9e9e9;
padding: 6rpx;
border-radius: 8rpx;
.type-item {
padding: 10rpx 12rpx;
background: transparent;
border-radius: 6rpx;
margin-right: 0;
font-size: 24rpx;
color: #222;
border: none;
&.active {
background: #fff;
color: #333;
font-weight: 500;
box-shadow: 0 2rpx 4rpx rgba(0, 0, 0, 0.1);
}
}
}
.discount-input {
box-sizing: border-box;
width: 160rpx;
display: flex;
align-items: center;
margin-left: 10rpx;
background: #fff;
padding: 0 10rpx;
height: 64rpx;
border-radius: 8rpx;
border: 2rpx solid #eff0f2;
input {
width: 160rpx;
border-radius: 0;
padding: 0;
font-size: 24rpx;
height: 100%;
margin-right: 6rpx;
background: transparent;
color: #333333;
// text-align: left;
text-align: end;
}
text {
font-size: 24rpx;
color: #333;
line-height: 0rpx;
}
}
}
.gift-row {
display: flex;
align-items: center;
justify-content: space-between;
margin-bottom: 10rpx;
font-size: 28rpx;
color: #222222;
.gift-radios {
display: flex;
align-items: center;
.radio-label {
margin-left: 20rpx;
display: flex;
align-items: center;
justify-content: space-between;
radio {
transform: scale(0.6);
}
}
}
}
.final-price {
font-size: 28rpx;
color: #222222;
display: flex;
align-items: center;
justify-content: space-between;
.orange {
color: #FF6601;
font-weight: bold;
font-size: 30rpx;
margin-left: 10rpx;
}
}
}
.van-cell:after { .van-cell:after {
border: none !important; border: none !important;
} }
...@@ -452,16 +636,6 @@ ...@@ -452,16 +636,6 @@
position: relative; position: relative;
} }
.deleteicon {
// position: absolute;
// top: 50%;
// left: 40rpx;
// transform: translateY(-50%);
width: var(--fontSize40);
height: var(--fontSize40);
margin-right: 10rpx;
}
.goods-box .packageList { .goods-box .packageList {
height: auto; height: auto;
display: flex; display: flex;
...@@ -473,7 +647,8 @@ ...@@ -473,7 +647,8 @@
display: flex; display: flex;
align-items: center; align-items: center;
min-height: 104rpx; min-height: 104rpx;
padding: 20rpx 0; padding: 20rpx var(--fontSize24);
box-sizing: border-box;
.package-price { .package-price {
margin-left: auto; margin-left: auto;
...@@ -484,7 +659,6 @@ ...@@ -484,7 +659,6 @@
.packageBox { .packageBox {
box-sizing: border-box; box-sizing: border-box;
width: 630rpx; width: 630rpx;
// height: 104rpx;
background: #F5F5F7; background: #F5F5F7;
.itemSty { .itemSty {
...@@ -508,7 +682,7 @@ ...@@ -508,7 +682,7 @@
.payType-box { .payType-box {
display: flex; display: flex;
align-items: center; align-items: center;
// flex-wrap: wrap; /* flex-wrap: wrap; */
padding-top: var(--fontSize20); padding-top: var(--fontSize20);
justify-content: flex-end; justify-content: flex-end;
margin-right: calc(-1 * var(--fontSize40)); margin-right: calc(-1 * var(--fontSize40));
...@@ -593,6 +767,101 @@ ...@@ -593,6 +767,101 @@
justify-content: space-between; justify-content: space-between;
} }
.payment-text{ .discount-box {
color: #666666; margin-top: var(--fontSize16);
padding-top: var(--fontSize16);
border-top: 1rpx solid #eee;
.discount-type {
display: flex;
align-items: center;
justify-content: space-between;
margin-bottom: var(--fontSize16);
.type-tabs {
display: flex;
align-items: center;
background: #F0F1F5;
padding: var(--fontSize6);
border-radius: var(--fontSize8);
.type-item {
padding: var(--fontSize10) var(--fontSize12);
background: transparent;
border-radius: var(--fontSize6);
font-size: var(--fontSize24);
color: #222;
transition: all 0.3s;
&.active {
background: #fff;
color: #333;
font-weight: 500;
box-shadow: 0 2rpx 4rpx rgba(0, 0, 0, 0.1);
}
}
}
.discount-input {
display: flex;
align-items: center;
margin-left: var(--fontSize10);
background: #fff;
padding: 0 var(--fontSize10);
height: var(--fontSize64);
border-radius: var(--fontSize8);
border: 2rpx solid #eff0f2;
input {
width: 140rpx;
font-size: var(--fontSize24);
height: 100%;
text-align: left;
}
text {
font-size: var(--fontSize24);
color: #333;
}
}
}
.final-price {
font-size: var(--fontSize28);
color: #222222;
display: flex;
align-items: center;
justify-content: space-between;
.price-val {
color: #FF6601;
font-weight: bold;
font-size: var(--fontSize30);
}
}
}
.gift-row {
display: flex;
align-items: center;
justify-content: space-between;
margin-bottom: var(--fontSize16);
font-size: var(--fontSize28);
color: #222222;
.gift-radios {
display: flex;
align-items: center;
.radio-label {
margin-left: var(--fontSize20);
display: flex;
align-items: center;
font-size: var(--fontSize24);
radio {
transform: scale(0.6);
}
}
}
} }
\ No newline at end of file \ No newline at end of file
...@@ -13,104 +13,365 @@ ...@@ -13,104 +13,365 @@
</view> </view>
</view> </view>
<view> <view>
<gl-cell border valueAlign="right" class="goodsCom" label="购买商品" labelWidth="var(--fontSize140)" haveArrow requiredAfter required placeholder="点击选择" bindclick="showPopup" data-show-name="goodsBox" /> <gl-cell
border
valueAlign="right"
class="goodsCom"
label="订单类型"
labelWidth="var(--fontSize140)"
haveArrow
requiredAfter
required
value="{{ orderTypeName }}"
bindclick="openOrderType"
/>
<block wx:if="{{ orderInfo.resetOrder }}">
<gl-cell
class="item-disabled"
border
valueAlign="right"
label="原错误订单编码"
labelWidth="var(--fontSize280)"
value="{{ orderInfo.orderId }}"
/>
<gl-cell
class="item-disabled"
border
valueAlign="right"
label="原错误订单总价"
labelWidth="var(--fontSize280)"
value="¥{{ orderInfo.quotedPriceUpdate }}"
/>
<gl-cell
border
valueAlign="right"
label="关联交易流水"
labelWidth="var(--fontSize280)"
haveArrow
placeholder="点击选择"
value="{{ totalFee ? '¥' + totalFee/100 : '' }}"
bindclick="tipsEvent"
/>
</block>
<gl-cell
border
valueAlign="right"
class="goodsCom"
label="购买商品"
labelWidth="var(--fontSize140)"
haveArrow
requiredAfter
required
placeholder="点击选择"
bindclick="showPopup"
data-show-name="goodsBox"
/>
</view> </view>
<block wx:if="{{ orderInfo.vdQuotationGoodsList.length > 0 }}"> <block wx:if="{{ orderInfo.vdQuotationGoodsList.length > 0 }}">
<view class="goods-box"> <view class="goods-box">
<block wx:for="{{ orderInfo.vdQuotationGoodsList }}" wx:key="index"> <block wx:for="{{ orderInfo.vdQuotationGoodsList }}" wx:key="index">
<view class="goods" wx:if="{{ item.goods }}"> <view class="goods" wx:if="{{ item.goods }}">
<view class="goods-content">
<!-- <view class="alias" wx:if="{{ item.goods.goodsAlias || item.goods.goodsNameAlias }}">商品别名:{{ item.goods.goodsAlias || item.goods.goodsNameAlias }}</view> -->
<view class="bottom_box">
<view class="icon" bindtap="delGoodsList" data-index="{{ index }}"> <view class="icon" bindtap="delGoodsList" data-index="{{ index }}">
<image src="./images/del.png" /> <image src="./images/del.png" />
</view> </view>
<view class="name "> <view class="name left">
<!-- --> <view class="name">
{{item.goods.goodsAlias || item.goods.goodsNameAlias|| filter.replaceItemText(item.goods.upgradeGoodsName ,( item.goods.specificationData? '/'+item.goods.specificationData:'')) || filter.replaceItemText(item.goods.goodsName, (item.goods.specificationData? '/'+item.goods.specificationData:''))}} {{item.goods.goodsAlias || item.goods.goodsNameAlias|| filter.replaceItemText(item.goods.upgradeGoodsName ,( item.goods.specificationData? '/'+item.goods.specificationData:'')) || filter.replaceItemText(item.goods.goodsName, (item.goods.specificationData? '/'+item.goods.specificationData:''))}}
<!-- {{filter.replaceItemText(item.goods.goodsAlias) ||filter.replaceItemText(item.goods.upgradeGoodsName) || filter.replaceItemText(item.goods.goodsName)}} --> <!-- {{ filter.replaceItemText(item.goods.upgradeGoodsName ,( item.goods.specificationData? '/'+item.goods.specificationData:'')) || filter.replaceItemText(item.goods.goodsName, (item.goods.specificationData? '/'+item.goods.specificationData:'')) }} -->
</view>
<!-- <view class="position" wx:if="{{ item.goods.specificationData }}">{{ item.goods.specificationData }}</view> -->
</view> </view>
<view class="right">
<!-- goodsPriceModify:true 价格不可以修改,false价格可以修改 --> <!-- goodsPriceModify:true 价格不可以修改,false价格可以修改 -->
<view class="price-box-Modify" wx:if="{{item.goods.goodsPriceModify}}"> <view class="price-box-Modify" wx:if="{{ item.goods.goodsPriceModify }}">
<text>¥</text> <text>¥</text>
<view class="price"> <view class="price">{{item.goods.price}}</view>
{{ item.goods.price}}
</view>
</view> </view>
<view class="price-box" wx:else> <view class="price-box" wx:else>
<text>¥</text> <text>¥</text>
<view class="price"> <view class="price">
<input type="digit" value="{{ item.goods.price }}" bindinput="changePrice" disabled="{{ orderObj.selectPayType ==0||item.goods.goodsPriceModify }}" data-item="{{ item }}" bindblur="priceBlur" data-index="{{ index }}" class="{{ item.goods.checkError ? 'error':''}} {{orderObj.selectPayType ==0?'disabled':'' }}" always-embed /> <input
type="digit"
value="{{ item.goods.price }}"
bindinput="changePrice"
disabled="{{ orderObj.selectPayType ==0||item.goods.goodsPriceModify }}"
data-item="{{ item }}"
bindblur="priceBlur"
data-index="{{ index }}"
class="{{ item.goods.checkError ? 'error':''}} {{orderObj.selectPayType ==0?'disabled':'' }}"
always-embed
/>
</view>
</view>
<view class="count" catchtap="showPopup" data-show-name="goodsBox">x {{item.count||1}}</view>
</view>
</view>
<block wx:if="{{ orderInfo.orderType != 1 && orderInfo.orderType != 4 }}">
<view class="strategy-box" wx:if="{{ orderInfo.orderType != 1 && orderInfo.orderType != 4 }}">
<view class="gift-row" wx:if="{{ orderInfo.orderType == 3 }}">
<view>是否为赠品</view>
<radio-group bindchange="toggleGift" data-index="{{ index }}" class="gift-radios">
<label class="radio-label">
<radio value="1" checked="{{ item.goods.discountType == 4 }}" color="#347BFF" />
是
</label>
<label class="radio-label">
<radio value="0" checked="{{ item.goods.discountType != 4 }}" color="#347BFF" />
否
</label>
</radio-group>
</view>
<view class="discount-types" wx:else>
<view class="discount-tabs">
<view
class="type-item {{ (item.goods.discountType == 3 || !item.goods.discountType) ? 'active' : '' }}"
catchtap="changeProductDiscountType"
data-index="{{ index }}"
data-type="3"
>无折扣</view>
<view
class="type-item {{ item.goods.discountType == 1 ? 'active' : '' }}"
catchtap="changeProductDiscountType"
data-index="{{ index }}"
data-type="1"
wx:if="{{ orderInfo.orderType != 5 }}"
>折扣比例</view>
<view
class="type-item {{ item.goods.discountType == 2 ? 'active' : '' }}"
catchtap="changeProductDiscountType"
data-index="{{ index }}"
data-type="2"
>折扣金额</view>
</view>
<view class="discount-input" wx:if="{{ item.goods.discountType == 1 || item.goods.discountType == 2 }}">
<input type="digit" value="{{ item.goods.discountValue }}" bindinput="inputDiscountValue" data-index="{{ index }}" />
<text> {{item.goods.discountType == 1 ? '折': '元'}}</text>
</view>
</view>
<view class="final-price">
价格
<text class="orange">¥ {{item.goods.finalPrice !== undefined ? item.goods.finalPrice : (item.goods.sellPrice !== undefined ? item.goods.sellPrice : item.goods.price)}}</text>
</view>
</view> </view>
</block>
</view> </view>
<view class="count" catchtap="showPopup" data-show-name="goodsBox">x{{item.count||1}}</view>
</view> </view>
<!-- {{filter.replaceItemText(item.upgradeGoodsAlias) ||filter.replaceItemText(item.upgradeGoodsName) || filter.replaceItemText(item.goodsInfo.goodsName)}} --> <!-- {{filter.replaceItemText(item.upgradeGoodsAlias) ||filter.replaceItemText(item.upgradeGoodsName) || filter.replaceItemText(item.goodsInfo.goodsName)}}-->
<view class="goods packageList" wx:if="{{ item.packageGoods }}"> <view class="goods packageList" wx:if="{{ item.packageGoods }}">
<view class="package"> <view class="package">
<view class="deleteicon" bindtap="delGoodsList" data-index="{{ index }}"> <view class="icon" bindtap="delGoodsList" data-index="{{ index }}">
<image src="./images/del.png" /> <image src="./images/del.png" />
</view> </view>
<view class="name ">{{item.packageGoods.packageAlias || item.packageGoods.packageNameAlias || item.packageGoods.packageName}}</view> <!-- <view class="name">
<view class="package-price">¥{{item.price}}</view> <view class="alias" wx:if="{{ item.packageGoods.packageAlias || item.packageGoods.packageNameAlias }}">套餐别名:{{ item.packageGoods.packageAlias || item.packageGoods.packageNameAlias }}</view>
<!-- <view class="count" catchtap="showPopup" data-show-name="goodsBox">x{{item.count||1}}</view> --> <view>{{ item.packageGoods.packageName}}</view>
</view> -->
<view class="name">{{item.packageGoods.packageAlias || item.packageGoods.packageNameAlias || item.packageGoods.packageName}}</view>
<view class="package-price">¥ {{item.price}}</view>
<!-- <view class="count"catchtap="showPopup"data-show-name="goodsBox">x {{item.count||1}}</view>-->
</view> </view>
<view class="packageBox"> <view class="packageBox">
<view class="itemSty" wx:for="{{ item.packageGoods.goodsList }}" wx:key="childind" wx:for-index="childind" wx:for-item="child"> <view class="itemSty" wx:for="{{ item.packageGoods.goodsList }}" wx:key="childind" wx:for-index="childind" wx:for-item="child">
<view class="name ">{{child.goodsAlias || child.goodsNameAlias || filter.replaceItemText(child.upgradeGoodsName , (item.specificationData? '/'+child.specificationData: '') ) ||filter.replaceItemText(child.goodsName ,( item.specificationData? '/'+child.specificationData: '') ) }}</view> <view class="goods-content" style="width: 100%">
<view class="price-box-Modify" wx:if="{{child.goodsPriceModify}}"> <!-- <view class="alias" wx:if="{{ child.goodsAlias || child.goodsNameAlias }}">商品别名:{{ child.goodsAlias || child.goodsNameAlias }}</view> -->
<text>¥</text> <view class="bottom_box">
<view class="price"> <view class="name left">
{{ child.price}} <view class="name">
{{child.goodsAlias || child.goodsNameAlias || filter.replaceItemText(child.upgradeGoodsName , (item.specificationData? '/'+child.specificationData: '') ) ||filter.replaceItemText(child.goodsName ,( item.specificationData? '/'+child.specificationData: '') ) }}
</view> </view>
<!-- <view class="position" wx:if="{{ child.specificationData }}">{{ child.specificationData }}</view> -->
<!-- <view class="serveName" wx:if="{{child.serveName}}">(包含{{child.serveName}})</view> -->
</view>
<view class="right">
<view class="price-box-Modify" wx:if="{{ child.goodsPriceModify }}">
<text>¥</text>
<view class="price">{{child.price}}</view>
</view> </view>
<view class="price-box" wx:else> <view class="price-box" wx:else>
<text>¥</text> <text>¥</text>
<view class="price"> <view class="price">
<input
<input type="digit" value="{{ child.price }}" bindinput="changePricePackage" disabled="{{ orderObj.selectPayType ==0 ||child.goodsPriceModify}}" data-childind="{{ childind }}" data-item="{{ item }}" bindblur="priceBlur" data-index="{{ index }}" class="{{ child.checkError ? 'error':''}} {{orderObj.selectPayType ==0?'disabled':'' }}" always-embed /> type="digit"
value="{{ child.price }}"
bindinput="changePricePackage"
disabled="{{ orderObj.selectPayType ==0 ||child.goodsPriceModify }}"
data-childind="{{ childind }}"
data-item="{{ item }}"
bindblur="priceBlur"
data-index="{{ index }}"
class="{{ child.checkError ? 'error':''}} {{orderObj.selectPayType ==0?'disabled':'' }}"
always-embed
/>
</view>
</view>
<view class="count" catchtap="showPopup" data-show-name="goodsBox">x {{child.count||1}}</view>
</view>
</view>
<block wx:if="{{ orderInfo.orderType != 1 && orderInfo.orderType != 4 }}">
<view class="strategy-box" wx:if="{{ orderInfo.orderType != 1 && orderInfo.orderType != 4 }}">
<view class="gift-row" wx:if="{{ orderInfo.orderType == 3 }}">
<view>是否为赠品</view>
<radio-group bindchange="toggleGift" data-index="{{ index }}" data-gindex="{{ childind }}" class="gift-radios">
<label class="radio-label">
<radio value="1" checked="{{ child.discountType == 4 }}" color="#347BFF" />
是
</label>
<label class="radio-label">
<radio value="0" checked="{{ child.discountType != 4 }}" color="#347BFF" />
否
</label>
</radio-group>
</view>
<view class="discount-types" wx:else>
<view class="discount-tabs">
<view
class="type-item {{ (child.discountType == 3 || !child.discountType) ? 'active' : '' }}"
catchtap="changeProductDiscountType"
data-index="{{ index }}"
data-gindex="{{ childind }}"
data-type="3"
>无折扣</view>
<view
class="type-item {{ child.discountType == 1 ? 'active' : '' }}"
catchtap="changeProductDiscountType"
data-index="{{ index }}"
data-gindex="{{ childind }}"
data-type="1"
wx:if="{{ orderInfo.orderType != 5 }}"
>折扣比例</view>
<view
class="type-item {{ child.discountType == 2 ? 'active' : '' }}"
catchtap="changeProductDiscountType"
data-index="{{ index }}"
data-gindex="{{ childind }}"
data-type="2"
>折扣金额</view>
</view>
<view class="discount-input" wx:if="{{ child.discountType == 1 || child.discountType == 2 }}">
<input
type="digit"
value="{{ child.discountValue }}"
bindinput="inputDiscountValue"
data-index="{{ index }}"
data-gindex="{{ childind }}"
/>
<text> {{child.discountType == 1 ? '折': '元'}}</text>
</view>
</view>
<view class="final-price">
价格
<text class="orange">¥ {{child.finalPrice !== undefined ? child.finalPrice : (child.sellPrice !== undefined ? child.sellPrice : child.price)}}</text>
</view>
</view> </view>
</block>
</view> </view>
<view class="count" catchtap="showPopup" data-show-name="goodsBox">x{{child.count||1}}</view>
</view> </view>
</view> </view>
</view> </view>
<!-- 多规格 --> <!-- 多规格 -->
<view class="goods" wx:if="{{ item.multipleSpecificationsGoods }}"> <view class="goods" wx:if="{{ item.multipleSpecificationsGoods }}">
<view class="goods-content">
<view
class="alias"
wx:if="{{ item.multipleSpecificationsGoods.goods.goodsAlias || item.multipleSpecificationsGoods.goods.goodsNameAlias }}"
>商品别名:{{ item.multipleSpecificationsGoods.goods.goodsAlias || item.multipleSpecificationsGoods.goods.goodsNameAlias }}</view>
<view class="bottom_box">
<view class="icon" bindtap="delGoodsList" data-index="{{ index }}"> <view class="icon" bindtap="delGoodsList" data-index="{{ index }}">
<image src="./images/del.png" /> <image src="./images/del.png" />
</view> </view>
<view class="goods-content">
<view class="alias" wx:if="{{item.multipleSpecificationsGoods.goods.goodsAlias}}">
商品别名:{{item.multipleSpecificationsGoods.goods.goodsAlias}}
</view>
<view class="bottom_box">
<view class="name left"> <view class="name left">
<view class="name">{{item.multipleSpecificationsGoods.baseGoodsName}}</view> <view class="name">{{item.multipleSpecificationsGoods.baseGoodsName }}</view>
<view class="position" wx:if="{{ item.multipleSpecificationsGoods.goods.specificationStr }}">{{item.multipleSpecificationsGoods.goods.specificationStr}}</view> <view class="position" wx:if="{{ item.multipleSpecificationsGoods.goods.specificationStr }}">{{item.multipleSpecificationsGoods.goods.specificationStr}}</view>
</view> </view>
<view class="right"> <view class="right">
<view class="price-box-Modify" wx:if="{{item.multipleSpecificationsGoods.goods.goodsPriceModify}}"> <view class="price-box-Modify" wx:if="{{ item.multipleSpecificationsGoods.goods.goodsPriceModify }}">
<text>¥</text> <text>¥</text>
<view class="price"> <view class="price">{{item.multipleSpecificationsGoods.goods.price}}</view>
{{ item.multipleSpecificationsGoods.goods.price}}
</view>
</view> </view>
<view class="price-box" wx:else> <view class="price-box" wx:else>
<text>¥</text> <text>¥</text>
<view class="price"> <view class="price">
<input type="digit" value="{{item.multipleSpecificationsGoods.goods.price}}" bindinput="changeSpecific" disabled="{{ orderObj.selectPayType ==0||item.multipleSpecificationsGoods.goods.goodsPriceModify }}" data-item="{{ item }}" bindblur="priceBlur" data-index="{{ index }}" class="{{ item.multipleSpecificationsGoods.goods.checkError ? 'error':''}} {{orderObj.selectPayType ==0?'disabled':'' }}" always-embed /> <input
type="digit"
value="{{ item.multipleSpecificationsGoods.goods.price }}"
bindinput="changeSpecific"
disabled="{{ orderObj.selectPayType ==0||item.multipleSpecificationsGoods.goods.goodsPriceModify }}"
data-item="{{ item }}"
bindblur="priceBlur"
data-index="{{ index }}"
class="{{ item.multipleSpecificationsGoods.goods.checkError ? 'error':''}} {{orderObj.selectPayType ==0?'disabled':'' }}"
always-embed
/>
</view>
</view>
<view class="count" catchtap="showPopup" data-show-name="goodsBox">x {{item.count||1}}</view>
</view>
</view>
<block wx:if="{{ orderInfo.orderType != 1 && orderInfo.orderType != 4 }}">
<view class="strategy-box" wx:if="{{ orderInfo.orderType != 1 && orderInfo.orderType != 4 }}">
<view class="gift-row" wx:if="{{ orderInfo.orderType == 3 }}">
<view>是否为赠品</view>
<radio-group bindchange="toggleGift" data-index="{{ index }}" class="gift-radios">
<label class="radio-label">
<radio value="1" checked="{{ item.multipleSpecificationsGoods.goods.discountType == 4 }}" color="#347BFF" />
是
</label>
<label class="radio-label">
<radio value="0" checked="{{ item.multipleSpecificationsGoods.goods.discountType != 4 }}" color="#347BFF" />
否
</label>
</radio-group>
</view>
<view class="discount-types" wx:else>
<view class="discount-tabs">
<view
class="type-item {{ (item.multipleSpecificationsGoods.goods.discountType == 3 || !item.multipleSpecificationsGoods.goods.discountType) ? 'active' : '' }}"
catchtap="changeProductDiscountType"
data-index="{{ index }}"
data-type="3"
>无折扣</view>
<view
class="type-item {{ item.multipleSpecificationsGoods.goods.discountType == 1 ? 'active' : '' }}"
catchtap="changeProductDiscountType"
data-index="{{ index }}"
data-type="1"
wx:if="{{ orderInfo.orderType != 5 }}"
>折扣比例</view>
<view
class="type-item {{ item.multipleSpecificationsGoods.goods.discountType == 2 ? 'active' : '' }}"
catchtap="changeProductDiscountType"
data-index="{{ index }}"
data-type="2"
>折扣金额</view>
</view>
<view
class="discount-input"
wx:if="{{ item.multipleSpecificationsGoods.goods.discountType == 1 || item.multipleSpecificationsGoods.goods.discountType == 2 }}"
>
<input
type="digit"
value="{{ item.multipleSpecificationsGoods.goods.discountValue }}"
bindinput="inputDiscountValue"
data-index="{{ index }}"
/>
<text> {{item.multipleSpecificationsGoods.goods.discountType == 1 ? '折': '元'}}</text>
</view> </view>
</view> </view>
<view class="final-price">
<view class="count" catchtap="showPopup" data-show-name="goodsBox">x{{item.count||1}}</view> 价格
<text class="orange">¥ {{item.multipleSpecificationsGoods.goods.finalPrice !== undefined ? item.multipleSpecificationsGoods.goods.finalPrice : (item.multipleSpecificationsGoods.goods.sellPrice !== undefined ? item.multipleSpecificationsGoods.goods.sellPrice : item.multipleSpecificationsGoods.goods.price)}}</text>
</view> </view>
</view> </view>
</block>
</view> </view>
</view> </view>
</block> </block>
<view class="goods total-box"> <view class="goods total-box">
<view>总价</view> <view>总价</view>
<view class="total">¥{{orderInfo.total || 0}}</view> <view class="total">¥ {{orderInfo.total || 0}}</view>
</view> </view>
</view> </view>
</block> </block>
...@@ -124,72 +385,103 @@ ...@@ -124,72 +385,103 @@
<view class="label">其他信息</view> <view class="label">其他信息</view>
</view> </view>
</view> </view>
<!-- <gl-cell <!-- <gl-cell wx:if="{{ !orderInfo.outTradeNo || orderInfo.resetOrder }}"
wx:if="{{ !orderInfo.outTradeNo || orderInfo.resetOrder }}" border class="pay-type"
label="支付方式"
valueAlign="right"
labelWidth="var(--fontSize140)"
><view class="only-select-text"wx:if="{{ orderInfo.resetOrder }}">门店收款</view><view wx:else class="switch-box"><view class="block text-center {{ orderInfo.payType==1?'':'right' }}"/><view class="left text-center {{ orderInfo.payType == 1?'active':'' }}"bindtap="changePayType"data-payType="1">线上支付</view><view class="right text-center {{ orderInfo.payType == 2?'active':'' }}"bindtap="changePayType"data-payType="2">门店收款</view></view></gl-cell>-->
<!-- 新下单非历史单 -->
<gl-cell
border
class="pay-type"
label="收款方"
valueAlign="right"
labelWidth="var(--fontSize140)"
value="{{ orderInfo.payee == 1 ? '4S店收款' : '嘀加收款' }}"
wx:if="{{ !(orderInfo.switchValue == 1 && orderInfo.selectOutTradeNoArr.length == 1) }}"
></gl-cell>
<gl-cell
border border
class="pay-type" class="pay-type"
label="支付方式" label="支付方式"
valueAlign="right" valueAlign="right"
labelWidth="var(--fontSize140)" labelWidth="var(--fontSize140)"
> value="{{ payTypeObj[orderInfo.payType] }}"
<view class="only-select-text" wx:if="{{ orderInfo.resetOrder }}">门店收款</view> wx:if="{{ !(orderInfo.switchValue == 1 && orderInfo.selectOutTradeNoArr.length == 1) }}"
<view wx:else class="switch-box"> ></gl-cell>
<view class="block text-center {{ orderInfo.payType==1?'':'right' }}" /> <view class="paytype-tips" wx:if="{{ orderInfo.payType == 7 }}">其它收款:当客户已向嘀加付款但无法使用流水补录时,新建工单应选择收款方为「嘀加收款」且支付方为「其它收款」。</view>
<view class="left text-center {{ orderInfo.payType == 1?'active':'' }}" bindtap="changePayType" data-payType="1">线上支付</view> <gl-cell
<view class="right text-center {{ orderInfo.payType == 2?'active':'' }}" bindtap="changePayType" data-payType="2">门店收款</view> wx:if="{{ (orderInfo.payType == 2 ||orderInfo.payType ==5 || orderInfo.payType == 6 || orderInfo.payType == 7 )&&!orderInfo.resetOrder&&!orderInfo.selectOutTradeNoArr }}"
</view> value="{{ successDateTime }}"
</gl-cell> --> bind:click="toSelectDate"
<!-- 新下单非历史单 --> haveArrow="{{ true }}"
<block wx:if="{{paymentMethod || !orderInfo.oldOrder}}"> placeholder="请选择时间"
<gl-cell border class="pay-type" label="收款方" valueAlign="right" labelWidth="var(--fontSize140)" wx:if="{{!(orderInfo.switchValue == 1 && orderInfo.selectOutTradeNoArr.length == 1)}}"> required="{{ true }}"
<view class="payType-box"> requiredAfter="{{ true }}"
<view class="text-center payment-text">{{orderInfo.payee == 1 ? '4S店收款' : '嘀加收款'}}</view> border
</view> class="pay-type"
</gl-cell> label="{{ orderInfo.payType == 2?'4S店收款时间':'嘀加收款时间' }}"
<gl-cell border class="pay-type" label="支付方式" valueAlign="right" labelWidth="var(--fontSize140)" wx:if="{{!(orderInfo.switchValue == 1 && orderInfo.selectOutTradeNoArr.length == 1)}}"> valueAlign="right"
<view class="payType-box"> labelWidth="var(--fontSize200)"
<view class="text-center payment-text">{{payTypeObj[orderInfo.payType]}}</view> ></gl-cell>
</view> <gl-cell
</gl-cell> wx:if="{{ orderInfo.selectOutTradeNoArr.length && !(orderInfo.switchValue == 1 && orderInfo.selectOutTradeNoArr.length == 1) }}"
</block> value="{{ orderInfo.successDateTime }}"
<block wx:else> haveArrow="{{ true }}"
<!-- 非正常分账期单流水补录 --> placeholder="请选择时间"
<gl-cell border class="pay-type" label="收款方" valueAlign="right" labelWidth="var(--fontSize140)" wx:if="{{!(orderInfo.switchValue == 1 && orderInfo.selectOutTradeNoArr.length == 1)}}"> required="{{ true }}"
<view class="payType-box"> requiredAfter="{{ true }}"
<block wx:for="{{ payeeList }}" wx:key="index"> border
<view class="item text-center {{ orderInfo.payee == item.value?'active':'' }} {{(orderInfo.resetOrder||orderInfo.selectOutTradeNoArr) && orderInfo.payee != item.value ? 'disabled' : ''}}" bindtap="changePayee" data-payee="{{ item.value }}">{{item.name}}</view> class="pay-type"
</block> label="{{ orderInfo.payType == 2?'4S店收款时间':'嘀加收款时间' }}"
</view> valueAlign="right"
</gl-cell> labelWidth="var(--fontSize200)"
<!-- 非正常分账期单流水补录 --> ></gl-cell>
<gl-cell border class="pay-type" label="支付方式" valueAlign="right" labelWidth="var(--fontSize140)" wx:if="{{!(orderInfo.switchValue == 1 && orderInfo.selectOutTradeNoArr.length == 1)}}">
<view class="payType-box">
<!-- 错误工单或非正常分账期单流水补录 固定显示嘀加收款 -->
<view class="item text-center active" wx:if="{{ orderInfo.resetOrder || orderInfo.selectOutTradeNoArr}}">嘀加收款</view>
<block wx:else>
<block wx:for="{{ payTypeList }}" wx:key="index">
<view class="item text-center {{ orderInfo.payType == item.value?'active':'' }}" bindtap="changePayType" data-payType="{{ item.value }}">{{item.name}}</view>
</block>
</block>
</view>
</gl-cell>
</block>
<view class="paytype-tips" wx:if="{{orderInfo.payType == 7}}">其它收款:当客户已向嘀加付款但无法使用流水补录时,新建工单应选择收款方为「嘀加收款」且支付方为「其它收款」。</view>
<gl-cell wx:if="{{ (orderInfo.payType == 2 ||orderInfo.payType ==5 || orderInfo.payType == 6 || orderInfo.payType == 7 )&&!orderInfo.resetOrder&&!orderInfo.selectOutTradeNoArr }}" value="{{ successDateTime }}" bind:click="toSelectDate" haveArrow="{{ true }}" placeholder="请选择时间" required="{{ true }}" requiredAfter="{{ true }}" border class="pay-type" label="{{orderInfo.payType == 2?'4S店收款时间':'嘀加收款时间'}}" valueAlign="right" labelWidth="var(--fontSize200)"></gl-cell>
<gl-cell wx:if="{{ orderInfo.selectOutTradeNoArr.length && !(orderInfo.switchValue == 1 && orderInfo.selectOutTradeNoArr.length == 1) }}" value="{{ orderInfo.successDateTime }}" haveArrow="{{ true }}" placeholder="请选择时间" required="{{ true }}" requiredAfter="{{ true }}" border class="pay-type" label="{{orderInfo.payType == 2?'4S店收款时间':'嘀加收款时间'}}" valueAlign="right" labelWidth="var(--fontSize200)"></gl-cell>
<view class="box"> <view class="box">
<!-- 支付方式为其他收款时,备注必填 --> <!-- 支付方式为其他收款时,备注必填 -->
<view class="title remarkTitle"> <view class="title remarkTitle">
备注 备注
<text wx:if="{{orderInfo.payType == 7}}" class="required">*</text> <text wx:if="{{ orderInfo.payType == 7 }}" class="required">*</text>
</view> </view>
<van-field type="textarea" maxlength="30" autosize class="inputBox" border="{{ false }}" data-hold-keyboard value="{{ orderInfo.notes }}" data-attrName="notes" placeholder="请输入(30字以内)" data-attrType="" bindinput="handleInput"></van-field> <van-field
type="textarea"
maxlength="30"
autosize
class="inputBox"
border="{{ false }}"
data-hold-keyboard
value="{{ orderInfo.notes }}"
data-attrName="notes"
placeholder="请输入(30字以内)"
data-attrType=""
bindinput="handleInput"
></van-field>
</view> </view>
</van-collapse-item> </van-collapse-item>
</view> </view>
</van-collapse> </van-collapse>
<Gl-Button-Group bindbtnTap="btnTap" textNameObj="{{ textNameObj }}" /> <Gl-Button-Group bindbtnTap="btnTap" textNameObj="{{ textNameObj }}" />
</view> </view>
<goods show="{{ goodsBox }}" bindconfirm="chooseGoods" goodsData="{{ quotationGoodsList }}" chooseGoodsList="{{ orderInfo.vdQuotationGoodsList }}" />
<sku-goods show="{{ skuGoodsBox }}" wx:if="{{skuGoodsBox}}" sceneType="0" goodsData="{{ skuGoodsData }}" chooseGoodsList="{{ orderInfo.vdQuotationGoodsList }}"></sku-goods>
<date-select show="{{ showDateSelect }}" bind:close="closeDateModal" selectPay="{{orderInfo.payType}}" bind:confirm="onChanteSuccessDate"></date-select>
\ No newline at end of file \ No newline at end of file
<goods
show="{{ goodsBox }}"
bindconfirm="chooseGoods"
goodsData="{{ quotationGoodsList }}"
chooseGoodsList="{{ orderInfo.vdQuotationGoodsList }}"
/>
<sku-goods
show="{{ skuGoodsBox }}"
wx:if="{{ skuGoodsBox }}"
sceneType="0"
goodsData="{{ skuGoodsData }}"
chooseGoodsList="{{ orderInfo.vdQuotationGoodsList }}"
></sku-goods>
<date-select
show="{{ showDateSelect }}"
bind:close="closeDateModal"
selectPay="{{ orderInfo.payType }}"
bind:confirm="onChanteSuccessDate"
></date-select>
<van-popup show="{{ orderTypeBox }}" position="bottom" bind:close="onCloseOrderType">
<van-picker columns="{{ orderTypeList }}" show-toolbar bind:cancel="onCloseOrderType" bind:confirm="onConfirmOrderType" />
</van-popup>
\ No newline at end of file \ No newline at end of file
...@@ -17,13 +17,9 @@ import { ...@@ -17,13 +17,9 @@ import {
updateCustomerInfo, updateCustomerInfo,
waitinputorder waitinputorder
} from '../../../api' } from '../../../api'
let time = null; let time = null
import { import { quotedImgUrl } from '~/config'
quotedImgUrl import { checkStudyTask } from '~/store/ModalToQueueControl'
} from '~/config'
import {
checkStudyTask
} from "~/store/ModalToQueueControl";
import dataForm from '../components/constant/stepData' import dataForm from '../components/constant/stepData'
import NP from 'number-precision' import NP from 'number-precision'
Page({ Page({
...@@ -33,10 +29,10 @@ Page({ ...@@ -33,10 +29,10 @@ Page({
data: { data: {
scrollDisabled: false, scrollDisabled: false,
tipsProps: { tipsProps: {
tipsText: "该门店产生异常订单,请点击补录!", tipsText: '该门店产生异常订单,请点击补录!',
showTips: true, showTips: true,
type: 2, type: 2,
typeText: "补录订单", typeText: '补录订单'
}, },
showOrderpop: false, showOrderpop: false,
showTips: false, showTips: false,
...@@ -76,6 +72,7 @@ Page({ ...@@ -76,6 +72,7 @@ Page({
// }, // },
orderInfo: { orderInfo: {
mode: 1, mode: 1,
orderType: 1,
payee: 0, payee: 0,
payType: 1, payType: 1,
insurancePrice: '', insurancePrice: '',
...@@ -122,31 +119,29 @@ Page({ ...@@ -122,31 +119,29 @@ Page({
secFormData: {}, secFormData: {},
tempVin: '', tempVin: '',
showZyPopup: false, // 上传合同协议弹窗 showZyPopup: false, // 上传合同协议弹窗
paymentMethod: null paymentMethod: 1
}, },
tipsEvent() { tipsEvent() {
this.setData({ this.setData({
showOrderpop: true, showOrderpop: true
}); })
}, },
closeSwitchPopup() { closeSwitchPopup() {
this.setData({ this.setData({
showOrderpop: false, showOrderpop: false
}); })
}, },
async navigator(e) { async navigator(e) {
let { let { selectOutTradeNoArr } = e.detail
selectOutTradeNoArr this.closeSwitchPopup()
} = e.detail;
this.closeSwitchPopup();
let { paymentMethod } = this.data let { paymentMethod } = this.data
selectOutTradeNoArr && selectOutTradeNoArr &&
this.onRoute({ this.onRoute({
paymentMethod, paymentMethod,
selectOutTradeNoArr, selectOutTradeNoArr,
orderCreateType: "additionRecordOrder", orderCreateType: 'additionRecordOrder'
}); })
// let { orderObj } = this.data // let { orderObj } = this.data
// // 如果是补录 需清订单的空礼券和商品 清空销售顾问 // // 如果是补录 需清订单的空礼券和商品 清空销售顾问
// let deleteName = [ // let deleteName = [
...@@ -174,17 +169,13 @@ Page({ ...@@ -174,17 +169,13 @@ Page({
}) })
}, },
secondChange() { secondChange() {
let { let { showVinDialog } = this.data
showVinDialog
} = this.data
this.setData({ this.setData({
showVinDialog: !showVinDialog showVinDialog: !showVinDialog
}) })
}, },
handleSecClose() { handleSecClose() {
let { let { tempVin } = this.data
tempVin
} = this.data
this.setData({ this.setData({
secFormData: { secFormData: {
carVin: '' carVin: ''
...@@ -199,9 +190,7 @@ Page({ ...@@ -199,9 +190,7 @@ Page({
this.secondChange() this.secondChange()
}, },
handleSecConfirm(e) { handleSecConfirm(e) {
let { let { detail } = e
detail
} = e
this.setData({ this.setData({
['owner.carVin']: detail.carVin, ['owner.carVin']: detail.carVin,
tempVin: detail.carVin tempVin: detail.carVin
...@@ -209,9 +198,7 @@ Page({ ...@@ -209,9 +198,7 @@ Page({
}, },
reWrite(type, data) { reWrite(type, data) {
console.log(type, data) console.log(type, data)
let { let { owner } = this.data
owner
} = this.data
if (type == 'vehicleCertificate') { if (type == 'vehicleCertificate') {
this.setData({ this.setData({
tempVin: this.data.owner.carVin tempVin: this.data.owner.carVin
...@@ -282,10 +269,7 @@ Page({ ...@@ -282,10 +269,7 @@ Page({
supplementaryFlag: true supplementaryFlag: true
}) // 补录订单标识 }) // 补录订单标识
// 获取保险信息 // 获取保险信息
let { let { outTradeNo, userInfo } = this.data
outTradeNo,
userInfo
} = this.data
let orderInfo = this.getInsurance() let orderInfo = this.getInsurance()
let owner = this.getOwnerInfo() let owner = this.getOwnerInfo()
owner.salesType = owner.salesType == '售后' ? 1 : 0 owner.salesType = owner.salesType == '售后' ? 1 : 0
...@@ -315,11 +299,7 @@ Page({ ...@@ -315,11 +299,7 @@ Page({
.then(async result => { .then(async result => {
wx.hideLoading() wx.hideLoading()
console.log(result) console.log(result)
let { let { code, data, message } = result
code,
data,
message
} = result
if (code == 0 && data) { if (code == 0 && data) {
this.setData({ this.setData({
confirmStatus: false, confirmStatus: false,
...@@ -366,10 +346,7 @@ Page({ ...@@ -366,10 +346,7 @@ Page({
}, },
// 补录订单上传合同协议点击确定 // 补录订单上传合同协议点击确定
zyPayConfirm(e) { zyPayConfirm(e) {
let { let { supplementaryOrderId, zyConfirmFlag } = this.data // 补录订单id
supplementaryOrderId,
zyConfirmFlag
} = this.data // 补录订单id
wx.showLoading({ wx.showLoading({
title: '加载中', title: '加载中',
mask: true mask: true
...@@ -382,17 +359,11 @@ Page({ ...@@ -382,17 +359,11 @@ Page({
id: supplementaryOrderId id: supplementaryOrderId
}) })
.then(res => { .then(res => {
let { let { code, message, data } = res
code,
message,
data
} = res
if (code == 0) { if (code == 0) {
let obj = wx.$util.deepClone(data), let obj = wx.$util.deepClone(data),
orderInfo = {} orderInfo = {}
let { let { default4SStoreInfo } = wx.$util.getUserInfo()
default4SStoreInfo
} = wx.$util.getUserInfo()
orderInfo.check = true orderInfo.check = true
orderInfo.id = obj.id orderInfo.id = obj.id
orderInfo.orderId = obj.orderId orderInfo.orderId = obj.orderId
...@@ -406,7 +377,8 @@ Page({ ...@@ -406,7 +377,8 @@ Page({
zyPayUrl: e.detail?.zyPayUrl?.join(',') zyPayUrl: e.detail?.zyPayUrl?.join(',')
}).then(result => { }).then(result => {
wx.hideLoading() wx.hideLoading()
this.setData({ this.setData(
{
showZyPopup: false showZyPopup: false
}, },
() => { () => {
...@@ -505,12 +477,7 @@ Page({ ...@@ -505,12 +477,7 @@ Page({
}, },
async handleSecondConfirm(e) { async handleSecondConfirm(e) {
let { let { orderInfo, outTradeNo, confirmStatus, userInfo } = this.data
orderInfo,
outTradeNo,
confirmStatus,
userInfo
} = this.data
let staffCheck = await this.staffDailyReportMerchantValid(userInfo) let staffCheck = await this.staffDailyReportMerchantValid(userInfo)
if (staffCheck) return false if (staffCheck) return false
// 校验学习中心开单限制 // 校验学习中心开单限制
...@@ -527,8 +494,9 @@ Page({ ...@@ -527,8 +494,9 @@ Page({
// 非标记错误或非正常分账期单流水补录,2:门店收款 5:嘀加收款 6:对公转账 7:其它收款 // 非标记错误或非正常分账期单流水补录,2:门店收款 5:嘀加收款 6:对公转账 7:其它收款
if ( if (
!orderInfo.pay2Time && !orderInfo.pay2Time &&
([2, 5, 6, 7].includes(Number(orderInfo.payType))) && [2, 5, 6, 7].includes(Number(orderInfo.payType)) &&
!orderInfo.resetOrder && !orderInfo.selectOutTradeNoArr !orderInfo.resetOrder &&
!orderInfo.selectOutTradeNoArr
) )
return wx.$util.showToast( return wx.$util.showToast(
orderInfo.payType == 2 ? '请选择4S店收款时间' : '请选择嘀加收款时间' orderInfo.payType == 2 ? '请选择4S店收款时间' : '请选择嘀加收款时间'
...@@ -537,6 +505,17 @@ Page({ ...@@ -537,6 +505,17 @@ Page({
if (orderInfo.payType == 7 && !orderInfo.notes) { if (orderInfo.payType == 7 && !orderInfo.notes) {
return wx.$util.showToast('备注不能为空') return wx.$util.showToast('备注不能为空')
} }
// 错误订单提交校验
if (orderInfo.resetOrder) {
let originalPrice = Number(orderInfo.quotedPriceUpdate || 0)
let transactionPrice = NP.divide(this.data.totalFee || 0, 100)
let currentTotal = Number(orderInfo.total || 0)
if (NP.plus(originalPrice, transactionPrice) != currentTotal) {
return wx.$util.showToast('原错误订单总价+关联交易流水必须等于订单总价')
}
}
// 修改权益报价逻辑 // 修改权益报价逻辑
if (confirmStatus) return false if (confirmStatus) return false
this.setData({ this.setData({
...@@ -544,8 +523,11 @@ Page({ ...@@ -544,8 +523,11 @@ Page({
}) })
// 正常分账期多流水或超分账期是否已上传凭证 是在走下一步 // 正常分账期多流水或超分账期是否已上传凭证 是在走下一步
if (orderInfo.selectOutTradeNoArr?.length > 1 || (orderInfo.switchValue && orderInfo.switchValue != 1)) { if (
if (!orderInfo.paymentDocList.length) { orderInfo.selectOutTradeNoArr?.length > 1 ||
(orderInfo.switchValue && orderInfo.switchValue != 1)
) {
if (!orderInfo.paymentDocList.length && !orderInfo.resetOrder) {
return this.setData({ return this.setData({
showPopup: true, showPopup: true,
confirmStatus: false confirmStatus: false
...@@ -560,8 +542,9 @@ Page({ ...@@ -560,8 +542,9 @@ Page({
// 如果是2:门店收款 5:嘀加收款 6:对公转账 7:其它收款 并且付款凭证没有填 // 如果是2:门店收款 5:嘀加收款 6:对公转账 7:其它收款 并且付款凭证没有填
if ( if (
([2, 5, 6, 7].includes(Number(orderInfo.payType))) && [2, 5, 6, 7].includes(Number(orderInfo.payType)) &&
!(orderInfo.transactionNo && orderInfo.paymentDocList.length) !(orderInfo.transactionNo && orderInfo.paymentDocList.length) &&
!orderInfo.resetOrder
) )
return this.setData({ return this.setData({
showPopup: true, showPopup: true,
...@@ -590,11 +573,7 @@ Page({ ...@@ -590,11 +573,7 @@ Page({
// ------- // -------
wx.showLoading('报价中...') wx.showLoading('报价中...')
let result = await this.handleSecondConfirmCheck(true, e) let result = await this.handleSecondConfirmCheck(true, e)
let { let { code, data: id, message } = result
code,
data: id,
message
} = result
console.log(result) console.log(result)
// 校验生成告知书是否成功 // 校验生成告知书是否成功
...@@ -623,13 +602,13 @@ Page({ ...@@ -623,13 +602,13 @@ Page({
} }
let res = await checkZyPayFlag(params) let res = await checkZyPayFlag(params)
let zyPayFlag = res?.code == 0 && res?.data let zyPayFlag = res?.code == 0 && res?.data
status.code == 0 ? status.code == 0
this.navigatorNext({ ? this.navigatorNext({
id, id,
orderId: status.data.orderId, orderId: status.data.orderId,
zyVoucherStatus: zyPayFlag ? 1 : 0 // "中邮凭证上传状态:0-无需上传,1-待上传,2-已上传") zyVoucherStatus: zyPayFlag ? 1 : 0 // "中邮凭证上传状态:0-无需上传,1-待上传,2-已上传")
}) : })
wx.$util.showToast(status.message || '报价失败') : wx.$util.showToast(status.message || '报价失败')
} else { } else {
console.log(message) console.log(message)
wx.hideLoading() wx.hideLoading()
...@@ -646,13 +625,9 @@ Page({ ...@@ -646,13 +625,9 @@ Page({
} }
}, },
getInsurance() { getInsurance() {
let { let { orderInfo } = this.data
orderInfo
} = this.data
orderInfo = wx.$util.deepClone(orderInfo) orderInfo = wx.$util.deepClone(orderInfo)
let { let { default4SStoreInfo } = wx.$util.getUserInfo()
default4SStoreInfo
} = wx.$util.getUserInfo()
orderInfo.merchantId4s = default4SStoreInfo?.merchantId orderInfo.merchantId4s = default4SStoreInfo?.merchantId
orderInfo.merchantName4s = default4SStoreInfo?.merchantName orderInfo.merchantName4s = default4SStoreInfo?.merchantName
...@@ -672,14 +647,20 @@ Page({ ...@@ -672,14 +647,20 @@ Page({
(pre, item) => { (pre, item) => {
if (item.goods) { if (item.goods) {
item = item.goods item = item.goods
let price =
item.finalPrice !== undefined ? item.finalPrice : item.price
const obj = { const obj = {
goodsId: item.merchantGoodsId, goodsId: item.merchantGoodsId,
goodsName: item.goodsName, goodsName: item.goodsName,
goodsNameAlias: item.goodsAlias || item.goodsNameAlias, goodsNameAlias: item.goodsAlias || item.goodsNameAlias,
specificationsName: item.specificationNameSequence, specificationsName: item.specificationNameSequence,
specificationsValue: item.specificationData ? specificationsValue: item.specificationData
item.specificationData.replace(/;~;/g, '/') : '', ? item.specificationData.replace(/;~;/g, '/')
goodsPrice: this.multipliedByHundred(item.price) : '',
goodsPrice: this.multipliedByHundred(price),
discountType: item.discountType,
discountValue: item.discountValue,
discountAmount: this.multipliedByHundred(item.discountAmount || 0)
} }
pre.push(obj) pre.push(obj)
} }
...@@ -688,6 +669,8 @@ Page({ ...@@ -688,6 +669,8 @@ Page({
item = item.packageGoods item = item.packageGoods
item.goodsList.map(ele => { item.goodsList.map(ele => {
// console.log(ele, '2222'); // console.log(ele, '2222');
let price =
ele.finalPrice !== undefined ? ele.finalPrice : ele.price
let obj = { let obj = {
packageId: item.packageCode, packageId: item.packageCode,
packageName: item.packageName, packageName: item.packageName,
...@@ -696,10 +679,14 @@ Page({ ...@@ -696,10 +679,14 @@ Page({
goodsName: ele.upgradeGoodsName || ele.goodsName, goodsName: ele.upgradeGoodsName || ele.goodsName,
goodsNameAlias: ele.goodsAlias || ele.goodsNameAlias, goodsNameAlias: ele.goodsAlias || ele.goodsNameAlias,
specificationsName: ele.specificationNameSequence, specificationsName: ele.specificationNameSequence,
specificationsValue: ele.specificationData ? specificationsValue: ele.specificationData
ele.specificationData.replace(/;~;/g, '/') : '', ? ele.specificationData.replace(/;~;/g, '/')
: '',
// specificationsValue: item.specificationData ? item.specificationData.replace(reg, ' ') : '', // specificationsValue: item.specificationData ? item.specificationData.replace(reg, ' ') : '',
goodsPrice: this.multipliedByHundred(ele.price) goodsPrice: this.multipliedByHundred(price),
discountType: ele.discountType,
discountValue: ele.discountValue,
discountAmount: this.multipliedByHundred(ele.discountAmount || 0)
} }
pre.push(obj) pre.push(obj)
}) })
...@@ -707,14 +694,20 @@ Page({ ...@@ -707,14 +694,20 @@ Page({
if (item.multipleSpecificationsGoods) { if (item.multipleSpecificationsGoods) {
if (item.multipleSpecificationsGoods.goods) { if (item.multipleSpecificationsGoods.goods) {
item = item.multipleSpecificationsGoods.goods item = item.multipleSpecificationsGoods.goods
let price =
item.finalPrice !== undefined ? item.finalPrice : item.price
const obj = { const obj = {
goodsId: item.merchantGoodsId, goodsId: item.merchantGoodsId,
goodsName: item.upgradeGoodsName || item.goodsName, goodsName: item.upgradeGoodsName || item.goodsName,
goodsNameAlias: item.goodsAlias || item.goodsNameAlias, goodsNameAlias: item.goodsAlias || item.goodsNameAlias,
specificationsName: item.specificationNameSequence, specificationsName: item.specificationNameSequence,
specificationsValue: item.specificationData ? specificationsValue: item.specificationData
item.specificationData.replace(/;~;/g, '/') : '', ? item.specificationData.replace(/;~;/g, '/')
goodsPrice: this.multipliedByHundred(item.price) : '',
goodsPrice: this.multipliedByHundred(price),
discountType: item.discountType,
discountValue: item.discountValue,
discountAmount: this.multipliedByHundred(item.discountAmount || 0)
} }
pre.push(obj) pre.push(obj)
} }
...@@ -726,15 +719,13 @@ Page({ ...@@ -726,15 +719,13 @@ Page({
return orderInfo return orderInfo
}, },
getOwnerInfo() { getOwnerInfo() {
let { let { owner } = this.data
owner
} = this.data
owner = wx.$util.deepClone(owner) owner = wx.$util.deepClone(owner)
owner.price = owner.price =
parseFloat(owner?.price).toString() != 'NaN' ? parseFloat(owner?.price).toString() != 'NaN'
this.multipliedByHundred(owner?.price) : ? this.multipliedByHundred(owner?.price)
'' : ''
// orderInfo.owner = owner // orderInfo.owner = owner
if (owner) { if (owner) {
delete owner?.buyCarTime delete owner?.buyCarTime
...@@ -745,9 +736,7 @@ Page({ ...@@ -745,9 +736,7 @@ Page({
// 获取保险信息 // 获取保险信息
let orderInfo = this.getInsurance() let orderInfo = this.getInsurance()
let owner = this.getOwnerInfo() let owner = this.getOwnerInfo()
let { let { userInfo } = this.data
userInfo
} = this.data
owner.salesType = owner.salesType == '售后' ? 1 : 0 owner.salesType = owner.salesType == '售后' ? 1 : 0
orderInfo.owner = owner orderInfo.owner = owner
orderInfo.check = check orderInfo.check = check
...@@ -759,9 +748,10 @@ Page({ ...@@ -759,9 +748,10 @@ Page({
// 当合同协议弹窗点击稍后补录会传值detail:cancel, 提交表单时不会重复弹出合同协议弹出 // 当合同协议弹窗点击稍后补录会传值detail:cancel, 提交表单时不会重复弹出合同协议弹出
if ( if (
check && check &&
([2, 5, 6, 7].includes(Number(orderInfo.payType))) && [2, 5, 6, 7].includes(Number(orderInfo.payType)) &&
detail != 'cancel' && detail != 'cancel' &&
!orderInfo?.zyPayUrl !orderInfo?.zyPayUrl &&
!orderInfo.resetOrder
) { ) {
wx.hideLoading() wx.hideLoading()
// 请求接口判断是否需要上传合同协议 // 请求接口判断是否需要上传合同协议
...@@ -784,10 +774,7 @@ Page({ ...@@ -784,10 +774,7 @@ Page({
code: 0 code: 0
} }
} }
let { let { code, message } = result
code,
message
} = result
if (code == 0) { if (code == 0) {
this.setData({ this.setData({
showPopup: false showPopup: false
...@@ -832,10 +819,7 @@ Page({ ...@@ -832,10 +819,7 @@ Page({
} else { } else {
// 新增提交 // 新增提交
let result = await quotationAdd(orderInfo) let result = await quotationAdd(orderInfo)
let { let { code, data } = result
code,
data
} = result
// console.log('result', result) // console.log('result', result)
return resolve(result) return resolve(result)
} }
...@@ -849,11 +833,7 @@ Page({ ...@@ -849,11 +833,7 @@ Page({
}, },
getOrderInfo() { getOrderInfo() {
wx.$util.showLoading('加载中...') wx.$util.showLoading('加载中...')
let { let { id, orderInfo, quotationGoodsList } = this.data
id,
orderInfo,
quotationGoodsList
} = this.data
// 先写死调试 // 先写死调试
getQuotationInfoById({ getQuotationInfoById({
...@@ -861,10 +841,7 @@ Page({ ...@@ -861,10 +841,7 @@ Page({
}) })
.then(result => { .then(result => {
console.log('result22222222222', result) console.log('result22222222222', result)
let { let { code, data: tableInfo } = result
code,
data: tableInfo
} = result
tableInfo.owner.price = this.divideByHundred(tableInfo.owner.price) tableInfo.owner.price = this.divideByHundred(tableInfo.owner.price)
// tableInfo.quotedPrice = this.divideByHundred(tableInfo.quotedPrice) // tableInfo.quotedPrice = this.divideByHundred(tableInfo.quotedPrice)
tableInfo.insurancePrice = this.divideByHundred( tableInfo.insurancePrice = this.divideByHundred(
...@@ -882,7 +859,6 @@ Page({ ...@@ -882,7 +859,6 @@ Page({
) )
wx.hideLoading() wx.hideLoading()
if (code == 0) { if (code == 0) {
tableInfo.vdQuotationGoodsList = tableInfo.vdQuotationGoodsList =
tableInfo.vdQuotationGoodsList.reduce((pre, item) => { tableInfo.vdQuotationGoodsList.reduce((pre, item) => {
// 是普通商品 // 是普通商品
...@@ -948,9 +924,11 @@ Page({ ...@@ -948,9 +924,11 @@ Page({
packageGoods: { packageGoods: {
...item, ...item,
packageCode: item.packageId, packageCode: item.packageId,
goodsList: [{ goodsList: [
{
...obj ...obj
}] }
]
} }
}) })
} }
...@@ -991,25 +969,24 @@ Page({ ...@@ -991,25 +969,24 @@ Page({
orderInfo.vdQuotationGoodsList.length && this.totalFee() orderInfo.vdQuotationGoodsList.length && this.totalFee()
} }
}) })
.catch(err => { }) .catch(err => {})
}, },
handleSpecificationsEcho(item) { handleSpecificationsEcho(item) {
console.log('item', item) console.log('item', item)
let { let { quotationGoodsList } = this.data,
quotationGoodsList skuArr = [],
} = this.data, skuArr = [],
arr = item.specificationsValue.split('/'), arr = item.specificationsValue.split('/'),
str = arr.join(';~;'); str = arr.join(';~;')
quotationGoodsList.forEach(data => { quotationGoodsList.forEach(data => {
if (data.goodsFlag == 2) { if (data.goodsFlag == 2) {
let tempData = data.multipleSpecificationsGoods.specificationGoodsMap[str] let tempData =
data.multipleSpecificationsGoods.specificationGoodsMap[str]
if (tempData) { if (tempData) {
tempData.forEach(temp => { tempData.forEach(temp => {
if (temp.merchantGoodsId == item.goodsId) { if (temp.merchantGoodsId == item.goodsId) {
let obj = { let obj = {
goodsFlag: 2, goodsFlag: 2,
goods: null, goods: null
} }
obj.multipleSpecificationsGoods = { obj.multipleSpecificationsGoods = {
...@@ -1029,19 +1006,14 @@ Page({ ...@@ -1029,19 +1006,14 @@ Page({
skuArr.push(obj) skuArr.push(obj)
} }
}) })
} }
} }
}) })
console.log(skuArr) console.log(skuArr)
return skuArr return skuArr
}, },
totalFee() { totalFee() {
let { let { orderInfo } = this.data
orderInfo
} = this.data
let total = 0 let total = 0
// orderInfo.vdQuotationGoodsList.map(i => (total += parseFloat(i?.count || 1) * parseFloat(i.price))) // orderInfo.vdQuotationGoodsList.map(i => (total += parseFloat(i?.count || 1) * parseFloat(i.price)))
...@@ -1068,7 +1040,10 @@ Page({ ...@@ -1068,7 +1040,10 @@ Page({
// total += parseFloat(i.goods.count || 1) * parseFloat(i.goods.price) // total += parseFloat(i.goods.count || 1) * parseFloat(i.goods.price)
total = NP.plus( total = NP.plus(
total, total,
NP.times(parseFloat(i.count || 1), parseFloat(i.multipleSpecificationsGoods.goods.price)) NP.times(
parseFloat(i.count || 1),
parseFloat(i.multipleSpecificationsGoods.goods.price)
)
) )
} }
} }
...@@ -1079,9 +1054,7 @@ Page({ ...@@ -1079,9 +1054,7 @@ Page({
}, },
// 缩小100 // 缩小100
divideByHundredObj(obj) { divideByHundredObj(obj) {
let { let { needChangeList } = this.data
needChangeList
} = this.data
for (const key in obj) { for (const key in obj) {
if (needChangeList.includes(key)) { if (needChangeList.includes(key)) {
obj[key] = this.divideByHundred(obj[key]) obj[key] = this.divideByHundred(obj[key])
...@@ -1092,9 +1065,7 @@ Page({ ...@@ -1092,9 +1065,7 @@ Page({
// 放大100 // 放大100
multipliedByHundredObj(obj) { multipliedByHundredObj(obj) {
console.log(obj, 'obj') console.log(obj, 'obj')
let { let { needChangeList } = this.data
needChangeList
} = this.data
for (const key in obj) { for (const key in obj) {
if (needChangeList.includes(key)) { if (needChangeList.includes(key)) {
obj[key] = this.multipliedByHundred(obj[key]) obj[key] = this.multipliedByHundred(obj[key])
...@@ -1104,17 +1075,12 @@ Page({ ...@@ -1104,17 +1075,12 @@ Page({
}, },
updateOrderStatus() { updateOrderStatus() {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
let { let { orderInfo } = this.data
orderInfo
} = this.data
updateOrderStatus({ updateOrderStatus({
id: orderInfo.id, id: orderInfo.id,
orderStatus: 0 orderStatus: 0
}).then(res => { }).then(res => {
let { let { code, message } = res
code,
message
} = res
if (code == 0) { if (code == 0) {
resolve(true) resolve(true)
// wx.$util.showToast('提交成功') // wx.$util.showToast('提交成功')
...@@ -1128,11 +1094,7 @@ Page({ ...@@ -1128,11 +1094,7 @@ Page({
// 不需要检验 存草稿 // 不需要检验 存草稿
async handleEditSave() { async handleEditSave() {
let { let { owner, orderInfo, saveStatus } = this.data
owner,
orderInfo,
saveStatus
} = this.data
// 补单点放弃 // 补单点放弃
if (orderInfo.outTradeNo || orderInfo.resetOrder) { if (orderInfo.outTradeNo || orderInfo.resetOrder) {
return wx.$router.reLaunch('packageEquity.equityPage', { return wx.$router.reLaunch('packageEquity.equityPage', {
...@@ -1159,11 +1121,7 @@ Page({ ...@@ -1159,11 +1121,7 @@ Page({
saveStatus: false saveStatus: false
}) })
console.log('id', res) console.log('id', res)
let { let { code, data, message } = res
code,
data,
message
} = res
if (code == 0) { if (code == 0) {
wx.$router.reLaunch('packageEquity.equityPage', { wx.$router.reLaunch('packageEquity.equityPage', {
tabIndex: 1 tabIndex: 1
...@@ -1180,14 +1138,9 @@ Page({ ...@@ -1180,14 +1138,9 @@ Page({
this.getQuotationInfo(true) // 不重新调用详情接口 避免修改车辆价格导致重新获取详情 把数据重置了 this.getQuotationInfo(true) // 不重新调用详情接口 避免修改车辆价格导致重新获取详情 把数据重置了
}, },
getQuotationInfo(getOrderInfo, timeNum = 0) { getQuotationInfo(getOrderInfo, timeNum = 0) {
let { default4SStoreInfo } = wx.$util.getUserInfo()
let { let {
default4SStoreInfo owner: { price, carSeriesId },
} = wx.$util.getUserInfo()
let {
owner: {
price,
carSeriesId
},
orderInfo, orderInfo,
id id
} = this.data } = this.data
...@@ -1203,13 +1156,9 @@ Page({ ...@@ -1203,13 +1156,9 @@ Page({
sceneType: 0 sceneType: 0
}) })
.then(result => { .then(result => {
// debugger // debugger
let { let { data } = result
data
} = result
data = data.map(ele => { data = data.map(ele => {
// goodsFlag商品标识(1.普通商品,2.多规格商品,3:套餐商品) // goodsFlag商品标识(1.普通商品,2.多规格商品,3:套餐商品)
if (ele.goodsFlag == 1) { if (ele.goodsFlag == 1) {
let item = ele.goods let item = ele.goods
...@@ -1245,11 +1194,16 @@ Page({ ...@@ -1245,11 +1194,16 @@ Page({
goodsNameAlias: item.upgradeGoodsAlias, goodsNameAlias: item.upgradeGoodsAlias,
appreciation: item?.appreciation, appreciation: item?.appreciation,
goodsName: item?.upgradeGoodsName, goodsName: item?.upgradeGoodsName,
specificationNameSequence: item.specificationTypeSequence && item.specificationNameSequence ? specificationNameSequence:
item.specificationNameSequence.replace(/;~;/g, '/') : '', item.specificationTypeSequence && item.specificationNameSequence
specificationData: item.specificationTypeSequence && item.specificationData ? ? item.specificationNameSequence.replace(/;~;/g, '/')
item.specificationData.replace(/;~;/g, '/') : '', : '',
quotationGoodsServiceItemsRelationDTOList: item?.upgradeGoodsServiceItemsList, specificationData:
item.specificationTypeSequence && item.specificationData
? item.specificationData.replace(/;~;/g, '/')
: '',
quotationGoodsServiceItemsRelationDTOList:
item?.upgradeGoodsServiceItemsList,
titlePictureUrl: item.goodsInfo?.thumbUrl titlePictureUrl: item.goodsInfo?.thumbUrl
} }
} }
...@@ -1257,15 +1211,14 @@ Page({ ...@@ -1257,15 +1211,14 @@ Page({
if (ele.goodsFlag == 3) { if (ele.goodsFlag == 3) {
let item = ele.packageGoods let item = ele.packageGoods
ele.packageGoods.goodsList = item.goodsList.map(item => { ele.packageGoods.goodsList = item.goodsList.map(item => {
; ;((item.specificationNameSequence =
(item.specificationNameSequence = item.specificationTypeSequence && item.specificationNameSequence
item.specificationTypeSequence && item.specificationNameSequence ? ? item.specificationNameSequence.replace(/;~;/g, '/')
item.specificationNameSequence.replace(/;~;/g, '/') : : ''),
''),
(item.specificationData = (item.specificationData =
item.specificationTypeSequence && item.specificationData ? item.specificationTypeSequence && item.specificationData
item.specificationData.replace(/;~;/g, '/') : ? item.specificationData.replace(/;~;/g, '/')
'') : ''))
return item return item
}) })
ele.packageGoods.sellPrice = item.goodsList.reduce((pre, item) => { ele.packageGoods.sellPrice = item.goodsList.reduce((pre, item) => {
...@@ -1281,7 +1234,9 @@ Page({ ...@@ -1281,7 +1234,9 @@ Page({
item.specificationSelectValueList = [] item.specificationSelectValueList = []
item.specificationValueList.forEach(second => { item.specificationValueList.forEach(second => {
if (second.show) { if (second.show) {
item.specificationSelectValueList.push(second.specificationValue) item.specificationSelectValueList.push(
second.specificationValue
)
} }
}) })
}) })
...@@ -1361,10 +1316,7 @@ Page({ ...@@ -1361,10 +1316,7 @@ Page({
}, },
back() { back() {
console.log('back') console.log('back')
let { let { step, isClue } = this.data
step,
isClue
} = this.data
console.log('step', step) console.log('step', step)
// return wx.$router.go('packageEquity.equityPage', { tabIndex: 1 }) // return wx.$router.go('packageEquity.equityPage', { tabIndex: 1 })
if (isClue) return wx.$router.back() if (isClue) return wx.$router.back()
...@@ -1382,13 +1334,11 @@ Page({ ...@@ -1382,13 +1334,11 @@ Page({
navBarHeight navBarHeight
}) })
}, },
init() { }, init() {},
onRoute(options) { onRoute(options) {
console.log(options, 'options') console.log(options, 'options')
// options.id = 9047 // options.id = 9047
let { let { firstEnter } = this.data
firstEnter
} = this.data
// 判断是编辑还是新增 // 判断是编辑还是新增
let { let {
selectOutTradeNoArr, selectOutTradeNoArr,
...@@ -1408,7 +1358,14 @@ Page({ ...@@ -1408,7 +1358,14 @@ Page({
// paymentMethod 4 收款方为嘀加且属于对公转账收款:跳转新建工单页面-且收款方为嘀加收款,收款方式为对公转账,不可修改 // paymentMethod 4 收款方为嘀加且属于对公转账收款:跳转新建工单页面-且收款方为嘀加收款,收款方式为对公转账,不可修改
// paymentMethod 6 收款方为嘀加二维码收款(适用于多笔订单一笔流水付款):跳转新建工单页面-且收款方为嘀加收款,收款方式为其它收款,不可修改 // paymentMethod 6 收款方为嘀加二维码收款(适用于多笔订单一笔流水付款):跳转新建工单页面-且收款方为嘀加收款,收款方式为其它收款,不可修改
this.setData({ this.setData({
['orderInfo.payType']: paymentMethod == 3 ? 2 : paymentMethod == 1 ? 1 : paymentMethod == 4 ? 6 : 7, ['orderInfo.payType']:
paymentMethod == 3
? 2
: paymentMethod == 1
? 1
: paymentMethod == 4
? 6
: 7,
['orderInfo.payee']: paymentMethod == 3 ? 1 : 0 ['orderInfo.payee']: paymentMethod == 3 ? 1 : 0
}) })
} }
...@@ -1416,7 +1373,9 @@ Page({ ...@@ -1416,7 +1373,9 @@ Page({
// 流水补录 // 流水补录
if (selectOutTradeNoArr?.length) { if (selectOutTradeNoArr?.length) {
// 处理已选的交易参考号数据 // 处理已选的交易参考号数据
const switchValues = new Set(selectOutTradeNoArr.map(item => Number(item.switchValue))); const switchValues = new Set(
selectOutTradeNoArr.map(item => Number(item.switchValue))
)
let switchValue let switchValue
if (switchValues.size === 1) { if (switchValues.size === 1) {
switchValue = switchValues.has(1) ? 1 : 2 switchValue = switchValues.has(1) ? 1 : 2
...@@ -1433,7 +1392,7 @@ Page({ ...@@ -1433,7 +1392,7 @@ Page({
}, '') }, '')
const totalFee = selectOutTradeNoArr.reduce((num, item, index) => { const totalFee = selectOutTradeNoArr.reduce((num, item, index) => {
num += item.totalFee num += item.totalFee
return num; return num
}, 0) }, 0)
console.log(selectOutTradeNoArr, switchValue) console.log(selectOutTradeNoArr, switchValue)
const accountDate = this.getLatestAccountDate(selectOutTradeNoArr) const accountDate = this.getLatestAccountDate(selectOutTradeNoArr)
...@@ -1445,17 +1404,25 @@ Page({ ...@@ -1445,17 +1404,25 @@ Page({
totalFee, totalFee,
accountDate, accountDate,
showTips: true, showTips: true,
['orderInfo.payType']: switchValue == 1 && selectOutTradeNoArr?.length == 1 ? 1 : 5, // 当已选交易参考号只有一个并且是正常分账期内,支付方式随意赋值防止提交校验支付方式为空(后端会根据流水号付款方式处理)其余则为嘀加收款支付方式 ['orderInfo.payType']:
switchValue == 1 && selectOutTradeNoArr?.length == 1 ? 1 : 5, // 当已选交易参考号只有一个并且是正常分账期内,支付方式随意赋值防止提交校验支付方式为空(后端会根据流水号付款方式处理)其余则为嘀加收款支付方式
['orderInfo.payee']: 0, ['orderInfo.payee']: 0,
['orderInfo.outTradeNo']: outTradeNo, ['orderInfo.outTradeNo']: outTradeNo,
['orderInfo.tradeNo']: tradeNo, ['orderInfo.tradeNo']: tradeNo,
['orderInfo.transactionNo']: tradeNo, ['orderInfo.transactionNo']: tradeNo,
['orderInfo.switchValue']: switchValue, ['orderInfo.switchValue']: switchValue,
['orderInfo.selectOutTradeNoArr']: selectOutTradeNoArr, ['orderInfo.selectOutTradeNoArr']: selectOutTradeNoArr,
['orderInfo.successDateTime']: switchValue == 1 && selectOutTradeNoArr?.length == 1 ? '' : accountDate, ['orderInfo.successDateTime']:
['orderInfo.pay2Time']: switchValue == 1 && selectOutTradeNoArr?.length == 1 ? '' : accountDate switchValue == 1 && selectOutTradeNoArr?.length == 1
? ''
: accountDate,
['orderInfo.pay2Time']:
switchValue == 1 && selectOutTradeNoArr?.length == 1
? ''
: accountDate
}) })
} }
// 错误工单
if (resetOrder) this.resetOrder = resetOrder if (resetOrder) this.resetOrder = resetOrder
if (id) { if (id) {
this.setData({ this.setData({
...@@ -1473,10 +1440,7 @@ Page({ ...@@ -1473,10 +1440,7 @@ Page({
this.orderSettingList() this.orderSettingList()
}, },
setCustomerInfo(customerInfo) { setCustomerInfo(customerInfo) {
let { let { owner, orderInfo } = this.data
owner,
orderInfo
} = this.data
owner.owner = customerInfo.customerName owner.owner = customerInfo.customerName
owner.phone = customerInfo.customerPhone owner.phone = customerInfo.customerPhone
owner.ownerGender = customerInfo.customerSex != 2 ? '男' : '女' owner.ownerGender = customerInfo.customerSex != 2 ? '男' : '女'
...@@ -1516,10 +1480,7 @@ Page({ ...@@ -1516,10 +1480,7 @@ Page({
orderSettingList(params) orderSettingList(params)
.then(result => { .then(result => {
console.log(result, 'result') console.log(result, 'result')
let { let { code, data } = result
code,
data
} = result
if (code == 0) { if (code == 0) {
let required = data.reduce((pre, item) => { let required = data.reduce((pre, item) => {
if (item.isRequired) { if (item.isRequired) {
...@@ -1548,10 +1509,12 @@ Page({ ...@@ -1548,10 +1509,12 @@ Page({
required: true, required: true,
requiredAfter: true requiredAfter: true
} }
formRule.carSeriesName = [{ formRule.carSeriesName = [
{
required: true, required: true,
message: '车型不能为空' message: '车型不能为空'
}] }
]
} }
if (required.includes('carNo')) { if (required.includes('carNo')) {
first.carFormList[2] = { first.carFormList[2] = {
...@@ -1562,16 +1525,18 @@ Page({ ...@@ -1562,16 +1525,18 @@ Page({
required: true, required: true,
requiredAfter: true requiredAfter: true
} }
formRule.carVin = [{ formRule.carVin = [
{
required: true, required: true,
message: '车架号不能为空' message: '车架号不能为空'
}, },
{ {
validator: (rule, value) => { validator: (rule, value) => {
return value.length != 17 ? { return value.length != 17
? {
message: '请输入正确的17位车架号' message: '请输入正确的17位车架号'
} : }
null : null
} }
} }
] ]
...@@ -1586,17 +1551,19 @@ Page({ ...@@ -1586,17 +1551,19 @@ Page({
required: true, required: true,
requiredAfter: true requiredAfter: true
} }
formRule.certificateNo = [{ formRule.certificateNo = [
{
required: true, required: true,
message: '证件号码不能为空' message: '证件号码不能为空'
}, },
{ {
validator: (rule, value) => { validator: (rule, value) => {
if (value) { if (value) {
return value.length != 18 ? { return value.length != 18
? {
message: '请输入正确的18位证件号' message: '请输入正确的18位证件号'
} : }
null : null
} }
} }
} }
...@@ -1609,14 +1576,14 @@ Page({ ...@@ -1609,14 +1576,14 @@ Page({
}) })
} }
}) })
.catch(err => { }) .catch(err => {})
}, },
setTime() { setTime() {
let _this = this; let _this = this
time = setTimeout(() => { time = setTimeout(() => {
// console.log(_this.getWaitOrder) // console.log(_this.getWaitOrder)
// _this.getWaitOrder(); // _this.getWaitOrder();
}, 10 * 1000); }, 10 * 1000)
}, },
// 10s轮询一次待补录 // 10s轮询一次待补录
getWaitOrder() { getWaitOrder() {
...@@ -1625,22 +1592,20 @@ Page({ ...@@ -1625,22 +1592,20 @@ Page({
// let thisPage = wx.$router.getPageInstance() // let thisPage = wx.$router.getPageInstance()
// console.log(thisPage.route, ' thisPage.route') // console.log(thisPage.route, ' thisPage.route')
// thisPage.route == 'tabIndex/pages/index/index' && // thisPage.route == 'tabIndex/pages/index/index' &&
time && clearTimeout(time); //解决切换门店时 需要清除计时器 time && clearTimeout(time) //解决切换门店时 需要清除计时器
// if (isStaff) { // if (isStaff) {
waitinputorder().then((result) => { waitinputorder()
.then(result => {
console.log(result, 'getWaitOrder') console.log(result, 'getWaitOrder')
let { let { code, data } = result
code, this.setTime()
data
} = result;
this.setTime();
if (code == 0) { if (code == 0) {
this.setData({ this.setData({
waitInputCount: data.waitInputCount, waitInputCount: data.waitInputCount
}); })
} }
}) })
.catch((err) => { }); .catch(err => {})
// } // }
}, },
/** /**
...@@ -1668,37 +1633,36 @@ Page({ ...@@ -1668,37 +1633,36 @@ Page({
/** /**
* 生命周期函数--监听页面初次渲染完成 * 生命周期函数--监听页面初次渲染完成
*/ */
onReady() { }, onReady() {},
/** /**
* 生命周期函数--监听页面显示 * 生命周期函数--监听页面显示
*/ */
onShow() { onShow() {
// 如果是员工 开启订单补录轮询 // 如果是员工 开启订单补录轮询
// this.getWaitOrder(); // this.getWaitOrder();
}, },
/** /**
* 生命周期函数--监听页面隐藏 * 生命周期函数--监听页面隐藏
*/ */
onHide() { onHide() {
time && clearTimeout(time); time && clearTimeout(time)
}, },
/** /**
* 生命周期函数--监听页面卸载 * 生命周期函数--监听页面卸载
*/ */
onUnload() { onUnload() {
time && clearTimeout(time); time && clearTimeout(time)
}, },
/** /**
* 页面相关事件处理函数--监听用户下拉动作 * 页面相关事件处理函数--监听用户下拉动作
*/ */
onPullDownRefresh() { }, onPullDownRefresh() {},
/** /**
* 页面上拉触底事件的处理函数 * 页面上拉触底事件的处理函数
*/ */
onReachBottom() { }, onReachBottom() {},
/** /**
* 用户点击右上角分享 * 用户点击右上角分享
*/ */
onShareAppMessage() { } onShareAppMessage() {}
}) })
...@@ -3,19 +3,36 @@ ...@@ -3,19 +3,36 @@
<!-- <scroll-view class="container" scroll-y style="height:{{windowHeight}}px"> --> <!-- <scroll-view class="container" scroll-y style="height:{{windowHeight}}px"> -->
<navigation-bar class="navigation-header" bindnavbarReady="navbarReady" showBack="{{ true }}" bindback="back"> <navigation-bar class="navigation-header" bindnavbarReady="navbarReady" showBack="{{ true }}" bindback="back">
<view class="navigation-title"> <view class="navigation-title">
<view class="navigation-title-text text-hide"> <view class="navigation-title-text text-hide">车险信息</view>
车险信息
</view>
</view> </view>
</navigation-bar> </navigation-bar>
<!-- {{scrollDisabled? "": height:{{windowHeight}}px}} --> <!-- {{scrollDisabled? "": height:{{windowHeight}}px}} -->
<view class="layout {{(showTips||waitInputCount)?'fullSucreen-tips':'' }} {{scrollDisabled?'scroll-disabled':''}}" style="padding-top:{{ navBarHeight }}px; "> <view
<first-step id="FirstStep" serviceInfo="{{ owner }}" dataAttrName="{{ dataAttrName }}" orderInfo="{{ orderInfo }}" subBtnShow="{{ false }}" mode="{{mode}}" /> class="layout {{ (showTips||waitInputCount)?'fullSucreen-tips':'' }} {{scrollDisabled?'scroll-disabled':'' }}"
<second-step id="SecondStep" orderInfo="{{ orderInfo }}" quotationGoodsList="{{ quotationGoodsList }}" bindconfirm="handleSecondConfirm" bindeditSave="handleEditSave" paymentMethod="{{paymentMethod}}" /> style="padding-top:{{ navBarHeight }}px;"
>
<first-step
id="FirstStep"
serviceInfo="{{ owner }}"
dataAttrName="{{ dataAttrName }}"
orderInfo="{{ orderInfo }}"
subBtnShow="{{ false }}"
mode="{{ mode }}"
/>
<second-step
id="SecondStep"
orderInfo="{{ orderInfo }}"
quotationGoodsList="{{ quotationGoodsList }}"
bindconfirm="handleSecondConfirm"
bindeditSave="handleEditSave"
paymentMethod="{{ paymentMethod }}"
totalFee="{{ totalFee }}"
bind:showTips="tipsEvent"
/>
</view> </view>
<view wx:if="{{showTips}}" class="btns {{isFullSucreen?'isFullSucreen-btn':''}}"> <view wx:if="{{ showTips && !orderInfo.resetOrder }}" class="btns {{ isFullSucreen?'isFullSucreen-btn':'' }}">
<view class="tips"> <view class="tips">
<image class=" tipsIcon" src="../../../images/tips.png" /> <image class="tipsIcon" src="../../../images/tips.png" />
<view class="contentText"> <view class="contentText">
<view class="tradeNoCon"> <view class="tradeNoCon">
<view>交易参考号:</view> <view>交易参考号:</view>
...@@ -36,10 +53,35 @@ ...@@ -36,10 +53,35 @@
<!-- <view class="waitOrderCon {{ showTips? 'showTips':'' }}" wx:if="{{ waitInputCount && !orderInfo.resetOrder && !isErrorOrder&&!outTradeNo }}"> <!-- <view class="waitOrderCon {{ showTips? 'showTips':'' }}" wx:if="{{ waitInputCount && !orderInfo.resetOrder && !isErrorOrder&&!outTradeNo }}">
<tips-bottom style="width: 100%;box-sizing: border-box;" tipsProps="{{ tipsProps }}" /> <tips-bottom style="width: 100%;box-sizing: border-box;" tipsProps="{{ tipsProps }}" />
</view> --> </view> -->
<order-no-popup wx:if="{{ showOrderpop && !(isErrorOrder) }}" outTradeNo="{{ selectOutTradeNoArr }}" switchValuerec="{{switchValue}}" show="{{ showOrderpop }}" bind:success="navigator" title="请选择交易参考号" /> <order-no-popup
<order-popup orderType="{{orderInfo.payType }}" resetTransNo="{{orderInfo.transactionNo || orderInfo.outTradeNo}}" resetOrder="{{orderInfo.resetOrder}}" orderInfo="{{orderInfo}}" wx:if="{{showPopup}}" show="{{showPopup}}" /> wx:if="{{ showOrderpop }}"
outTradeNo="{{ selectOutTradeNoArr }}"
switchValuerec="{{ switchValue }}"
show="{{ showOrderpop }}"
bind:success="navigator"
title="请选择交易参考号"
/>
<order-popup
orderType="{{ orderInfo.payType }}"
resetTransNo="{{ orderInfo.transactionNo || orderInfo.outTradeNo }}"
resetOrder="{{ orderInfo.resetOrder }}"
orderInfo="{{ orderInfo }}"
wx:if="{{ showPopup }}"
show="{{ showPopup }}"
/>
<!-- vin二次复核 --> <!-- vin二次复核 -->
<vin-sec-dialog wx:if="{{showVinDialog}}" showVinDialog="{{showVinDialog}}" secFormData="{{secFormData}}" bindonClose="handleSecClose" bindonConfirm="handleSecConfirm"></vin-sec-dialog> <vin-sec-dialog
wx:if="{{ showVinDialog }}"
showVinDialog="{{ showVinDialog }}"
secFormData="{{ secFormData }}"
bindonClose="handleSecClose"
bindonConfirm="handleSecConfirm"
></vin-sec-dialog>
<!-- 上传合同协议 --> <!-- 上传合同协议 -->
<zy-pay-popup show="{{showZyPopup}}" wx:if="{{showZyPopup}}" supplementaryFlag="{{supplementaryFlag}}" bindconfirm="zyPayConfirm"></zy-pay-popup> <zy-pay-popup
show="{{ showZyPopup }}"
wx:if="{{ showZyPopup }}"
supplementaryFlag="{{ supplementaryFlag }}"
bindconfirm="zyPayConfirm"
></zy-pay-popup>
<study-permission-modal id="customModal" /> <study-permission-modal id="customModal" />
\ No newline at end of file \ No newline at end of file
/**
* 商品操作策略模式实现
*
* 设计意图:
* 针对 createOrder 页面中存在的多种商品类型(普通商品、多规格商品、套餐商品),
* 采用策略模式(Strategy Pattern)统一封装商品的数据获取、价格计算、校验逻辑。
*
* 结构说明:
* - ProductStrategy (基类): 定义所有商品类型共有的接口(如 getData, getPrice, validatePrice 等)。
* - NormalProductStrategy: 处理普通商品 (item.goods)。
* - MultiSpecProductStrategy: 处理多规格商品 (item.multipleSpecificationsGoods)。
* - PackageProductStrategy: 处理套餐商品 (item.packageGoods),包含对子商品的处理逻辑。
* - getProductStrategy (工厂函数): 根据商品数据结构自动匹配对应的策略实例。
*/
import NP from 'number-precision'
export const ORDER_TYPE = {
NORMAL: 1,
DISCOUNT: 2,
GIFT: 3,
IMPULSE: 4,
COMBINATION: 5
}
export const DISCOUNT_TYPE = {
RATIO: 1,
AMOUNT: 2,
NONE: 3,
GIFT: 4,
NON_GIFT: 5
}
/**
* 商品策略基类
*/
function ProductStrategy(item) {
this.item = item
}
ProductStrategy.prototype.getData = function () {
return {}
}
ProductStrategy.prototype.getPrice = function () {
return 0
}
ProductStrategy.prototype.setPrice = function (price) {
// override
}
ProductStrategy.prototype.getMinPrice = function () {
const data = this.getData()
return data.minSellPrice || 0
}
ProductStrategy.prototype.getCount = function () {
return this.item.count || 1
}
ProductStrategy.prototype.calculateSubtotal = function () {
return NP.times(parseFloat(this.getCount()), parseFloat(this.getPrice()))
}
ProductStrategy.prototype.validatePrice = function (price) {
const checkPrice = price !== undefined ? price : this.getPrice()
const data = this.getData()
if (data.discountType === DISCOUNT_TYPE.GIFT) {
return { valid: true }
}
if (
data.validMinSellPrice === 'Y' &&
Number(checkPrice) < Number(data.minSellPrice)
) {
return { valid: false, message: '单价不可低于商品最低价' }
}
return { valid: true }
}
ProductStrategy.prototype.initBasePrice = function () {
const data = this.getData()
if (data.basePrice === undefined) {
data.basePrice = this.getPrice()
}
}
ProductStrategy.prototype.setBasePrice = function (price) {
const data = this.getData()
data.basePrice = price
this.setPrice(price)
this.applyDiscount()
}
ProductStrategy.prototype.getBasePrice = function () {
const data = this.getData()
return data.basePrice !== undefined ? data.basePrice : this.getPrice()
}
ProductStrategy.prototype.resetDiscount = function () {
this.setDiscount(DISCOUNT_TYPE.NONE, 0)
}
ProductStrategy.prototype.setDiscount = function (type, value) {
const data = this.getData()
this.initBasePrice()
data.discountType = type
data.discountValue = value
this.applyDiscount()
}
ProductStrategy.prototype.applyDiscount = function () {
const data = this.getData()
const basePrice =
data.basePrice !== undefined ? data.basePrice : this.getPrice()
let finalPrice = basePrice
const type = data.discountType
const value = data.discountValue
if (type == DISCOUNT_TYPE.RATIO && value) {
if (value > 0 && value <= 10) {
finalPrice = NP.times(basePrice, NP.divide(value, 10))
finalPrice = Math.round(finalPrice * 100) / 100
}
} else if (type == DISCOUNT_TYPE.AMOUNT && value) {
finalPrice = NP.minus(basePrice, value)
if (finalPrice < 0) finalPrice = 0
} else if (type == DISCOUNT_TYPE.GIFT) {
finalPrice = 0
} else if (type == DISCOUNT_TYPE.NONE || type == DISCOUNT_TYPE.NON_GIFT) {
finalPrice = basePrice
}
// this.setPrice(finalPrice)
data.finalPrice = finalPrice
data.discountAmount = NP.minus(basePrice, finalPrice)
}
ProductStrategy.prototype.setError = function (isError) {
const data = this.getData()
if (data) {
data.errorTarget = isError
}
}
ProductStrategy.prototype.performValidation = function () {
// 使用 getBasePrice() 验证基础价格,而不是最终价格(this.getPrice())
// 避免因折扣导致最终价格低于最低售价时,基础价格输入框报红
const result = this.validatePrice(this.getBasePrice())
this.setError(!result.valid)
const data = this.getData()
if (data.sellPrice !== undefined && data.validMinSellPrice === 'Y') {
if (Number(data.sellPrice) < Number(data.minSellPrice)) {
data.basePriceError = true
} else {
data.basePriceError = false
}
}
return result
}
/**
* 普通商品策略
*/
function NormalProductStrategy(item) {
ProductStrategy.call(this, item)
}
NormalProductStrategy.prototype = Object.create(ProductStrategy.prototype)
NormalProductStrategy.prototype.constructor = NormalProductStrategy
NormalProductStrategy.prototype.getData = function () {
return this.item.goods
}
NormalProductStrategy.prototype.getPrice = function () {
return this.item.goods.finalPrice !== undefined
? this.item.goods.finalPrice
: this.item.goods.sellPrice
}
NormalProductStrategy.prototype.setPrice = function (price) {
this.item.goods.sellPrice = price
}
/**
* 多规格商品策略
*/
function MultiSpecProductStrategy(item) {
ProductStrategy.call(this, item)
}
MultiSpecProductStrategy.prototype = Object.create(ProductStrategy.prototype)
MultiSpecProductStrategy.prototype.constructor = MultiSpecProductStrategy
MultiSpecProductStrategy.prototype.getData = function () {
return this.item.multipleSpecificationsGoods.goods
}
MultiSpecProductStrategy.prototype.getPrice = function () {
return this.item.multipleSpecificationsGoods.goods.finalPrice !== undefined
? this.item.multipleSpecificationsGoods.goods.finalPrice
: this.item.multipleSpecificationsGoods.goods.sellPrice
}
MultiSpecProductStrategy.prototype.setPrice = function (price) {
this.item.multipleSpecificationsGoods.goods.sellPrice = price
}
/**
* 套餐商品策略
*/
function PackageProductStrategy(item) {
ProductStrategy.call(this, item)
}
PackageProductStrategy.prototype = Object.create(ProductStrategy.prototype)
PackageProductStrategy.prototype.constructor = PackageProductStrategy
PackageProductStrategy.prototype.getData = function () {
return this.item.packageGoods
}
PackageProductStrategy.prototype.getPrice = function () {
return this.item.packageGoods.price
}
PackageProductStrategy.prototype.setPrice = function (price) {
this.item.packageGoods.price = price
}
PackageProductStrategy.prototype.calculateSubtotal = function () {
const packagePrice = this.item.packageGoods.goodsList.reduce((prev, cur) => {
const price = cur.finalPrice !== undefined ? cur.finalPrice : cur.price
return NP.plus(prev, price)
}, 0)
this.item.packageGoods.price = packagePrice
const total = NP.times(packagePrice, this.getCount())
this.item.totalPrice = total
return total
}
PackageProductStrategy.prototype.performValidation = function () {
let hasError = false
if (this.item.packageGoods && this.item.packageGoods.goodsList) {
this.item.packageGoods.goodsList.forEach(subItem => {
if (
subItem.validMinSellPrice === 'Y' &&
Number(subItem.price) < Number(subItem.minSellPrice)
) {
subItem.errorTarget = true
hasError = true
} else {
subItem.errorTarget = false
}
})
}
return { valid: !hasError }
}
PackageProductStrategy.prototype.getSubItemData = function (index) {
if (this.item.packageGoods && this.item.packageGoods.goodsList) {
return this.item.packageGoods.goodsList[index]
}
return {}
}
PackageProductStrategy.prototype.resetDiscount = function () {
if (this.item.packageGoods && this.item.packageGoods.goodsList) {
this.item.packageGoods.goodsList.forEach((subItem, index) => {
this.updateSubItemDiscount(index, DISCOUNT_TYPE.NONE, 0)
})
}
}
PackageProductStrategy.prototype.getSubItemBasePrice = function (index) {
if (
this.item.packageGoods &&
this.item.packageGoods.goodsList &&
this.item.packageGoods.goodsList[index]
) {
const subItem = this.item.packageGoods.goodsList[index]
if (subItem.basePrice === undefined) {
subItem.basePrice = subItem.price
}
return subItem.basePrice
}
return 0
}
PackageProductStrategy.prototype.updateSubItemPrice = function (index, price) {
if (
this.item.packageGoods &&
this.item.packageGoods.goodsList &&
this.item.packageGoods.goodsList[index]
) {
const subItem = this.item.packageGoods.goodsList[index]
if (subItem.basePrice === undefined) {
subItem.basePrice = subItem.price
}
subItem.basePrice = price
this.applySubItemDiscount(subItem)
}
}
PackageProductStrategy.prototype.updateSubItemDiscount = function (
index,
type,
value
) {
if (
this.item.packageGoods &&
this.item.packageGoods.goodsList &&
this.item.packageGoods.goodsList[index]
) {
const subItem = this.item.packageGoods.goodsList[index]
if (subItem.basePrice === undefined) {
subItem.basePrice = subItem.price
}
subItem.discountType = type
subItem.discountValue = value
this.applySubItemDiscount(subItem)
}
}
PackageProductStrategy.prototype.applySubItemDiscount = function (subItem) {
const basePrice = subItem.basePrice
let finalPrice = basePrice
const type = subItem.discountType
const value = subItem.discountValue
if (type == DISCOUNT_TYPE.RATIO && value) {
if (value > 0 && value <= 10) {
finalPrice = NP.times(basePrice, NP.divide(value, 10))
finalPrice = Math.round(finalPrice * 100) / 100
}
} else if (type == DISCOUNT_TYPE.AMOUNT && value) {
finalPrice = NP.minus(basePrice, value)
if (finalPrice < 0) finalPrice = 0
} else if (type == DISCOUNT_TYPE.GIFT) {
finalPrice = 0
} else if (type == DISCOUNT_TYPE.NONE || type == DISCOUNT_TYPE.NON_GIFT) {
finalPrice = basePrice
}
// subItem.price = finalPrice
subItem.finalPrice = finalPrice
subItem.discountAmount = NP.minus(basePrice, finalPrice)
}
PackageProductStrategy.prototype.validateSubItemPrice = function (
subItem,
price
) {
if (subItem.discountType === DISCOUNT_TYPE.GIFT) {
return { valid: true }
}
if (
subItem.validMinSellPrice === 'Y' &&
Number(price) < Number(subItem.minSellPrice)
) {
return { valid: false, message: '单价不可低于商品最低价' }
}
return { valid: true }
}
export function getProductStrategy(item) {
if (!item) return null
if (item.goods) {
return new NormalProductStrategy(item)
} else if (item.packageGoods) {
return new PackageProductStrategy(item)
} else if (item.multipleSpecificationsGoods) {
return new MultiSpecProductStrategy(item)
}
return null
}
...@@ -314,7 +314,7 @@ Page({ ...@@ -314,7 +314,7 @@ Page({
}) })
getRecruitDetailAPI({ getRecruitDetailAPI({
id: id id: '341'
}) })
.then(res => { .then(res => {
let { let {
...@@ -386,7 +386,7 @@ Page({ ...@@ -386,7 +386,7 @@ Page({
recruitmentInfoConfig: filteredRecruitmentInfoConfig recruitmentInfoConfig: filteredRecruitmentInfoConfig
}) })
}) })
.catch(err => {}) .catch(err => { })
}, },
/** /**
* 处理按钮点击 * 处理按钮点击
...@@ -666,35 +666,35 @@ Page({ ...@@ -666,35 +666,35 @@ Page({
/** /**
* 生命周期函数--监听页面初次渲染完成 * 生命周期函数--监听页面初次渲染完成
*/ */
onReady() {}, onReady() { },
/** /**
* 生命周期函数--监听页面显示 * 生命周期函数--监听页面显示
*/ */
onShow() {}, onShow() { },
/** /**
* 生命周期函数--监听页面隐藏 * 生命周期函数--监听页面隐藏
*/ */
onHide() {}, onHide() { },
/** /**
* 生命周期函数--监听页面卸载 * 生命周期函数--监听页面卸载
*/ */
onUnload() {}, onUnload() { },
/** /**
* 页面相关事件处理函数--监听用户下拉动作 * 页面相关事件处理函数--监听用户下拉动作
*/ */
onPullDownRefresh() {}, onPullDownRefresh() { },
/** /**
* 页面上拉触底事件的处理函数 * 页面上拉触底事件的处理函数
*/ */
onReachBottom() {}, onReachBottom() { },
/** /**
* 用户点击右上角分享 * 用户点击右上角分享
*/ */
onShareAppMessage() {} onShareAppMessage() { }
}) })
...@@ -52,11 +52,13 @@ Page({ ...@@ -52,11 +52,13 @@ Page({
// 没有返回触发事件, 使用定时器轮询学习状态,是否卸载返回拦截弹窗 // 没有返回触发事件, 使用定时器轮询学习状态,是否卸载返回拦截弹窗
this.setTime(param) this.setTime(param)
} }
}
}, },
setTime(param) { setTime(param) {
time = setTimeout(() => { time = setTimeout(() => {
commonApi.getShortCourseDetail({ commonApi
.getShortCourseDetail({
id: param?.studyId id: param?.studyId
}) })
.then(res => { .then(res => {
...@@ -105,11 +107,11 @@ Page({ ...@@ -105,11 +107,11 @@ Page({
}, },
handleMessage(e) { handleMessage(e) {
const { data } = e.detail; const { data } = e.detail
// 将数据返回给跳转来源 // 将数据返回给跳转来源
if (data) { if (data) {
const eventChannel = this.getOpenerEventChannel(); const eventChannel = this.getOpenerEventChannel()
eventChannel.emit('webViewMessage', data[0]); // 发送数据 eventChannel.emit('webViewMessage', data[0]) // 发送数据
this.setData({ this.setData({
isH5Bind: true isH5Bind: true
}) })
...@@ -128,9 +130,9 @@ Page({ ...@@ -128,9 +130,9 @@ Page({
} }
// 中邮上传合同协议页面 // 中邮上传合同协议页面
if (url.includes('zyUpload')) { if (url.includes('zyUpload')) {
const eventChannel = this.getOpenerEventChannel(); const eventChannel = this.getOpenerEventChannel()
if (!this.data.isH5Bind) { if (!this.data.isH5Bind) {
eventChannel.emit('webViewMessage', 'cancel'); // 发送数据 eventChannel.emit('webViewMessage', 'cancel') // 发送数据
} }
} }
// 北森考试页面返回 // 北森考试页面返回
......
Component({
options: {
addGlobalClass: true
},
properties: {
product: {
type: Object,
value: {}
},
orderType: {
type: Number,
value: 1
},
selectPayType: {
type: Number,
value: 0
},
index: {
type: Number,
value: 0
},
gindex: {
type: Number,
value: -1
},
count: {
type: Number,
value: 1
},
isPackageSubItem: {
type: Boolean,
value: false
},
positionTypeList: {
type: Array,
value: []
},
baseConfigData: {
type: Object,
value: {}
},
positionNum: {
type: String,
value: ''
},
popupType: {
type: String,
value: '2'
},
showPopupName: {
type: String,
value: 'goodsBox'
},
productName: {
type: String,
value: ''
}
},
methods: {
changePrice(e) {
this.triggerEvent('priceChange', {
value: e.detail.value,
index: this.data.index,
gindex: this.data.gindex,
item: this.data.product
})
},
priceBlur(e) {
this.triggerEvent('priceBlur', {
index: this.data.index,
gindex: this.data.gindex
})
},
changeProductDiscountType(e) {
const { type } = e.currentTarget.dataset
this.triggerEvent('discountTypeChange', {
type,
index: this.data.index,
gindex: this.data.gindex
})
},
inputDiscountValue(e) {
this.triggerEvent('discountValueInput', {
value: e.detail.value,
index: this.data.index,
gindex: this.data.gindex
})
},
toggleGift(e) {
this.triggerEvent('toggleGift', {
value: e.detail.value,
index: this.data.index
})
},
delGoodsList() {
this.triggerEvent('delete', {
index: this.data.index
})
},
showPopup(e) {
const dataset = e.currentTarget.dataset
// Pass the dataset needed for popup
this.triggerEvent('showPopup', {
...dataset,
index: this.data.index,
gindex: this.data.gindex
})
},
// For package sub-items, sometimes we need to know if it's the package itself or item inside
changeMealPrice(e) {
this.triggerEvent('mealPriceChange', {
value: e.detail.value,
index: this.data.index,
gindex: this.data.gindex,
item: this.data.product
})
}
}
})
{
"component": true,
"usingComponents": {}
}
\ No newline at end of file \ No newline at end of file
<wxs src="/tabWorkOrder/index.wxs" module="filter" />
<view class="goods">
<view class="name_box">
<view class="name text-hide alias" wx:if="{{ product.goodsAlias && productName }}">商品别名: {{product.goodsAlias}}</view>
<view class="name text-hide">
{{productName || filter.replaceItemText(product.goodsAlias) || filter.replaceItemText(product.upgradeGoodsName) || filter.replaceItemText(product.goodsInfo.goodsName)}}
</view>
</view>
<view class="bottom_box">
<view class="position" wx:if="{{ product.specificationStr }}">{{product.specificationStr}}</view>
<view
class="position"
wx:elif="{{ (product.merchantGoodsPosition || product.upgradeGoodsPosition || product.goodsInfo.goodsTypeName) }}"
>
<!-- Logic for formatting position -->
<block
wx:if="{{ product.goodsInfo.goodsType == 1 || product.upgradeGoodsType == 1 || product.goodsInfo.goodsType == baseConfigData.selfBuildFilmType || product.upgradeGoodsType == baseConfigData.selfBuildFilmType }}"
>{{filter.formatPosition((product.merchantGoodsPosition || product.upgradeGoodsPosition), positionTypeList)}}</block>
<block wx:else>{{product.goodsInfo.goodsTypeName || ''}}</block>
</view>
<view
class="position red_text"
wx:elif="{{ (product.goodsInfo.goodsType == 1 || product.upgradeGoodsType == 1 || product.goodsInfo.goodsType == baseConfigData.selfBuildFilmType || product.upgradeGoodsType == baseConfigData.selfBuildFilmType) && !product.merchantGoodsPosition && !product.upgradeGoodsPosition }}"
>无部位属性</view>
<view class="position" wx:else></view>
<!-- Price and Count -->
<view class="price_count">
<view class="price">
<text>¥</text>
<input
type="digit"
value="{{ product.sellPrice !== undefined ? product.sellPrice : product.price }}"
bindinput="changePrice"
disabled="{{ selectPayType == 0 || product.goodsPriceModify }}"
bindblur="priceBlur"
class="{{ (product.basePriceError || product.errorTarget) && (selectPayType != 0) ? 'error' : '' }} {{ selectPayType == 0 ? 'disabled' : '' }}"
always-embed
/>
</view>
<!-- Count Trigger -->
<view
class="count"
catchtap="showPopup"
data-show-name="{{ showPopupName }}"
data-type="{{ popupType }}"
data-positionnnum="{{ positionNum }}"
>x {{ count }}</view>
</view>
</view>
<!-- Strategy Box (Discount/Gift) -->
<!-- Only show if NOT disabled or some logic? Original code checks orderType -->
<view class="strategy-box" wx:if="{{ orderType == 2 }}">
<view class="discount-types">
<view class="discount-tabs">
<view
class="type-item {{ (product.discountType == 3 || !product.discountType) ? 'active' : '' }}"
catchtap="changeProductDiscountType"
data-type="3"
>无折扣</view>
<view class="type-item {{ product.discountType == 1 ? 'active' : '' }}" catchtap="changeProductDiscountType" data-type="1">折扣比例</view>
<view class="type-item {{ product.discountType == 2 ? 'active' : '' }}" catchtap="changeProductDiscountType" data-type="2">折扣金额</view>
</view>
<view class="discount-input" wx:if="{{ product.discountType == 1 || product.discountType == 2 }}">
<input
type="digit"
placeholder="{{ product.discountType == 1 ? '输入折扣' : '输入金额' }}"
value="{{ product.discountValue }}"
bindinput="inputDiscountValue"
/>
<text> {{product.discountType == 1 ? '折': '元'}}</text>
</view>
</view>
<view class="final-price">
价格
<text class="orange">¥ {{product.finalPrice !== undefined ? product.finalPrice : (product.sellPrice !== undefined ? product.sellPrice : product.price)}}</text>
</view>
</view>
<view class="strategy-box" wx:if="{{ orderType == 3 }}">
<view class="gift-row">
<view>是否为赠品</view>
<radio-group bindchange="toggleGift" class="gift-radios">
<label class="radio-label">
<radio value="1" checked="{{ product.discountType == 4 }}" color="#347BFF" />
是
</label>
<label class="radio-label">
<radio value="0" checked="{{ product.discountType != 4 }}" color="#347BFF" />
否
</label>
</radio-group>
</view>
<view class="final-price">
价格
<text class="orange">¥ {{product.finalPrice !== undefined ? product.finalPrice : (product.sellPrice !== undefined ? product.sellPrice : product.price)}}</text>
</view>
</view>
<view class="strategy-box" wx:if="{{ orderType == 5 }}">
<view class="discount-types">
<view class="discount-tabs">
<view
class="type-item {{ (product.discountType == 3 || !product.discountType) ? 'active' : '' }}"
catchtap="changeProductDiscountType"
data-type="3"
>无抵扣</view>
<view class="type-item {{ product.discountType == 2 ? 'active' : '' }}" catchtap="changeProductDiscountType" data-type="2">抵扣金额</view>
</view>
<view class="discount-input" wx:if="{{ product.discountType == 2 }}">
<input type="digit" placeholder="输入金额" value="{{ product.discountValue }}" bindinput="inputDiscountValue" />
<text>元</text>
</view>
</view>
<view class="final-price">
价格
<text class="orange">¥ {{product.finalPrice !== undefined ? product.finalPrice : (product.sellPrice !== undefined ? product.sellPrice : product.price)}}</text>
</view>
</view>
<!-- Delete Icon (Only if not package sub-item) -->
<view class="icon" bindtap="delGoodsList" wx:if="{{ !isPackageSubItem }}">
<image src="/tabWorkOrder/images/del.png" />
</view>
</view>
\ No newline at end of file \ No newline at end of file
/* components/OrderGoodsRow/order-goods-row.wxss */
.goods {
background: #F7F8FA;
border-radius: 16rpx;
margin: 16rpx 20rpx;
display: flex;
flex-flow: column;
padding: 24rpx;
justify-content: space-between;
font-size: 28rpx;
position: relative;
}
.goods .icon {
position: absolute;
top: 0;
right: 0;
width: 40rpx;
height: 40rpx;
background: rgba(52, 123, 255, 0.1);
border-radius: 0 16rpx 0 16rpx;
display: flex;
align-items: center;
justify-content: center;
}
.goods .icon image {
width: 100%;
height: 100%;
}
.goods .name_box {
width: 100%;
margin-bottom: 8rpx;
}
.goods .name {
color: #FF6601;
width: 100%;
}
.goods .bottom_box {
display: flex;
align-items: center;
justify-content: space-between;
}
.goods .bottom_box .position {
color: #888888;
}
.goods .bottom_box .red_text {
color: red;
}
.goods .bottom_box .price_count {
display: flex;
align-items: center;
justify-content: flex-start;
}
.goods .price {
color: #333333;
width: 240rpx;
height: 64rpx;
background: #FFFFFF;
border: 2rpx solid #E6E6E6;
border-radius: 8rpx;
position: relative;
margin-right: 32rpx;
}
.goods .price text {
position: absolute;
left: 16rpx;
top: 50%;
font-size: 24rpx;
transform: translateY(-50%);
}
.goods .price input {
box-sizing: border-box;
width: 100%;
height: 100%;
text-align: end;
min-height: 100%;
font-size: 28rpx;
padding: 0 16rpx 0 50rpx;
}
.goods .price input.error {
border: 2rpx solid #F24724;
}
.goods .price input.disabled {
background-color: #f0f0f0;
color: #dcdcdc;
}
.goods .count {
min-width: 64rpx;
color: #292D33;
}
.alias {
font-size: 12px;
color: #222222 !important;
}
/* Strategy Box Styles */
.strategy-box {
margin-top: 10rpx;
padding-top: 10rpx;
border-top: 1rpx solid #eee;
}
.strategy-box .discount-types {
display: flex;
align-items: center;
justify-content: space-between;
margin-bottom: 10rpx;
}
.strategy-box .discount-types .discount-tabs {
display: flex;
align-items: center;
background: #e9e9e9;
padding: 6rpx;
border-radius: 8rpx;
}
.strategy-box .discount-types .type-item {
padding: 10rpx 12rpx;
background: transparent;
border-radius: 6rpx;
margin-right: 0;
font-size: 24rpx;
color: #222;
border: none;
}
.strategy-box .discount-types .type-item.active {
background: #fff;
color: #333;
font-weight: 500;
box-shadow: 0 2rpx 4rpx rgba(0, 0, 0, 0.1);
}
.strategy-box .discount-types .discount-input {
display: flex;
align-items: center;
margin-left: 10rpx;
background: #fff;
padding: 0 10rpx;
height: 64rpx;
border-radius: 8rpx;
border: 2rpx solid #eff0f2;
}
.strategy-box .discount-types .discount-input input {
width: 160rpx;
border-radius: 0;
padding: 0;
font-size: 24rpx;
height: 100%;
margin-right: 6rpx;
background: transparent;
text-align: left;
}
.strategy-box .discount-types .discount-input text {
font-size: 24rpx;
color: #333;
line-height: 0rpx;
}
.strategy-box .gift-row {
display: flex;
align-items: center;
justify-content: space-between;
margin-bottom: 10rpx;
font-size: 28rpx;
/* color: #333; */
color: #222222;
}
.strategy-box .gift-row .gift-radios {
display: flex;
align-items: center;
}
.strategy-box .gift-row .gift-radios .radio-label {
margin-left: 20rpx;
display: flex;
align-items: center;
justify-content: space-between;
}
.strategy-box .gift-row .gift-radios .radio-label radio {
transform: scale(0.6);
}
.strategy-box .final-price {
font-size: 28rpx;
/* color: #666; */
color: #222222;
display: flex;
align-items: center;
justify-content: space-between;
}
.strategy-box .final-price .orange {
color: #FF6601;
font-weight: bold;
font-size: 30rpx;
margin-left: 10rpx;
}
/* Utilities */
.text-hide {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
\ No newline at end of file \ No newline at end of file
// tabWorkOrder/pages/createOrder/createOrder.js // tabWorkOrder/pages/createOrder/createOrder.js
import { import { checkDailyReport, checkStudyTask } from '~/store/ModalToQueueControl'
checkDailyReport, import api from '../../api'
checkStudyTask import { getProductStrategy, DISCOUNT_TYPE } from './productStrategy'
} from "~/store/ModalToQueueControl"; import { SubmitContext } from './submitStrategy'
import api from "../../api"; import { RouteContext } from './routeStrategy'
import { import { getYQorderInfo, getPositionList, setConfigInfo } from '~/store/index'
getYQorderInfo,
getPositionList,
setConfigInfo
} from "~/store/index";
import NP from 'number-precision' import NP from 'number-precision'
const app = getApp(); const app = getApp()
let time = null; let time = null
let toastList = { let toastList = {
userId: "销售顾问不能为空", userId: '销售顾问不能为空',
subShopMerchantId: "二级流量方不能为空", subShopMerchantId: '二级流量方不能为空',
deliveryUserId: "交付专员不能为空", deliveryUserId: '交付专员不能为空',
customerName: "车主姓名不能为空", customerName: '车主姓名不能为空',
salesType: "客户来源不能为空", salesType: '客户来源不能为空',
customerPhone: "手机号不能为空", customerPhone: '手机号不能为空',
sellerUserId: "转化人员不能为空", sellerUserId: '转化人员不能为空',
customerCouponCode: "精品礼券不能为空", customerCouponCode: '精品礼券不能为空',
carBrand: "车型不能为空", carBrand: '车型不能为空',
standNo: "车架号( VIN码 )不能为空", standNo: '车架号( VIN码 )不能为空',
plateNumber: "车牌不能为空", plateNumber: '车牌不能为空',
payeeType: "收款方不能为空", payeeType: '收款方不能为空',
selectPayType: "支付方式不能为空" selectPayType: '支付方式不能为空'
}; }
import { validateVin, formatVinInput } from '~/utils/vinVaildate' import { validateVin, formatVinInput } from '~/utils/vinVaildate'
const phoneRex = /^[1]([3-9])[0-9]{9}$/; const phoneRex = /^[1]([3-9])[0-9]{9}$/
// orderSource 订单来源(1后台录入,2移动端预录客户,3移动端升级下单,4再次下单) // orderSource 订单来源(1后台录入,2移动端预录客户,3移动端升级下单,4再次下单)
Page({ Page({
...@@ -47,68 +43,82 @@ Page({ ...@@ -47,68 +43,82 @@ Page({
7: '其它收款' 7: '其它收款'
}, },
paymentMethod: null, paymentMethod: null,
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:
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/miniProgram/windshield.png',
selectIcon: "https://img02.glsx.com.cn/weapp/resource/dj-car-boutique-work-wechat/selectIncon.webp", sideIcorn:
recordIcon: "https://img02.glsx.com.cn/weapp/resource/dj-car-boutique-work-wechat/miniProgram/record.png", 'https://img02.glsx.com.cn/weapp/resource/dj-car-boutique-work-wechat/miniProgram/sideIcon.png',
name: "createdOrder", afterIcorn:
outTradeNo: "", 'https://img02.glsx.com.cn/weapp/resource/dj-car-boutique-work-wechat/miniProgram/afterIcon.png',
totalFee: "", scanIcon:
accountDate: "", 'https://img02.glsx.com.cn/weapp/resource/dj-car-boutique-work-wechat/ocr_icon.png',
selectIcon:
'https://img02.glsx.com.cn/weapp/resource/dj-car-boutique-work-wechat/selectIncon.webp',
recordIcon:
'https://img02.glsx.com.cn/weapp/resource/dj-car-boutique-work-wechat/miniProgram/record.png',
name: 'createdOrder',
outTradeNo: '',
totalFee: '',
accountDate: '',
waitInputCount: 0, waitInputCount: 0,
switchVlaue: '', switchVlaue: '',
orderCreateType: "createdOrder", // additionRecordOrder(补录订单) createdOrder(新增) errorOrder(错误订单) alreadyExistOrder(扫码/预约订单) orderCreateType: 'createdOrder', // additionRecordOrder(补录订单) createdOrder(新增) errorOrder(错误订单) alreadyExistOrder(扫码/预约订单)
showOrderpop: false, showOrderpop: false,
phoneShow: false, phoneShow: false,
customerInfoBox: false, customerInfoBox: false,
payTypeList: [{ payTypeList: [
name: "门店收款", {
value: 2, name: '门店收款',
value: 2
}, },
{ {
name: "POS机", name: 'POS机',
value: 3, value: 3
}, },
{ {
name: '嘀加收款', name: '嘀加收款',
value: 5 value: 5
}, },
{ {
name: "微信支付", name: '微信支付',
value: 1, value: 1,
imgurl: "../../images/wxPayIcon.png", imgurl: '../../images/wxPayIcon.png'
}, }
], ],
showPayList: [], showPayList: [],
payeeList: [{ payeeList: [
{
name: '嘀加收款', name: '嘀加收款',
value: 0 value: 0
}, { },
{
name: '4S店收款', name: '4S店收款',
value: 1 value: 1
}], }
],
orderObj: { orderObj: {
customer: { customer: {
customerName: "", customerName: '',
customerPhone: "", customerPhone: '',
standNo: "", standNo: '',
plateNumber: "", plateNumber: '',
customerSex: 1, customerSex: 1,
experienceFlag: "Y", experienceFlag: 'Y',
salesType: 0, salesType: 0
}, },
deliveryUserId: '', deliveryUserId: '',
deliveryEmployeeName: '', deliveryEmployeeName: '',
// selectPayType: 0, // selectPayType: 0,
selectPayType: 2, // 支付方式:默认门店收款 selectPayType: 2, // 支付方式:默认门店收款
payeeType: 1, // 收款方:默认4s店收款 payeeType: 1, // 收款方:默认4s店收款
remark: "", orderType: 0, // 订单类型:默认普通订单
customerCouponId: "", discountType: 3, // 优惠类型:默认无优惠
subOrderList: [], remark: '',
customerCouponId: '',
subOrderList: []
}, },
goodsList: [], goodsList: [],
goodsData: [], goodsData: [],
...@@ -119,10 +129,10 @@ Page({ ...@@ -119,10 +129,10 @@ Page({
showTips: false, showTips: false,
associateOrderType: false, associateOrderType: false,
tipsProps: { tipsProps: {
tipsText: "该门店产生异常订单,请点击补录!", tipsText: '该门店产生异常订单,请点击补录!',
showTips: true, showTips: true,
type: 2, type: 2,
typeText: "补录订单", typeText: '补录订单'
}, },
positionTypeList: [], positionTypeList: [],
currentWordNumber: 0, // 订单备注字数 currentWordNumber: 0, // 订单备注字数
...@@ -137,15 +147,24 @@ Page({ ...@@ -137,15 +147,24 @@ Page({
packageList: [], packageList: [],
baseConfigData: {}, baseConfigData: {},
showSource: false, showSource: false,
Sourcecolumns: [{ Sourcecolumns: [
{
type: 0, type: 0,
name: "售前", name: '售前'
}, },
{ {
type: 1, type: 1,
name: "售后", name: '售后'
}, }
],
orderTypeList: [
{ text: '正常订单', value: 1 },
{ text: '打折策略', value: 2 },
{ text: '买赠策略', value: 3 },
{ text: '冲量活动', value: 4 },
{ text: '组合付款', value: 5 }
], ],
orderTypeName: '正常订单',
packageBox: false, packageBox: false,
skuGoodsBox: false, skuGoodsBox: false,
djPayList: [], // 嘀加收款方对应支付方式 djPayList: [], // 嘀加收款方对应支付方式
...@@ -153,75 +172,222 @@ Page({ ...@@ -153,75 +172,222 @@ Page({
configPayTypeList: [], // 园区店配置支持的支付方式 configPayTypeList: [], // 园区店配置支持的支付方式
recordOrderFlag: true, // 补录订单入口标识 recordOrderFlag: true, // 补录订单入口标识
skuGoodsData: {}, //多规格商品数据 skuGoodsData: {}, //多规格商品数据
vinValid:true vinValid: true
},
onCloseOrderType() {
this.setData({ orderTypeBox: false })
},
onConfirmOrderType(e) {
const { value } = e.detail
const { orderObj, goodsList } = this.data
// 如果订单类型改变,重置所有商品的折扣信息
if (orderObj.orderType !== value.value) {
goodsList.forEach(item => {
const strategy = getProductStrategy(item)
if (strategy) {
// 重置为无折扣
strategy.resetDiscount()
}
})
this.setGoodsTotal(goodsList)
}
this.setData({
'orderObj.orderType': value.value,
orderTypeName: value.text,
orderTypeBox: false,
goodsList
})
},
changeProductDiscountType(e) {
console.log(e, 'e')
const { index, gindex } = e.detail // gindex for package sub-items
const { type } = e.detail
const { goodsList } = this.data
const discountType = parseInt(type)
const item = goodsList[index]
const strategy = getProductStrategy(item)
if (strategy) {
// 如果是套餐子商品
if (gindex !== undefined && strategy.updateSubItemDiscount) {
strategy.updateSubItemDiscount(gindex, discountType, '') // Reset to empty string
} else {
strategy.setDiscount(discountType, '') // Reset value when type changes
}
this.setGoodsTotal(goodsList)
}
},
inputDiscountValue(e) {
const { index, gindex } = e.detail
let { value } = e.detail
const { goodsList, orderObj } = this.data
const item = goodsList[index]
const strategy = getProductStrategy(item)
if (strategy) {
// 获取当前的 discountType
let currentType
let basePrice
if (gindex !== undefined && strategy.getSubItemData) {
currentType = strategy.getSubItemData(gindex).discountType
basePrice = strategy.getSubItemBasePrice(gindex)
} else {
currentType = strategy.getData().discountType
basePrice = strategy.getBasePrice()
}
// 1:默认值为空不是为0
if (value === '') {
// Allow empty value
} else {
// Remove non-digit and non-dot characters
value = value.replace(/[^\d.]/g, '')
// Ensure only one dot
const parts = value.split('.')
if (parts.length > 2) {
value = parts[0] + '.' + parts.slice(1).join('')
}
if (currentType == 1) {
// 折扣比例
// 2:是折扣比例的话,最多只能输入1位整数和两个小数
const dotIndex = value.indexOf('.')
if (dotIndex !== -1) {
let integerPart = value.substring(0, dotIndex)
let decimalPart = value.substring(dotIndex + 1)
if (integerPart.length > 1) {
integerPart = integerPart.slice(0, 1)
}
if (decimalPart.length > 2) {
decimalPart = decimalPart.slice(0, 2)
}
value = integerPart + '.' + decimalPart
} else {
if (value.length > 1) {
value = value.slice(0, 1)
}
}
} else if (currentType == 2) {
// 折扣金额
// 3:是折扣金额的话,最大值不能超过 item.goods.sellPrice 的值,超过取 item.goods.sellPrice,输入最多不超过两个小数
const dotIndex = value.indexOf('.')
if (dotIndex !== -1) {
let integerPart = value.substring(0, dotIndex)
let decimalPart = value.substring(dotIndex + 1)
if (decimalPart.length > 2) {
decimalPart = decimalPart.slice(0, 2)
}
value = integerPart + '.' + decimalPart
}
if (parseFloat(value) > parseFloat(basePrice)) {
value = basePrice.toString()
}
}
}
if (gindex !== undefined && strategy.updateSubItemDiscount) {
strategy.updateSubItemDiscount(gindex, currentType, value)
} else {
strategy.setDiscount(currentType, value)
}
this.setGoodsTotal(goodsList)
return value
}
}, },
toggleGift(e) {
const { index, gindex } = e.detail
const { value } = e.detail // "1" for Yes, "0" for No
const { goodsList } = this.data
const isGift = value === '1'
const item = goodsList[index]
const strategy = getProductStrategy(item)
if (strategy) {
if (gindex !== undefined && strategy.updateSubItemDiscount) {
const type = isGift ? DISCOUNT_TYPE.GIFT : DISCOUNT_TYPE.NON_GIFT
strategy.updateSubItemDiscount(gindex, type, 0)
} else {
const type = isGift ? DISCOUNT_TYPE.GIFT : DISCOUNT_TYPE.NON_GIFT
strategy.setDiscount(type, 0)
}
this.setGoodsTotal(goodsList)
}
},
closeTips() { closeTips() {
this.setData({ this.setData({
showTips: false showTips: false
}) })
}, },
async navigator(e) { async navigator(e) {
let { let { selectOutTradeNoArr } = e.detail
selectOutTradeNoArr let { paymentMethod, isErrorOrder } = this.data
} = e.detail;
let { paymentMethod } = this.data
this.closeSwitchPopup() this.closeSwitchPopup()
selectOutTradeNoArr?.length && selectOutTradeNoArr?.length &&
this.onRoute({ this.onRoute({
selectOutTradeNoArr, selectOutTradeNoArr,
orderCreateType: "additionRecordOrder", orderCreateType: 'additionRecordOrder',
paymentMethod paymentMethod
}); })
let {
orderObj if (isErrorOrder) return
} = this.data
let { orderObj } = this.data
// 如果是补录 需清订单的空礼券和商品 清空销售顾问 // 如果是补录 需清订单的空礼券和商品 清空销售顾问
let deleteName = [ let deleteName = [
'employeeName', 'employeeName',
"userId", 'userId',
"orderSource", 'orderSource',
"couponName", 'couponName',
"customerCouponCode", 'customerCouponCode',
"customerCouponId", 'customerCouponId'
]; ]
deleteName.map((item) => { deleteName.map(item => {
if (orderObj[item]) delete orderObj[item]; if (orderObj[item]) delete orderObj[item]
}); })
console.log(orderObj.customerCouponId, '被删除了') console.log(orderObj.customerCouponId, '被删除了')
let goodsList = []; let goodsList = []
console.log(this.data.orderObj) console.log(this.data.orderObj)
this.setData({ this.setData({
orderObj, orderObj,
goodsList, goodsList
}); })
this.setGoodsTotal(goodsList); this.setGoodsTotal(goodsList)
}, },
tipsEvent() { tipsEvent() {
this.setData({ this.setData({
showOrderpop: true, showOrderpop: true
}); })
}, },
closeSwitchPopup() { closeSwitchPopup() {
this.setData({ this.setData({
showOrderpop: false, showOrderpop: false
}); })
}, },
remarkInput(e) { remarkInput(e) {
this.setData({ this.setData({
currentWordNumber: e.detail.cursor, currentWordNumber: e.detail.cursor,
"orderObj.remark": e.detail.value, 'orderObj.remark': e.detail.value
}); })
}, },
showCustomPop() { showCustomPop() {
this.setData({ this.setData({
customerInfoBox: true, customerInfoBox: true
}); })
}, },
chooseCustomerInfo(e) { chooseCustomerInfo(e) {
let { let { detail } = e
detail
} = e;
let { let {
outTradeNo, outTradeNo,
showPayList, showPayList,
...@@ -233,7 +399,7 @@ Page({ ...@@ -233,7 +399,7 @@ Page({
} }
} = this.data } = this.data
detail.outTradeNo = outTradeNo detail.outTradeNo = outTradeNo
console.log(detail, 'detail'); console.log(detail, 'detail')
// 解决补录订单 这两个参数丢失问题 // 解决补录订单 这两个参数丢失问题
if (associateOrderType || associateOrderCode) { if (associateOrderType || associateOrderCode) {
detail.associateOrderType = associateOrderType detail.associateOrderType = associateOrderType
...@@ -242,68 +408,60 @@ Page({ ...@@ -242,68 +408,60 @@ Page({
detail.selectPayType = selectPayType detail.selectPayType = selectPayType
detail.payeeType = payeeType detail.payeeType = payeeType
// detail.selectPayType = 3 // detail.selectPayType = 3
this.onRoute(detail); this.onRoute(detail)
// 判断一下档案支付方式现在是否还在,在就替换,没有就去掉这个参数 // 判断一下档案支付方式现在是否还在,在就替换,没有就去掉这个参数
this.settingPayType(detail) this.settingPayType(detail)
}, },
closeTips() { closeTips() {
this.setData({ this.setData({
showTips: false, showTips: false
}); })
}, },
reWrite(type, data) { reWrite(type, data) {
let { let { orderObj } = this.data
orderObj
} = this.data;
// 车架号字段特殊处理 // 车架号字段特殊处理
if (type === 'standNo') { if (type === 'standNo') {
this.handleVinInput(data, true,type) // 扫描时立即校验 this.handleVinInput(data, true, type) // 扫描时立即校验
} else { } else {
orderObj.customer[type] = data; orderObj.customer[type] = data
this.setData({ this.setData({
orderObj, orderObj
}); })
} }
}, },
navOcr(e) { navOcr(e) {
let { let { type } = e.currentTarget.dataset
type
} = e.currentTarget.dataset;
// console.log(type) // console.log(type)
wx.$router.go(`ocr?type=${type}`); wx.$router.go(`ocr?type=${type}`)
}, },
showPopup(e) { showPopup(e) {
console.log(e) console.log(e)
let { let {
copyGoodsData, copyGoodsData,
packageList, packageList,
orderObj: { orderObj: { selectPayType },
selectPayType baseConfigData
}, } = this.data
baseConfigData, let { showName, positionnnum: positionNum } =
} = this.data; e.currentTarget.dataset || e.detail
let { console.log(positionNum, 'positionNum')
showName,
positionnnum: positionNum
} = e.currentTarget.dataset;
console.log(positionNum, 'positionNum');
console.log(copyGoodsData, 'copyGoodsData') console.log(copyGoodsData, 'copyGoodsData')
let obj = { let obj = {
'1': 'frontGearArr', 1: 'frontGearArr',
'2': 'sideBeforeRearGearArr', 2: 'sideBeforeRearGearArr',
'3': 'sideRearGearArr', 3: 'sideRearGearArr',
'4': 'sideAfterRearGearArr', 4: 'sideAfterRearGearArr',
'5,6,7': 'skylightArr', '5,6,7': 'skylightArr',
'other': 'otherProduct' other: 'otherProduct'
} }
let arr = []; let arr = []
if (showName == "goodsBox") { if (showName == 'goodsBox') {
// type 产品类型 1前挡 2侧后挡 3天窗 4其它精品 // type 产品类型 1前挡 2侧后挡 3天窗 4其它精品
let keyName = obj[positionNum] let keyName = obj[positionNum]
arr = keyName ? this.data[keyName] : [] arr = keyName ? this.data[keyName] : []
if (arr?.length < 1) { if (arr?.length < 1) {
return this.showToast(`门店无配置其它精品商品`); return this.showToast(`门店无配置其它精品商品`)
} }
} }
if (showName == 'packageBox') { if (showName == 'packageBox') {
...@@ -313,320 +471,230 @@ Page({ ...@@ -313,320 +471,230 @@ Page({
// debugger // debugger
this.setData({ this.setData({
[showName]: true, [showName]: true,
goodsData: arr, goodsData: arr
}); })
}, },
input(e) { input(e) {
let { let { orderObj, userInfo, goodsList } = this.data
orderObj, let { value } = e.detail
userInfo, let { name } = e.currentTarget.dataset
goodsList
} = this.data;
let {
value
} = e.detail;
let {
name
} = e.currentTarget.dataset;
let prop = `orderObj.${name}` let prop = `orderObj.${name}`
if (name == "customer.customerPhone" && phoneRex.test(value)) { if (name == 'customer.customerPhone' && phoneRex.test(value)) {
// 如果手机号有变动 需清订单的空礼券和商品 // 如果手机号有变动 需清订单的空礼券和商品
let deleteName = [ let deleteName = [
"orderSource", 'orderSource',
"couponName", 'couponName',
"customerCouponCode", 'customerCouponCode',
"customerCouponId", 'customerCouponId'
]; ]
deleteName.map((item) => { deleteName.map(item => {
if (orderObj[item]) delete orderObj[item]; if (orderObj[item]) delete orderObj[item]
}); })
console.log('input这里没了') console.log('input这里没了')
if (orderObj.selectPayType != 0) { if (orderObj.selectPayType != 0) {
goodsList = []; goodsList = []
} }
// goodsList = [] // goodsList = []
this.setData({ this.setData({
orderObj, orderObj,
goodsList, goodsList
}); })
this.setGoodsTotal(goodsList); this.setGoodsTotal(goodsList)
} }
// 车架号字段特殊处理 // 车架号字段特殊处理
if (name === 'customer.standNo') { if (name === 'customer.standNo') {
this.handleVinInput(value) // 手动输入时需达到17位才校验 this.handleVinInput(value) // 手动输入时需达到17位才校验
return; return
} }
this.setData({ this.setData({
[`orderObj.${name}`]: value.trim(), [`orderObj.${name}`]: value.trim()
}); })
}, },
phoneBlur() { phoneBlur() {
this.selectComponent("#coupon")?.customerPhoneBlur && this.selectComponent('#coupon')?.customerPhoneBlur &&
this.selectComponent("#coupon")?.customerPhoneBlur(); this.selectComponent('#coupon')?.customerPhoneBlur()
}, },
changeGender(e) { changeGender(e) {
let { let { gender } = e.currentTarget.dataset
gender wx.vibrateShort()
} = e.currentTarget.dataset;
wx.vibrateShort();
this.setData({ this.setData({
["orderObj.customer.customerSex"]: gender, ['orderObj.customer.customerSex']: gender
}); })
}, },
changeExperience(e) { changeExperience(e) {
let { let { experience } = e.currentTarget.dataset
experience
} = e.currentTarget.dataset;
// console.log(experience) // console.log(experience)
wx.vibrateShort(); wx.vibrateShort()
this.setData({ this.setData({
["orderObj.customer.experienceFlag"]: experience, ['orderObj.customer.experienceFlag']: experience
}); })
}, },
changeSelectPayType(e) { changeSelectPayType(e) {
let { let { experience } = e.currentTarget.dataset
experience
} = e.currentTarget.dataset;
// console.log(experience) // console.log(experience)
wx.vibrateShort(); wx.vibrateShort()
this.setData({ this.setData({
["orderObj.selectPayType"]: experience, ['orderObj.selectPayType']: experience,
["orderObj.subOrderList"]: [], ['orderObj.subOrderList']: [],
goodsList: [], goodsList: []
}); })
// this.setData() // this.setData()
console.log(33333333333333333) console.log(33333333333333333)
// 解决没选门店就切换查询商品的的问题 // 解决没选门店就切换查询商品的的问题
this.data.orderObj.merchantId && this.data.orderObj.merchantId &&
this.getSelectOrderGoodsList(this.data.orderObj.merchantId); this.getSelectOrderGoodsList(this.data.orderObj.merchantId)
// this.data.orderObj.merchantId && // this.data.orderObj.merchantId &&
// this.getOrderBaseGoodsList(this.data.orderObj.merchantId); // this.getOrderBaseGoodsList(this.data.orderObj.merchantId);
}, },
// 切换收款方 // 切换收款方
changePayee(e) { changePayee(e) {
let { let {
item: { item: { value }
value
},
} = e.currentTarget.dataset } = e.currentTarget.dataset
let { let { isErrorOrder, switchVlaue, merchantPayList, djPayList } = this.data
isErrorOrder,
switchVlaue,
merchantPayList,
djPayList
} = this.data
if (isErrorOrder || switchVlaue) return if (isErrorOrder || switchVlaue) return
this.setData({ this.setData({
["orderObj.payeeType"]: value, ['orderObj.payeeType']: value
}) })
if (value == 1) { // 收款方:4S店收款 支付方式默认选中门店收款 if (value == 1) {
// 收款方:4S店收款 支付方式默认选中门店收款
this.setData({ this.setData({
showPayList: merchantPayList, showPayList: merchantPayList,
["orderObj.selectPayType"]: 2 ['orderObj.selectPayType']: 2
}) })
} else { // 收款方:嘀加收款 (1:微信支付)(3:pos机支付)(4:支付宝支付)支付方式有选中微信支付,没有选中,支付方式获取园区店配置,微信支付和pos机支付必须选中一项 } else {
// 收款方:嘀加收款 (1:微信支付)(3:pos机支付)(4:支付宝支付)支付方式有选中微信支付,没有选中,支付方式获取园区店配置,微信支付和pos机支付必须选中一项
this.setData({ this.setData({
showPayList: djPayList, showPayList: djPayList,
['orderObj.selectPayType']: djPayList?.some(v => v.value == 1) ? 1 : djPayList?.some(v => v.value == 3) ? 3 : 4 ['orderObj.selectPayType']: djPayList?.some(v => v.value == 1)
? 1
: djPayList?.some(v => v.value == 3)
? 3
: 4
}) })
} }
}, },
// 切换支付方式 // 切换支付方式
changePayType(e) { changePayType(e) {
let { let {
item: { item: { value }
value } = e.currentTarget.dataset
}, let { goodsList } = this.data
} = e.currentTarget.dataset; if (value == 0 && goodsList && goodsList.length > 0) return
let { wx.vibrateShort()
goodsList
} = this.data;
if (value == 0 && goodsList && goodsList.length > 0) return;
wx.vibrateShort();
this.setData({ this.setData({
["orderObj.selectPayType"]: value, ['orderObj.selectPayType']: value
}); })
}, },
chooseCar(e) { chooseCar(e) {
console.log(e); console.log(e)
let { let { carBrand, carType } = e.detail
carBrand,
carType
} = e.detail;
this.setData({ this.setData({
car: `${carBrand}|${carType}`, car: `${carBrand}|${carType}`
}); })
}, },
chooseCoupon(e) { chooseCoupon(e) {
console.log(e); console.log(e)
let { let { name } = e.detail
name
} = e.detail;
this.setData({ this.setData({
couponName: name, couponName: name
}); })
}, },
//修改套餐价格 //修改套餐价格
changeMealPrice(e) { changeMealPrice(e) {
console.log(e); console.log(e)
let { let { goodsList } = this.data
goodsList let { value } = e.detail
} = this.data; let { index, gindex, item } = e.currentTarget.dataset
let { let number = wx.$util.removeLeadingZerosAndEnsureNonNegative(value)
value
} = e.detail;
let {
index,
gindex,
item
} = e.currentTarget.dataset;
let number = wx.$util.removeLeadingZerosAndEnsureNonNegative(value);
console.log(item, 'item');
// item.minSellPrice = 100
// item.validMinSellPrice = 'Y'
// 如果开启了最低价格校验
if (item.validMinSellPrice == 'Y' && item.minSellPrice > number) {
goodsList[index].packageGoods.goodsList[gindex].errorTarget = true
wx.$util.showToast('单价不可低于商品最低价')
// return false;
} else {
goodsList[index].packageGoods.goodsList[gindex].errorTarget = false
}
goodsList[index].packageGoods.goodsList[gindex].price = number;
//获取套餐内商品价格
goodsList[index].packageGoods.price = goodsList[index].packageGoods.goodsList.reduce((prev, cur) => {
return Number(prev) + Number(cur.price);
}, 0);
//获取套餐内商品总价 const strategy = getProductStrategy(goodsList[index])
let total = goodsList[index].packageGoods.price * goodsList[index].count; // 策略模式应用:
goodsList[index].totalPrice = wx.$util.decimal(total, 2); // 获取对应的策略实例(此处预期为 PackageProductStrategy)。
// 利用策略类封装的 updateSubItemPrice 方法更新子商品价格,
// 以及 validateSubItemPrice 方法进行价格合规性校验(如最低限价检查)。
// 这样做避免了在业务层直接操作复杂的嵌套数据结构,提高了代码的可读性和可维护性。
if (strategy && strategy.updateSubItemPrice) {
strategy.updateSubItemPrice(gindex, number)
this.setData({ const validation = strategy.validateSubItemPrice(item, number)
goodsList, if (!validation.valid) {
}, wx.$util.showToast(validation.message)
() => { }
this.setGoodsTotal(goodsList);
this.setGoodsTotal(goodsList)
} }
);
}, },
changePrice(e) { changePrice(e) {
console.log(e) console.log(e)
let { let { index } = e.detail
orderObj, let { value } = e.detail
goodsList let { goodsList } = this.data
} = this.data;
let { let number = wx.$util.removeLeadingZerosAndEnsureNonNegative(value)
value
} = e.detail; // 策略模式应用:
let { // 通过 getProductStrategy 工厂函数获取商品对应的策略实例(普通、多规格或套餐)。
index, // 统一调用 strategy.validatePrice 进行价格校验,
item // 调用 strategy.setPrice 更新价格。
} = e.currentTarget.dataset; // 业务层无需关心具体商品类型的内部数据结构差异,实现了逻辑解耦。
console.log(index) const strategy = getProductStrategy(goodsList[index])
let goodsType = item.goodsFlag == 1 ? 'goods' : 'multipleSpecificationsGoods.goods' if (strategy) {
let target = `goodsList[${index}].${goodsType}.sellPrice`; const validation = strategy.validatePrice(number)
let errorTarget = `goodsList[${index}].${goodsType}.errorTarget` if (!validation.valid) {
let resultObj = this.circulation(item, goodsType) wx.$util.showToast(validation.message)
let number = wx.$util.removeLeadingZerosAndEnsureNonNegative(value);
console.log(resultObj)
// 如果开启了最低价格校验
if (resultObj.validMinSellPrice == 'Y' && resultObj.minSellPrice > number) {
// number = item.shopMinPrice > number
// this.setData({
// [errorTarget]: true, //显示错误
// });
wx.$util.showToast('单价不可低于商品最低价')
// return false;
} else {
this.setData({
[errorTarget]: false, //显示错误
});
} }
this.setData({
[target]: number, //价格不能低于0
}, () => {
this.setGoodsTotal(goodsList);
});
}, if (
circulation(data, str) { this.data.orderObj.orderType == 2 ||
let arr = str.split('.'), this.data.orderObj.orderType == 5
result; ) {
if (arr.length) { strategy.setBasePrice(number)
result = arr.reduce((pre, key) => { } else {
return pre[key] strategy.setPrice(number)
}, data) }
this.setGoodsTotal(goodsList)
} }
return result;
}, },
priceBlur(e) { priceBlur(e) {
let { let { index } = e.currentTarget.dataset || e.detail
index, let { goodsList } = this.data
item
} = e.currentTarget.dataset; // 策略模式应用:
console.log(item) // 获取策略实例,利用 strategy.getPrice() 和 strategy.getMinPrice() 统一接口访问商品价格数据。
let goodsType = item.goodsFlag == 1 ? 'goods' : 'multipleSpecificationsGoods.goods' // 当输入价格为空时,自动恢复为最低售价,保证数据完整性。
let target = `goodsList[${index}].${goodsType}.sellPrice`; const strategy = getProductStrategy(goodsList[index])
let resultObj = this.circulation(item, goodsType) if (strategy) {
this.setData({ const currentPrice = strategy.getPrice()
[target]: !resultObj.sellPrice ? resultObj.minSellPrice : resultObj.sellPrice, // 如果价格无效(空字符串等),重置为最低价
}); if (!currentPrice && currentPrice !== 0) {
let { const minPrice = strategy.getMinPrice()
goodsList strategy.setPrice(minPrice)
} = this.data; this.setGoodsTotal(goodsList)
this.setGoodsTotal(goodsList); }
}
}, },
setGoodsTotal(goodsList) { setGoodsTotal(goodsList) {
let total = 0 let total = 0
goodsList.map(i => { goodsList.forEach(item => {
if (i.goods) { // 策略模式应用:
if (i.goods.validMinSellPrice == 'Y' && i.goods.minSellPrice > i.goods.sellPrice) { // 遍历商品列表,为每个商品获取策略实例。
i.goods.errorTarget = true // 调用 strategy.performValidation() 统一处理各类型商品的价格校验逻辑并更新错误状态。
} else { // 调用 strategy.calculateSubtotal() 统一计算小计金额(处理了普通商品总价和套餐子商品累加的不同逻辑)。
i.goods.errorTarget = false // 从而消除了原有的大量 if-else 判断,使总价计算逻辑清晰简洁。
} const strategy = getProductStrategy(item)
total = NP.plus( if (strategy) {
total, strategy.performValidation()
NP.times(parseFloat(i.count || 1), parseFloat(i.goods.sellPrice)) total = NP.plus(total, strategy.calculateSubtotal())
)
}
if (i.packageGoods) {
if (i.packageGoods.goodsList) {
i.packageGoods.goodsList.forEach((item) => {
if (item.validMinSellPrice == 'Y' && item.minSellPrice > item.price) {
item.errorTarget = true
} }
}) })
}
total = NP.plus(
total,
i.totalPrice
)
}
if (i.multipleSpecificationsGoods) {
if (i.multipleSpecificationsGoods.goods) {
if (i.multipleSpecificationsGoods.goods.validMinSellPrice == 'Y' && i.multipleSpecificationsGoods.goods.minSellPrice > i.multipleSpecificationsGoods.goods.sellPrice) {
i.multipleSpecificationsGoods.goods.errorTarget = true
} else {
i.multipleSpecificationsGoods.goods.errorTarget = false
}
total = NP.plus(
total,
NP.times(parseFloat(i.count || 1), parseFloat(i.multipleSpecificationsGoods.goods.sellPrice))
)
}
}
})
this.setData({ this.setData({
goodsList, goodsList,
total: wx.$util.decimal(total, 2), total: wx.$util.decimal(total, 2)
}); })
}, },
// setGoodsTotal(goodsList) { // setGoodsTotal(goodsList) {
// let total = 0; // let total = 0;
...@@ -653,251 +721,61 @@ Page({ ...@@ -653,251 +721,61 @@ Page({
// }); // });
// }, // },
delGoodsList(e) { delGoodsList(e) {
let { let { index } = e.detail
index
} = e.currentTarget.dataset;
let { let { goodsList } = this.data
goodsList goodsList.splice(index, 1)
} = this.data;
goodsList.splice(index, 1);
this.setData({ this.setData({
goodsList, goodsList
}); })
this.setGoodsTotal(goodsList); this.setGoodsTotal(goodsList)
}, },
async submit(i) { async submit(i) {
// 校验是否填写昨日日报 const context = new SubmitContext(this)
let staffCheck = await checkDailyReport(); await context.execute(i)
if (staffCheck) return false;
// 校验学习中心开单限制
let staffStudyTask = await checkStudyTask()
if (staffStudyTask) return false
// 判断手机号是否用配置的默认值
this.checkPhoneUseConfig();
let {
save
} = i.currentTarget.dataset;
let {
goodsList,
orderObj,
scene,
isErrorOrder,
isAlreadyExistOrder,
submitStatus,
orderCreateType,
vinValid
} = this.data;
orderObj = wx.$util.deepClone(orderObj);
if (scene && !orderObj.customerCouponId) {
console.log('没customerCouponId')
}
// 如果是错单补录 禁用掉保存功能 或待跟进订单/预约订单 或补录工单 禁用建档
if ((isErrorOrder && save) || (isAlreadyExistOrder && save) || (orderCreateType == 'additionRecordOrder' && save)) return;
let key = this.checkRequired(save, orderObj);
// debugger
if (key) {
toastList[key] && this.showToast(toastList[key]);
toastList[key] &&
wx.pageScrollTo({
selector: `.${key}`,
});
return;
}
// 车架号动态校验
const carVin = orderObj.customer.standNo
if (carVin) {
// 判断standNo是否为表单必传:1. 在requiredList中
// const { requiredList } = this.data;
// const isCarVinRequired = requiredList.includes('standNo');// 再次判断一下车架号是否必填项
// 前置判断
if (carVin.length !== 17) {
wx.$util.showToast('请输入 17 位有效字符(支持大写 A-H/J-N/P-Z、0-9)')
return false
}
// 根据接口校验结果判断
if (carVin.length === 17 && !vinValid) {
wx.$util.showToast('车架号校验不匹配,请核对后重新输入')
return false
}
}
let subOrderList = [];
let priceDisabled = true;
let goodsKey = this.checkGoods(
save,
subOrderList,
priceDisabled,
goodsList,
orderObj
);
if (goodsKey) {
return this.showToast(goodsKey);
}
if (!scene) {
if (!orderObj.orderCode) delete orderObj.orderCode;
}
const propertiesToDelete = [
"profitAllocatinList",
"packageGoodsList",
"expenseCategoryList",
"merchantDistributionList",
"orderTime",
"createdBy",
"createdDate",
"updatedBy",
"updatedDate"
];
for (const prop of propertiesToDelete) {
if (orderObj.hasOwnProperty(prop)) {
delete orderObj[prop];
}
}
if (orderObj.customer) {
const customerPropertiesToDelete = ["buyTime", "createdDate"];
for (const prop of customerPropertiesToDelete) {
if (orderObj.customer.hasOwnProperty(prop)) {
delete orderObj.customer[prop];
}
}
}
// if (orderObj.customer.buyTime) delete orderObj.customer.buyTime
// delete orderObj.customer.createdDate
// delete orderObj.customerCouponCode
// return console.log(orderObj)
// 是订单修正就把错误单号带上
if (isErrorOrder) orderObj.oldOrderCode = orderObj.associateOrderCode;
let submitObj = wx.$util.deepClone(orderObj);
if (save) {
// 建档删除卡券商品支付方式参数
delete submitObj.subOrderList;
delete submitObj.customerCouponCode;
delete submitObj.selectPayType;
}
if (submitObj.selectPayType == 0) {
const deleteArr = ["plateNumber", "standNo", "carBrand"];
delete submitObj.remark;
submitObj.customer.experienceFlag = "Y";
deleteArr.forEach((element) => {
delete submitObj.customer[element];
});
}
// for (let k = 0; k < goodsList; k++) {
// let item = goodsList[k]
// try {
// if (item.goodsType == 1 && (!item.merchantGoodsPosition || !item.upgradeGoodsPosition)) throw i
// } catch (err) {
// return this.showToast('商品无配置部位属性,请联系总部运营配置上架')
// }
// }
// wx.showLoading({
// title: '加载中'
// })
// 请求中就不给再重复提交了
if (submitStatus) return;
this.setData({
submitStatus: true,
});
// return
let apiName =
save && !isErrorOrder ?
"createPrerecordedOrder" :
isErrorOrder ?
"correctionOrder" :
"createWithPay";
apiName = orderCreateType == 'additionRecordOrder' ? 'supplementOrder' : apiName
// 太阳膜下单入口
submitObj.filmOrder = 0;
api[apiName](submitObj)
.then((res) => {
// console.log(orderObj, res)
let {
code,
data,
message
} = res;
if (code == 0) {
wx.disableAlertBeforeUnload && wx.disableAlertBeforeUnload(); //关闭小程序页面返回询问对话框
if (save) {
wx.showModal({
title: "温馨提示",
content: "保存成功",
showCancel: false,
confirmText: "知道了",
confirmColor: "#347BFF",
success(_res_) {
if (_res_.confirm) {
if (apiName == "createPrerecordedOrder") {
// 预录建档跳转到预约列表 状态更新 需刷新工单列表和预约管理列表
wx.$util.refreshPageData();
wx.$router.go("pages.tabDateIndex");
wx.$util.pointRecord(30);
} else {
wx.$router.back((page) => {
page.search && page.search();
});
}
}
}, },
});
} else { handleRequiredError(key) {
// 状态更新 需刷新工单列表和预约管理列表 if (toastList[key]) {
wx.$util.refreshPageData(); this.showToast(toastList[key])
if (this.data.isErrorOrder) data.isErrorOrder = true; wx.pageScrollTo({
wx.$router.redirectTo("confirmOrder", data); selector: `.${key}`
}
} else {
this.showToast(message);
}
}) })
.finally(() => { }
setTimeout(() => {
wx.hideLoading();
}, 2000)
this.setData({
submitStatus: false,
});
});
}, },
checkGoods(save, subOrderList, priceDisabled, goodsList, orderObj) { checkGoods(save, subOrderList, priceDisabled, goodsList, orderObj) {
if (save) return false; if (save) return false
// if (orderObj.selectPayType != 0) { // if (orderObj.selectPayType != 0) {
let { let { baseConfigData } = this.data
baseConfigData let filmArr = []
} = this.data; let arr = []
let filmArr = [];
let arr = [];
let errTargetNum = 0 let errTargetNum = 0
if (goodsList) { if (goodsList) {
goodsList.map((e) => { goodsList.map(e => {
if (e.goodsFlag == 1) { if (e.goodsFlag == 1) {
if (e.goods.errorTarget) { if (e.goods.errorTarget) {
errTargetNum++; errTargetNum++
} }
let obj = { let obj = {
baseGoodsId: e.goods.baseGoodsId, baseGoodsId: e.goods.baseGoodsId,
totalPrice: Number(e.goods.sellPrice), totalPrice: Number(e.goods.sellPrice),
number: e.count, number: e.count,
merchantGoodsId: e.goods.id || e.goods.merchantGoodsId, merchantGoodsId: e.goods.id || e.goods.merchantGoodsId
}; }
if (e.goods.price < e.goods.shopMinPrice && orderObj.selectPayType != 0) if (
priceDisabled = false; e.goods.price < e.goods.shopMinPrice &&
subOrderList.push(obj); orderObj.selectPayType != 0
)
priceDisabled = false
subOrderList.push(obj)
} }
//套餐 //套餐
if (e.goodsFlag == 3) { if (e.goodsFlag == 3) {
e.packageGoods.goodsList.forEach((g) => { e.packageGoods.goodsList.forEach(g => {
if (g.errorTarget) { if (g.errorTarget) {
errTargetNum++; errTargetNum++
} }
arr.push({ arr.push({
packageCode: e.packageGoods.packageCode, packageCode: e.packageGoods.packageCode,
...@@ -906,101 +784,109 @@ Page({ ...@@ -906,101 +784,109 @@ Page({
number: e.count, number: e.count,
merchantGoodsId: g.merchantGoodsId, merchantGoodsId: g.merchantGoodsId,
upgradePrice: g.sellPrice upgradePrice: g.sellPrice
}); })
}); })
} }
//多规格 //多规格
if (e.goodsFlag == 2) { if (e.goodsFlag == 2) {
if (e.multipleSpecificationsGoods.goods) { if (e.multipleSpecificationsGoods.goods) {
if (e.multipleSpecificationsGoods.goods.errorTarget) { if (e.multipleSpecificationsGoods.goods.errorTarget) {
errTargetNum++; errTargetNum++
} }
let obj = { let obj = {
baseGoodsId: e.multipleSpecificationsGoods.goods.baseGoodsId, baseGoodsId: e.multipleSpecificationsGoods.goods.baseGoodsId,
totalPrice: Number(e.multipleSpecificationsGoods.goods.sellPrice), totalPrice: Number(e.multipleSpecificationsGoods.goods.sellPrice),
number: e.count, number: e.count,
merchantGoodsId: e.multipleSpecificationsGoods.goods.id || e.multipleSpecificationsGoods.goods.merchantGoodsId, merchantGoodsId:
}; e.multipleSpecificationsGoods.goods.id ||
subOrderList.push(obj); e.multipleSpecificationsGoods.goods.merchantGoodsId
}
subOrderList.push(obj)
} }
} }
}); })
orderObj.subOrderList = subOrderList?.concat(arr); orderObj.subOrderList = subOrderList?.concat(arr)
} }
if (orderObj.subOrderList?.length == 0) { if (orderObj.subOrderList?.length == 0) {
return "商品不能为空"; return '商品不能为空'
}
if (orderObj.orderType == 3) {
const totalCount = orderObj.subOrderList.reduce(
(sum, item) => sum + (Number(item.number) || 0),
0
)
if (totalCount < 2) {
return '买赠策略至少需要选择两个商品'
}
} }
if (errTargetNum) { if (errTargetNum) {
return "商品不能低于最低价格"; return '商品不能低于最低价格'
} }
}, },
checkRequired(save, obj) { checkRequired(save, obj) {
// 导入动态校验字段 // 导入动态校验字段
let { let { requiredList } = this.data
requiredList
} = this.data;
// let target = save ? ['userId', 'merchantId', 'employeeName', ...requiredList, 'customerName', 'customerPhone', 'sellerUserId', 'sellerName', 'sellerMerchantId'] // let target = save ? ['userId', 'merchantId', 'employeeName', ...requiredList, 'customerName', 'customerPhone', 'sellerUserId', 'sellerName', 'sellerMerchantId']
// : ['userId', 'merchantId', 'employeeName', ...requiredList, 'customerName', 'customerPhone', 'sellerUserId', 'sellerName', 'sellerMerchantId', 'customerCouponCode'] // : ['userId', 'merchantId', 'employeeName', ...requiredList, 'customerName', 'customerPhone', 'sellerUserId', 'sellerName', 'sellerMerchantId', 'customerCouponCode']
let target = [ let target = [
"userId", 'userId',
"merchantId", 'merchantId',
"employeeName", 'employeeName',
...requiredList, ...requiredList,
"customerName", 'customerName',
"salesType", 'salesType',
"customerPhone", 'customerPhone',
"sellerUserId", 'sellerUserId',
"sellerName", 'sellerName',
"sellerMerchantId", 'sellerMerchantId',
"payeeType", 'payeeType',
"selectPayType" 'selectPayType'
]; ]
if (save) { if (save) {
target.push("customerCouponCode"); target.push('customerCouponCode')
} }
// 是战败就去除一些无用字段 // 是战败就去除一些无用字段
if (obj.selectPayType == 0) { if (obj.selectPayType == 0) {
target = target.filter( target = target.filter(
(item) => !["carBrand", "standNo", "plateNumber"].includes(item) item => !['carBrand', 'standNo', 'plateNumber'].includes(item)
); )
} }
// 支付方式为其他收款,备注必填 // 支付方式为其他收款,备注必填
if (obj.selectPayType == 7 && !obj.remark) { if (obj.selectPayType == 7 && !obj.remark) {
this.showToast("备注不能为空") this.showToast('备注不能为空')
return true return true
} }
obj = { obj = {
...obj, ...obj,
...obj.customer, ...obj.customer
}; }
if (!phoneRex.test(obj.customer.customerPhone)) { if (!phoneRex.test(obj.customer.customerPhone)) {
this.showToast("请输入正确的手机号"); this.showToast('请输入正确的手机号')
return true; return true
} }
if (obj.customer.standNo && obj.selectPayType != 0) { if (obj.customer.standNo && obj.selectPayType != 0) {
const vinRex = /[^\w]/g; const vinRex = /[^\w]/g
if (vinRex.test(obj.customer.standNo)) { if (vinRex.test(obj.customer.standNo)) {
this.showToast("请输入正确的VIN码"); this.showToast('请输入正确的VIN码')
return true; return true
} }
} }
try { try {
target.map((key) => { target.map(key => {
if ((obj[key] ?? '') === '') { if ((obj[key] ?? '') === '') {
throw key; throw key
} }
}); })
} catch (error) { } catch (error) {
return error; return error
} }
return false; return false
}, },
checkPhoneUseConfig() { checkPhoneUseConfig() {
let { let { phoneShow, orderObj } = this.data
phoneShow,
orderObj
} = this.data;
if ( if (
phoneShow && phoneShow &&
phoneShow.length && phoneShow.length &&
...@@ -1010,12 +896,12 @@ Page({ ...@@ -1010,12 +896,12 @@ Page({
) { ) {
// let list = phoneShow.shopMerchantPhoneList // let list = phoneShow.shopMerchantPhoneList
let phoneConfig = let phoneConfig =
phoneShow.find((item) => { phoneShow.find(item => {
item.shopMerchantId == orderObj.merchantId; item.shopMerchantId == orderObj.merchantId
}) || phoneShow.pop(); }) || phoneShow.pop()
this.setData({ this.setData({
["orderObj.customer.customerPhone"]: phoneConfig?.phoneNumber, ['orderObj.customer.customerPhone']: phoneConfig?.phoneNumber
}); })
} }
}, },
setOrderObj(options) { setOrderObj(options) {
...@@ -1028,91 +914,90 @@ Page({ ...@@ -1028,91 +914,90 @@ Page({
isAlreadyExistOrder, isAlreadyExistOrder,
subShopMerchantList, subShopMerchantList,
paymentMethod paymentMethod
} = this.data; } = this.data
console.log("setOrderObj", options); console.log('setOrderObj', options)
// debugger // debugger
wx.$util.showLoading("加载中..."); wx.$util.showLoading('加载中...')
let orderObj = {}; let orderObj = {}
Object.keys(options).map((e) => { Object.keys(options).map(e => {
if (options[e] != null && options[e] != undefined) { if (options[e] != null && options[e] != undefined) {
if (typeof options[e] == "object") { if (typeof options[e] == 'object') {
Object.keys(options[e]).map((key) => { Object.keys(options[e]).map(key => {
if (options[e][key] == null || options[e][key] == undefined) if (options[e][key] == null || options[e][key] == undefined)
delete options[e][key]; delete options[e][key]
}); })
} }
orderObj[e] = options[e]; orderObj[e] = options[e]
} }
}); })
// 去除优惠券 参数 // 去除优惠券 参数
delete orderObj.couponName; delete orderObj.couponName
// 使用优惠券的merchantId 避免优惠券和店区不一致的情况 // 使用优惠券的merchantId 避免优惠券和店区不一致的情况
if (!orderObj.merchantId) if (!orderObj.merchantId)
orderObj.merchantId = orderObj.merchantCoupon.merchantId; orderObj.merchantId = orderObj.merchantCoupon.merchantId
if (!orderObj.customer) orderObj.customer = orderObj.customerInfo; if (!orderObj.customer) orderObj.customer = orderObj.customerInfo
// debugger // debugger
// 是再次下单的 就删除优惠券字段 不是就赋值 // 是再次下单的 就删除优惠券字段 不是就赋值
// || orderObj.associatedOrderCode // || orderObj.associatedOrderCode
if (orderObj.customerCoupon && orderObj.constructionFlag != "Y") { if (orderObj.customerCoupon && orderObj.constructionFlag != 'Y') {
orderObj.couponName = orderObj.customerCoupon.couponName; orderObj.couponName = orderObj.customerCoupon.couponName
orderObj.customerCouponCode = orderObj.customerCouponCode =
orderObj.customerCoupon.customerCouponCode?.split("-")[0]; orderObj.customerCoupon.customerCouponCode?.split('-')[0]
if (orderObj.couponId) { if (orderObj.couponId) {
orderObj.customerCouponId = orderObj.id; orderObj.customerCouponId = orderObj.id
} }
} else { } else {
delete orderObj.merchantCouponId; delete orderObj.merchantCouponId
} }
if (scene) { if (scene) {
orderObj.customerCouponId = orderObj.id; orderObj.customerCouponId = orderObj.id
orderObj.orderSource = 5; orderObj.orderSource = 5
orderObj.sellerMerchantName = userInfo.merchantName; orderObj.sellerMerchantName = userInfo.merchantName
orderObj.sellerName = userInfo.name; orderObj.sellerName = userInfo.name
orderObj.sellerMerchantId = userInfo.merchantId; orderObj.sellerMerchantId = userInfo.merchantId
orderObj.sellerUserId = userInfo.uuid; orderObj.sellerUserId = userInfo.uuid
delete orderObj.remark; delete orderObj.remark
} else { } else {
orderObj.orderSource = orderObj.orderSource; orderObj.orderSource = orderObj.orderSource
} }
if (!orderObj.customer.customerSex) orderObj.customer.customerSex = 1; if (!orderObj.customer.customerSex) orderObj.customer.customerSex = 1
if (!orderObj.customer.experienceFlag) if (!orderObj.customer.experienceFlag)
orderObj.customer.experienceFlag = "N"; orderObj.customer.experienceFlag = 'N'
if (orderObj.associateOrderCode || orderObj.associateOrderType) { if (orderObj.associateOrderCode || orderObj.associateOrderType) {
// if (orderObj.oldOrderCode) { // if (orderObj.oldOrderCode) {
wx.setNavigationBarTitle({ wx.setNavigationBarTitle({
title: "修正订单", title: '修正订单'
}); })
if (orderObj.associateOrderCode) { if (orderObj.associateOrderCode) {
isErrorOrder = true; isErrorOrder = true
orderObj.payeeType = 0 // 收款方: 0嘀加收款 orderObj.payeeType = 0 // 收款方: 0嘀加收款
orderObj.selectPayType = 5 // 支付方式: 5嘀加收款 orderObj.selectPayType = 5 // 支付方式: 5嘀加收款
} else { } else {
associateOrderType = true; associateOrderType = true
} }
// 默认添加离开弹框 提交成功后取消 // 默认添加离开弹框 提交成功后取消
wx.enableAlertBeforeUnload && wx.enableAlertBeforeUnload &&
wx.enableAlertBeforeUnload({ wx.enableAlertBeforeUnload({
title: "提示", title: '提示',
message: "您需完成正确工单的信息录入", message: '您需完成正确工单的信息录入',
success: function (res) { success: function (res) {
console.log("成功:", res); console.log('成功:', res)
}, },
fail: function (err) { fail: function (err) {
console.log("失败:", err); console.log('失败:', err)
}, }
}); })
} }
// 预约工单跳转下单(处理园区店id参数 保证可以拿到园区店的礼券yqMerchantId) // 预约工单跳转下单(处理园区店id参数 保证可以拿到园区店的礼券yqMerchantId)
if (options.yqMerchantId && options.isAppointment) { if (options.yqMerchantId && options.isAppointment) {
orderObj.sellerMerchantId = options.yqMerchantId; orderObj.sellerMerchantId = options.yqMerchantId
} }
if (!orderObj.customer.salesType) orderObj.customer.salesType = 0; if (!orderObj.customer.salesType) orderObj.customer.salesType = 0
console.log(JSON.parse(JSON.stringify(orderObj))) console.log(JSON.parse(JSON.stringify(orderObj)))
this.setData({ this.setData({
currentWordNumber: orderObj?.remark?.length || 0, currentWordNumber: orderObj?.remark?.length || 0,
...@@ -1122,17 +1007,17 @@ Page({ ...@@ -1122,17 +1007,17 @@ Page({
isErrorOrder, isErrorOrder,
associateOrderType, associateOrderType,
isAppointment: options.isAppointment isAppointment: options.isAppointment
}); })
if (paymentMethod && scene) { if (paymentMethod && scene) {
if (paymentMethod == 1 && options.yqMerchantId) { if (paymentMethod == 1 && options.yqMerchantId) {
let oParams = {}; let oParams = {}
oParams.yqMerchantId = options.yqMerchantId oParams.yqMerchantId = options.yqMerchantId
api.getYqStoreConfig(oParams).then((res) => { api.getYqStoreConfig(oParams).then(res => {
let obj = res.data || {} let obj = res.data || {}
let m = obj.supportPayTypes || [] let m = obj.supportPayTypes || []
let n = this.data.payTypeList let n = this.data.payTypeList
let list = n.filter((k) => { let list = n.filter(k => {
let idx = m.find((j) => j == k.value) let idx = m.find(j => j == k.value)
return idx >= 0 return idx >= 0
}) })
this.setData({ this.setData({
...@@ -1143,14 +1028,14 @@ Page({ ...@@ -1143,14 +1028,14 @@ Page({
} }
if (paymentMethod != 1 && paymentMethod != 5) { if (paymentMethod != 1 && paymentMethod != 5) {
this.setData({ this.setData({
['orderObj.selectPayType']: paymentMethod == 3 ? 2 : paymentMethod == 4 ? 6 : 7, ['orderObj.selectPayType']:
paymentMethod == 3 ? 2 : paymentMethod == 4 ? 6 : 7,
['orderObj.payeeType']: paymentMethod == 3 ? 1 : 0 ['orderObj.payeeType']: paymentMethod == 3 ? 1 : 0
}) })
} }
} }
this.getSelectOrderGoodsList(orderObj.merchantId) this.getSelectOrderGoodsList(orderObj.merchantId)
// this.getOrderBaseGoodsList(orderObj.merchantId); // this.getOrderBaseGoodsList(orderObj.merchantId);
}, },
/** /**
...@@ -1163,29 +1048,26 @@ Page({ ...@@ -1163,29 +1048,26 @@ Page({
}) })
// console.log(app.globalData.YQorderSetting, 'app.globalData.YQorderSetting?.yqPhoneConfig') // console.log(app.globalData.YQorderSetting, 'app.globalData.YQorderSetting?.yqPhoneConfig')
console.log(options, 'options'); console.log(options, 'options')
if (options.scene) { if (options.scene) {
this.setData(options); this.setData(options)
} }
if (options.orderCode) { if (options.orderCode) {
this.onRoute(options); this.onRoute(options)
} }
// 添加埋点 // 添加埋点
wx.$track.setTrackData(0, 'submit_order', {}, '', 1) wx.$track.setTrackData(0, 'submit_order', {}, '', 1)
}, },
init(userInfo) { init(userInfo) {
let { let { scene, orderObj } = this.data
scene,
orderObj
} = this.data;
if (!orderObj.sellerMerchantName) { if (!orderObj.sellerMerchantName) {
orderObj.sellerMerchantName = userInfo.merchantName; orderObj.sellerMerchantName = userInfo.merchantName
orderObj.sellerName = userInfo.name; orderObj.sellerName = userInfo.name
orderObj.sellerMerchantId = userInfo.merchantId; orderObj.sellerMerchantId = userInfo.merchantId
orderObj.sellerUserId = userInfo.uuid; orderObj.sellerUserId = userInfo.uuid
this.setData({ this.setData({
orderObj, orderObj
}); })
} }
// console.log(this.data) // console.log(this.data)
// console.log(scene); // console.log(scene);
...@@ -1193,76 +1075,65 @@ Page({ ...@@ -1193,76 +1075,65 @@ Page({
if (scene) { if (scene) {
scene = decodeURIComponent(scene) scene = decodeURIComponent(scene)
if (userInfo.userType == 2) { if (userInfo.userType == 2) {
let id = scene.split("=")[1]; let id = scene.split('=')[1]
api api
.getCouponDeatil({ .getCouponDeatil({
id, id
}) })
.then((info) => { .then(info => {
let { let { code, data, message } = info
code,
data,
message
} = info;
if (code == 0) { if (code == 0) {
if (data.usedFlag == "Y") { if (data.usedFlag == 'Y') {
wx.showModal({ wx.showModal({
content: "该礼券已被使用", content: '该礼券已被使用',
confirmText: "知道了", confirmText: '知道了',
confirmColor: "#347BFF", confirmColor: '#347BFF',
showCancel: false, showCancel: false,
success(res) { success(res) {
if (res.confirm) wx.$router.back(); if (res.confirm) wx.$router.back()
}, }
}); })
return; return
} }
this.setOrderObj(data); this.setOrderObj(data)
api api
.getOrderByCustomerCouponId({ .getOrderByCustomerCouponId({
customerCouponId: id, customerCouponId: id
}) })
.then((res) => { .then(res => {
let { let { code, data, message } = res
code,
data,
message
} = res;
if (code == 0) { if (code == 0) {
this.setData({ this.setData({
["orderObj.orderCode"]: data.orderCode, ['orderObj.orderCode']: data.orderCode
}); })
} else { } else {
this.showToast(message); this.showToast(message)
} }
}); })
} else { } else {
this.showToast(message); this.showToast(message)
} }
}); })
} else { } else {
wx.showModal({ wx.showModal({
title: "温馨提示", title: '温馨提示',
content: "您的账号无法完成此操作", content: '您的账号无法完成此操作',
confirmText: "知道了", confirmText: '知道了',
confirmColor: "#347BFF", confirmColor: '#347BFF',
showCancel: false, showCancel: false,
success(res) { success(res) {
if (res.confirm) { if (res.confirm) {
wx.$util.refreshPageData(); wx.$util.refreshPageData()
wx.$router.go("index"); wx.$router.go('index')
} }
}, }
}); })
} }
} }
}, },
async getSelectOrderGoodsList(merchantId) { async getSelectOrderGoodsList(merchantId) {
let { let { first, orderObj } = this.data
first,
orderObj,
} = this.data;
let packageList = [], let packageList = [],
frontGearArr = [], // 前挡 frontGearArr = [], // 前挡
sideBeforeRearGearArr = [], // 前侧窗玻璃 sideBeforeRearGearArr = [], // 前侧窗玻璃
...@@ -1270,27 +1141,23 @@ Page({ ...@@ -1270,27 +1141,23 @@ Page({
sideAfterRearGearArr = [], // 后档 sideAfterRearGearArr = [], // 后档
skylightArr = [], // 天窗 skylightArr = [], // 天窗
otherProduct = [] //其他精品 otherProduct = [] //其他精品
let { let { subOrderList } = orderObj
subOrderList const selectPayType = orderObj.selectPayType == 0
} = orderObj; const positionTypeList = (await getPositionList()) || []
const selectPayType = orderObj.selectPayType == 0;
const positionTypeList = (await getPositionList()) || [];
// 获取配置服务数据 // 获取配置服务数据
let baseConfigData = await setConfigInfo(app.globalData); let baseConfigData = await setConfigInfo(app.globalData)
this.setData({ this.setData({
positionTypeList, positionTypeList,
baseConfigData, baseConfigData
}); })
merchantId && api merchantId &&
api
.getSelectOrderGoodsList({ .getSelectOrderGoodsList({
merchantId, merchantId,
sceneType: 1 sceneType: 1
}).then(result => { })
let { .then(result => {
code, let { code, data, message } = result
data,
message
} = result;
if (code == 0) { if (code == 0) {
console.log('data', data) console.log('data', data)
data.forEach(val => { data.forEach(val => {
...@@ -1303,41 +1170,44 @@ Page({ ...@@ -1303,41 +1170,44 @@ Page({
subVal.goodsId = subVal.merchantGoodsId subVal.goodsId = subVal.merchantGoodsId
//前挡 //前挡
if ([1].includes(subVal.merchantGoodsPosition)) { if ([1].includes(subVal.merchantGoodsPosition)) {
frontGearArr.push(val); frontGearArr.push(val)
} }
// 前侧窗玻璃 // 前侧窗玻璃
if ([2].includes(subVal.merchantGoodsPosition)) { if ([2].includes(subVal.merchantGoodsPosition)) {
sideBeforeRearGearArr.push(val); sideBeforeRearGearArr.push(val)
} }
//侧后挡 //侧后挡
if ([3].includes(subVal.merchantGoodsPosition)) { if ([3].includes(subVal.merchantGoodsPosition)) {
sideRearGearArr.push(val); sideRearGearArr.push(val)
} }
// 后档 // 后档
if ([4].includes(subVal.merchantGoodsPosition)) { if ([4].includes(subVal.merchantGoodsPosition)) {
sideAfterRearGearArr.push(val); sideAfterRearGearArr.push(val)
} }
// 天窗 // 天窗
if ([5, 6, 7].includes(subVal.merchantGoodsPosition)) { if ([5, 6, 7].includes(subVal.merchantGoodsPosition)) {
skylightArr.push(val); skylightArr.push(val)
} }
if (![1, 2, 3, 4, 5, 6, 7].includes(subVal.merchantGoodsPosition)) { if (
![1, 2, 3, 4, 5, 6, 7].includes(subVal.merchantGoodsPosition)
) {
otherProduct.push(val) otherProduct.push(val)
} }
if (subOrderList?.length) { if (subOrderList?.length) {
subOrderList.forEach((subV) => { subOrderList.forEach(subV => {
// 历史子订单商品部位被更改 再次下单将部位更新 // 历史子订单商品部位被更改 再次下单将部位更新
if ( if (
subVal.merchantGoodsPosition && subVal.merchantGoodsPosition &&
subV.upgradeGoodsPosition && subV.upgradeGoodsPosition &&
subVal.merchantGoodsPosition != subV.upgradeGoodsPosition && subVal.merchantGoodsPosition !=
subV.upgradeGoodsPosition &&
subVal.upgradeGoodsId == subV.upgradeGoodsId subVal.upgradeGoodsId == subV.upgradeGoodsId
) { ) {
subV.upgradeGoodsPosition = subVal.merchantGoodsPosition; subV.upgradeGoodsPosition = subVal.merchantGoodsPosition
} }
subV.active = true; subV.active = true
if (subV.merchantGoodsId) subV.id = subV.merchantGoodsId; if (subV.merchantGoodsId) subV.id = subV.merchantGoodsId
}); })
} }
} }
//套餐 //套餐
...@@ -1346,14 +1216,18 @@ Page({ ...@@ -1346,14 +1216,18 @@ Page({
} }
//商品多规格 //商品多规格
if (val.goodsFlag == 2) { if (val.goodsFlag == 2) {
val.multipleSpecificationsGoods.specificationList.forEach(item => { val.multipleSpecificationsGoods.specificationList.forEach(
item => {
item.specificationSelectValueList = [] item.specificationSelectValueList = []
item.specificationValueList.forEach(second => { item.specificationValueList.forEach(second => {
if (second.show) { if (second.show) {
item.specificationSelectValueList.push(second.specificationValue) item.specificationSelectValueList.push(
second.specificationValue
)
} }
}) })
}) }
)
otherProduct.push(val) otherProduct.push(val)
} }
}) })
...@@ -1371,12 +1245,11 @@ Page({ ...@@ -1371,12 +1245,11 @@ Page({
skylightArr: skylightArr, skylightArr: skylightArr,
otherProduct: otherProduct, otherProduct: otherProduct,
// orderObj // orderObj
["orderObj.subOrderList"]: subOrderList, ['orderObj.subOrderList']: subOrderList
}); })
if (first) this.getChooseList(); if (first) this.getChooseList()
} else { } else {
wx.$util.showToast(message)
wx.$util.showToast(message);
} }
}) })
wx.hideLoading() wx.hideLoading()
...@@ -1389,33 +1262,28 @@ Page({ ...@@ -1389,33 +1262,28 @@ Page({
sideBeforeRearGearArr, // 前侧窗玻璃 sideBeforeRearGearArr, // 前侧窗玻璃
sideRearGearArr, // 侧后挡 sideRearGearArr, // 侧后挡
sideAfterRearGearArr, // 后档 sideAfterRearGearArr, // 后档
skylightArr, // 天窗 skylightArr // 天窗
} = this.data; } = this.data
let { let { subOrderList } = orderObj
subOrderList const selectPayType = orderObj.selectPayType == 0
} = orderObj; const positionTypeList = (await getPositionList()) || []
const selectPayType = orderObj.selectPayType == 0;
const positionTypeList = (await getPositionList()) || [];
// 获取配置服务数据 // 获取配置服务数据
let baseConfigData = await setConfigInfo(app.globalData); let baseConfigData = await setConfigInfo(app.globalData)
this.setData({ this.setData({
positionTypeList, positionTypeList,
baseConfigData, baseConfigData
}); })
merchantId && api merchantId &&
api
.getOrderBaseGoodsList({ .getOrderBaseGoodsList({
merchantId, merchantId,
upradeFlag: selectPayType ? "N" : "Y", upradeFlag: selectPayType ? 'N' : 'Y'
}) })
.then((res) => { .then(res => {
let { let { code, data, message } = res
code,
data,
message
} = res;
console.log(subOrderList, res, 'subOrderList') console.log(subOrderList, res, 'subOrderList')
if (code == 0) { if (code == 0) {
wx.hideLoading(); wx.hideLoading()
// data?.forEach((val) => { // data?.forEach((val) => {
// val?.upgradeGoodsList?.forEach((subVal) => { // val?.upgradeGoodsList?.forEach((subVal) => {
// subVal.merchantGoodsId = subVal.id; // subVal.merchantGoodsId = subVal.id;
...@@ -1453,48 +1321,48 @@ Page({ ...@@ -1453,48 +1321,48 @@ Page({
// }); // });
// 筛选出是当前门店的商品 // 筛选出是当前门店的商品
let goodsData = data; let goodsData = data
const filterList = goodsData.reduce((list, item) => { const filterList = goodsData.reduce((list, item) => {
item.upgradeGoodsList.forEach((val) => { item.upgradeGoodsList.forEach(val => {
val.positionStr = positionTypeList.filter( val.positionStr = positionTypeList.filter(
(v) => v.positionValue == val.merchantGoodsPosition v => v.positionValue == val.merchantGoodsPosition
)[0]?.positionName; )[0]?.positionName
}); })
item.upgradeGoodsList && list.push(...item.upgradeGoodsList); item.upgradeGoodsList && list.push(...item.upgradeGoodsList)
return list; return list
}, []); }, [])
if (subOrderList?.length > 0) { if (subOrderList?.length > 0) {
subOrderList = subOrderList.filter((item) => { subOrderList = subOrderList.filter(item => {
return filterList.find((goods) => { return filterList.find(goods => {
return ( return (
(goods.merchantGoodsId || goods.id) == item.merchantGoodsId (goods.merchantGoodsId || goods.id) == item.merchantGoodsId
); )
}); })
}); })
} }
subOrderList?.forEach((val) => { subOrderList?.forEach(val => {
// 保证已选的商品是选中状态 // 保证已选的商品是选中状态
val.active = true; val.active = true
if (val.merchantGoodsId) val.id = val.merchantGoodsId; // 改造商品数据 id为null if (val.merchantGoodsId) val.id = val.merchantGoodsId // 改造商品数据 id为null
}); })
if (selectPayType) { if (selectPayType) {
//战败特殊处理 //战败特殊处理
// console.log(data[0], 'upgradeGoodsList') // console.log(data[0], 'upgradeGoodsList')
data.forEach((item) => { data.forEach(item => {
item.upgradeGoodsList.forEach((v) => { item.upgradeGoodsList.forEach(v => {
v.price = 0; v.price = 0
v.shopMinPrice = 0; v.shopMinPrice = 0
v.upgradePrice = 0; v.upgradePrice = 0
v.totalPrice = 0; v.totalPrice = 0
v.number = 1; v.number = 1
}); })
}); })
// 是战败并且只有一个商品 默认选中 // 是战败并且只有一个商品 默认选中
if (data.length == 1 && data[0].upgradeGoodsList.length == 1) { if (data.length == 1 && data[0].upgradeGoodsList.length == 1) {
const list = wx.$util.deepClone(data[0].upgradeGoodsList[0]); const list = wx.$util.deepClone(data[0].upgradeGoodsList[0])
list.count = 1; list.count = 1
list.active = true; list.active = true
subOrderList = [list]; subOrderList = [list]
// this.setData({ // this.setData({
// goodsList: [list] // goodsList: [list]
// }) // })
...@@ -1517,50 +1385,43 @@ Page({ ...@@ -1517,50 +1385,43 @@ Page({
// }); // });
// if (first) this.getChooseList(); // if (first) this.getChooseList();
} else { } else {
wx.$util.showToast(message); wx.$util.showToast(message)
} }
}); })
}, },
remarkConfirm(e) { remarkConfirm(e) {
let value = e.detail; let value = e.detail
this.setData({ this.setData({
["orderObj.remark"]: value, ['orderObj.remark']: value
}); })
}, },
getChooseList() { getChooseList() {
let { let { orderObj, goodsData } = this.data
orderObj, let { subOrderList, packageGoodsList } = orderObj
goodsData let chooseList = []
} = this.data;
let {
subOrderList,
packageGoodsList
} = orderObj;
let chooseList = [];
subOrderList = subOrderList?.concat(packageGoodsList) subOrderList = subOrderList?.concat(packageGoodsList)
if (subOrderList && subOrderList.length) { if (subOrderList && subOrderList.length) {
subOrderList.map(e => {
subOrderList.map((e) => {
// 是普通商品 // 是普通商品
if (e && !e.packageName) { if (e && !e.packageName) {
if (e.specificationData.indexOf(';~;') == -1) { if (e.specificationData.indexOf(';~;') == -1) {
// 修复取值字段名字错误问题 // 修复取值字段名字错误问题
if (!e.price) { if (!e.price) {
e.price = wx.$util.decimal(Number(e.totalPrice / e.number), 2); e.price = wx.$util.decimal(Number(e.totalPrice / e.number), 2)
//最低价 //最低价
} }
e.sellPrice = e.price e.sellPrice = e.price
e.goodsId = e.merchantGoodsId e.goodsId = e.merchantGoodsId
if (!e.minSellPrice) e.minSellPrice = e.upgradeShopMinPrice; if (!e.minSellPrice) e.minSellPrice = e.upgradeShopMinPrice
e.goodsInfo = { e.goodsInfo = {
goodsName: e.upgradeGoodsAlias || e.upgradeGoodsName, goodsName: e.upgradeGoodsAlias || e.upgradeGoodsName
}; }
e.count = e.number; e.count = e.number
e.merchantGoodsId = e.merchantGoodsId || e.id; e.merchantGoodsId = e.merchantGoodsId || e.id
chooseList.push({ chooseList.push({
goodsFlag: 1, goodsFlag: 1,
goods: e, goods: e,
...@@ -1570,23 +1431,22 @@ Page({ ...@@ -1570,23 +1431,22 @@ Page({
} }
} }
if (e && e.packageName) { if (e && e.packageName) {
e.packageGoodsOrderList.forEach((g) => { e.packageGoodsOrderList.forEach(g => {
g.sellPrice = g.sellPrice || g.upgradePrice; g.sellPrice = g.sellPrice || g.upgradePrice
g.price = g.totalPrice ? g.price = g.totalPrice
Number(g.totalPrice) / Number(g.number) : ? Number(g.totalPrice) / Number(g.number)
g.sellPrice; : g.sellPrice
}); })
e.goodsList = e.packageGoodsOrderList; e.goodsList = e.packageGoodsOrderList
e.upgradePrice = e.goodsList.reduce((prev, cur) => { e.upgradePrice = e.goodsList.reduce((prev, cur) => {
return prev + cur.sellPrice; return prev + cur.sellPrice
}, 0); }, 0)
e.count = e.goodsList.length ? e.goodsList[0].number : 1; e.count = e.goodsList.length ? e.goodsList[0].number : 1
e.price = e.goodsList.reduce((prev, cur) => { e.price = e.goodsList.reduce((prev, cur) => {
return prev + Number(cur.totalPrice) / Number(cur.number); return prev + Number(cur.totalPrice) / Number(cur.number)
}, 0); }, 0)
chooseList.push({ chooseList.push({
isType: 'meal', isType: 'meal',
...@@ -1598,39 +1458,41 @@ Page({ ...@@ -1598,39 +1458,41 @@ Page({
}) })
} }
if (e && !e.packageName) { if (e && !e.packageName) {
console.log(e.specificationData, e, e.specificationData.indexOf(';~;') > -1) console.log(
e.specificationData,
e,
e.specificationData.indexOf(';~;') > -1
)
if (e.specificationData.indexOf(';~;') > -1) { if (e.specificationData.indexOf(';~;') > -1) {
// 修复取值字段名字错误问题 // 修复取值字段名字错误问题
if (!e.price) { if (!e.price) {
e.price = wx.$util.decimal(Number(e.totalPrice / e.number), 2); e.price = wx.$util.decimal(Number(e.totalPrice / e.number), 2)
//最低价 //最低价
e.sellPrice = e.price e.sellPrice = e.price
} }
e.goodsId = e.merchantGoodsId e.goodsId = e.merchantGoodsId
if (!e.minSellPrice) e.minSellPrice = e.upgradeShopMinPrice; if (!e.minSellPrice) e.minSellPrice = e.upgradeShopMinPrice
e.goodsInfo = { e.goodsInfo = {
goodsName: e.upgradeGoodsAlias || e.upgradeGoodsName, goodsName: e.upgradeGoodsAlias || e.upgradeGoodsName
}; }
e.count = e.number; e.count = e.number
e.merchantGoodsId = e.merchantGoodsId || e.id; e.merchantGoodsId = e.merchantGoodsId || e.id
let specificdata = this.handleSpecificationsEcho(e) let specificdata = this.handleSpecificationsEcho(e)
chooseList = chooseList.concat(specificdata) chooseList = chooseList.concat(specificdata)
} }
} }
}); })
} }
this.setData({ this.setData({
goodsList: chooseList, goodsList: chooseList,
first: false, first: false
}); })
this.setGoodsTotal(chooseList); this.setGoodsTotal(chooseList)
}, },
handleVinInput(value, autoValidate = false,type='standNo') { handleVinInput(value, autoValidate = false, type = 'standNo') {
let { let { orderObj } = this.data
orderObj
} = this.data;
const formattedValue = formatVinInput(value || '') const formattedValue = formatVinInput(value || '')
orderObj.customer[type] = formattedValue; orderObj.customer[type] = formattedValue
this.setData({ this.setData({
orderObj orderObj
}) })
...@@ -1638,7 +1500,7 @@ Page({ ...@@ -1638,7 +1500,7 @@ Page({
if (formattedValue && (autoValidate || formattedValue.length === 17)) { if (formattedValue && (autoValidate || formattedValue.length === 17)) {
validateVin(formattedValue) validateVin(formattedValue)
.then(result => { .then(result => {
let { valid } = result.data.data; let { valid } = result.data.data
// 校验成功,所有提示已在公共方法中处理 // 校验成功,所有提示已在公共方法中处理
this.setData({ this.setData({
vinValid: valid vinValid: valid
...@@ -1652,10 +1514,8 @@ Page({ ...@@ -1652,10 +1514,8 @@ Page({
} }
}, },
handleSpecificationsEcho(item) { handleSpecificationsEcho(item) {
let skuArr = []; let skuArr = []
let { let { otherProduct } = this.data,
otherProduct
} = this.data,
arr = item.specificationData.split('/'), arr = item.specificationData.split('/'),
str = arr.join(';~;'), str = arr.join(';~;'),
obj = { obj = {
...@@ -1664,10 +1524,11 @@ Page({ ...@@ -1664,10 +1524,11 @@ Page({
goods: null, goods: null,
active: true, active: true,
isFlag: true //初始化进来不显示标识 isFlag: true //初始化进来不显示标识
}; }
otherProduct.forEach(data => { otherProduct.forEach(data => {
if (data.goodsFlag == 2) { if (data.goodsFlag == 2) {
let tempData = data.multipleSpecificationsGoods.specificationGoodsMap[str] let tempData =
data.multipleSpecificationsGoods.specificationGoodsMap[str]
if (tempData) { if (tempData) {
tempData.forEach(temp => { tempData.forEach(temp => {
if (temp.merchantGoodsId == item.goodsId) { if (temp.merchantGoodsId == item.goodsId) {
...@@ -1685,10 +1546,7 @@ Page({ ...@@ -1685,10 +1546,7 @@ Page({
skuArr.push(obj) skuArr.push(obj)
} }
}) })
} }
} }
}) })
console.log(skuArr) console.log(skuArr)
...@@ -1713,53 +1571,50 @@ Page({ ...@@ -1713,53 +1571,50 @@ Page({
}, },
getSetting() { getSetting() {
// 动态获取 车型 车架 车牌 是否必填 // 动态获取 车型 车架 车牌 是否必填
let { let { dynamicSetting, requiredList } = this.data
dynamicSetting,
requiredList
} = this.data;
// app . // app .
getYQorderInfo() getYQorderInfo()
.then((merchantSettingInfo) => { .then(merchantSettingInfo => {
let dictionaryObj = { let dictionaryObj = {
carTypeRequiredFlag: "carBrand", carTypeRequiredFlag: 'carBrand',
standNoRequiredFlag: "standNo", standNoRequiredFlag: 'standNo',
plateNumRequiredFlag: "plateNumber", plateNumRequiredFlag: 'plateNumber'
}; }
for (const key in dictionaryObj) { for (const key in dictionaryObj) {
if (merchantSettingInfo[key] == "Y") { if (merchantSettingInfo[key] == 'Y') {
requiredList.push(dictionaryObj[key]); requiredList.push(dictionaryObj[key])
} }
} }
this.setData({ this.setData({
requiredList: [...new Set(requiredList)], requiredList: [...new Set(requiredList)],
phoneShow: wx.$util.deepClone(merchantSettingInfo.yqPhoneConfig), phoneShow: wx.$util.deepClone(merchantSettingInfo.yqPhoneConfig)
}); })
})
.catch(err => {
console.log(err)
}) })
.catch((err) => {
console.log(err);
});
}, },
// 获取园区店支付配置 // 获取园区店支付配置
getConfig() { getConfig() {
// console.log(this.data.orderObj) // console.log(this.data.orderObj)
let orderObj = wx.$util.deepClone(this.data.orderObj) let orderObj = wx.$util.deepClone(this.data.orderObj)
let o = this.data.orderObj; let o = this.data.orderObj
let oParams = {}; let oParams = {}
oParams.yqMerchantId = o.sellerMerchantId; oParams.yqMerchantId = o.sellerMerchantId
api.getYqStoreConfig(oParams).then((res) => { api.getYqStoreConfig(oParams).then(res => {
// console.log(res) // console.log(res)
let obj = res.data || {} let obj = res.data || {}
let m = obj.supportPayTypes || [] let m = obj.supportPayTypes || []
let n = this.data.payTypeList; let n = this.data.payTypeList
let list = n.filter((k) => { let list = n.filter(k => {
let idx = m.find((j) => j == k.value); let idx = m.find(j => j == k.value)
return idx >= 0; return idx >= 0
}); })
this.setData({ this.setData({
configPayTypeList: list configPayTypeList: list
}) })
this.settingPayType(orderObj) this.settingPayType(orderObj)
}); })
}, },
settingPayType(orderObj) { settingPayType(orderObj) {
let { let {
...@@ -1772,8 +1627,11 @@ Page({ ...@@ -1772,8 +1627,11 @@ Page({
} = this.data } = this.data
// 新建工单按引导进入 // 新建工单按引导进入
if (paymentMethod) { if (paymentMethod) {
if (paymentMethod == 1) { // 未支付下单 if (paymentMethod == 1) {
let linePayTypeArr = configPayTypeList?.filter(v => ![2, 5].includes(Number(v.value))) // 未支付下单
let linePayTypeArr = configPayTypeList?.filter(
v => ![2, 5].includes(Number(v.value))
)
this.setData({ this.setData({
['orderObj.selectPayType']: linePayTypeArr[0]?.value, // 默认线上支付,微信或pos机或支付宝 ['orderObj.selectPayType']: linePayTypeArr[0]?.value, // 默认线上支付,微信或pos机或支付宝
['orderObj.payeeType']: 0 ['orderObj.payeeType']: 0
...@@ -1783,7 +1641,8 @@ Page({ ...@@ -1783,7 +1641,8 @@ Page({
// paymentMethod 3 收款方为门店收款:跳转新建工单页面-且收款方为4s店收款,收款方式为门店收款,不可修改 // paymentMethod 3 收款方为门店收款:跳转新建工单页面-且收款方为4s店收款,收款方式为门店收款,不可修改
// paymentMethod 4 收款方为嘀加且属于对公转账收款:跳转新建工单页面-且收款方为嘀加收款,收款方式为对公转账,不可修改 // paymentMethod 4 收款方为嘀加且属于对公转账收款:跳转新建工单页面-且收款方为嘀加收款,收款方式为对公转账,不可修改
// paymentMethod 6 收款方为嘀加二维码收款(适用于多笔订单一笔流水付款):跳转新建工单页面-且收款方为嘀加收款,收款方式为其它收款,不可修改 // paymentMethod 6 收款方为嘀加二维码收款(适用于多笔订单一笔流水付款):跳转新建工单页面-且收款方为嘀加收款,收款方式为其它收款,不可修改
['orderObj.selectPayType']: paymentMethod == 3 ? 2 : paymentMethod == 4 ? 6 : 7, ['orderObj.selectPayType']:
paymentMethod == 3 ? 2 : paymentMethod == 4 ? 6 : 7,
['orderObj.payeeType']: paymentMethod == 3 ? 1 : 0 ['orderObj.payeeType']: paymentMethod == 3 ? 1 : 0
}) })
} }
...@@ -1792,7 +1651,8 @@ Page({ ...@@ -1792,7 +1651,8 @@ Page({
// 补录或标记错误订单 // 补录或标记错误订单
if (isErrorOrder || switchVlaue) { if (isErrorOrder || switchVlaue) {
this.setData({ this.setData({
['orderObj.selectPayType']: switchVlaue == 1 && selectOutTradeNoArr?.length == 1 ? 1 : 5, // 正常分账期单流水线上支付,正常流水多流水或超分账期嘀加收款 ['orderObj.selectPayType']:
switchVlaue == 1 && selectOutTradeNoArr?.length == 1 ? 1 : 5, // 正常分账期单流水线上支付,正常流水多流水或超分账期嘀加收款
['orderObj.payeeType']: 0 ['orderObj.payeeType']: 0
}) })
return return
...@@ -1811,17 +1671,21 @@ Page({ ...@@ -1811,17 +1671,21 @@ Page({
} }
] ]
// 收款方:4S店收款 仅有门店收款 // 收款方:4S店收款 仅有门店收款
let merchantPayList = [ let merchantPayList = [...configPayTypeList?.filter(v => v.value == 2)]
...configPayTypeList?.filter(v => v.value == 2)
]
// 未选择支付方式 通过待跟进/预约跳转下单 并且是非历史订单 默认按线上支付方式(根据园区店配置的支付方式) // 未选择支付方式 通过待跟进/预约跳转下单 并且是非历史订单 默认按线上支付方式(根据园区店配置的支付方式)
if ((orderObj?.selectPayType ?? '') === '' && (orderObj.isNewOrder != 'N' || isAppointment)) { if (
let linePayTypeArr = configPayTypeList?.filter(v => ![2, 5].includes(Number(v.value))) (orderObj?.selectPayType ?? '') === '' &&
(orderObj.isNewOrder != 'N' || isAppointment)
) {
let linePayTypeArr = configPayTypeList?.filter(
v => ![2, 5].includes(Number(v.value))
)
this.setData({ this.setData({
['orderObj.selectPayType']: linePayTypeArr[0]?.value, // 默认线上支付,微信或pos机或支付宝 ['orderObj.selectPayType']: linePayTypeArr[0]?.value, // 默认线上支付,微信或pos机或支付宝
['orderObj.payeeType']: 0 ['orderObj.payeeType']: 0
}) })
} else if ((orderObj?.selectPayType ?? '') === '') { // 未选择支付方式 通过待跟进/预约跳转下单默认门店收款 } else if ((orderObj?.selectPayType ?? '') === '') {
// 未选择支付方式 通过待跟进/预约跳转下单默认门店收款
this.setData({ this.setData({
['orderObj.selectPayType']: 2, ['orderObj.selectPayType']: 2,
showPayList: merchantPayList, showPayList: merchantPayList,
...@@ -1829,13 +1693,15 @@ Page({ ...@@ -1829,13 +1693,15 @@ Page({
}) })
} else { } else {
// 判断一下已保存的支付方式现在是否还在,在就替换,没有就去掉这个参数 // 判断一下已保存的支付方式现在是否还在,在就替换,没有就去掉这个参数
if (orderObj?.selectPayType == 2) { // 收款方:4s店收款 if (orderObj?.selectPayType == 2) {
// 收款方:4s店收款
this.setData({ this.setData({
showPayList: merchantPayList, showPayList: merchantPayList,
['orderObj.payeeType']: 1 ['orderObj.payeeType']: 1
}) })
} else { } else {
if (djPayList?.some(item => item.value == orderObj?.selectPayType)) { // 收款方:嘀加收款 if (djPayList?.some(item => item.value == orderObj?.selectPayType)) {
// 收款方:嘀加收款
this.setData({ this.setData({
['orderObj.payeeType']: 0, ['orderObj.payeeType']: 0,
showPayList: djPayList showPayList: djPayList
...@@ -1854,11 +1720,9 @@ Page({ ...@@ -1854,11 +1720,9 @@ Page({
}) })
}, },
getShopMerchantPointConfig() { getShopMerchantPointConfig() {
let { let { userInfo } = this.data
userInfo let oParams = {}
} = this.data; oParams.merchantId = userInfo.shopMerchantId
let oParams = {};
oParams.merchantId = userInfo.shopMerchantId;
api.getShopMerchantPointConfig(oParams).then(res => { api.getShopMerchantPointConfig(oParams).then(res => {
if (res.data.pointsMultiRole == 'Y') { if (res.data.pointsMultiRole == 'Y') {
toastList.userId = '销售顾问/录单员不能为空' toastList.userId = '销售顾问/录单员不能为空'
...@@ -1872,7 +1736,7 @@ Page({ ...@@ -1872,7 +1736,7 @@ Page({
* 生命周期函数--监听页面初次渲染完成 * 生命周期函数--监听页面初次渲染完成
*/ */
onReady: function () { onReady: function () {
this.getConfig(); this.getConfig()
this.getShopMerchantPointConfig() this.getShopMerchantPointConfig()
}, },
/** /**
...@@ -1882,214 +1746,103 @@ Page({ ...@@ -1882,214 +1746,103 @@ Page({
// 如果是员工 开启订单补录轮询 // 如果是员工 开启订单补录轮询
// 2025-8月版本,隐藏补录入口 // 2025-8月版本,隐藏补录入口
// this.getWaitOrder(); // this.getWaitOrder();
wx.disableAlertBeforeUnload && wx.disableAlertBeforeUnload(); //关闭小程序页面返回询问对话框 wx.disableAlertBeforeUnload && wx.disableAlertBeforeUnload() //关闭小程序页面返回询问对话框
}, },
setTime() { setTime() {
let _this = this; let _this = this
time = setTimeout(() => { time = setTimeout(() => {
// 2025-8月版本,隐藏补录入口 // 2025-8月版本,隐藏补录入口
// _this.getWaitOrder(); // _this.getWaitOrder();
}, 10 * 1000); }, 10 * 1000)
}, },
// 10s轮询一次待补录 // 10s轮询一次待补录
getWaitOrder() { getWaitOrder() {
let { let { isErrorOrder, isAlreadyExistOrder } = this.data
isErrorOrder,
isAlreadyExistOrder
} = this.data;
// isStaff && // isStaff &&
// console.log(isErrorOrder, isAlreadyExistOrder); // console.log(isErrorOrder, isAlreadyExistOrder);
!(isErrorOrder || isAlreadyExistOrder) && !(isErrorOrder || isAlreadyExistOrder) &&
api api
.waitinputorder() .waitinputorder()
.then((result) => { .then(result => {
let { let { code, data } = result
code, this.setTime()
data
} = result;
this.setTime();
if (code == 0) { if (code == 0) {
this.setData({ this.setData({
waitInputCount: data.waitInputCount, waitInputCount: data.waitInputCount
});
}
})
.catch((err) => { });
},
async onRoute(res) {
// debugger
console.log(res, "onroute");
// res.scene = 'scene=1384'
// console.log()
if (res?.paymentMethod) {
this.setData({
paymentMethod: res.paymentMethod
}) })
} }
// 是订单补录跳转进来的
if (res?.orderCreateType == "additionRecordOrder") {
let {supplementId, selectOutTradeNoArr} = res
if (supplementId) {
return this.checkShowOrderInfo()
}
// 处理已选的交易参考号数据
const switchValues = new Set(selectOutTradeNoArr.map(item => Number(item.switchValue)));
let switchValue
if (switchValues.size === 1) {
switchValue = switchValues.has(1) ? 1 : 2
} else {
switchValue = null
}
const outTradeNo = selectOutTradeNoArr.reduce((str, item, index) => {
str += index ? `,${item.outTradeNo}` : item.outTradeNo
return str
}, '')
const tradeNo = selectOutTradeNoArr.reduce((str, item, index) => {
str += index ? `,${item.tradeNo}` : item.tradeNo
return str
}, '')
const totalFee = selectOutTradeNoArr.reduce((num, item, index) => {
num += item.totalFee
return num;
}, 0)
console.log(selectOutTradeNoArr, switchValue)
this.setData({
switchValue,
selectOutTradeNoArr,
outTradeNo,
tradeNo,
['orderObj.outTradeNo']: outTradeNo,
['orderObj.tradeNo']: tradeNo,
['orderObj.payeeType']: 0,
['orderObj.selectPayType']: switchValue == 1 && selectOutTradeNoArr?.length == 1 ? 1 : 5, // 当已选交易参考号只有一个并且是正常分账期内,支付方式随意赋值防止提交校验支付方式为空(后端会根据流水号付款方式处理)其余则为嘀加收款支付方式
totalFee,
showTips: true,
orderCreateType: res?.orderCreateType
}) })
} .catch(err => {})
if (res.orderCode && res.page) {
let result = await api.getOrderDetail({
orderCode: res.orderCode,
});
console.log(res);
let {
code,
message,
data
} = result;
// data.customer.customerName = res.customerName
code == 0 && (res = data);
}
let {
tipsProps,
isAlreadyExistOrder,
recordOrderFlag
} = this.data;
if (Object.keys(res).length > 0) {
if (res.associateOrderCode || res.associateOrderType) {
// tipsProps.showTips = true;
// tipsProps.tipsText = "原订单录入信息有误,请重新提交正确的订单信息。";
} else if (res.orderCode || res.againOrder) {
// 以建档(预约列表)/待跟进工单不可建档
isAlreadyExistOrder = true;
}
this.setData({
tipsProps,
isAlreadyExistOrder,
});
}
if (res.scene) {
res.returnFun = true;
// 扫描核销进入新建工单 不可建档
isAlreadyExistOrder = true;
// 扫码核销进入不展示补录订单入口
recordOrderFlag = false
// 修复 res 为...res 解决对象没有拓展的问题
this.setData({
...res,
tipsProps,
isAlreadyExistOrder,
recordOrderFlag
});
// console.log(res,'res');
// debugger
} else if (res.merchantId) {
this.setData({
returnFun: true,
});
this.setOrderObj(res);
} else {
wx.$util.showLoading("加载中...");
this.setData({
flag: true,
}, },
() => { async onRoute(res) {
wx.$util.hideLoading(); console.log(res, 'onRoute Strategy Start')
} try {
); const routeContext = new RouteContext(this)
await routeContext.execute(res)
} catch (error) {
console.error('onRoute execution failed:', error)
// Fallback: 至少保证页面不白屏
wx.$util.hideLoading()
this.setData({ flag: true })
} }
this.getSetting();
}, },
// 假设数据存储在变量 list 中 // 假设数据存储在变量 list 中
getLatestAccountDate(list) { getLatestAccountDate(list) {
if (!list || list.length === 0) return null; // 处理空数组 if (!list || list.length === 0) return null // 处理空数组
// 获取最大的时间戳 // 获取最大的时间戳
const latestTimestamp = list.reduce((max, item) => { const latestTimestamp = list.reduce((max, item) => {
return Math.max(max, item.accountDateValue); return Math.max(max, item.accountDateValue)
}, -Infinity); }, -Infinity)
// 转为日期对象 // 转为日期对象
return new Date(latestTimestamp).format('yyyy-MM-dd hh:mm:ss'); return new Date(latestTimestamp).format('yyyy-MM-dd hh:mm:ss')
// return latestDate.formattedDate(); // 或返回时间戳 latestTimestamp // return latestDate.formattedDate(); // 或返回时间戳 latestTimestamp
}, },
toSelectCustomerSource() { toSelectCustomerSource() {
this.setData({ this.setData({
showSource: true, showSource: true
}); })
}, },
onChangeSource(e) { onChangeSource(e) {
console.log(e); console.log(e)
const { const { type } = e.detail.value
type
} = e.detail.value;
this.setData({ this.setData({
showSource: false, showSource: false,
"orderObj.customer.salesType": type, 'orderObj.customer.salesType': type
}); })
}, },
onCloseSource() { onCloseSource() {
this.setData({ this.setData({
showSource: false, showSource: false
}); })
}, },
/** /**
* 生命周期函数--监听页面隐藏 * 生命周期函数--监听页面隐藏
*/ */
onHide: function () { onHide: function () {
time && clearTimeout(time); time && clearTimeout(time)
}, },
/** /**
* 生命周期函数--监听页面卸载 * 生命周期函数--监听页面卸载
*/ */
onUnload: function () { onUnload: function () {
time && clearTimeout(time); time && clearTimeout(time)
}, },
/** /**
* 页面相关事件处理函数--监听用户下拉动作 * 页面相关事件处理函数--监听用户下拉动作
*/ */
onPullDownRefresh: function () { }, onPullDownRefresh: function () {},
/** /**
* 页面上拉触底事件的处理函数 * 页面上拉触底事件的处理函数
*/ */
onReachBottom: function () { }, onReachBottom: function () {},
/** /**
* 用户点击右上角分享 * 用户点击右上角分享
*/ */
onShareAppMessage: function () { },
});
\ No newline at end of file \ No newline at end of file
onShareAppMessage: function () {}
})
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
"van-picker": "@vant/weapp/picker/index", "van-picker": "@vant/weapp/picker/index",
"van-popup": "@vant/weapp/popup/index", "van-popup": "@vant/weapp/popup/index",
"set-meal": "/components/SetMeal/SetMeal", "set-meal": "/components/SetMeal/SetMeal",
"order-goods-row": "./components/OrderGoodsRow/order-goods-row",
"recording-order-popup": "/tabIndex/components/recordingOrderPopup/recordingOrderPopup", "recording-order-popup": "/tabIndex/components/recordingOrderPopup/recordingOrderPopup",
"study-permission-modal": "/components/studyPermissionModal/studyPermissionModal" "study-permission-modal": "/components/studyPermissionModal/studyPermissionModal"
} }
......
...@@ -335,6 +335,13 @@ page { ...@@ -335,6 +335,13 @@ page {
font-weight: 600; font-weight: 600;
} }
.totalPrice {
text-align: right;
color: #347bff;
font-size: 28rpx;
font-weight: 600;
}
.btns { .btns {
/* position: fixed; /* position: fixed;
left: 0; left: 0;
...@@ -564,13 +571,125 @@ page { ...@@ -564,13 +571,125 @@ page {
width: var(--fontSize32); width: var(--fontSize32);
height: var(--fontSize32); height: var(--fontSize32);
} }
.alias{
.alias {
font-size: 12px; font-size: 12px;
color: #222222!important; color: #222222 !important;
} }
.payment-text { .payment-text {
color: #666666; color: #666666;
} }
.required { .required {
color: #f00; color: #f00;
} }
.strategy-box {
margin-top: 10rpx;
padding-top: 10rpx;
border-top: 1rpx solid #eee;
.discount-types {
display: flex;
align-items: center;
justify-content: space-between;
margin-bottom: 10rpx;
.discount-tabs {
display: flex;
align-items: center;
background: #e9e9e9;
padding: 6rpx;
border-radius: 8rpx;
}
.type-item {
padding: 10rpx 12rpx;
background: transparent;
border-radius: 6rpx;
margin-right: 0;
font-size: 24rpx;
color: #222;
border: none;
&.active {
background: #fff;
color: #333;
font-weight: 500;
box-shadow: 0 2rpx 4rpx rgba(0, 0, 0, 0.1);
}
}
.discount-input {
display: flex;
align-items: center;
margin-left: 10rpx;
background: #fff;
padding: 0 10rpx;
height: 64rpx;
border-radius: 8rpx;
border: 2rpx solid #eff0f2;
input {
width: 160rpx;
border-radius: 0;
padding: 0;
font-size: 24rpx;
height: 100%;
margin-right: 6rpx;
background: transparent;
text-align: left;
height: 64rpx;
}
text {
font-size: 24rpx;
color: #333;
line-height: 0rpx;
}
}
}
.gift-row {
display: flex;
align-items: center;
justify-content: space-between;
margin-bottom: 10rpx;
font-size: 28rpx;
color: #333;
.gift-radios {
display: flex;
align-items: center;
.radio-label {
margin-left: 20rpx;
display: flex;
align-items: center;
justify-content: space-between;
radio {
transform: scale(0.8);
}
}
}
}
.final-price {
font-size: 26rpx;
color: #666;
display: flex;
align-items: center;
justify-content: space-between;
.orange {
color: #FF6601;
font-weight: bold;
font-size: 30rpx;
margin-left: 10rpx;
}
}
}
\ No newline at end of file \ No newline at end of file
<wxs src="../../index.wxs" module="filter" /> <wxs src="../../index.wxs" module="filter" />
<block wx:if="{{ flag }}"> <block wx:if="{{ flag }}">
<!-- <scroll-view class="container" scroll-y style="height:{{windowHeight}}px"> --> <!-- <scroll-view class="container"scroll-y style="height:{{windowHeight}}px">-->
<!-- {{ isFullSucreen?'isFullSucreen':''}} --> <!-- {{isFullSucreen?'isFullSucreen': ''}}
-->
<view class="main {{ tipsProps.showTips?'fullSucreen-tips':'' }} {{showTips? 'showTips':'' }}"> <view class="main {{ tipsProps.showTips?'fullSucreen-tips':'' }} {{showTips? 'showTips':'' }}">
<view class="box"> <view class="box">
<view class="userId"> <view class="userId">
...@@ -20,10 +22,10 @@ ...@@ -20,10 +22,10 @@
> >
<block wx:if="{{ orderObj.merchantName && orderObj.employeeName }}"> <block wx:if="{{ orderObj.merchantName && orderObj.employeeName }}">
<view class="between"> <view class="between">
<view class="start text-hide">{{orderObj.merchantName}}</view> <view class="start text-hide">{{ orderObj.merchantName }}</view>
<view class="end text-hide"> <view class="end text-hide">
<text>|</text> <text>|</text>
{{orderObj.employeeName}} {{ orderObj.employeeName }}
</view> </view>
</view> </view>
</block> </block>
...@@ -95,17 +97,15 @@ ...@@ -95,17 +97,15 @@
</block> </block>
</gl-cell> </gl-cell>
</view> </view>
<!-- <gl-cell <!-- <gl-cell wx:if="{{ orderObj.selectPayType !=0 }}"
wx:if="{{ orderObj.selectPayType !=0 }}" border valueAlign="right"
border label="订单备注"
valueAlign="right" labelWidth="var(--fontSize140)"
label="订单备注" bindclick="showPopup"
labelWidth="var(--fontSize140)" data-show-name="showRemark"
bindclick="showPopup" placeholder="100字以内"
data-show-name="showRemark" value="{{ orderObj.remark }}"
placeholder="100字以内" />-->
value="{{ orderObj.remark }}"
/> -->
</view> </view>
<view class="box"> <view class="box">
<view class="customerName"> <view class="customerName">
...@@ -183,7 +183,11 @@ ...@@ -183,7 +183,11 @@
> >
<block wx:if="{{ orderObj.customer.carSeriesName }}"> <block wx:if="{{ orderObj.customer.carSeriesName }}">
<view class="between"> <view class="between">
{{orderObj.customer.carBrand}}-{{orderObj.customer.carChildsBrandName}}-{{orderObj.customer.carSeriesName}} {{orderObj.customer.carBrand}}
- {{orderObj.customer.carChildsBrandName}}
- {{orderObj.customer.carSeriesName}}
</view> </view>
</block> </block>
</gl-cell> </gl-cell>
...@@ -251,17 +255,7 @@ ...@@ -251,17 +255,7 @@
</view> </view>
<view class="box"> <view class="box">
<block wx:if="{{ orderObj.merchantId }}"> <block wx:if="{{ orderObj.merchantId }}">
<!-- <gl-cell border label="客户类型" valueAlign="right" labelWidth="var(--fontSize140)"> <!-- <gl-cell border label="客户类型"valueAlign="right"labelWidth="var(--fontSize140)"><view class="gender-box"><view class="block text-center {{orderObj.selectPayType !=0?'':'right'}}"/><view class="male text-center {{orderObj.selectPayType !=0 ?'active':''}}"bindtap="changeSelectPayType"data-experience="2">升级 </view><view class="woman text-center {{orderObj.selectPayType ==0?'active':''}}"bindtap="changeSelectPayType"data-experience="0">战败 </view></view></gl-cell>-->
<view class="gender-box">
<view class="block text-center {{orderObj.selectPayType !=0?'':'right'}}" />
<view class="male text-center {{orderObj.selectPayType !=0 ?'active':''}}" bindtap="changeSelectPayType" data-experience="2">
升级
</view>
<view class="woman text-center {{orderObj.selectPayType ==0?'active':''}}" bindtap="changeSelectPayType" data-experience="0">
战败
</view>
</view>
</gl-cell> -->
<gl-cell <gl-cell
border border
valueAlign="right" valueAlign="right"
...@@ -276,7 +270,48 @@ ...@@ -276,7 +270,48 @@
data-show-name="couponBox" data-show-name="couponBox"
disabled="{{ orderObj.orderSource == 5 }}" disabled="{{ orderObj.orderSource == 5 }}"
/> />
<!-- class="{{orderObj.selectPayType ==0?'item-disabled':''}}" --> <gl-cell
border
valueAlign="right"
label="订单类型"
labelWidth="var(--fontSize140)"
haveArrow
requiredAfter
required
value="{{ orderTypeName }}"
placeholder="点击选择"
bindclick="showPopup"
data-show-name="orderTypeBox"
/>
<block wx:if="{{ isErrorOrder }}">
<gl-cell
class="item-disabled"
border
valueAlign="right"
label="原错误订单编码"
labelWidth="var(--fontSize280)"
value="{{ orderObj.associateOrderCode }}"
/>
<gl-cell
class="item-disabled"
border
valueAlign="right"
label="原错误订单总价"
labelWidth="var(--fontSize280)"
value="¥{{ orderObj.finalPrice }}"
/>
<gl-cell
border
valueAlign="right"
label="关联交易流水"
labelWidth="var(--fontSize280)"
haveArrow
placeholder="点击选择"
value="{{ totalFee ? '¥' + totalFee/100 : '' }}"
bindclick="tipsEvent"
/>
</block>
<!-- class="{{orderObj.selectPayType ==0?'item-disabled':''}}"-->
<view class="goods_box"> <view class="goods_box">
<view <view
class="label" class="label"
...@@ -302,48 +337,25 @@ ...@@ -302,48 +337,25 @@
<view class="goods-box"> <view class="goods-box">
<block wx:for="{{ goodsList }}" wx:key="index"> <block wx:for="{{ goodsList }}" wx:key="index">
<!-- 前挡 --> <!-- 前挡 -->
<view <order-goods-row
class="goods"
wx:if="{{ filter.filterIncludes((item.goods.merchantGoodsPosition || item.goods.upgradeGoodsPosition), [1]) }}" wx:if="{{ filter.filterIncludes((item.goods.merchantGoodsPosition || item.goods.upgradeGoodsPosition), [1]) }}"
> product="{{ item.goods }}"
<view class="name_box"> count="{{ item.count }}"
<view class="name text-hide"> orderType="{{ orderObj.orderType }}"
{{filter.replaceItemText(item.goods.goodsAlias) ||filter.replaceItemText(item.goods.upgradeGoodsName) || filter.replaceItemText(item.goods.goodsInfo.goodsName)}} selectPayType="{{ orderObj.selectPayType }}"
</view> index="{{ index }}"
</view> positionTypeList="{{ positionTypeList }}"
<view class="bottom_box"> baseConfigData="{{ baseConfigData }}"
<!-- merchantGoodsPosition商品列表部位字段 upgradeGoodsPosition订单详情部位字段 --> positionNum="1"
<view popupType="1"
class="position" bind:priceChange="changePrice"
wx:if="{{ (item.goods.merchantGoodsPosition || item.goods.upgradeGoodsPosition) && (item.goods.goodsInfo.goodsType == 1 || item.goods.upgradeGoodsType == 1 || item.goods.goodsInfo.goodsType == baseConfigData.selfBuildFilmType || item.goods.upgradeGoodsType == baseConfigData.selfBuildFilmType) }}" bind:discountTypeChange="changeProductDiscountType"
>{{filter.formatPosition((item.goods.merchantGoodsPosition || item.goods.upgradeGoodsPosition), positionTypeList)}}</view> bind:discountValueInput="inputDiscountValue"
<view bind:toggleGift="toggleGift"
class="position red_text" bind:delete="delGoodsList"
wx:if="{{ (item.goods.goodsInfo.goodsType == 1 || item.goods.upgradeGoodsType == 1 || item.goods.goodsInfo.goodsType == baseConfigData.selfBuildFilmType || item.goods.upgradeGoodsType == baseConfigData.selfBuildFilmType) && !item.goods.merchantGoodsPosition && !item.goods.upgradeGoodsPosition }}" bind:showPopup="showPopup"
>无部位属性</view> bind:priceBlur="priceBlur"
<view class="position" wx:else></view>
<view class="price_count">
<view class="price">
<text>¥</text>
<input
type="digit"
value="{{ item.goods.sellPrice }}"
bindinput="changePrice"
disabled="{{ orderObj.selectPayType ==0 ||item.goods.goodsPriceModify }}"
data-item="{{ item }}"
bindblur="priceBlur"
data-index="{{ index }}"
class="{{ item.goods.errorTarget && (orderObj.selectPayType !=0) ? 'error':''}} {{orderObj.selectPayType ==0?'disabled':'' }}"
always-embed
/> />
</view>
<view class="count" catchtap="showPopup" data-show-name="goodsBox" data-type="1" data-positionnnum="1">x{{item.count}}</view>
</view>
</view>
<view class="icon" bindtap="delGoodsList" data-index="{{ index }}">
<image src="../../images/del.png" />
</view>
</view>
</block> </block>
</view> </view>
</block> </block>
...@@ -365,48 +377,25 @@ ...@@ -365,48 +377,25 @@
<view class="goods-box"> <view class="goods-box">
<block wx:for="{{ goodsList }}" wx:key="index"> <block wx:for="{{ goodsList }}" wx:key="index">
<!-- 前侧窗玻璃 --> <!-- 前侧窗玻璃 -->
<view <order-goods-row
class="goods"
wx:if="{{ filter.filterIncludes((item.goods.merchantGoodsPosition || item.goods.upgradeGoodsPosition), [2]) }}" wx:if="{{ filter.filterIncludes((item.goods.merchantGoodsPosition || item.goods.upgradeGoodsPosition), [2]) }}"
> product="{{ item.goods }}"
<view class="name_box"> count="{{ item.count }}"
<view class="name text-hide"> orderType="{{ orderObj.orderType }}"
{{filter.replaceItemText(item.goods.goodsAlias) ||filter.replaceItemText(item.goods.upgradeGoodsName) || filter.replaceItemText(item.goods.goodsInfo.goodsName)}} selectPayType="{{ orderObj.selectPayType }}"
</view> index="{{ index }}"
</view> positionTypeList="{{ positionTypeList }}"
<view class="bottom_box"> baseConfigData="{{ baseConfigData }}"
<!-- merchantGoodsPosition商品列表部位字段 upgradeGoodsPosition订单详情部位字段 --> positionNum="2"
<view popupType="2"
class="position" bind:priceChange="changePrice"
wx:if="{{ (item.goods.merchantGoodsPosition || item.goods.upgradeGoodsPosition) && (item.goods.goodsInfo.goodsType == 1 || item.goods.upgradeGoodsType == 1 || item.goods.goodsInfo.goodsType == baseConfigData.selfBuildFilmType || item.goods.upgradeGoodsType == baseConfigData.selfBuildFilmType) }}" bind:discountTypeChange="changeProductDiscountType"
>{{filter.formatPosition((item.goods.merchantGoodsPosition || item.upgradeGoodsPosition), positionTypeList)}}</view> bind:discountValueInput="inputDiscountValue"
<view bind:toggleGift="toggleGift"
class="position red_text" bind:delete="delGoodsList"
wx:if="{{ (item.goods.goodsInfo.goodsType == 1 || item.goods.upgradeGoodsType == 1 || item.goods.goodsInfo.goodsType == baseConfigData.selfBuildFilmType || item.goods.upgradeGoodsType == baseConfigData.selfBuildFilmType) && !item.goods.merchantGoodsPosition && !item.goods.upgradeGoodsPosition }}" bind:showPopup="showPopup"
>无部位属性</view> bind:priceBlur="priceBlur"
<view class="position" wx:else></view>
<view class="price_count">
<view class="price">
<text>¥</text>
<input
type="digit"
value="{{ item.goods.sellPrice }}"
bindinput="changePrice"
disabled="{{ orderObj.selectPayType ==0||item.goods.goodsPriceModify }}"
data-item="{{ item }}"
bindblur="priceBlur"
data-index="{{ index }}"
class="{{ item.goods.errorTarget && (orderObj.selectPayType !=0) ? 'error':''}} {{orderObj.selectPayType ==0?'disabled':'' }}"
always-embed
/> />
</view>
<view class="count" catchtap="showPopup" data-show-name="goodsBox" data-type="2" data-positionnnum="2">x{{item.count}}</view>
</view>
</view>
<view class="icon" bindtap="delGoodsList" data-index="{{ index }}">
<image src="../../images/del.png" />
</view>
</view>
</block> </block>
</view> </view>
</block> </block>
...@@ -428,48 +417,25 @@ ...@@ -428,48 +417,25 @@
<view class="goods-box"> <view class="goods-box">
<block wx:for="{{ goodsList }}" wx:key="index"> <block wx:for="{{ goodsList }}" wx:key="index">
<!-- 后侧窗玻璃 --> <!-- 后侧窗玻璃 -->
<view <order-goods-row
class="goods"
wx:if="{{ filter.filterIncludes((item.goods.merchantGoodsPosition || item.goods.upgradeGoodsPosition), [3]) }}" wx:if="{{ filter.filterIncludes((item.goods.merchantGoodsPosition || item.goods.upgradeGoodsPosition), [3]) }}"
> product="{{ item.goods }}"
<view class="name_box"> count="{{ item.count }}"
<view class="name text-hide"> orderType="{{ orderObj.orderType }}"
{{filter.replaceItemText(item.goods.goodsAlias) ||filter.replaceItemText(item.goods.upgradeGoodsName) || filter.replaceItemText(item.goods.goodsInfo.goodsName)}} selectPayType="{{ orderObj.selectPayType }}"
</view> index="{{ index }}"
</view> positionTypeList="{{ positionTypeList }}"
<view class="bottom_box"> baseConfigData="{{ baseConfigData }}"
<!-- merchantGoodsPosition商品列表部位字段 upgradeGoodsPosition订单详情部位字段 --> positionNum="3"
<view popupType="2"
class="position" bind:priceChange="changePrice"
wx:if="{{ (item.goods.merchantGoodsPosition || item.goods.upgradeGoodsPosition) && (item.goods.goodsInfo.goodsType == 1 || item.goods.upgradeGoodsType == 1 || item.goods.goodsInfo.goodsType == baseConfigData.selfBuildFilmType || item.goods.upgradeGoodsType == baseConfigData.selfBuildFilmType) }}" bind:discountTypeChange="changeProductDiscountType"
>{{filter.formatPosition((item.goods.merchantGoodsPosition || item.goods.upgradeGoodsPosition), positionTypeList)}}</view> bind:discountValueInput="inputDiscountValue"
<view bind:toggleGift="toggleGift"
class="position red_text" bind:delete="delGoodsList"
wx:if="{{ (item.goods.goodsInfo.goodsType == 1 || item.goods.upgradeGoodsType == 1 || item.goods.goodsInfo.goodsType == baseConfigData.selfBuildFilmType || item.goods.upgradeGoodsType == baseConfigData.selfBuildFilmType) && !item.goods.merchantGoodsPosition && !item.goods.upgradeGoodsPosition }}" bind:showPopup="showPopup"
>无部位属性</view> bind:priceBlur="priceBlur"
<view class="position" wx:else></view>
<view class="price_count">
<view class="price">
<text>¥</text>
<input
type="digit"
value="{{ item.goods.sellPrice }}"
bindinput="changePrice"
disabled="{{ orderObj.selectPayType ==0 ||item.goods.goodsPriceModify }}"
data-item="{{ item }}"
bindblur="priceBlur"
data-index="{{ index }}"
class="{{ item.goods.errorTarget && (orderObj.selectPayType !=0) ? 'error':''}} {{orderObj.selectPayType ==0?'disabled':'' }}"
always-embed
/> />
</view>
<view class="count" catchtap="showPopup" data-show-name="goodsBox" data-type="2" data-positionnnum="3">x{{item.count}}</view>
</view>
</view>
<view class="icon" bindtap="delGoodsList" data-index="{{ index }}">
<image src="../../images/del.png" />
</view>
</view>
</block> </block>
</view> </view>
</block> </block>
...@@ -491,48 +457,25 @@ ...@@ -491,48 +457,25 @@
<view class="goods-box"> <view class="goods-box">
<block wx:for="{{ goodsList }}" wx:key="index"> <block wx:for="{{ goodsList }}" wx:key="index">
<!-- 后档 --> <!-- 后档 -->
<view <order-goods-row
class="goods"
wx:if="{{ filter.filterIncludes((item.goods.merchantGoodsPosition || item.goods.upgradeGoodsPosition), [4]) }}" wx:if="{{ filter.filterIncludes((item.goods.merchantGoodsPosition || item.goods.upgradeGoodsPosition), [4]) }}"
> product="{{ item.goods }}"
<view class="name_box"> count="{{ item.count }}"
<view class="name text-hide"> orderType="{{ orderObj.orderType }}"
{{filter.replaceItemText(item.goods.goodsAlias) ||filter.replaceItemText(item.goods.upgradeGoodsName) || filter.replaceItemText(item.goods.goodsInfo.goodsName)}} selectPayType="{{ orderObj.selectPayType }}"
</view> index="{{ index }}"
</view> positionTypeList="{{ positionTypeList }}"
<view class="bottom_box"> baseConfigData="{{ baseConfigData }}"
<!-- merchantGoodsPosition商品列表部位字段 upgradeGoodsPosition订单详情部位字段 --> positionNum="4"
<view popupType="2"
class="position" bind:priceChange="changePrice"
wx:if="{{ (item.goods.merchantGoodsPosition || item.goods.upgradeGoodsPosition) && (item.goods.goodsInfo.goodsType == 1 || item.goods.upgradeGoodsType == 1 || item.goods.goodsInfo.goodsType == baseConfigData.selfBuildFilmType || item.goods.upgradeGoodsType == baseConfigData.selfBuildFilmType) }}" bind:discountTypeChange="changeProductDiscountType"
>{{filter.formatPosition((item.goods.merchantGoodsPosition || item.goods.upgradeGoodsPosition), positionTypeList)}}</view> bind:discountValueInput="inputDiscountValue"
<view bind:toggleGift="toggleGift"
class="position red_text" bind:delete="delGoodsList"
wx:if="{{ (item.goods.goodsInfo.goodsType == 1 || item.goods.upgradeGoodsType == 1 || item.goods.goodsInfo.goodsType == baseConfigData.selfBuildFilmType || item.goods.upgradeGoodsType == baseConfigData.selfBuildFilmType) && !item.goods.merchantGoodsPosition && !item.goods.upgradeGoodsPosition }}" bind:showPopup="showPopup"
>无部位属性</view> bind:priceBlur="priceBlur"
<view class="position" wx:else></view>
<view class="price_count">
<view class="price">
<text>¥</text>
<input
type="digit"
value="{{ item.goods.sellPrice }}"
bindinput="changePrice"
disabled="{{ orderObj.selectPayType ==0 ||item.goods.goodsPriceModify }}"
data-item="{{ item }}"
bindblur="priceBlur"
data-index="{{ index }}"
class="{{ item.goods.errorTarget && (orderObj.selectPayType !=0) ? 'error':''}} {{orderObj.selectPayType ==0?'disabled':'' }}"
always-embed
/> />
</view>
<view class="count" catchtap="showPopup" data-show-name="goodsBox" data-type="2" data-positionnnum="4">x{{item.count}}</view>
</view>
</view>
<view class="icon" bindtap="delGoodsList" data-index="{{ index }}">
<image src="../../images/del.png" />
</view>
</view>
</block> </block>
</view> </view>
</block> </block>
...@@ -554,48 +497,25 @@ ...@@ -554,48 +497,25 @@
<view class="goods-box"> <view class="goods-box">
<block wx:for="{{ goodsList }}" wx:key="index"> <block wx:for="{{ goodsList }}" wx:key="index">
<!-- 天窗 --> <!-- 天窗 -->
<view <order-goods-row
class="goods"
wx:if="{{ filter.filterIncludes((item.goods.merchantGoodsPosition || item.goods.upgradeGoodsPosition), [5, 6, 7]) }}" wx:if="{{ filter.filterIncludes((item.goods.merchantGoodsPosition || item.goods.upgradeGoodsPosition), [5, 6, 7]) }}"
> product="{{ item.goods }}"
<view class="name_box"> count="{{ item.count }}"
<view class="name text-hide"> orderType="{{ orderObj.orderType }}"
{{filter.replaceItemText(item.goods.goodsAlias) ||filter.replaceItemText(item.goods.upgradeGoodsName) || filter.replaceItemText(item.goods.goodsInfo.goodsName)}} selectPayType="{{ orderObj.selectPayType }}"
</view> index="{{ index }}"
</view> positionTypeList="{{ positionTypeList }}"
<view class="bottom_box"> baseConfigData="{{ baseConfigData }}"
<!-- merchantGoodsPosition商品列表部位字段 upgradeGoodsPosition订单详情部位字段 --> positionNum="5,6,7"
<view popupType="3"
class="position" bind:priceChange="changePrice"
wx:if="{{ (item.goods.merchantGoodsPosition || item.goods.upgradeGoodsPosition) && (item.goods.goodsInfo.goodsType == 1 || item.goods.upgradeGoodsType == 1 || item.goods.goodsInfo.goodsType == baseConfigData.selfBuildFilmType || item.goods.upgradeGoodsType == baseConfigData.selfBuildFilmType) }}" bind:discountTypeChange="changeProductDiscountType"
>{{filter.formatPosition((item.goods.merchantGoodsPosition || item.goods.upgradeGoodsPosition), positionTypeList)}}</view> bind:discountValueInput="inputDiscountValue"
<view bind:toggleGift="toggleGift"
class="position red_text" bind:delete="delGoodsList"
wx:if="{{ (item.goods.goodsInfo.goodsType == 1 || item.goods.upgradeGoodsType == 1 || item.goods.goodsInfo.goodsType == baseConfigData.selfBuildFilmType || item.goods.upgradeGoodsType == baseConfigData.selfBuildFilmType) && !item.goods.merchantGoodsPosition && !item.goods.upgradeGoodsPosition }}" bind:showPopup="showPopup"
>无部位属性</view> bind:priceBlur="priceBlur"
<view class="position" wx:else></view>
<view class="price_count">
<view class="price">
<text>¥</text>
<input
type="digit"
value="{{ item.goods.sellPrice }}"
bindinput="changePrice"
disabled="{{ orderObj.selectPayType ==0||item.goods.goodsPriceModify }}"
data-item="{{ item }}"
bindblur="priceBlur"
data-index="{{ index }}"
class="{{ item.goods.errorTarget && (orderObj.selectPayType !=0) ? 'error':''}} {{orderObj.selectPayType ==0?'disabled':'' }}"
always-embed
/> />
</view>
<view class="count" catchtap="showPopup" data-show-name="goodsBox" data-type="3" data-positionnnum="5,6,7">x{{item.count}}</view>
</view>
</view>
<view class="icon" bindtap="delGoodsList" data-index="{{ index }}">
<image src="../../images/del.png" />
</view>
</view>
</block> </block>
</view> </view>
</block> </block>
...@@ -623,37 +543,34 @@ ...@@ -623,37 +543,34 @@
<image src="../../images/del-btn.png" /> <image src="../../images/del-btn.png" />
</view> </view>
<view class="meal-name">{{item.packageGoods.packageAlias||item.packageGoods.packageName}}</view> <view class="meal-name">{{item.packageGoods.packageAlias||item.packageGoods.packageName}}</view>
<view class="meal-price">¥{{item.totalPrice}}</view> <view class="meal-price">¥ {{item.totalPrice}}</view>
</view> </view>
<view class="goods" wx:for="{{ item.packageGoods.goodsList }}" wx:for-index="gInx" wx:for-item="g"> <order-goods-row
<view class="name_box"> wx:for="{{ item.packageGoods.goodsList }}"
<view class="name text-hide">{{g.goodsAlias||g.upgradeGoodsName}}</view> wx:for-index="gInx"
</view> wx:for-item="g"
<view class="bottom_box"> wx:key="gInx"
<view class="position" wx:if="{{ (g.merchantGoodsPosition||g.goodsInfo.goodsTypeName) }}"> product="{{ g }}"
{{g.goodsInfo.goodsType===1?filter.formatPosition((g.merchantGoodsPosition), positionTypeList): g.goodsInfo.goodsTypeName}} count="{{ item.count }}"
</view> orderType="{{ orderObj.orderType }}"
<view class="position" wx:else></view> selectPayType="{{ orderObj.selectPayType }}"
<view class="price_count"> index="{{ index }}"
<view class="price"> gindex="{{ gInx }}"
<text>¥</text> isPackageSubItem="{{ true }}"
<input positionTypeList="{{ positionTypeList }}"
type="digit" baseConfigData="{{ baseConfigData }}"
value="{{ g.price }}" popupType="3"
disabled="{{ g.goodsPriceModify }}" showPopupName="packageBox"
class="{{ g.errorTarget? 'error':'' }}" bind:priceChange="changeMealPrice"
bindinput="changeMealPrice" bind:discountTypeChange="changeProductDiscountType"
bind:discountValueInput="inputDiscountValue"
bind:toggleGift="toggleGift"
bind:showPopup="showPopup"
data-item="{{ g }}" data-item="{{ g }}"
data-gindex="{{ gInx }}" data-gindex="{{ gInx }}"
data-index="{{ index }}" data-index="{{ index }}"
always-embed
/> />
</view> </view>
<view class="count" catchtap="showPopup" data-show-name="packageBox" data-type="3">x{{item.count}}</view>
</view>
</view>
</view>
</view>
</block> </block>
</block> </block>
</view> </view>
...@@ -675,90 +592,60 @@ ...@@ -675,90 +592,60 @@
<block wx:for="{{ goodsList }}" wx:key="index"> <block wx:for="{{ goodsList }}" wx:key="index">
<!-- 其它精品 --> <!-- 其它精品 -->
<block wx:if="{{ item.goodsFlag==1 }}"> <block wx:if="{{ item.goodsFlag==1 }}">
<view <order-goods-row
class="goods"
wx:if="{{ !filter.filterIncludes((item.goods.merchantGoodsPosition || item.goods.upgradeGoodsPosition), [1,2,3,4,5,6,7]) }}" wx:if="{{ !filter.filterIncludes((item.goods.merchantGoodsPosition || item.goods.upgradeGoodsPosition), [1,2,3,4,5,6,7]) }}"
> product="{{ item.goods }}"
<view class="name_box"> count="{{ item.count }}"
<view class="name text-hide"> orderType="{{ orderObj.orderType }}"
{{filter.replaceItemText(item.goods.goodsAlias) ||filter.replaceItemText(item.goods.upgradeGoodsName) || filter.replaceItemText(item.goods.goodsInfo.goodsName)}} selectPayType="{{ orderObj.selectPayType }}"
</view> index="{{ index }}"
</view> positionTypeList="{{ positionTypeList }}"
<view class="bottom_box"> baseConfigData="{{ baseConfigData }}"
<!-- merchantGoodsPosition商品列表部位字段 upgradeGoodsPosition订单详情部位字段 --> positionNum="other"
<view popupType="4"
class="position" bind:priceChange="changePrice"
wx:if="{{ (item.goods.merchantGoodsPosition || item.goods.upgradeGoodsPosition) && (item.goods.goodsInfo.goodsType == 1 || item.goods.upgradeGoodsType == 1) }}" bind:discountTypeChange="changeProductDiscountType"
>{{filter.formatPosition((item.goods.merchantGoodsPosition || item.goods.upgradeGoodsPosition), positionTypeList)}}</view> bind:discountValueInput="inputDiscountValue"
<view bind:toggleGift="toggleGift"
class="position red_text" bind:delete="delGoodsList"
wx:if="{{ (item.goods.goodsInfo.goodsType == 1 || item.goods.upgradeGoodsType == 1) && !item.goods.merchantGoodsPosition && !item.goods.upgradeGoodsPosition }}" bind:showPopup="showPopup"
>无部位属性</view> bind:priceBlur="priceBlur"
<view class="position" wx:else>{{item.goods.goodsInfo.goodsTypeName || item.goods.upgradeGoodsTypeName}}</view>
<view class="price_count">
<view class="price">
<text>¥</text>
<input
type="digit"
value="{{ item.goods.sellPrice }}"
bindinput="changePrice"
disabled="{{ orderObj.selectPayType ==0||item.goods.goodsPriceModify }}"
data-item="{{ item }}"
bindblur="priceBlur"
data-index="{{ index }}"
class="{{ item.goods.errorTarget && (orderObj.selectPayType !=0) ? 'error':''}} {{orderObj.selectPayType ==0?'disabled':'' }}"
always-embed
/> />
</view>
<view class="count" catchtap="showPopup" data-show-name="goodsBox" data-type="4" data-positionnnum="other">x{{item.count}}</view>
</view>
</view>
<view class="icon" bindtap="delGoodsList" data-index="{{ index }}">
<image src="../../images/del.png" />
</view>
</view>
</block> </block>
<block wx:if="{{ item.multipleSpecificationsGoods }}"> <block wx:if="{{ item.multipleSpecificationsGoods }}">
<view class="goods"> <order-goods-row
<view class="name_box"> product="{{ item.multipleSpecificationsGoods.goods }}"
<view class="name text-hide alias" wx:if="{{ item.multipleSpecificationsGoods.goods.goodsAlias }}">商品别名:{{item.multipleSpecificationsGoods.goods.goodsAlias}}</view> productName="{{ item.multipleSpecificationsGoods.baseGoodsName }}"
<view class="name text-hide">{{item.multipleSpecificationsGoods.baseGoodsName}}</view> count="{{ item.count }}"
</view> orderType="{{ orderObj.orderType }}"
<view class="bottom_box"> selectPayType="{{ orderObj.selectPayType }}"
<view class="position" wx:if="{{ item.multipleSpecificationsGoods.goods.specificationStr }}">{{item.multipleSpecificationsGoods.goods.specificationStr}}</view> index="{{ index }}"
<view class="price_count"> positionTypeList="{{ positionTypeList }}"
<view class="price"> baseConfigData="{{ baseConfigData }}"
<text>¥</text> positionNum="other"
<input popupType="4"
type="digit" bind:priceChange="changePrice"
value="{{ item.multipleSpecificationsGoods.goods.sellPrice }}" bind:discountTypeChange="changeProductDiscountType"
bindinput="changePrice" bind:discountValueInput="inputDiscountValue"
disabled="{{ orderObj.selectPayType ==0||item.multipleSpecificationsGoods.goods.goodsPriceModify }}" bind:toggleGift="toggleGift"
data-item="{{ item }}" bind:delete="delGoodsList"
bindblur="priceBlur" bind:showPopup="showPopup"
data-index="{{ index }}" bind:priceBlur="priceBlur"
class="{{ item.multipleSpecificationsGoods.goods.errorTarget && (orderObj.selectPayType !=0) ? 'error':''}} {{orderObj.selectPayType ==0?'disabled':'' }}"
always-embed
/> />
</view>
<view class="count" catchtap="showPopup" data-show-name="goodsBox" data-type="4" data-positionnnum="other">x{{item.count}}</view>
</view>
</view>
<view class="icon" bindtap="delGoodsList" data-index="{{ index }}">
<image src="../../images/del.png" />
</view>
</view>
</block> </block>
</block> </block>
</view> </view>
</block> </block>
<block wx:if="{{ goodsList.length > 0 }}"> <block wx:if="{{ goodsList.length > 0 }}">
<view class="goods-box"> <gl-cell border label="总价" valueAlign="right" labelWidth="var(--fontSize152)" class="total-box">
<view class="totalPrice">¥ {{total || 0}}</view>
</gl-cell>
<!-- <view class="goods-box">
<view class="total-box"> <view class="total-box">
<view>总价</view> <view>总价</view>
<view class="total">¥{{total || 0}}</view> <view class="total">¥ {{total || 0}}</view>
</view>
</view> </view>
</view> -->
</block> </block>
</view> </view>
</block> </block>
...@@ -771,7 +658,7 @@ ...@@ -771,7 +658,7 @@
wx:if="{{ !(switchValue == 1 && selectOutTradeNoArr.length == 1) }}" wx:if="{{ !(switchValue == 1 && selectOutTradeNoArr.length == 1) }}"
> >
<view class="payType-box error-box"> <view class="payType-box error-box">
<view class="text-center payment-text">{{orderObj.payeeType == 1 ? '4S店收款' : '嘀加收款'}}</view> <view class="text-center payment-text">{{orderObj.payeeType==1 ? '4S店收款': '嘀加收款'}}</view>
</view> </view>
</gl-cell> </gl-cell>
<gl-cell <gl-cell
...@@ -841,9 +728,7 @@ ...@@ -841,9 +728,7 @@
<view class="paytype-tips" wx:if="{{ orderObj.selectPayType == 7 }}">其它收款:当客户已向嘀加付款但无法使用流水补录时,新建工单应选择收款方为「嘀加收款」且支付方为「其它收款」。</view> <view class="paytype-tips" wx:if="{{ orderObj.selectPayType == 7 }}">其它收款:当客户已向嘀加付款但无法使用流水补录时,新建工单应选择收款方为「嘀加收款」且支付方为「其它收款」。</view>
</view> </view>
<view class="box"> <view class="box">
<!-- <gl-cell wx:if="{{orderObj.selectPayType==2}}" value="{{successDateTime}}" bind:click="toSelectDate" haveArrow placeholder="请选择时间" required requiredAfter border class="pay-type" label="门店收款时间" valueAlign="right" labelWidth="var(--fontSize200)"> <!-- <gl-cell wx:if="{{orderObj.selectPayType==2}}"value="{{successDateTime}}"bind:click="toSelectDate"haveArrow placeholder="请选择时间"required requiredAfter border class="pay-type"label="门店收款时间"valueAlign="right"labelWidth="var(--fontSize200)"></gl-cell>-->
</gl-cell> -->
<view class="remark_box"> <view class="remark_box">
<view class="label"> <view class="label">
订单备注 订单备注
...@@ -851,41 +736,45 @@ ...@@ -851,41 +736,45 @@
</view> </view>
<view class="textArea_box"> <view class="textArea_box">
<textarea value="{{ orderObj.remark }}" placeholder="请输入" class="textarea" maxlength="100" bindinput="remarkInput" /> <textarea value="{{ orderObj.remark }}" placeholder="请输入" class="textarea" maxlength="100" bindinput="remarkInput" />
<view class="currentWordNumber">{{currentWordNumber || 0}} / 100</view> <view class="currentWordNumber">{{currentWordNumber || 0}}/ 100</view>
</view> </view>
</view> </view>
</view> </view>
</view> </view>
<view class="btns {{ isFullSucreen?'isFullSucreen-btn':'' }}"> <view class="btns {{ isFullSucreen?'isFullSucreen-btn':'' }}">
<view class="tipsadd" wx:if="{{ showTips }}"> <view class="tipsadd" wx:if="{{ showTips && !isErrorOrder }}">
<image class="tipsIcon" src="../../../images/tips.png" /> <image class="tipsIcon" src="../../../images/tips.png" />
<view class="contentText"> <view class="contentText">
<view class="tradeNoCon"> <view class="tradeNoCon">
<view>交易参考号:</view> <view>交易参考号:</view>
<view class="tradeNo text-hide">{{tradeNo}}</view> <view class="tradeNo text-hide">{{tradeNo}}</view>
<view>(共{{selectOutTradeNoArr.length}}条)</view> <view>(共 {{selectOutTradeNoArr.length }}条)</view>
</view> </view>
<!-- <view>支付时间:{{accountDate}}</view> --> <!-- <view>支付时间: {{accountDate}}
</view>-->
<view class="tipsbox"> <view class="tipsbox">
<view>支付金额:¥{{totalFee/100}}</view> <view>支付金额:¥ {{totalFee/100}}</view>
<view class="tipsbtn" bindtap="tipsEvent">补录订单</view> <view class="tipsbtn" bindtap="tipsEvent">补录订单</view>
</view> </view>
</view> </view>
<!-- <image class="closeIcon" bindtap="closeTips" src="../../images/closeIcon.png" /> --> <!-- <image class="closeIcon"bindtap="closeTips"src="../../images/closeIcon.png"/>-->
</view> </view>
<view class="btns-con"> <view class="btns-con">
<view class="save text-center {{ isErrorOrder || isAlreadyExistOrder || orderCreateType == 'additionRecordOrder' ? 'disabled':'' }}" bindtap="submit" data-save>建档</view> <view
class="save text-center {{ isErrorOrder || isAlreadyExistOrder || orderCreateType == 'additionRecordOrder' ? 'disabled':'' }}"
bindtap="submit"
data-save
>建档</view>
<view class="confirm text-center" bindtap="submit">直接下单</view> <view class="confirm text-center" bindtap="submit">直接下单</view>
</view> </view>
</view> </view>
<!-- </scroll-view> --> <!-- </scroll-view>-->
</block> </block>
<!-- 2025-8月版本 隐藏补录订单入口 --> <!-- 2025-8月版本 隐藏补录订单入口 -->
<!-- <view class="waitOrderCon {{ showTips? 'showTips':'' }}" wx:if="{{ waitInputCount && !associateOrderType && !isErrorOrder&&!outTradeNo && recordOrderFlag }}"> <!-- <view class="waitOrderCon {{ showTips? 'showTips':'' }}"wx:if="{{ waitInputCount && !associateOrderType && !isErrorOrder&&!outTradeNo && recordOrderFlag }}"><tips-bottom style="width: 100%;box-sizing: border-box;"tipsProps="{{ tipsProps }}"/></view>-->
<tips-bottom style="width: 100%;box-sizing: border-box;" tipsProps="{{ tipsProps }}" />
</view> -->
<recording-order-popup <recording-order-popup
wx:if="{{ showOrderpop && !(isErrorOrder) }}" wx:if="{{ showOrderpop }}"
outTradeNo="{{ selectOutTradeNoArr }}" outTradeNo="{{ selectOutTradeNoArr }}"
switchValuerec="{{ switchValue }}" switchValuerec="{{ switchValue }}"
show="{{ showOrderpop }}" show="{{ showOrderpop }}"
...@@ -976,6 +865,16 @@ ...@@ -976,6 +865,16 @@
bind:confirm="onChangeSource" bind:confirm="onChangeSource"
/> />
</van-popup> </van-popup>
<van-popup show="{{ orderTypeBox }}" position="bottom" bind:close="onCloseOrderType">
<van-picker
show-toolbar
title="订单类型"
bind:cancel="onCloseOrderType"
columns="{{ orderTypeList }}"
value-key="text"
bind:confirm="onConfirmOrderType"
/>
</van-popup>
<set-meal <set-meal
wx:if="{{ packageBox }}" wx:if="{{ packageBox }}"
show="{{ packageBox }}" show="{{ packageBox }}"
......
/**
* 商品操作策略模式实现
*
* 设计意图:
* 针对 createOrder 页面中存在的多种商品类型(普通商品、多规格商品、套餐商品),
* 采用策略模式(Strategy Pattern)统一封装商品的数据获取、价格计算、校验逻辑。
*
* 结构说明:
* - ProductStrategy (基类): 定义所有商品类型共有的接口(如 getData, getPrice, validatePrice 等)。
* - NormalProductStrategy: 处理普通商品 (item.goods)。
* - MultiSpecProductStrategy: 处理多规格商品 (item.multipleSpecificationsGoods)。
* - PackageProductStrategy: 处理套餐商品 (item.packageGoods),包含对子商品的处理逻辑。
* - getProductStrategy (工厂函数): 根据商品数据结构自动匹配对应的策略实例。
*/
import NP from 'number-precision'
export const ORDER_TYPE = {
NORMAL: 1,
DISCOUNT: 2,
GIFT: 3,
IMPULSE: 4,
COMBINATION: 5
}
export const DISCOUNT_TYPE = {
RATIO: 1,
AMOUNT: 2,
NONE: 3,
GIFT: 4,
NON_GIFT: 5
}
/**
* 商品策略基类
*/
function ProductStrategy(item) {
this.item = item
}
ProductStrategy.prototype.getData = function () {
return {}
}
ProductStrategy.prototype.getPrice = function () {
return 0
}
ProductStrategy.prototype.setPrice = function (price) {
// override
}
ProductStrategy.prototype.getMinPrice = function () {
const data = this.getData()
return data.minSellPrice || 0
}
ProductStrategy.prototype.getCount = function () {
return this.item.count || 1
}
ProductStrategy.prototype.calculateSubtotal = function () {
return NP.times(parseFloat(this.getCount()), parseFloat(this.getPrice()))
}
ProductStrategy.prototype.validatePrice = function (price) {
const checkPrice = price !== undefined ? price : this.getPrice()
const data = this.getData()
if (data.discountType === DISCOUNT_TYPE.GIFT) {
return { valid: true }
}
if (
data.validMinSellPrice === 'Y' &&
Number(checkPrice) < Number(data.minSellPrice)
) {
return { valid: false, message: '单价不可低于商品最低价' }
}
return { valid: true }
}
ProductStrategy.prototype.initBasePrice = function () {
const data = this.getData()
if (data.basePrice === undefined) {
data.basePrice = this.getPrice()
}
}
ProductStrategy.prototype.setBasePrice = function (price) {
const data = this.getData()
data.basePrice = price
this.setPrice(price)
this.applyDiscount()
}
ProductStrategy.prototype.getBasePrice = function () {
const data = this.getData()
return data.basePrice !== undefined ? data.basePrice : this.getPrice()
}
ProductStrategy.prototype.resetDiscount = function () {
this.setDiscount(DISCOUNT_TYPE.NONE, 0)
}
ProductStrategy.prototype.setDiscount = function (type, value) {
const data = this.getData()
this.initBasePrice()
data.discountType = type
data.discountValue = value
this.applyDiscount()
}
ProductStrategy.prototype.applyDiscount = function () {
const data = this.getData()
const basePrice =
data.basePrice !== undefined ? data.basePrice : this.getPrice()
let finalPrice = basePrice
const type = data.discountType
const value = data.discountValue
if (type == DISCOUNT_TYPE.RATIO && value) {
if (value > 0 && value <= 10) {
finalPrice = NP.times(basePrice, NP.divide(value, 10))
finalPrice = Math.round(finalPrice * 100) / 100
}
} else if (type == DISCOUNT_TYPE.AMOUNT && value) {
finalPrice = NP.minus(basePrice, value)
if (finalPrice < 0) finalPrice = 0
} else if (type == DISCOUNT_TYPE.GIFT) {
finalPrice = 0
} else if (type == DISCOUNT_TYPE.NONE || type == DISCOUNT_TYPE.NON_GIFT) {
finalPrice = basePrice
}
// this.setPrice(finalPrice)
data.finalPrice = finalPrice
data.discountAmount = NP.minus(basePrice, finalPrice)
}
ProductStrategy.prototype.setError = function (isError) {
const data = this.getData()
if (data) {
data.errorTarget = isError
}
}
ProductStrategy.prototype.performValidation = function () {
// 使用 getBasePrice() 验证基础价格,而不是最终价格(this.getPrice())
// 避免因折扣导致最终价格低于最低售价时,基础价格输入框报红
const result = this.validatePrice(this.getBasePrice())
this.setError(!result.valid)
const data = this.getData()
if (data.sellPrice !== undefined && data.validMinSellPrice === 'Y') {
if (Number(data.sellPrice) < Number(data.minSellPrice)) {
data.basePriceError = true
} else {
data.basePriceError = false
}
}
return result
}
/**
* 普通商品策略
*/
function NormalProductStrategy(item) {
ProductStrategy.call(this, item)
}
NormalProductStrategy.prototype = Object.create(ProductStrategy.prototype)
NormalProductStrategy.prototype.constructor = NormalProductStrategy
NormalProductStrategy.prototype.getData = function () {
return this.item.goods
}
NormalProductStrategy.prototype.getPrice = function () {
return this.item.goods.finalPrice !== undefined
? this.item.goods.finalPrice
: this.item.goods.sellPrice
}
NormalProductStrategy.prototype.setPrice = function (price) {
this.item.goods.sellPrice = price
}
/**
* 多规格商品策略
*/
function MultiSpecProductStrategy(item) {
ProductStrategy.call(this, item)
}
MultiSpecProductStrategy.prototype = Object.create(ProductStrategy.prototype)
MultiSpecProductStrategy.prototype.constructor = MultiSpecProductStrategy
MultiSpecProductStrategy.prototype.getData = function () {
return this.item.multipleSpecificationsGoods.goods
}
MultiSpecProductStrategy.prototype.getPrice = function () {
return this.item.multipleSpecificationsGoods.goods.finalPrice !== undefined
? this.item.multipleSpecificationsGoods.goods.finalPrice
: this.item.multipleSpecificationsGoods.goods.sellPrice
}
MultiSpecProductStrategy.prototype.setPrice = function (price) {
this.item.multipleSpecificationsGoods.goods.sellPrice = price
}
/**
* 套餐商品策略
*/
function PackageProductStrategy(item) {
ProductStrategy.call(this, item)
}
PackageProductStrategy.prototype = Object.create(ProductStrategy.prototype)
PackageProductStrategy.prototype.constructor = PackageProductStrategy
PackageProductStrategy.prototype.getData = function () {
return this.item.packageGoods
}
PackageProductStrategy.prototype.getPrice = function () {
return this.item.packageGoods.price
}
PackageProductStrategy.prototype.setPrice = function (price) {
this.item.packageGoods.price = price
}
PackageProductStrategy.prototype.calculateSubtotal = function () {
const packagePrice = this.item.packageGoods.goodsList.reduce((prev, cur) => {
const price = cur.finalPrice !== undefined ? cur.finalPrice : cur.price
return NP.plus(prev, price)
}, 0)
this.item.packageGoods.price = packagePrice
const total = NP.times(packagePrice, this.getCount())
this.item.totalPrice = total
return total
}
PackageProductStrategy.prototype.performValidation = function () {
let hasError = false
if (this.item.packageGoods && this.item.packageGoods.goodsList) {
this.item.packageGoods.goodsList.forEach(subItem => {
if (
subItem.validMinSellPrice === 'Y' &&
Number(subItem.price) < Number(subItem.minSellPrice)
) {
subItem.errorTarget = true
hasError = true
} else {
subItem.errorTarget = false
}
})
}
return { valid: !hasError }
}
PackageProductStrategy.prototype.getSubItemData = function (index) {
if (this.item.packageGoods && this.item.packageGoods.goodsList) {
return this.item.packageGoods.goodsList[index]
}
return {}
}
PackageProductStrategy.prototype.resetDiscount = function () {
if (this.item.packageGoods && this.item.packageGoods.goodsList) {
this.item.packageGoods.goodsList.forEach((subItem, index) => {
this.updateSubItemDiscount(index, DISCOUNT_TYPE.NONE, 0)
})
}
}
PackageProductStrategy.prototype.getSubItemBasePrice = function (index) {
if (
this.item.packageGoods &&
this.item.packageGoods.goodsList &&
this.item.packageGoods.goodsList[index]
) {
const subItem = this.item.packageGoods.goodsList[index]
if (subItem.basePrice === undefined) {
subItem.basePrice = subItem.price
}
return subItem.basePrice
}
return 0
}
PackageProductStrategy.prototype.updateSubItemPrice = function (index, price) {
if (
this.item.packageGoods &&
this.item.packageGoods.goodsList &&
this.item.packageGoods.goodsList[index]
) {
const subItem = this.item.packageGoods.goodsList[index]
if (subItem.basePrice === undefined) {
subItem.basePrice = subItem.price
}
subItem.basePrice = price
this.applySubItemDiscount(subItem)
}
}
PackageProductStrategy.prototype.updateSubItemDiscount = function (
index,
type,
value
) {
if (
this.item.packageGoods &&
this.item.packageGoods.goodsList &&
this.item.packageGoods.goodsList[index]
) {
const subItem = this.item.packageGoods.goodsList[index]
if (subItem.basePrice === undefined) {
subItem.basePrice = subItem.price
}
subItem.discountType = type
subItem.discountValue = value
this.applySubItemDiscount(subItem)
}
}
PackageProductStrategy.prototype.applySubItemDiscount = function (subItem) {
const basePrice = subItem.basePrice
let finalPrice = basePrice
const type = subItem.discountType
const value = subItem.discountValue
if (type == DISCOUNT_TYPE.RATIO && value) {
if (value > 0 && value <= 10) {
finalPrice = NP.times(basePrice, NP.divide(value, 10))
finalPrice = Math.round(finalPrice * 100) / 100
}
} else if (type == DISCOUNT_TYPE.AMOUNT && value) {
finalPrice = NP.minus(basePrice, value)
if (finalPrice < 0) finalPrice = 0
} else if (type == DISCOUNT_TYPE.GIFT) {
finalPrice = 0
} else if (type == DISCOUNT_TYPE.NONE || type == DISCOUNT_TYPE.NON_GIFT) {
finalPrice = basePrice
}
// subItem.price = finalPrice
subItem.finalPrice = finalPrice
subItem.discountAmount = NP.minus(basePrice, finalPrice)
}
PackageProductStrategy.prototype.validateSubItemPrice = function (
subItem,
price
) {
if (subItem.discountType === DISCOUNT_TYPE.GIFT) {
return { valid: true }
}
if (
subItem.validMinSellPrice === 'Y' &&
Number(price) < Number(subItem.minSellPrice)
) {
return { valid: false, message: '单价不可低于商品最低价' }
}
return { valid: true }
}
export function getProductStrategy(item) {
if (!item) return null
if (item.goods) {
return new NormalProductStrategy(item)
} else if (item.packageGoods) {
return new PackageProductStrategy(item)
} else if (item.multipleSpecificationsGoods) {
return new MultiSpecProductStrategy(item)
}
return null
}
import api from '../../api'
/**
* 路由策略上下文
* 负责根据入参分发到具体的策略处理类
*/
export function RouteContext(page) {
this.page = page
}
/**
* 执行路由逻辑
* @param {Object} res 路由参数
*/
RouteContext.prototype.execute = async function (res) {
// 1. 公共前置处理 (PaymentMethod)
if (res && res.paymentMethod) {
this.page.setData({
paymentMethod: res.paymentMethod
})
}
// 2. 策略匹配与执行
// 优先级:扫码 -> 编辑 -> 补录 -> 商户入口 -> 默认
var strategy
if (res.scene) {
strategy = new ScanCodeStrategy(this.page)
} else if (res.orderCode && res.page) {
strategy = new EditOrderStrategy(this.page)
} else if (res && res.orderCreateType === 'additionRecordOrder') {
strategy = new AdditionRecordStrategy(this.page)
} else if (res.merchantId) {
strategy = new MerchantStrategy(this.page)
} else {
strategy = new DefaultStrategy(this.page)
}
console.log('[RouteStrategy] Matched Strategy', res)
await strategy.run(res)
// 3. 最终通用逻辑 (对应原 onRoute 最后的 getSetting)
this.page.getSetting()
}
/**
* 策略基类
* 定义模板方法和通用处理逻辑
*/
function BaseStrategy(page) {
this.page = page
}
/**
* 模板方法:定义处理流程
* 1. specificHandle: 特定业务逻辑 (可能修改 res 或 setData)
* 2. commonHandle: 通用状态/默认值处理
* 3. finalHandle: 最终收尾 (Loading/Flag/Navigation)
*/
BaseStrategy.prototype.run = async function (res) {
// 步骤1:特定逻辑,返回处理后的 res (因为 Edit 模式可能会替换 res)
// 如果返回 false,则中断后续流程 (例如补录模式下 checkShowOrderInfo 需要中断)
var processedRes = await this.specificHandle(res)
if (processedRes === false) return
var finalRes = processedRes || res
// 步骤2:通用字段与状态处理
this.commonHandle(finalRes)
// 步骤3:收尾逻辑
this.finalHandle(finalRes)
}
BaseStrategy.prototype.specificHandle = async function (res) {
return res
}
/**
* 通用逻辑:默认值、显隐提示、已存在订单判断
* 对应原代码 lines 1840-1861
*/
BaseStrategy.prototype.commonHandle = function (res) {
// 1. 兼容初始化字段默认值
if (res.orderType === undefined || res.orderType === null) res.orderType = 0
if (res.discountType === undefined || res.discountType === null)
res.discountType = 3
// 2. 处理 Tips 和 isAlreadyExistOrder
var data = this.page.data
var tipsProps = data.tipsProps
var isAlreadyExistOrder = data.isAlreadyExistOrder
if (Object.keys(res).length > 0) {
if (res.associateOrderCode || res.associateOrderType) {
// tipsProps.showTips = true;
} else if (res.orderCode || res.againOrder) {
// 以建档(预约列表)/待跟进工单不可建档
isAlreadyExistOrder = true
}
// 注意:这里只是准备数据,建议最后统一 setData,但为了保持逻辑独立,这里先 set
this.page.setData({
tipsProps: tipsProps,
isAlreadyExistOrder: isAlreadyExistOrder
})
}
}
/**
* 默认收尾逻辑:显示 Loading 并设置 flag
* 对应原代码 lines 1882-1892 (else 分支)
*/
BaseStrategy.prototype.finalHandle = function (res) {
wx.$util.showLoading('加载中...')
this.page.setData({ flag: true }, function () {
wx.$util.hideLoading()
})
}
/**
* 策略1:扫码进入
* 对应原代码 lines 1862-1876
*/
function ScanCodeStrategy(page) {
BaseStrategy.call(this, page)
}
// 继承 BaseStrategy
ScanCodeStrategy.prototype = Object.create(BaseStrategy.prototype)
ScanCodeStrategy.prototype.constructor = ScanCodeStrategy
ScanCodeStrategy.prototype.specificHandle = async function (res) {
// 扫码场景逻辑其实主要在 finalHandle 中处理了,但为了结构统一,这里可以做预处理
return res
}
// 覆写收尾逻辑
ScanCodeStrategy.prototype.finalHandle = function (res) {
res.returnFun = true
// 扫描核销进入新建工单 不可建档
var isAlreadyExistOrder = true
// 扫码核销进入不展示补录订单入口
var recordOrderFlag = false
var newData = Object.assign({}, res, {
isAlreadyExistOrder: isAlreadyExistOrder,
recordOrderFlag: recordOrderFlag
})
this.page.setData(newData)
}
/**
* 策略2:编辑/详情模式
* 对应原代码 lines 1830-1838
*/
function EditOrderStrategy(page) {
BaseStrategy.call(this, page)
}
EditOrderStrategy.prototype = Object.create(BaseStrategy.prototype)
EditOrderStrategy.prototype.constructor = EditOrderStrategy
EditOrderStrategy.prototype.specificHandle = async function (res) {
var result = await api.getOrderDetail({
orderCode: res.orderCode
})
console.log('EditOrderStrategy fetch result:', result)
var code = result.code
var data = result.data
if (code == 0) {
// data.customer.customerName = res.customerName // 原代码注释
return data // 返回新的 res 数据源
}
return res
}
/**
* 策略3:补录订单模式
* 对应原代码 lines 1787-1829
*/
function AdditionRecordStrategy(page) {
BaseStrategy.call(this, page)
}
AdditionRecordStrategy.prototype = Object.create(BaseStrategy.prototype)
AdditionRecordStrategy.prototype.constructor = AdditionRecordStrategy
AdditionRecordStrategy.prototype.specificHandle = async function (res) {
var supplementId = res.supplementId
var selectOutTradeNoArr = res.selectOutTradeNoArr
if (supplementId) {
this.page.checkShowOrderInfo()
return false // 中断后续流程
}
// 处理已选的交易参考号数据
var switchValues = new Set(
selectOutTradeNoArr.map(function (item) {
return Number(item.switchValue)
})
)
var switchValue
if (switchValues.size === 1) {
switchValue = switchValues.has(1) ? 1 : 2
} else {
switchValue = null
}
var outTradeNo = selectOutTradeNoArr.reduce(function (str, item, index) {
return str + (index ? ',' + item.outTradeNo : item.outTradeNo)
}, '')
var tradeNo = selectOutTradeNoArr.reduce(function (str, item, index) {
return str + (index ? ',' + item.tradeNo : item.tradeNo)
}, '')
var totalFee = selectOutTradeNoArr.reduce(function (num, item) {
return num + item.totalFee
}, 0)
console.log('AdditionRecordStrategy:', selectOutTradeNoArr, switchValue)
var updateData = {
switchValue: switchValue,
selectOutTradeNoArr: selectOutTradeNoArr,
outTradeNo: outTradeNo,
tradeNo: tradeNo,
'orderObj.outTradeNo': outTradeNo,
'orderObj.tradeNo': tradeNo,
'orderObj.payeeType': 0,
'orderObj.selectPayType':
switchValue == 1 && selectOutTradeNoArr && selectOutTradeNoArr.length == 1
? 1
: 5,
totalFee: totalFee,
showTips: true,
orderCreateType: res && res.orderCreateType
}
this.page.setData(updateData)
return res
}
/**
* 策略4:商户入口
* 对应原代码 lines 1877-1881
*/
function MerchantStrategy(page) {
BaseStrategy.call(this, page)
}
MerchantStrategy.prototype = Object.create(BaseStrategy.prototype)
MerchantStrategy.prototype.constructor = MerchantStrategy
MerchantStrategy.prototype.finalHandle = function (res) {
this.page.setData({
returnFun: true
})
this.page.setOrderObj(res)
}
/**
* 策略5:默认策略
* 仅执行通用逻辑和默认收尾
*/
function DefaultStrategy(page) {
BaseStrategy.call(this, page)
}
DefaultStrategy.prototype = Object.create(BaseStrategy.prototype)
DefaultStrategy.prototype.constructor = DefaultStrategy
import { checkDailyReport, checkStudyTask } from '~/store/ModalToQueueControl'
import api from '../../api'
import NP from 'number-precision'
// ----------------------------------------------------------------------
// 辅助构造函数:校验结果
// ----------------------------------------------------------------------
function ValidationResult(isValid, message, errorKey) {
this.isValid = isValid
this.message = message || null
this.errorKey = errorKey || null
}
ValidationResult.success = function () {
return new ValidationResult(true)
}
ValidationResult.failure = function (message) {
return new ValidationResult(false, message)
}
ValidationResult.errorKey = function (key) {
return new ValidationResult(false, null, key)
}
// ----------------------------------------------------------------------
// 策略基类 (模拟)
// ----------------------------------------------------------------------
// 实际上不需要复杂的继承结构,只需确保每个策略对象都有 validate 方法即可。
// 这里使用工厂函数模式来创建策略对象。
// 1. 异步前置校验 (日报、学习任务、配置)
function AsyncPreCheckStrategy(page, context) {
this.page = page
this.context = context
}
AsyncPreCheckStrategy.prototype.validate = async function () {
// 校验是否填写昨日日报
let staffCheck = await checkDailyReport()
if (staffCheck) return ValidationResult.failure(null) // checkDailyReport 自带提示或跳转
// 校验学习中心开单限制
let staffStudyTask = await checkStudyTask()
if (staffStudyTask) return ValidationResult.failure(null)
// 判断手机号是否用配置的默认值
this.page.checkPhoneUseConfig()
return ValidationResult.success()
}
// 2. 状态与权限校验
function StatePermissionStrategy(page, context) {
this.page = page
this.context = context
}
StatePermissionStrategy.prototype.validate = async function () {
const save = this.context.save
const data = this.page.data
const isErrorOrder = data.isErrorOrder
const isAlreadyExistOrder = data.isAlreadyExistOrder
const orderCreateType = data.orderCreateType
// 如果是错单补录 禁用掉保存功能 或待跟进订单/预约订单 或补录工单 禁用建档
if (
(isErrorOrder && save) ||
(isAlreadyExistOrder && save) ||
(orderCreateType == 'additionRecordOrder' && save)
) {
return ValidationResult.failure(null)
}
return ValidationResult.success()
}
// 3. 必填项校验
function RequiredFieldStrategy(page, context) {
this.page = page
this.context = context
}
RequiredFieldStrategy.prototype.validate = async function () {
const save = this.context.save
const orderObj = this.page.data.orderObj
// 调用页面的 checkRequired 方法
let key = this.page.checkRequired(save, orderObj)
if (key) {
return ValidationResult.errorKey(key)
}
return ValidationResult.success()
}
// 4. VIN码校验
function VinValidationStrategy(page, context) {
this.page = page
this.context = context
}
VinValidationStrategy.prototype.validate = async function () {
const data = this.page.data
const orderObj = data.orderObj
const vinValid = data.vinValid
const carVin = orderObj.customer.standNo
if (carVin) {
if (carVin.length !== 17) {
return ValidationResult.failure(
'请输入 17 位有效字符(支持大写 A-H/J-N/P-Z、0-9)'
)
}
if (!vinValid) {
return ValidationResult.failure('车架号校验不匹配,请核对后重新输入')
}
}
return ValidationResult.success()
}
// 5. 商品校验
function GoodsValidationStrategy(page, context) {
this.page = page
this.context = context
}
GoodsValidationStrategy.prototype.validate = async function () {
const save = this.context.save
const data = this.page.data
const goodsList = data.goodsList
const orderObj = data.orderObj
let subOrderList = []
let priceDisabled = true
// 调用页面的 checkGoods 方法
let goodsKey = this.page.checkGoods(
save,
subOrderList,
priceDisabled,
goodsList,
orderObj
)
if (goodsKey) {
return ValidationResult.failure(goodsKey)
}
return ValidationResult.success()
}
// 6. 错单金额校验
function ErrorOrderPriceStrategy(page, context) {
this.page = page
this.context = context
}
ErrorOrderPriceStrategy.prototype.validate = async function () {
const data = this.page.data
const isErrorOrder = data.isErrorOrder
const totalFee = data.totalFee
const total = data.total
const orderObj = data.orderObj
if (isErrorOrder) {
const originalPrice = Number(orderObj.finalPrice || 0)
const associatedPrice = NP.divide(Number(totalFee || 0), 100)
const currentTotal = Number(total || 0)
console.log('Validation:', {
originalPrice: originalPrice,
associatedPrice: associatedPrice,
currentTotal: currentTotal
})
if (NP.minus(NP.plus(originalPrice, associatedPrice), currentTotal) !== 0) {
return ValidationResult.failure(
'原错误订单总价+关联交易流水必须等于商品总价'
)
}
}
return ValidationResult.success()
}
// ----------------------------------------------------------------------
// 提交上下文 (Main Entry)
// ----------------------------------------------------------------------
function SubmitContext(page) {
this.page = page
}
SubmitContext.prototype.execute = async function (event) {
const dataset = event.currentTarget.dataset
const save = dataset.save
const context = { save: save }
// 1. 构建校验链
const strategies = [
new AsyncPreCheckStrategy(this.page, context),
new StatePermissionStrategy(this.page, context),
new RequiredFieldStrategy(this.page, context),
new VinValidationStrategy(this.page, context),
new GoodsValidationStrategy(this.page, context),
new ErrorOrderPriceStrategy(this.page, context)
]
// 2. 执行校验
for (let i = 0; i < strategies.length; i++) {
const strategy = strategies[i]
const result = await strategy.validate()
if (!result.isValid) {
if (result.message) {
this.page.showToast(result.message)
}
if (result.errorKey) {
this.page.handleRequiredError(result.errorKey)
}
return
}
}
// 3. 准备提交数据
const preparedData = this.prepareSubmitData(save)
const submitObj = preparedData.submitObj
const apiName = preparedData.apiName
// 4. 执行提交
await this.doSubmit(submitObj, apiName, save)
}
SubmitContext.prototype.prepareSubmitData = function (save) {
const data = this.page.data
const orderObj = data.orderObj
const scene = data.scene
const isErrorOrder = data.isErrorOrder
const orderCreateType = data.orderCreateType
// 深拷贝
let submitObj = wx.$util.deepClone(orderObj)
// 数据清洗逻辑
if (!scene) {
if (!submitObj.orderCode) delete submitObj.orderCode
}
const propertiesToDelete = [
'profitAllocatinList',
'packageGoodsList',
'expenseCategoryList',
'merchantDistributionList',
'orderTime',
'createdBy',
'createdDate',
'updatedBy',
'updatedDate'
]
for (let i = 0; i < propertiesToDelete.length; i++) {
const prop = propertiesToDelete[i]
if (submitObj.hasOwnProperty(prop)) {
delete submitObj[prop]
}
}
if (submitObj.customer) {
const customerPropertiesToDelete = ['buyTime', 'createdDate']
for (let i = 0; i < customerPropertiesToDelete.length; i++) {
const prop = customerPropertiesToDelete[i]
if (submitObj.customer.hasOwnProperty(prop)) {
delete submitObj.customer[prop]
}
}
}
if (isErrorOrder) submitObj.oldOrderCode = submitObj.associateOrderCode
if (save) {
// 建档删除卡券商品支付方式参数
delete submitObj.subOrderList
delete submitObj.customerCouponCode
delete submitObj.selectPayType
}
if (submitObj.selectPayType == 0) {
const deleteArr = ['plateNumber', 'standNo', 'carBrand']
delete submitObj.remark
submitObj.customer.experienceFlag = 'Y'
deleteArr.forEach(function (element) {
delete submitObj.customer[element]
})
}
// 太阳膜下单入口
submitObj.filmOrder = 0
// 确定 API 名称
let apiName =
save && !isErrorOrder
? 'createPrerecordedOrder'
: isErrorOrder
? 'correctionOrder'
: 'createWithPay'
apiName =
orderCreateType == 'additionRecordOrder' ? 'supplementOrder' : apiName
return { submitObj: submitObj, apiName: apiName }
}
SubmitContext.prototype.doSubmit = async function (submitObj, apiName, save) {
const page = this.page
const data = page.data
const submitStatus = data.submitStatus
const isErrorOrder = data.isErrorOrder
// 防止重复提交
if (submitStatus) return
page.setData({
submitStatus: true
})
try {
const res = await api[apiName](submitObj)
let code = res.code
let resData = res.data
let message = res.message
if (code == 0) {
wx.disableAlertBeforeUnload && wx.disableAlertBeforeUnload() //关闭小程序页面返回询问对话框
if (save) {
wx.showModal({
title: '温馨提示',
content: '保存成功',
showCancel: false,
confirmText: '知道了',
confirmColor: '#347BFF',
success: function (_res_) {
if (_res_.confirm) {
if (apiName == 'createPrerecordedOrder') {
// 预录建档跳转到预约列表
wx.$util.refreshPageData()
wx.$router.go('pages.tabDateIndex')
wx.$util.pointRecord(30)
} else {
wx.$router.back(function (p) {
p.search && p.search()
})
}
}
}
})
} else {
// 状态更新 需刷新工单列表和预约管理列表
wx.$util.refreshPageData()
if (isErrorOrder) resData.isErrorOrder = true
wx.$router.redirectTo('confirmOrder', resData)
}
} else {
page.showToast(message)
}
} finally {
setTimeout(function () {
wx.hideLoading()
}, 2000)
page.setData({
submitStatus: false
})
}
}
export { SubmitContext }
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!