Commit 2522ab98 by 张立顺

feat 功能开发

1 parent 8a15f552
......@@ -11,7 +11,7 @@
"van-picker": "@vant/weapp/picker/index",
"van-popup": "@vant/weapp/popup/index",
"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",
"study-permission-modal": "/components/studyPermissionModal/studyPermissionModal"
}
......
......@@ -14,8 +14,8 @@ import comApi from '~/api/api'
let toastList = {
deliveryCount: '新车交付数不能为空',
// filmToShopCount: '到店流量数(太阳膜)不能为空',
equityToShopCount: '新车到店流量数(会员权益/延保)不能为空',
afterSaleEquityToShopCount: '售后到店流量(会员权益/延保)不能为空'
extendedWarrantyToShopCount: '新车到店流量数(会员权益/延保)不能为空',
afterSaleExtendedWarrantyToShopCount: '售后到店流量(会员权益/延保)不能为空'
}
const app = getApp()
let programeFlag = false
......@@ -75,8 +75,8 @@ Page({
staffCount: '', // 今日驻店人数
onBreak: 'N', // 当天休息 Y-是 N-否
deliveryCount: '',
equityToShopCount: '',
afterSaleEquityToShopCount: '',
extendedWarrantyToShopCount: '',
afterSaleExtendedWarrantyToShopCount: '',
remark: '',
pickerValue: 0
},
......@@ -118,8 +118,8 @@ Page({
inputPlaceholder: ''
},
{
label: '实际售前触客数',
key: 'equityToShopCount',
label: '延保实际售前触客数',
key: 'extendedWarrantyToShopCount',
type: 'number',
required: true,
min: 0,
......@@ -127,8 +127,8 @@ Page({
inputPlaceholder: ''
},
{
label: '实际售后触客数',
key: 'afterSaleEquityToShopCount',
label: '延保实际售后触客数',
key: 'afterSaleExtendedWarrantyToShopCount',
type: 'number',
required: false,
min: 0,
......@@ -249,8 +249,8 @@ Page({
inputPlaceholder: ''
},
{
label: '实际售前触客数',
key: 'equityToShopCount',
label: '延保实际售前触客数',
key: 'extendedWarrantyToShopCount',
type: 'number',
required: true,
min: 0,
......@@ -258,8 +258,8 @@ Page({
inputPlaceholder: ''
},
{
label: '实际售后触客数',
key: 'afterSaleEquityToShopCount',
label: '延保实际售后触客数',
key: 'afterSaleExtendedWarrantyToShopCount',
type: 'number',
required: false,
min: 0,
......@@ -323,8 +323,8 @@ Page({
inputPlaceholder: ''
},
{
label: '实际售前触客数',
key: 'equityToShopCount',
label: '延保实际售前触客数',
key: 'extendedWarrantyToShopCount',
type: 'number',
required: true,
min: 0,
......@@ -332,8 +332,8 @@ Page({
inputPlaceholder: ''
},
{
label: '实际售后触客数',
key: 'afterSaleEquityToShopCount',
label: '延保实际售后触客数',
key: 'afterSaleExtendedWarrantyToShopCount',
type: 'number',
required: false,
min: 0,
......@@ -422,14 +422,93 @@ Page({
hwObjArray.forEach(item => (item.error = false))
otherObjArray.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({
['orderObj.templateType']: +value + 1,
['orderObj.templateType']: templateType,
['orderObj.staffCountEmptyError']: false,
hwObjArray,
otherObjArray,
hwOhterObjArray
hwObjArray: updated.hwObjArray,
otherObjArray: updated.otherObjArray,
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) {
const { value } = e.detail
this.setData({
......@@ -506,8 +585,8 @@ Page({
let { role } = this.data
let target = [
'deliveryCount',
'equityToShopCount',
'afterSaleEquityToShopCount'
'extendedWarrantyToShopCount',
'afterSaleExtendedWarrantyToShopCount'
]
if (role == 'super') {
target = ['deliveryCount']
......@@ -623,12 +702,12 @@ Page({
// if (['', null].includes(carBandList[index].deliveryCount)) {
// return this.showToast(`请输入${carBandList[index].brandName}新车交付数`)
// }
// if (['', null].includes(carBandList[index].equityToShopCount)) {
// if (['', null].includes(carBandList[index].extendedWarrantyToShopCount)) {
// return this.showToast(
// `请输入${carBandList[index].brandName}新车到店流量`
// )
// }
// if (['', null].includes(carBandList[index].afterSaleEquityToShopCount)) {
// if (['', null].includes(carBandList[index].afterSaleExtendedWarrantyToShopCount)) {
// return this.showToast(
// `请输入${carBandList[index].brandName}售后到店流量`
// )
......@@ -640,7 +719,7 @@ Page({
if (orderObj.onBreak == 'N') {
// 必填校验
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
checkFlag = true
if (firstInvalidIndex === -1) firstInvalidIndex = index
......@@ -648,7 +727,7 @@ Page({
return 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
checkFlag = true
if (firstInvalidIndex === -1) firstInvalidIndex = index
......@@ -656,7 +735,7 @@ Page({
return 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
checkFlag = true
if (firstInvalidIndex === -1) firstInvalidIndex = index
......@@ -692,7 +771,10 @@ Page({
if (orderObj.onBreak == 'Y') {
orderObj.brandDataList.forEach(item => {
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({
// bandType[el.brandType] ||
context += `【${item.brandName}】 店端总未触客数+门店售前触客数与当月实际交车数不符,差异值${item.differenceValue},请相关驻店销售对齐核销再次提交\t\n`
el.deliveryCountinputError = true
el.equityToShopCountinputError = true
el.extendedWarrantyToShopCountinputError = true
el.notDeliveryCountinputError = true
}
})
......@@ -884,7 +966,8 @@ Page({
// 'staffCount',
'deliveryCount',
'notDeliveryCount',
'equityToShopCount',
'extendedWarrantyToShopCount',
'realEquityToShopCount',
'waitInviteCount',
'customerLossCount'
].includes(name)
......@@ -1315,10 +1398,19 @@ Page({
item.error = false
return item
})
this.setData({
let templateType = isHmStore ? 1 : data.templateType || 1
let updated = this.getUpdatedArrays(
templateType,
hwObjArray,
otherObjArray,
hwOhterObjArray,
otherObjArray
)
this.setData({
hwObjArray: updated.hwObjArray,
otherObjArray: updated.otherObjArray,
hwOhterObjArray: updated.hwOhterObjArray,
carBandList,
formData,
['orderObj.isDateWithin7Days']: util.isDateWithin7Days(
......@@ -1335,7 +1427,7 @@ Page({
['orderObj.glWorryFreeCount']: data.glWorryFreeCount,
['orderObj.cancelOrderCount']: data.cancelOrderCount,
['orderObj.cancelOrderMoney']: data.cancelOrderMoney,
['orderObj.templateType']: isHmStore ? 1 : data.templateType || 1, // 是鸿蒙那就默认只能单店延保
['orderObj.templateType']: templateType, // 是鸿蒙那就默认只能单店延保
['orderObj.staffCount']: data.staffCount,
['orderObj.onBreak']: data.onBreak || 'N',
['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!