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

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

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