Commit 2522ab98 by 张立顺

feat 功能开发

1 parent 8a15f552
...@@ -11,7 +11,7 @@ ...@@ -11,7 +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", "order-goods-row": "/tabWorkOrder/pages/createOrder/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"
} }
......
...@@ -14,8 +14,8 @@ import comApi from '~/api/api' ...@@ -14,8 +14,8 @@ import comApi from '~/api/api'
let toastList = { let toastList = {
deliveryCount: '新车交付数不能为空', deliveryCount: '新车交付数不能为空',
// filmToShopCount: '到店流量数(太阳膜)不能为空', // filmToShopCount: '到店流量数(太阳膜)不能为空',
equityToShopCount: '新车到店流量数(会员权益/延保)不能为空', extendedWarrantyToShopCount: '新车到店流量数(会员权益/延保)不能为空',
afterSaleEquityToShopCount: '售后到店流量(会员权益/延保)不能为空' afterSaleExtendedWarrantyToShopCount: '售后到店流量(会员权益/延保)不能为空'
} }
const app = getApp() const app = getApp()
let programeFlag = false let programeFlag = false
...@@ -75,8 +75,8 @@ Page({ ...@@ -75,8 +75,8 @@ Page({
staffCount: '', // 今日驻店人数 staffCount: '', // 今日驻店人数
onBreak: 'N', // 当天休息 Y-是 N-否 onBreak: 'N', // 当天休息 Y-是 N-否
deliveryCount: '', deliveryCount: '',
equityToShopCount: '', extendedWarrantyToShopCount: '',
afterSaleEquityToShopCount: '', afterSaleExtendedWarrantyToShopCount: '',
remark: '', remark: '',
pickerValue: 0 pickerValue: 0
}, },
...@@ -118,8 +118,8 @@ Page({ ...@@ -118,8 +118,8 @@ Page({
inputPlaceholder: '' inputPlaceholder: ''
}, },
{ {
label: '实际售前触客数', label: '延保实际售前触客数',
key: 'equityToShopCount', key: 'extendedWarrantyToShopCount',
type: 'number', type: 'number',
required: true, required: true,
min: 0, min: 0,
...@@ -127,8 +127,8 @@ Page({ ...@@ -127,8 +127,8 @@ Page({
inputPlaceholder: '' inputPlaceholder: ''
}, },
{ {
label: '实际售后触客数', label: '延保实际售后触客数',
key: 'afterSaleEquityToShopCount', key: 'afterSaleExtendedWarrantyToShopCount',
type: 'number', type: 'number',
required: false, required: false,
min: 0, min: 0,
...@@ -249,8 +249,8 @@ Page({ ...@@ -249,8 +249,8 @@ Page({
inputPlaceholder: '' inputPlaceholder: ''
}, },
{ {
label: '实际售前触客数', label: '延保实际售前触客数',
key: 'equityToShopCount', key: 'extendedWarrantyToShopCount',
type: 'number', type: 'number',
required: true, required: true,
min: 0, min: 0,
...@@ -258,8 +258,8 @@ Page({ ...@@ -258,8 +258,8 @@ Page({
inputPlaceholder: '' inputPlaceholder: ''
}, },
{ {
label: '实际售后触客数', label: '延保实际售后触客数',
key: 'afterSaleEquityToShopCount', key: 'afterSaleExtendedWarrantyToShopCount',
type: 'number', type: 'number',
required: false, required: false,
min: 0, min: 0,
...@@ -323,8 +323,8 @@ Page({ ...@@ -323,8 +323,8 @@ Page({
inputPlaceholder: '' inputPlaceholder: ''
}, },
{ {
label: '实际售前触客数', label: '延保实际售前触客数',
key: 'equityToShopCount', key: 'extendedWarrantyToShopCount',
type: 'number', type: 'number',
required: true, required: true,
min: 0, min: 0,
...@@ -332,8 +332,8 @@ Page({ ...@@ -332,8 +332,8 @@ Page({
inputPlaceholder: '' inputPlaceholder: ''
}, },
{ {
label: '实际售后触客数', label: '延保实际售后触客数',
key: 'afterSaleEquityToShopCount', key: 'afterSaleExtendedWarrantyToShopCount',
type: 'number', type: 'number',
required: false, required: false,
min: 0, min: 0,
...@@ -422,13 +422,92 @@ Page({ ...@@ -422,13 +422,92 @@ Page({
hwObjArray.forEach(item => (item.error = false)) hwObjArray.forEach(item => (item.error = false))
otherObjArray.forEach(item => (item.error = false)) otherObjArray.forEach(item => (item.error = false))
hwOhterObjArray.forEach(item => (item.error = false)) hwOhterObjArray.forEach(item => (item.error = false))
let templateType = +value + 1
let updated = this.getUpdatedArrays(
templateType,
hwObjArray,
hwOhterObjArray,
otherObjArray
)
this.setData({ this.setData({
['orderObj.templateType']: +value + 1, ['orderObj.templateType']: templateType,
['orderObj.staffCountEmptyError']: false, ['orderObj.staffCountEmptyError']: false,
hwObjArray, hwObjArray: updated.hwObjArray,
otherObjArray, otherObjArray: updated.otherObjArray,
hwOhterObjArray hwOhterObjArray: updated.hwOhterObjArray
})
},
getUpdatedArrays(templateType, hwObjArray, hwOhterObjArray, otherObjArray) {
const labelMap = {
1: {
extendedWarrantyToShopCount: '延保实际售前触客数',
afterSaleExtendedWarrantyToShopCount: '延保实际售后触客数'
},
2: {
extendedWarrantyToShopCount: '延保实际售前触客数',
afterSaleExtendedWarrantyToShopCount: '延保实际售后触客数'
},
3: {
extendedWarrantyToShopCount: '权益实际售前触客数',
afterSaleExtendedWarrantyToShopCount: '权益实际售后触客数'
}
}
const updateArray = arr => {
// 先过滤掉可能存在的动态字段,防止重复添加
let newArr = arr.filter(item =>
!['realEquityToShopCount', 'afterSaleRealEquityToShopCount'].includes(item.key)
)
// 更新现有字段label
newArr = newArr.map(item => {
if (item.key === 'extendedWarrantyToShopCount') {
item.label = labelMap[templateType].extendedWarrantyToShopCount
}
if (item.key === 'afterSaleExtendedWarrantyToShopCount') {
item.label = labelMap[templateType].afterSaleExtendedWarrantyToShopCount
}
return item
}) })
// 权益延保模板(2) 新增两个字段
if (templateType == 2) {
const realEquityFields = [
{
label: '权益实际售前触客数',
key: 'realEquityToShopCount',
type: 'number',
required: true,
min: 0,
max: 100,
inputPlaceholder: ''
},
{
label: '权益实际售后触客数',
key: 'afterSaleRealEquityToShopCount',
type: 'number',
required: false,
min: 0,
max: 100,
inputPlaceholder: ''
}
]
// 插入到 afterSaleExtendedWarrantyToShopCount 之后
const index = newArr.findIndex(item => item.key === 'afterSaleExtendedWarrantyToShopCount')
if (index > -1) {
newArr.splice(index + 1, 0, ...realEquityFields)
} else {
newArr.push(...realEquityFields)
}
}
return newArr
}
return {
hwObjArray: updateArray(hwObjArray),
hwOhterObjArray: updateArray(hwOhterObjArray),
otherObjArray: updateArray(otherObjArray)
}
}, },
handlePickerChange(e) { handlePickerChange(e) {
const { value } = e.detail const { value } = e.detail
...@@ -506,8 +585,8 @@ Page({ ...@@ -506,8 +585,8 @@ Page({
let { role } = this.data let { role } = this.data
let target = [ let target = [
'deliveryCount', 'deliveryCount',
'equityToShopCount', 'extendedWarrantyToShopCount',
'afterSaleEquityToShopCount' 'afterSaleExtendedWarrantyToShopCount'
] ]
if (role == 'super') { if (role == 'super') {
target = ['deliveryCount'] target = ['deliveryCount']
...@@ -623,12 +702,12 @@ Page({ ...@@ -623,12 +702,12 @@ Page({
// if (['', null].includes(carBandList[index].deliveryCount)) { // if (['', null].includes(carBandList[index].deliveryCount)) {
// return this.showToast(`请输入${carBandList[index].brandName}新车交付数`) // return this.showToast(`请输入${carBandList[index].brandName}新车交付数`)
// } // }
// if (['', null].includes(carBandList[index].equityToShopCount)) { // if (['', null].includes(carBandList[index].extendedWarrantyToShopCount)) {
// return this.showToast( // return this.showToast(
// `请输入${carBandList[index].brandName}新车到店流量` // `请输入${carBandList[index].brandName}新车到店流量`
// ) // )
// } // }
// if (['', null].includes(carBandList[index].afterSaleEquityToShopCount)) { // if (['', null].includes(carBandList[index].afterSaleExtendedWarrantyToShopCount)) {
// return this.showToast( // return this.showToast(
// `请输入${carBandList[index].brandName}售后到店流量` // `请输入${carBandList[index].brandName}售后到店流量`
// ) // )
...@@ -640,7 +719,7 @@ Page({ ...@@ -640,7 +719,7 @@ Page({
if (orderObj.onBreak == 'N') { if (orderObj.onBreak == 'N') {
// 必填校验 // 必填校验
hwObjArray = hwObjArray.map(el => { hwObjArray = hwObjArray.map(el => {
if (el.required && ['', null].includes(item[el.key])) { if (el.required && (item[el.key] === '' || item[el.key] === null || item[el.key] === undefined)) {
el.error = true el.error = true
checkFlag = true checkFlag = true
if (firstInvalidIndex === -1) firstInvalidIndex = index if (firstInvalidIndex === -1) firstInvalidIndex = index
...@@ -648,7 +727,7 @@ Page({ ...@@ -648,7 +727,7 @@ Page({
return el return el
}) })
hwOhterObjArray = hwOhterObjArray.map(el => { hwOhterObjArray = hwOhterObjArray.map(el => {
if (el.required && ['', null].includes(item[el.key])) { if (el.required && (item[el.key] === '' || item[el.key] === null || item[el.key] === undefined)) {
el.error = true el.error = true
checkFlag = true checkFlag = true
if (firstInvalidIndex === -1) firstInvalidIndex = index if (firstInvalidIndex === -1) firstInvalidIndex = index
...@@ -656,7 +735,7 @@ Page({ ...@@ -656,7 +735,7 @@ Page({
return el return el
}) })
otherObjArray = otherObjArray.map(el => { otherObjArray = otherObjArray.map(el => {
if (el.required && ['', null].includes(item[el.key])) { if (el.required && (item[el.key] === '' || item[el.key] === null || item[el.key] === undefined)) {
el.error = true el.error = true
checkFlag = true checkFlag = true
if (firstInvalidIndex === -1) firstInvalidIndex = index if (firstInvalidIndex === -1) firstInvalidIndex = index
...@@ -692,7 +771,10 @@ Page({ ...@@ -692,7 +771,10 @@ Page({
if (orderObj.onBreak == 'Y') { if (orderObj.onBreak == 'Y') {
orderObj.brandDataList.forEach(item => { orderObj.brandDataList.forEach(item => {
item.notDeliveryCount = item.notDeliveryCount || 0 item.notDeliveryCount = item.notDeliveryCount || 0
item.equityToShopCount = item.equityToShopCount || 0 item.extendedWarrantyToShopCount = item.extendedWarrantyToShopCount || 0
if (orderObj.templateType == 2) {
item.realEquityToShopCount = item.realEquityToShopCount || 0
}
}) })
} }
// 非调休 日报填报前参数校验 // 非调休 日报填报前参数校验
...@@ -832,7 +914,7 @@ Page({ ...@@ -832,7 +914,7 @@ Page({
// bandType[el.brandType] || // bandType[el.brandType] ||
context += `【${item.brandName}】 店端总未触客数+门店售前触客数与当月实际交车数不符,差异值${item.differenceValue},请相关驻店销售对齐核销再次提交\t\n` context += `【${item.brandName}】 店端总未触客数+门店售前触客数与当月实际交车数不符,差异值${item.differenceValue},请相关驻店销售对齐核销再次提交\t\n`
el.deliveryCountinputError = true el.deliveryCountinputError = true
el.equityToShopCountinputError = true el.extendedWarrantyToShopCountinputError = true
el.notDeliveryCountinputError = true el.notDeliveryCountinputError = true
} }
}) })
...@@ -884,7 +966,8 @@ Page({ ...@@ -884,7 +966,8 @@ Page({
// 'staffCount', // 'staffCount',
'deliveryCount', 'deliveryCount',
'notDeliveryCount', 'notDeliveryCount',
'equityToShopCount', 'extendedWarrantyToShopCount',
'realEquityToShopCount',
'waitInviteCount', 'waitInviteCount',
'customerLossCount' 'customerLossCount'
].includes(name) ].includes(name)
...@@ -1315,10 +1398,19 @@ Page({ ...@@ -1315,10 +1398,19 @@ Page({
item.error = false item.error = false
return item return item
}) })
this.setData({
let templateType = isHmStore ? 1 : data.templateType || 1
let updated = this.getUpdatedArrays(
templateType,
hwObjArray, hwObjArray,
otherObjArray,
hwOhterObjArray, hwOhterObjArray,
otherObjArray
)
this.setData({
hwObjArray: updated.hwObjArray,
otherObjArray: updated.otherObjArray,
hwOhterObjArray: updated.hwOhterObjArray,
carBandList, carBandList,
formData, formData,
['orderObj.isDateWithin7Days']: util.isDateWithin7Days( ['orderObj.isDateWithin7Days']: util.isDateWithin7Days(
...@@ -1335,7 +1427,7 @@ Page({ ...@@ -1335,7 +1427,7 @@ Page({
['orderObj.glWorryFreeCount']: data.glWorryFreeCount, ['orderObj.glWorryFreeCount']: data.glWorryFreeCount,
['orderObj.cancelOrderCount']: data.cancelOrderCount, ['orderObj.cancelOrderCount']: data.cancelOrderCount,
['orderObj.cancelOrderMoney']: data.cancelOrderMoney, ['orderObj.cancelOrderMoney']: data.cancelOrderMoney,
['orderObj.templateType']: isHmStore ? 1 : data.templateType || 1, // 是鸿蒙那就默认只能单店延保 ['orderObj.templateType']: templateType, // 是鸿蒙那就默认只能单店延保
['orderObj.staffCount']: data.staffCount, ['orderObj.staffCount']: data.staffCount,
['orderObj.onBreak']: data.onBreak || 'N', ['orderObj.onBreak']: data.onBreak || 'N',
['orderObj.pickerValue']: data.onBreak == 'Y' ? 1 : 0, ['orderObj.pickerValue']: data.onBreak == 'Y' ? 1 : 0,
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!