Commit c23f2faf authored by dragondean@qq.com's avatar dragondean@qq.com

修复复制模板缺少特需价格的时候无法设置

parent 324cd867
...@@ -299,34 +299,36 @@ export default { ...@@ -299,34 +299,36 @@ export default {
getCurrencyList().then(res => this.currencyList = res.data) getCurrencyList().then(res => this.currencyList = res.data)
getUnitList().then(res => this.unitList = res.data) getUnitList().then(res => this.unitList = res.data)
this.$nextTick(async () => { await this.$nextTick()
// 如果是空运,阶梯价格默认为1 // 如果是空运,阶梯价格默认为1
if(this.type == 'air'){ if(this.type == 'air'){
this.$set(this.form, 'stepPrice', 1) this.$set(this.form, 'stepPrice', 1)
} }
await this.$nextTick()
// 默认单位,空运千克,海运立方米
this.setDefaultVolumeUnit(this.type == 'air' ? 6 : 7)
// 如果是复制,则获取数据并填充,先复制,然后填充特需,避免数据的特需不全导致部分不显示 // 默认单位,空运千克,海运立方米
if(this.$route.query.templateId){ this.setDefaultVolumeUnit(this.type == 'air' ? 6 : 7)
await this.getTemplateDetail(this.$route.query.templateId)
} // 如果是复制,则获取数据并填充,先复制,然后填充特需,避免数据的特需不全导致部分不显示
}) if(this.$route.query.templateId){
await this.getTemplateDetail(this.$route.query.templateId)
}
// 从价格中获取特需的默认单位
const obj = (this.form.stepPrice ? this.form.priceStepList[0] : this.form) || {}
this.getDictDatas(this.DICT_TYPE.ECW_SPECIAL_REQ_FOR_LINE_PRODUCTS).forEach(item => { this.getDictDatas(this.DICT_TYPE.ECW_SPECIAL_REQ_FOR_LINE_PRODUCTS).forEach(item => {
// 没有的才push,已有的可能是从复制模板携带过来的数据 // 没有的才push,已有的可能是从复制模板携带过来的数据
if(!this.form.specialList.find(special => special.specialDictType == item.value)) { if(!this.form.specialList.find(special => special.specialDictType == item.value)) {
console.log('特需push', item.value)
this.form.specialList.push({ this.form.specialList.push({
"clearancePrice": null, "clearancePrice": null,
"clearancePriceUnit": null, "clearancePriceUnit": obj.clearancePriceUnit,
"clearanceVolumeUnit": null, "clearanceVolumeUnit": obj.clearanceVolumeUnit,
"specialDictType": item.value, "specialDictType": item.value,
"transportPrice": null, "transportPrice": null,
"transportPriceUnit": null, "transportPriceUnit": obj.transportPriceUnit,
"transportVolumeUnit": null, "transportVolumeUnit": obj.transportVolumeUnit,
}) })
} }else console.log('已存在特需', item.value)
}) })
...@@ -334,68 +336,67 @@ export default { ...@@ -334,68 +336,67 @@ export default {
methods: { methods: {
// 获取模板数据(复制的源路线价格信息) // 获取模板数据(复制的源路线价格信息)
async getTemplateDetail(id){ async getTemplateDetail(id){
await getProductPrice(id).then(res => { const res = await getProductPrice(id)
// 填充商品、线路、价格信息、出货渠道(空运) // 填充商品、线路、价格信息、出货渠道(空运)
// this.form.productIdList = [res.data.productId] // this.form.productIdList = [res.data.productId]
this.selectedRoutes = [{ this.selectedRoutes = [{
"lineId": res.data.warehouseLineId, "lineId": res.data.warehouseLineId,
"channelId": res.data.shippingChannelId, "channelId": res.data.shippingChannelId,
"transportId": res.data.warehouseLineDO.transportType, "transportId": res.data.warehouseLineDO.transportType,
"shippingChannelId":res.data.channelId "shippingChannelId":res.data.channelId
}] }]
// 要复制过来的字段 // 要复制过来的字段
const { const {
allPrice, allPrice,
allPriceUnit, allPriceUnit,
allVolumeUnit, allVolumeUnit,
transportPrice, transportPrice,
transportPriceUnit, transportPriceUnit,
transportVolumeUnit, transportVolumeUnit,
clearancePrice, clearancePrice,
clearancePriceUnit, clearancePriceUnit,
clearanceVolumeUnit, clearanceVolumeUnit,
priceType, priceType,
stepPrice, stepPrice,
specialList, specialList,
priceStepList, priceStepList,
minWeight, minWeight,
minWeightUnit, minWeightUnit,
needOrderInquiry, needOrderInquiry,
needBook, needBook,
needPay needPay
} = res.data } = res.data
const data = { const data = {
allPrice, allPrice,
allPriceUnit, allPriceUnit,
allVolumeUnit, allVolumeUnit,
transportPrice, transportPrice,
transportPriceUnit, transportPriceUnit,
transportVolumeUnit, transportVolumeUnit,
clearancePrice, clearancePrice,
clearancePriceUnit, clearancePriceUnit,
clearanceVolumeUnit, clearanceVolumeUnit,
priceType, priceType,
stepPrice, stepPrice,
specialList, specialList,
priceStepList, priceStepList,
minWeight, minWeight,
minWeightUnit, minWeightUnit,
needOrderInquiry, needOrderInquiry,
needBook, needBook,
needPay needPay
} }
// 海运需要填充货柜位置和订单方数上限 // 海运需要填充货柜位置和订单方数上限
if(this.type == 'sea'){ if(this.type == 'sea'){
data.containerLocation = res.data.containerLocation data.containerLocation = res.data.containerLocation
data.square = res.data.square data.square = res.data.square
} }
this.$set(this, 'form', Object.assign({}, this.form, data)) this.$set(this, 'form', Object.assign({}, this.form, data))
// 产品选择器默认选择的商品 // 产品选择器默认选择的商品
getProduct(res.data.productId).then(res => { getProduct(res.data.productId).then(res => {
this.$refs.productSelector.choose(res.data) this.$refs.productSelector.choose(res.data)
})
}) })
}, },
// 同步全部单位 // 同步全部单位
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment