Commit 1b68605f by 张立顺

功能开发

1 parent b08df8e2
......@@ -248,6 +248,7 @@ Page({
this.checkPhoneUseConfig()
let { save } = i.currentTarget.dataset
let { goodsList, orderObj, scene, isErrorOrder, isAlreadyExistOrder } = this.data
orderObj = wx.$util.deepClone(orderObj)
console.log(orderObj)
// 如果是错单补录 禁用掉保存功能 或待跟进订单/预约订单 禁用建档
if ((isErrorOrder && save) || (isAlreadyExistOrder && save)) return
......@@ -263,18 +264,6 @@ Page({
return
}
if (!phoneRex.test(orderObj.customer.customerPhone)) {
this.showToast('请输入正确的手机号')
return
}
if (orderObj.customer.standNo) {
const vinRex = /[^\w]/g
if (vinRex.test(orderObj.customer.standNo)) {
this.showToast('请输入正确的VIN码')
return
}
}
let subOrderList = []
let priceDisabled = true
let goodsKey = this.checkGoods(save, subOrderList, priceDisabled, goodsList, orderObj)
......@@ -291,13 +280,22 @@ Page({
// return console.log(orderObj)
// 是订单修正就把错误单号带上
if (isErrorOrder) orderObj.oldOrderCode = orderObj.associateOrderCode
let submitObj = JSON.parse(JSON.stringify(orderObj))
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]
})
}
this.showLoading('提交中...')
let apiName = save && !isErrorOrder ? 'createPrerecordedOrder' : isErrorOrder ? 'correctionOrder' : 'createWithPay'
......@@ -373,12 +371,32 @@ Page({
checkRequired(save, obj) {
// 导入动态校验字段
let { requiredList } = this.data
// console.log(requiredList) ...requiredList,
let target = save ? ['userId', 'merchantId', 'employeeName', ...requiredList, 'customerName', 'customerPhone', 'sellerUserId', 'sellerName', 'sellerMerchantId'] : ['userId', 'merchantId', 'employeeName', ...requiredList, 'customerName', 'customerPhone', 'sellerUserId', 'sellerName', 'sellerMerchantId', 'customerCouponCode']
// let target = save ? ['userId', 'merchantId', 'employeeName', ...requiredList, 'customerName', 'customerPhone', 'sellerUserId', 'sellerName', 'sellerMerchantId']
// : ['userId', 'merchantId', 'employeeName', ...requiredList, 'customerName', 'customerPhone', 'sellerUserId', 'sellerName', 'sellerMerchantId', 'customerCouponCode']
let target = ['userId', 'merchantId', 'employeeName', ...requiredList, 'customerName', 'customerPhone', 'sellerUserId', 'sellerName', 'sellerMerchantId']
if (save) {
target.push('customerCouponCode')
}
// 是战败就去除一些无用字段
if (obj.selectPayType == 0) {
target = target.filter(item => !['carBrand', 'standNo', 'plateNumber'].includes(item))
}
obj = {
...obj,
...obj.customer
}
if (!phoneRex.test(obj.customer.customerPhone)) {
this.showToast('请输入正确的手机号')
return false
}
if (obj.customer.standNo && obj.selectPayType != 0) {
const vinRex = /[^\w]/g
if (vinRex.test(obj.customer.standNo)) {
this.showToast('请输入正确的VIN码')
return false
}
}
try {
target.map(key => {
if (!obj[key]) {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!