Commit 015cd478 by 杨北旺

修改日期不能选择问题

1 parent 2ceaec2a
......@@ -1018,10 +1018,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 = []
......@@ -1029,15 +1051,10 @@ export default {
blackArr.push([])
}
const newParaArr = []
// codeList.forEach((item, index) => {
// let attrStr = `attributes[${index}].packageCode`
// let contractNoStr = `attributes[${index}].contractNo`
// let obj = {
// [attrStr]: item,
// [contractNoStr]: this.routeInfo.contractNo && this.routeInfo.contractNo > -1 ? this.routeInfo.contractNo : ''
// }
// newArr.push(obj)
// })
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]) {
......@@ -1155,10 +1172,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
......@@ -1172,13 +1191,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
}
}
......@@ -1239,7 +1261,7 @@ export default {
})
},
getInfo(productArrData) {
this.$apis.beforeSale.getEquityApi({ contractNo: this.routeInfo.contractNo,repeatedFlag:this.routeInfo.addOrEdit==4?1:0 }).then(res => {
this.$apis.beforeSale.getEquityApi({ contractNo: this.routeInfo.contractNo, repeatedFlag: this.routeInfo.addOrEdit == 4 ? 1 : 0 }).then(res => {
this.editForm = {
...res
}
......@@ -1315,7 +1337,7 @@ export default {
packCode = []
detailInfo.attributes.forEach(item => {
let targetItem = productArrData.find(k => k.packageCode == item.packageCode)
const defalutAttr = this.handleDefaultValue(targetItem, item.attributeDTOList)
const defalutAttr = this.handleDefaultValue(targetItem, item.attributeDTOList)
if (defalutAttr.length) {
item.attributeDTOList = [...item.attributeDTOList, ...defalutAttr]
}
......@@ -1478,7 +1500,7 @@ export default {
this.$set(this.editFormPro, hashObj[item.attributeName] != 1 ? item.attributeName + item.sort : item.attributeName, item.attributeValue)
})
},
// 处理默认值赋值
// 处理默认值赋值
handleDefaultValue(targetItem, attributeDTOList) {
const currentPackageValue = this.productModal[targetItem.idName]
const groupAttributeList = targetItem.groupAttributeList
......@@ -1724,6 +1746,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
......@@ -1744,7 +1767,7 @@ export default {
params.dataSource = this.editForm.dataSource || ''
setTimeout(() => {
this.submit = false
}, 3000);
}, 3000)
this.$apis.beforeSale.updateEquityApi(params).then(res => {
this.submit = false
......@@ -1816,6 +1839,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!