Commit 1140258a by 张立顺

feat 功能开发

1 parent 4b1bf76b
...@@ -71,69 +71,80 @@ Page({ ...@@ -71,69 +71,80 @@ Page({
// approvedSource: 1, // 0是老板 1是督导 // approvedSource: 1, // 0是老板 1是督导
noStaffData: false, noStaffData: false,
noStoreData: false, noStoreData: false,
hwObj: {// 华为对象 hwObj: {
// 华为对象
staffCount: { staffCount: {
required: true, required: true,
max: 100, max: 100,
min: 1, min: 1,
placeholder: '当天在店的驻店人数' placeholder: '当天在店的驻店人数'
}, },
deliveryCount: {// 店端实际交车数 deliveryCount: {
// 店端实际交车数
required: true, required: true,
max: 100, max: 100,
min: 0, min: 0,
placeholder: '门店当天的实际交付台次' placeholder: '门店当天的实际交付台次'
}, },
notDeliveryCount: {// 店端总未触客数 notDeliveryCount: {
// 店端总未触客数
required: true, required: true,
max: 100, max: 100,
min: 0, min: 0,
placeholder: '门店当天的总计未触客数' placeholder: '门店当天的总计未触客数'
}, },
equityToShopCount: {// 实际售前触客数 equityToShopCount: {
// 实际售前触客数
required: true, required: true,
max: 100, max: 100,
min: 0, min: 0,
placeholder: '接待的售前客户数' placeholder: '接待的售前客户数'
}, },
afterSaleEquityToShopCount: {// 实际售后触客数 afterSaleEquityToShopCount: {
// 实际售后触客数
required: false, required: false,
max: 100, max: 100,
min: 0, min: 0,
placeholder: '接待的售后客户数' placeholder: '接待的售后客户数'
}, },
extendedWarrantyCount: {//售前整车延保成交数 extendedWarrantyCount: {
//售前整车延保成交数
required: true, required: true,
max: 100, max: 100,
min: 0, min: 0,
placeholder: '个人售前客户的整车延保订单数' placeholder: '个人售前客户的整车延保订单数'
}, },
tireWarrantyCount: {// 轮胎险成交数 tireWarrantyCount: {
// 轮胎险成交数
required: false, required: false,
max: 100, max: 100,
min: 0, min: 0,
inputPlaceholder: '自动填入系统数据' inputPlaceholder: '自动填入系统数据'
}, },
axPackageCount: {// 安心包成交数 axPackageCount: {
// 安心包成交数
required: false, required: false,
max: 100, max: 100,
min: 0, min: 0,
inputPlaceholder: '自动填入系统数据' inputPlaceholder: '自动填入系统数据'
}, },
batteryExtendedWarrantyCount: {// 电池延保成交数 batteryExtendedWarrantyCount: {
// 电池延保成交数
required: false, required: false,
max: 100, max: 100,
min: 0, min: 0,
inputPlaceholder: '自动填入系统数据' inputPlaceholder: '自动填入系统数据'
}, },
batteryExtendedWarrantyMoney: {// 电池延保成交金额 batteryExtendedWarrantyMoney: {
// 电池延保成交金额
required: false, required: false,
max: 100, max: 100,
min: 0, min: 0,
inputPlaceholder: '自动填入系统数据' inputPlaceholder: '自动填入系统数据'
}, },
totalOrderMoney: {// 个人成交总金额 totalOrderMoney: {
// 个人成交总金额
required: false, required: false,
max: 9999999, max: 9999999,
min: 0, min: 0,
...@@ -141,19 +152,22 @@ Page({ ...@@ -141,19 +152,22 @@ Page({
placeholder: '个人当天总产值(包含售后)', placeholder: '个人当天总产值(包含售后)',
inputPlaceholder: '自动填入系统数据' inputPlaceholder: '自动填入系统数据'
}, },
cancelOrderCount: {// 延保退单数 cancelOrderCount: {
// 延保退单数
required: false, required: false,
max: 100, max: 100,
min: 0, min: 0,
placeholder: '当天延保退单订单数' placeholder: '当天延保退单订单数'
}, },
cancelOrderMoney: {// 延保退单金额 cancelOrderMoney: {
// 延保退单金额
required: false, required: false,
max: 9999999, max: 9999999,
min: 0, min: 0,
placeholder: '当天延保退单订单数' placeholder: '当天延保退单订单数'
}, },
notDeliveryReturnCount: {// 未触客数返店人数 notDeliveryReturnCount: {
// 未触客数返店人数
required: false, required: false,
max: 100, max: 100,
min: 0, min: 0,
...@@ -161,289 +175,300 @@ Page({ ...@@ -161,289 +175,300 @@ Page({
} }
}, },
ohterObj: { ohterObj: {
deliveryCount: {// 店端实际交车数 deliveryCount: {
// 店端实际交车数
required: false, required: false,
max: 100, max: 100,
min: 0, min: 0,
placeholder: '门店非问界车型的交付台次' placeholder: '门店非问界车型的交付台次'
}, },
notDeliveryCount: { // 店端总未触客数 notDeliveryCount: {
// 店端总未触客数
required: false, required: false,
max: 100, max: 100,
min: 0, min: 0,
placeholder: '门店非问界车型未触客客户数' placeholder: '门店非问界车型未触客客户数'
}, },
equityToShopCount: {// 实际售前触客数 equityToShopCount: {
// 实际售前触客数
required: false, required: false,
max: 100, max: 100,
min: 0, min: 0,
placeholder: '非问界个人售前触客数' placeholder: '非问界个人售前触客数'
}, },
afterSaleEquityToShopCount: {// 实际售后触客数 afterSaleEquityToShopCount: {
// 实际售后触客数
required: false, required: false,
max: 100, max: 100,
min: 0, min: 0,
placeholder: '非问界个人售后触客数' placeholder: '非问界个人售后触客数'
}, },
totalOrderCount: {// 成交数 totalOrderCount: {
// 成交数
required: false, required: false,
max: 100, max: 100,
min: 0, min: 0,
placeholder: '非问界成交订单' placeholder: '非问界成交订单'
}, },
totalOrderMoney: {// 个人成交总金额 totalOrderMoney: {
// 个人成交总金额
required: false, required: false,
max: 9999999, max: 9999999,
min: 0, min: 0,
type: 'digit', type: 'digit',
placeholder: '非问界成交总金额' placeholder: '非问界成交总金额'
}, },
notDeliveryReturnCount: {// 售前未触客当日返店触客人数 notDeliveryReturnCount: {
// 售前未触客当日返店触客人数
required: false, required: false,
max: 100, max: 100,
min: 0, min: 0,
placeholder: '非问界往期未触客客户今日返店' placeholder: '非问界往期未触客客户今日返店'
}, }
}, },
hwObjArray: [ hwObjArray: [
{ {
label: "今日驻店人数(按店)", label: '今日驻店人数(按店)',
key: "staffCount", key: 'staffCount',
type: "number", type: 'number',
required: true, required: true,
min: 0, min: 0,
max: 100, max: 100,
placeholder: "当天在店的驻店人数", placeholder: '当天在店的驻店人数',
inputPlaceholder: "", inputPlaceholder: '',
error: false, error: false
}, },
{ {
label: "店端实际交车数(按店)", label: '店端实际交车数(按店)',
key: "deliveryCount", key: 'deliveryCount',
type: "number", type: 'number',
required: true, required: true,
min: 0, min: 0,
max: 100, max: 100,
placeholder: "门店当天的实际交付台次", placeholder: '门店当天的实际交付台次',
inputPlaceholder: "" inputPlaceholder: ''
}, },
{ {
label: "店端总未触客数(按店)", label: '店端总未触客数(按店)',
key: "notDeliveryCount", key: 'notDeliveryCount',
type: "number", type: 'number',
required: true, required: true,
min: 0, min: 0,
max: 100, max: 100,
placeholder: "门店当天的总计未触客数", placeholder: '门店当天的总计未触客数',
inputPlaceholder: "" inputPlaceholder: ''
}, },
{ {
name: 'person' name: 'person'
}, },
{ {
label: "实际售前触客数", label: '实际售前触客数',
key: "equityToShopCount", key: 'equityToShopCount',
type: "number", type: 'number',
required: true, required: true,
min: 0, min: 0,
max: 100, max: 100,
placeholder: "接待的售前客户数", placeholder: '接待的售前客户数',
inputPlaceholder: "" inputPlaceholder: ''
}, },
{ {
label: "实际售后触客数", label: '实际售后触客数',
key: "afterSaleEquityToShopCount", key: 'afterSaleEquityToShopCount',
type: "number", type: 'number',
required: false, required: false,
min: 0, min: 0,
max: 100, max: 100,
placeholder: "接待的售后客户数", placeholder: '接待的售后客户数',
inputPlaceholder: "" inputPlaceholder: ''
}, },
{ {
label: "售前整车延保成交数", label: '售前整车延保成交数',
key: "extendedWarrantyCount", key: 'extendedWarrantyCount',
type: "number", type: 'number',
required: true, required: true,
min: 0, min: 0,
max: 100, max: 100,
placeholder: "个人售前客户的整车延保订单数", placeholder: '个人售前客户的整车延保订单数',
inputPlaceholder: "" inputPlaceholder: ''
}, },
{ {
label: "轮胎险成交数", label: '轮胎险成交数',
key: "tireWarrantyCount", key: 'tireWarrantyCount',
type: "number", type: 'number',
required: false, required: false,
min: 0, min: 0,
max: 100, max: 100,
placeholder: "", placeholder: '',
inputPlaceholder: "自动填入系统数据" inputPlaceholder: '自动填入系统数据'
}, },
{ {
label: "安心包成交数", label: '安心包成交数',
key: "axPackageCount", key: 'axPackageCount',
type: "number", type: 'number',
required: false, required: false,
min: 0, min: 0,
max: 100, max: 100,
placeholder: "", placeholder: '',
inputPlaceholder: "自动填入系统数据" inputPlaceholder: '自动填入系统数据'
}, },
{ {
label: "电池延保成交数", label: '电池延保成交数',
key: "batteryExtendedWarrantyCount", key: 'batteryExtendedWarrantyCount',
type: "number", type: 'number',
required: false, required: false,
min: 0, min: 0,
max: 100, max: 100,
placeholder: "", placeholder: '',
inputPlaceholder: "自动填入系统数据" inputPlaceholder: '自动填入系统数据'
}, },
{ {
label: "电池延保成交金额", label: '电池延保成交金额',
key: "batteryExtendedWarrantyMoney", key: 'batteryExtendedWarrantyMoney',
type: "digit", type: 'digit',
required: false, required: false,
min: 0, min: 0,
max: 9999999, max: 9999999,
placeholder: "", placeholder: '',
inputPlaceholder: "自动填入系统数据" inputPlaceholder: '自动填入系统数据'
}, },
{ {
label: "个人成交总金额", label: '个人成交总金额',
key: "totalOrderMoney", key: 'totalOrderMoney',
type: "digit", type: 'digit',
required: true, required: true,
min: 0, min: 0,
max: 9999999, max: 9999999,
placeholder: "个人当天总产值(包含售后)", placeholder: '个人当天总产值(包含售后)',
inputPlaceholder: "自动填入系统数据" inputPlaceholder: '自动填入系统数据'
}, },
{ {
label: "延保退单数", label: '延保退单数',
key: "cancelOrderCount", key: 'cancelOrderCount',
type: "number", type: 'number',
required: false, required: false,
min: 0, min: 0,
max: 100, max: 100,
placeholder: "当天延保退单订单数", placeholder: '当天延保退单订单数',
inputPlaceholder: "" inputPlaceholder: ''
}, },
{ {
label: "延保退单金额", label: '延保退单金额',
key: "cancelOrderMoney", key: 'cancelOrderMoney',
type: "digit", type: 'digit',
required: false, required: false,
min: 0, min: 0,
max: 9999999, max: 9999999,
placeholder: "当天延保退单金额", placeholder: '当天延保退单金额',
inputPlaceholder: "" inputPlaceholder: ''
}, },
{ {
label: "未触客返店人数", label: '未触客返店人数',
key: "notDeliveryReturnCount", key: 'notDeliveryReturnCount',
type: "number", type: 'number',
required: false, required: false,
min: 0, min: 0,
max: 100, max: 100,
placeholder: "往期未触客的客户今日返店的人数", placeholder: '往期未触客的客户今日返店的人数',
inputPlaceholder: "" inputPlaceholder: ''
}, }
], ],
otherObjArray: [ otherObjArray: [
{ {
label: "店端实际交车数(按店)", label: '店端实际交车数(按店)',
key: "deliveryCount", key: 'deliveryCount',
type: "number", type: 'number',
required: false, required: false,
min: 0, min: 0,
max: 100, max: 100,
placeholder: "门店非问界车型的交付台次", placeholder: '门店非问界车型的交付台次',
inputPlaceholder: "" inputPlaceholder: ''
}, },
{ {
label: "店端未触客数(按店)", label: '店端未触客数(按店)',
key: "notDeliveryCount", key: 'notDeliveryCount',
type: "number", type: 'number',
required: false, required: false,
min: 0, min: 0,
max: 100, max: 100,
placeholder: "门店非问界车型未触客客户数", placeholder: '门店非问界车型未触客客户数',
inputPlaceholder: "" inputPlaceholder: ''
}, },
{ {
name: 'person' name: 'person'
}, },
{ {
label: "售前触客数", label: '售前触客数',
key: "equityToShopCount", key: 'equityToShopCount',
type: "number", type: 'number',
required: false, required: false,
min: 0, min: 0,
max: 100, max: 100,
placeholder: "非问界个人售前触客数", placeholder: '非问界个人售前触客数',
inputPlaceholder: "" inputPlaceholder: ''
}, },
{ {
label: "售后触客数", label: '售后触客数',
key: "afterSaleEquityToShopCount", key: 'afterSaleEquityToShopCount',
type: "number", type: 'number',
required: false, required: false,
min: 0, min: 0,
max: 100, max: 100,
placeholder: "非问界个人售后触客数", placeholder: '非问界个人售后触客数',
inputPlaceholder: "" inputPlaceholder: ''
}, },
{ {
label: "成交数", label: '成交数',
key: "totalOrderCount", key: 'totalOrderCount',
type: "number", type: 'number',
required: false, required: false,
min: 0, min: 0,
max: 100, max: 100,
placeholder: "非问界成交订单", placeholder: '非问界成交订单',
inputPlaceholder: "" inputPlaceholder: ''
}, },
{ {
label: "成交总金额", label: '成交总金额',
key: "totalOrderMoney", key: 'totalOrderMoney',
required: false, required: false,
allowDecimal: true, // 允许小数输入 allowDecimal: true, // 允许小数输入
type: "digit", type: 'digit',
min: 0, min: 0,
max: 9999999, max: 9999999,
placeholder: "非问界成交总金额", placeholder: '非问界成交总金额',
inputPlaceholder: "" inputPlaceholder: ''
}, },
{ {
label: "售前未触客当日返店触客人数", label: '售前未触客当日返店触客人数',
key: "notDeliveryReturnCount", key: 'notDeliveryReturnCount',
type: "number", type: 'number',
required: false, required: false,
min: 0, min: 0,
max: 100, max: 100,
placeholder: "非问界往期未触客客户今日返店", placeholder: '非问界往期未触客客户今日返店',
inputPlaceholder: "" inputPlaceholder: ''
}, }
] ]
}, },
showStorePicker() { showStorePicker() {
let { userInfo } = this.data let { userInfo } = this.data
; (userInfo?.isSuper || userInfo?.loginRole == 3 || userInfo?.loginRole == 5) && ;(userInfo?.isSuper ||
this.setData({ userInfo?.loginRole == 3 ||
showPicker: true, userInfo?.loginRole == 5) &&
pickerType: 'merchant' this.setData({
}) showPicker: true,
pickerType: 'merchant'
})
}, },
showStaffPicker() { showStaffPicker() {
let { userInfo } = this.data let { userInfo } = this.data
; (userInfo?.isSuper || userInfo?.loginRole == 3 || userInfo?.loginRole == 5) && ;(userInfo?.isSuper ||
this.setData({ userInfo?.loginRole == 3 ||
showPicker: true, userInfo?.loginRole == 5) &&
pickerType: 'staff' this.setData({
}) showPicker: true,
pickerType: 'staff'
})
}, },
navbarReady(e) { navbarReady(e) {
let navBarHeight = e.detail.height let navBarHeight = e.detail.height
...@@ -568,7 +593,7 @@ Page({ ...@@ -568,7 +593,7 @@ Page({
showCancel: false, showCancel: false,
confirmText: '确定', confirmText: '确定',
confirmColor: '#347BFF', confirmColor: '#347BFF',
success(res) { } success(res) {}
}) })
} else { } else {
wx.$util.showToast(message) wx.$util.showToast(message)
...@@ -614,22 +639,23 @@ Page({ ...@@ -614,22 +639,23 @@ Page({
// } // }
let checkFlag = false let checkFlag = false
carBandList.forEach(item => { carBandList.forEach(item => {
if (item.brandType == 0) { // 问界必填校验 if (item.brandType == 0) {
// 问界必填校验
hwObjArray = hwObjArray.map(el => { hwObjArray = hwObjArray.map(el => {
if (el.required && ['', null].includes(item[el.key])) { if (el.required && ['', null].includes(item[el.key])) {
el.error = true el.error = true
checkFlag = true checkFlag = true
} }
return el; return el
}) })
} }
}) })
console.log(checkFlag, 'checkFlag'); console.log(checkFlag, 'checkFlag')
if (checkFlag) { if (checkFlag) {
this.setData({ this.setData({
hwObjArray hwObjArray
}) })
return false; //必填校验没过 return false //必填校验没过
} }
orderObj.isAdmin = role == 'super' ? true : false orderObj.isAdmin = role == 'super' ? true : false
orderObj.oprBy = orderObj.staffUuid orderObj.oprBy = orderObj.staffUuid
...@@ -656,7 +682,7 @@ Page({ ...@@ -656,7 +682,7 @@ Page({
showCancel: false, showCancel: false,
confirmText: '确定', confirmText: '确定',
confirmColor: '#347BFF', confirmColor: '#347BFF',
success(res) { } success(res) {}
}) })
} else { } else {
wx.$util.showToast(message) wx.$util.showToast(message)
...@@ -689,7 +715,9 @@ Page({ ...@@ -689,7 +715,9 @@ Page({
} = this.data } = this.data
// 在超管/区域督导未拿到门店或员工信息 // 在超管/区域督导未拿到门店或员工信息
if ( if (
(userInfo?.isSuper || userInfo?.loginRole == 3 || userInfo?.loginRole == 5) && (userInfo?.isSuper ||
userInfo?.loginRole == 3 ||
userInfo?.loginRole == 5) &&
(!yqMerchantId || !merchantId || !staffUuid) (!yqMerchantId || !merchantId || !staffUuid)
) )
return return
...@@ -712,17 +740,25 @@ Page({ ...@@ -712,17 +740,25 @@ Page({
let that = this let that = this
let { value } = e.detail let { value } = e.detail
let { name, hwIndex, otherIndex, index } = e.currentTarget.dataset let { name, hwIndex, otherIndex, index } = e.currentTarget.dataset
let { orderObj, userInfo, carBandList, hwObjArray, otherObjArray } = this.data let { orderObj, userInfo, carBandList, hwObjArray, otherObjArray } =
// this.data
//
if (['staffCount', 'deliveryCount', 'notDeliveryCount'].includes(name)) { if (['staffCount', 'deliveryCount', 'notDeliveryCount'].includes(name)) {
let checkName = `record${name}` let checkName = `record${name}`
let checkVlaue = carBandList[index][checkName] let checkValue = carBandList[index][checkName]
let context = hwObjArray[hwIndex]?.label || otherObjArray[otherIndex]?.label let context =
hwObjArray[hwIndex]?.label || otherObjArray[otherIndex]?.label
// console.log(carBandList[index], carBandList[index][checkName], 'carBandList[name[checkName]]'); // console.log(carBandList[index], carBandList[index][checkName], 'carBandList[name[checkName]]');
carBandList[index].name != carBandList[index[checkName]] carBandList[index].name != carBandList[index[checkName]]
// console.log(checkVlaue != carBandList[index][name], orderObj.lastStaffUuid && userInfo.uuid != orderObj.lastStaffUuid); // console.log(checkValue != carBandList[index][name], orderObj.lastStaffUuid && userInfo.uuid != orderObj.lastStaffUuid);
// console.log(carBandList[index][name]); // console.log(carBandList[index][name]);
if (carBandList[index][checkName] != '' && carBandList[index][checkName] != null && checkVlaue != carBandList[index][name] && orderObj.lastStaffUuid && userInfo.uuid != orderObj.lastStaffUuid) { if (
carBandList[index][checkName] != '' &&
carBandList[index][checkName] != null &&
checkValue != carBandList[index][name] &&
orderObj.lastStaffUuid &&
userInfo.uuid != orderObj.lastStaffUuid
) {
wx.showModal({ wx.showModal({
title: '预警提示', title: '预警提示',
content: `${context}与 ${orderObj.lastStaffName} 提交不一致,再次确认!不一致提交日报时,${context}将被清空。`, content: `${context}与 ${orderObj.lastStaffName} 提交不一致,再次确认!不一致提交日报时,${context}将被清空。`,
...@@ -737,102 +773,30 @@ Page({ ...@@ -737,102 +773,30 @@ Page({
}) })
} }
} }
}, },
// input(e) {
// let { value } = e.detail;
// let { name, index, hwIndex, otherIndex } = e.currentTarget.dataset;
// const { hwObjArray, otherObjArray } = this.data;
// const currentConfig = hwObjArray[hwIndex] || otherObjArray[otherIndex];
// const min = currentConfig.min || 0;
// const max = currentConfig.max || 9999999;
// // 清洗输入值,允许数字和小数点
// let cleanedValue = value
// .replace(/[^\d.]/g, '') // 移除非数字和小数点
// .replace(/^\./, '0.') // 处理以点开头的情况
// .replace(/\.+/g, '.') // 多个点替换为单个点
// .replace(/(\..*)\./g, '$1'); // 保留第一个点
// // 分割整数和小数部分
// let [integerPart, decimalPart] = cleanedValue.split('.');
// decimalPart = decimalPart ? decimalPart.slice(0, 2) : ''; // 截断小数部分到两位
// cleanedValue = decimalPart !== undefined ?
// `${integerPart || '0'}.${decimalPart}` :
// (integerPart || '');
// // 处理空值和必填项
// if (cleanedValue === '' || cleanedValue === '0.') {
// if (currentConfig.required) {
// cleanedValue = min.toFixed(currentConfig.allowDecimal ? 2 : 0);
// } else {
// this.setData({
// [`carBandList[${index}].${name}inputError`]: '',
// [`carBandList[${index}].${name}`]: ''
// });
// return;
// }
// }
// // 转换为数值
// let numValue = parseFloat(cleanedValue);
// if (isNaN(numValue)) {
// numValue = currentConfig.required ? min : 0;
// }
// // 数值范围限制
// numValue = Math.min(Math.max(numValue, min), max);
// // 格式化最终值(保留两位小数)
// let finalValue;
// if (cleanedValue.includes('.') || currentConfig.allowDecimal) {
// // 如果有小数点或允许小数,保留两位小数
// finalValue = numValue.toFixed(2);
// // 保留用户输入的小数点后数字(最多两位)
// if (decimalPart && decimalPart.length < 2) {
// finalValue = numValue.toFixed(decimalPart.length);
// }
// } else {
// finalValue = numValue.toString();
// }
// // 更新数据
// this.setData({
// [`carBandList[${index}].${name}`]: finalValue,
// });
// // 错误状态处理
// if (hwIndex !== undefined) {
// this.setData({
// [`hwObjArray[${hwIndex}].error`]: false
// });
// }
// },
input(e) { input(e) {
// userInfo
// let { orderObj } = this.data
let { value } = e.detail let { value } = e.detail
let { name, index, hwIndex, otherIndex } = e.currentTarget.dataset let { name, index, hwIndex, otherIndex } = e.currentTarget.dataset
// console.log(e.currentTarget.dataset); // console.log(e.currentTarget.dataset);
const { hwObjArray, otherObjArray } = this.data; // 获取 hwObjArray 配置 const { hwObjArray, otherObjArray } = this.data // 获取 hwObjArray 配置
const currentConfig = hwObjArray[hwIndex] || otherObjArray[otherIndex]; const currentConfig = hwObjArray[hwIndex] || otherObjArray[otherIndex]
const min = currentConfig.min || 0; // 默认最小值 0 const min = currentConfig.min || 0 // 默认最小值 0
const max = currentConfig.max || 9999999; // 默认最大值 const max = currentConfig.max || 9999999 // 默认最大值
console.log(currentConfig, 'currentConfig'); console.log(currentConfig, 'currentConfig')
if (currentConfig.type == 'digit') { if (currentConfig.type == 'digit') {
let [number, decimal] = value.toString().split('.') let [number, decimal] = value.toString().split('.')
console.log(value, '222'); console.log(value, '222')
console.log(decimal == '', 'decimal'); console.log(decimal == '', 'decimal')
if (decimal != undefined) { if (decimal != undefined) {
decimal = decimal.substring(0, 2) decimal = decimal.substring(0, 2)
number += `.${decimal}` number += `.${decimal}`
value = number value = number
} }
if (decimal == '') { if (decimal == '') {
console.log(value); console.log(value)
this.setData({ this.setData({
[`carBandList[${index}].${name}`]: value [`carBandList[${index}].${name}`]: value
}); })
return return
} }
} }
...@@ -840,34 +804,40 @@ Page({ ...@@ -840,34 +804,40 @@ Page({
// return; // return;
// 清洗输入值 // 清洗输入值
// let cleanedValue = value.replace(/\D/g, ''); // 移除非数字字符 // let cleanedValue = value.replace(/\D/g, ''); // 移除非数字字符
let cleanedValue = value; // 移除非数字字符 let cleanedValue = value // 移除非数字字符
// let numValue = parseInt(cleanedValue, 10); // let numValue = parseInt(cleanedValue, 10);
let numValue = cleanedValue let numValue = cleanedValue
if (hwIndex !== undefined) {
this.setData({
[`hwObjArray[${hwIndex}].error`]: false
})
}
// 处理空值 // 处理空值
if (cleanedValue === '') { if (cleanedValue === '') {
if (currentConfig.required) { // if (currentConfig.required) {
// 必填项设置为 min 值(如 min=1 的字段不能为 0) // // 必填项设置为 min 值(如 min=1 的字段不能为 0)
numValue = min; // // numValue = min;
} else { // } else {
// 非必填项允许为空 // // 非必填项允许为空
this.setData({ // this.setData({
[`carBandList[${index}].${name}inputError`]: '' // [`carBandList[${index}].${name}inputError`]: ''
}); // });
return; // return;
} // }
// this.setData({
// [`carBandList[${index}].${name}inputError`]: ''
// })
this.setData({
[`carBandList[${index}].${name}`]: numValue.toString()
})
return
} }
// 限制数值范围 // 限制数值范围
numValue = Math.min(Math.max(numValue, min), max); numValue = Math.min(Math.max(numValue, min), max)
// 更新数据 // 更新数据
this.setData({ this.setData({
[`carBandList[${index}].${name}`]: numValue.toString(), [`carBandList[${index}].${name}`]: numValue.toString()
}); })
if (hwIndex) {
this.setData({
[`hwObjArray[${hwIndex}].error`]: false
})
}
}, },
/** /**
* 点击了下一周,选择周数字加一,然后直接调用工具类中一个方法获取到数据 * 点击了下一周,选择周数字加一,然后直接调用工具类中一个方法获取到数据
...@@ -879,7 +849,9 @@ Page({ ...@@ -879,7 +849,9 @@ Page({
} = this.data } = this.data
// 在超管/区域督导未拿到门店或员工信息 // 在超管/区域督导未拿到门店或员工信息
if ( if (
(userInfo?.isSuper || userInfo?.loginRole == 3 || userInfo?.loginRole == 5) && (userInfo?.isSuper ||
userInfo?.loginRole == 3 ||
userInfo?.loginRole == 5) &&
(!yqMerchantId || !merchantId || !staffUuid) (!yqMerchantId || !merchantId || !staffUuid)
) )
return return
...@@ -913,7 +885,9 @@ Page({ ...@@ -913,7 +885,9 @@ Page({
} = this.data } = this.data
// 在超管/区域督导未拿到门店或员工信息 // 在超管/区域督导未拿到门店或员工信息
if ( if (
(userInfo?.isSuper || userInfo?.loginRole == 3 || userInfo?.loginRole == 5) && (userInfo?.isSuper ||
userInfo?.loginRole == 3 ||
userInfo?.loginRole == 5) &&
(!yqMerchantId || !merchantId || !staffUuid) (!yqMerchantId || !merchantId || !staffUuid)
) )
return return
...@@ -938,13 +912,13 @@ Page({ ...@@ -938,13 +912,13 @@ Page({
}, },
async getMerchantCarBandList() { async getMerchantCarBandList() {
let { orderObj, hwObjArray, otherObjArray } = this.data let { orderObj, hwObjArray, otherObjArray } = this.data
if (!orderObj.merchantId) return false; if (!orderObj.merchantId) return false
// 请求对应的4s店车型 // 请求对应的4s店车型
let result = await api.staffDailyReportMerchantCarBand({ let result = await api.staffDailyReportMerchantCarBand({
merchantId: orderObj.merchantId, merchantId: orderObj.merchantId,
sceneType: 0 sceneType: 0
}) })
console.log(result, 'result'); console.log(result, 'result')
let { code, data } = result let { code, data } = result
// let reportType = 0 // let reportType = 0
let carBandList = [] let carBandList = []
...@@ -961,9 +935,9 @@ Page({ ...@@ -961,9 +935,9 @@ Page({
el[e.key] = null el[e.key] = null
}) })
} }
return el; return el
}) })
console.log(carBandList, 'carBandList'); console.log(carBandList, 'carBandList')
} else { } else {
carBandList = [] carBandList = []
} }
...@@ -1036,22 +1010,17 @@ Page({ ...@@ -1036,22 +1010,17 @@ Page({
let { code, data, message } = res let { code, data, message } = res
// console.log(data, 'data') // console.log(data, 'data')
if (code == 0) { if (code == 0) {
let { let { brandDataList, remark } = data
brandDataList,
remark
} = data
if (brandDataList && brandDataList.length) { if (brandDataList && brandDataList.length) {
carBandList = carBandList.map(item => { carBandList = carBandList.map(item => {
let carBand = brandDataList.find( let carBand = brandDataList.find(ele => {
ele => { if ([0, 1].includes(ele.brandType)) {
if ([0, 1].includes(ele.brandType)) { return ele.brandType == item.brandType
return ele.brandType == item.brandType } else if (ele.brandType == 2) {
} else if (ele.brandType == 2) { return ele.firstBrandId == item.firstBrandId
return ele.firstBrandId == item.firstBrandId
}
} }
) })
console.log(carBand, 'carBand'); console.log(carBand, 'carBand')
if (carBand != null) { if (carBand != null) {
item = { item = {
// ...item, // ...item,
...@@ -1089,7 +1058,7 @@ Page({ ...@@ -1089,7 +1058,7 @@ Page({
} }
hwObjArray = hwObjArray.map(item => { hwObjArray = hwObjArray.map(item => {
item.error = false item.error = false
return item; return item
}) })
this.setData({ this.setData({
hwObjArray, hwObjArray,
...@@ -1257,7 +1226,7 @@ Page({ ...@@ -1257,7 +1226,7 @@ Page({
wx.$util.message(message) wx.$util.message(message)
} }
}) })
.catch(err => { }) .catch(err => {})
}, },
inputSearch(e) { inputSearch(e) {
let { pickerType } = this.data let { pickerType } = this.data
...@@ -1354,7 +1323,7 @@ Page({ ...@@ -1354,7 +1323,7 @@ Page({
this.setReportDate() this.setReportDate()
setTimeout(() => { setTimeout(() => {
console.log(this.data.role, 'roleOther'); console.log(this.data.role, 'roleOther')
if (this.data.role == 'other' || approvedSource == '3') { if (this.data.role == 'other' || approvedSource == '3') {
this.getMerchantCarBandList() this.getMerchantCarBandList()
return return
...@@ -1390,7 +1359,11 @@ Page({ ...@@ -1390,7 +1359,11 @@ Page({
this.getMerchantCarBandList() this.getMerchantCarBandList()
} }
// console.log(userInfo.isSuper, 'userInfo.isSuper') // console.log(userInfo.isSuper, 'userInfo.isSuper')
if (userInfo?.isSuper || userInfo?.loginRole == 3 || userInfo?.loginRole == 5) { if (
userInfo?.isSuper ||
userInfo?.loginRole == 3 ||
userInfo?.loginRole == 5
) {
this.setData({ this.setData({
role: 'super' role: 'super'
}) })
...@@ -1460,7 +1433,7 @@ Page({ ...@@ -1460,7 +1433,7 @@ Page({
} }
// } // }
}) })
.catch(err => { }) .catch(err => {})
}, },
/** /**
* 生命周期函数--监听页面加载 * 生命周期函数--监听页面加载
...@@ -1496,7 +1469,7 @@ Page({ ...@@ -1496,7 +1469,7 @@ Page({
if (options.approvedSource == '3') { if (options.approvedSource == '3') {
role = 'staff' role = 'staff'
} else { } else {
role = "other"; role = 'other'
} }
this.setData( this.setData(
...@@ -1555,7 +1528,7 @@ Page({ ...@@ -1555,7 +1528,7 @@ Page({
if (options.approvedSource == '3') { if (options.approvedSource == '3') {
role = 'staff' role = 'staff'
} else { } else {
role = "other"; role = 'other'
} }
this.setData( this.setData(
...@@ -1582,5 +1555,5 @@ Page({ ...@@ -1582,5 +1555,5 @@ Page({
/** /**
* 生命周期函数--监听页面初次渲染完成 * 生命周期函数--监听页面初次渲染完成
*/ */
onReady: function () { } onReady: function () {}
}) })
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!