Commit d16064d0 by 杨北旺

修改日期不能选择问题

1 parent b0bdf09f
......@@ -1055,10 +1055,32 @@ export default {
this.handleProductArrParam(this.autoAttriButeList, this.autoPackageCodeList)
}
},
objSort(obj) {
let newObj = {}
//遍历对象,并将key进行排序
Object.keys(obj)
.sort()
.map(key => {
newObj[key] = obj[key]
})
//将排序好的数组转成字符串
return JSON.stringify(newObj)
},
unique(arr) {
let set = new Set()
for (let i = 0; i < arr.length; i++) {
let str = this.objSort(arr[i])
set.add(str)
}
//将数组中的字符串转回对象
arr = [...set].map(item => {
return JSON.parse(item)
})
return arr
},
// 处理数据结构对比后台所需的参数
handleProductArrParam(arr, codearr) {
let newArr = []
let newArr = [],filterList = []
const codeList = Array.from(new Set(codearr))
this.checkCodeList = codeList
let blackArr = []
......@@ -1066,6 +1088,10 @@ export default {
blackArr.push([])
}
const newParaArr = []
if (arr.length) {
filterList = this.unique(arr)
}
arr = filterList
for (let i = 0; i < arr.length; i++) {
for (let j = 0; j < codeList.length; j++) {
if (arr[i].packageCode == codeList[j]) {
......@@ -1182,10 +1208,12 @@ export default {
}
e.optionList = [...arr]
this.serviceObj[item.packageCode] = item.servicePeriod
this.productModal[item.idName][e.attributeName] = '1'
// this.productModal[item.idName][e.attributeName] = '1'
this.$set(this.productModal[item.idName],`${e.attributeName}`,'1')
} else if (e.attributeDesc == '购车类型') {
e.optionList = this.baseData.buyCarTypeList
this.productModal[item.idName][e.attributeName] = '0'
// this.productModal[item.idName][e.attributeName] = '0'
this.$set(this.productModal[item.idName],`${e.attributeName}`,'0')
} else if ((item.idName == 'tire' || item.idName == 'crash' || item.idName == `vip${item.packageCode}` || item.idName == 'glass') && e.attributeDesc == '服务期限') {
if (item.idName == 'tire' || item.idName == 'crash') {
e.optionList = this.baseData.servicePeriodList
......@@ -1199,13 +1227,16 @@ export default {
e.disabled = false
e.optionList = this.baseData.servicePeriodList
}
this.productModal[item.idName][e.attributeName] = '1'
// this.productModal[item.idName][e.attributeName] = '1'
this.$set(this.productModal[item.idName],`${e.attributeName}`,'1')
} else if (e.attributeDesc == '生效日期') {
let nextDay = new Date().getTime() + 24 * 60 * 60 * 1000
this.productModal[item.idName][e.attributeName] = utils.dateFormat(nextDay)
// this.productModal[item.idName][e.attributeName] = utils.dateFormat(nextDay)
this.$set(this.productModal[item.idName],`${e.attributeName}`,utils.dateFormat(nextDay))
if (item.idName == 'glass') {
let tAdd2 = new Date().getTime() + 24 * 60 * 60 * 1000 * 2
this.productModal[item.idName][e.attributeName] = utils.dateFormat(tAdd2)
// this.productModal[item.idName][e.attributeName] = utils.dateFormat(tAdd2)
this.$set(this.productModal[item.idName],`${e.attributeName}`,utils.dateFormat(tAdd2))
e.disabled = true
}
}
......@@ -1672,6 +1703,7 @@ export default {
}
this.submit = true
var params = this.getParams()
delete params.attributes
params.operationType = 0
if (this.routeInfo.addOrEdit == '2') {
params.contractNo = this.routeInfo.contractNo
......@@ -1760,6 +1792,7 @@ export default {
return true
}
var params = this.getParams()
delete params.attributes
params.operationType = 1
if ([2, 3, 4].includes(this.routeInfo.addOrEdit)) {
if (this.routeInfo.addOrEdit == 4 && this.editForm.orderStatus != 3) {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!