|
|
|
@ -332,11 +332,8 @@ const handleTrunkLinePricingType = response => {
|
|
|
|
|
const _billTemplateDetailArr = []; |
|
|
|
|
for (let i = 0; i < details.priceMethodType.length; i++) { |
|
|
|
|
const value = details.priceMethodType[i]; |
|
|
|
|
console.log(value,'value'); |
|
|
|
|
|
|
|
|
|
if (value.dictKey != '2') { |
|
|
|
|
console.log(value,'value===='); |
|
|
|
|
_billTemplateDetailArr.push({ |
|
|
|
|
const _itemObj = { |
|
|
|
|
title: value.dictValue + '计费品类', |
|
|
|
|
code: value.dictKey, |
|
|
|
|
categories: [ |
|
|
|
@ -350,11 +347,90 @@ const handleTrunkLinePricingType = response => {
|
|
|
|
|
loading: false, |
|
|
|
|
}, |
|
|
|
|
], |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
if (!props.templateData.request) { |
|
|
|
|
console.log('123123 :>> ', 123123); |
|
|
|
|
_billTemplateDetailArr.push(_itemObj); |
|
|
|
|
continue; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
console.log('222 :>> ', 222); |
|
|
|
|
const _arr = []; |
|
|
|
|
|
|
|
|
|
// 按件 |
|
|
|
|
if (value.dictKey === '1') { |
|
|
|
|
const { trunklinePieceCategorys } = props.templateData.request; |
|
|
|
|
|
|
|
|
|
if (trunklinePieceCategorys && trunklinePieceCategorys.length !== 0) { |
|
|
|
|
for (let i = 0; i < trunklinePieceCategorys.length; i++) { |
|
|
|
|
const item = trunklinePieceCategorys[i]; |
|
|
|
|
|
|
|
|
|
_arr.push({ |
|
|
|
|
reduce: i === 0 ? false : true, |
|
|
|
|
plus: true, |
|
|
|
|
goodsName: item.name, |
|
|
|
|
goodsId: item.id, |
|
|
|
|
goods: item.name, |
|
|
|
|
goodsArr: [], |
|
|
|
|
loading: false, |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
_itemObj.categories = _arr; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
// 按重量 |
|
|
|
|
if (value.dictKey === '4') { |
|
|
|
|
const { trunklineWeightCategorys } = props.templateData.request; |
|
|
|
|
|
|
|
|
|
if (trunklineWeightCategorys && trunklineWeightCategorys.length !== 0) { |
|
|
|
|
for (let i = 0; i < trunklineWeightCategorys.length; i++) { |
|
|
|
|
const item = trunklineWeightCategorys[i]; |
|
|
|
|
|
|
|
|
|
_arr.push({ |
|
|
|
|
reduce: i === 0 ? false : true, |
|
|
|
|
plus: true, |
|
|
|
|
goodsName: item.name, |
|
|
|
|
goodsId: item.id, |
|
|
|
|
goods: item.name, |
|
|
|
|
goodsArr: [], |
|
|
|
|
loading: false, |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
_itemObj.categories = _arr; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// 按方 |
|
|
|
|
if (value.dictKey === '3') { |
|
|
|
|
const { trunklineCubeCategorys } = props.templateData.request; |
|
|
|
|
|
|
|
|
|
if (trunklineCubeCategorys && trunklineCubeCategorys.length !== 0) { |
|
|
|
|
for (let i = 0; i < trunklineCubeCategorys.length; i++) { |
|
|
|
|
const item = trunklineCubeCategorys[i]; |
|
|
|
|
|
|
|
|
|
_arr.push({ |
|
|
|
|
reduce: i === 0 ? false : true, |
|
|
|
|
plus: true, |
|
|
|
|
goodsName: item.name, |
|
|
|
|
goodsId: item.id, |
|
|
|
|
goods: item.name, |
|
|
|
|
goodsArr: [], |
|
|
|
|
loading: false, |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
_itemObj.categories = _arr; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
_billTemplateDetailArr.push(_itemObj); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
console.log('_billTemplateDetailArr :>> ', _billTemplateDetailArr); |
|
|
|
|
details.form.billTemplateDetail = _billTemplateDetailArr; |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
@ -388,11 +464,28 @@ const initDictionaryBiz = async () => {
|
|
|
|
|
|
|
|
|
|
const [trunkLineResult, minCostResult] = await Promise.all([trunkLinePromise, minCostPromise]); |
|
|
|
|
|
|
|
|
|
await nextTick(); |
|
|
|
|
console.log('props.templateData.request :>> ', props.templateData.request); |
|
|
|
|
|
|
|
|
|
if (Object.keys(props.templateData).length !== 0) { |
|
|
|
|
details.form = deepClone(props.templateData.request); |
|
|
|
|
|
|
|
|
|
details.form.trunklinePricingType = details.form.trunklinePricingType |
|
|
|
|
? details.form.trunklinePricingType.split(',') |
|
|
|
|
: []; |
|
|
|
|
details.form.trunklineIsUnifyAreaBill += ''; |
|
|
|
|
details.form.trunklineIsByCategory += ''; |
|
|
|
|
details.form.trunklineIsPeculiarSetup += ''; |
|
|
|
|
details.form.trunklineIsMinCost += ''; |
|
|
|
|
details.form.trunklineMinCostType += ''; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
console.log('details.form :>> ', details.form); |
|
|
|
|
|
|
|
|
|
// 处理干线 |
|
|
|
|
handleTrunkLinePricingType(trunkLineResult); |
|
|
|
|
handleLowestPrice(minCostResult); |
|
|
|
|
|
|
|
|
|
// 初始化复制form数据 |
|
|
|
|
initFormData(); |
|
|
|
|
} catch (error) { |
|
|
|
|
console.log('error :>> ', error); |
|
|
|
@ -402,7 +495,6 @@ const initDictionaryBiz = async () => {
|
|
|
|
|
|
|
|
|
|
initDictionaryBiz(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** 新增品类 */ |
|
|
|
|
const handlePlus = async (value: any, index: number) => { |
|
|
|
|
value.categories.splice(index + 1, 0, { |
|
|
|
@ -514,25 +606,34 @@ const handleSubmit = async() => {
|
|
|
|
|
console.log(details.form, '初始表单'); |
|
|
|
|
const submitData = deepClone(details.form); //深拷贝 |
|
|
|
|
// 计价方式 |
|
|
|
|
submitData.trunklinePricingType= submitData.trunklinePricingType.join(',') |
|
|
|
|
submitData.trunklinePricingType = submitData.trunklinePricingType.join(','); |
|
|
|
|
//品类管理 |
|
|
|
|
// 是否区分品类,选择是才进行处理 |
|
|
|
|
if (details.form.trunklineIsByCategory === '1') { |
|
|
|
|
submitData.billTemplateDetail.forEach(item => { |
|
|
|
|
switch (item.code) { |
|
|
|
|
case '1': |
|
|
|
|
submitData.trunklinePieceCategory = item.categories.filter(res => res.goodsId).map(res => res.goodsId).join(','); |
|
|
|
|
submitData.trunklinePieceCategory = item.categories |
|
|
|
|
.filter(res => res.goodsId) |
|
|
|
|
.map(res => res.goodsId) |
|
|
|
|
.join(','); |
|
|
|
|
break; |
|
|
|
|
case '3': |
|
|
|
|
submitData.trunklineCubeCategory = item.categories.filter(res => res.goodsId).map(res => res.goodsId).join(','); |
|
|
|
|
submitData.trunklineCubeCategory = item.categories |
|
|
|
|
.filter(res => res.goodsId) |
|
|
|
|
.map(res => res.goodsId) |
|
|
|
|
.join(','); |
|
|
|
|
break; |
|
|
|
|
case '4': |
|
|
|
|
submitData.trunklineWeightCategory = item.categories.filter(res => res.goodsId).map(res => res.goodsId).join(','); |
|
|
|
|
submitData.trunklineWeightCategory = item.categories |
|
|
|
|
.filter(res => res.goodsId) |
|
|
|
|
.map(res => res.goodsId) |
|
|
|
|
.join(','); |
|
|
|
|
break; |
|
|
|
|
default: |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
delete submitData.billTemplateDetail; //删除是否区分品类多余参数 |
|
|
|
|
console.log(submitData, '处理好的参数'); |
|
|
|
@ -542,7 +643,7 @@ const handleSubmit = async() => {
|
|
|
|
|
checkType: '2', |
|
|
|
|
...submitData, //提交的参数 |
|
|
|
|
id: props.templateData.code, //编辑参数 |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
// 走编辑 |
|
|
|
|
$_putpriceTemplate(data).then(res => { |
|
|
|
|
console.log(res, '编辑成功之后返回值'); |
|
|
|
@ -550,14 +651,14 @@ const handleSubmit = async() => {
|
|
|
|
|
ElMessage({ |
|
|
|
|
message: res.data.msg, |
|
|
|
|
type: 'success', |
|
|
|
|
}) |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
}); |
|
|
|
|
} else { |
|
|
|
|
// 走新增 |
|
|
|
|
let data = { |
|
|
|
|
...submitData, //提交的参数 |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
$_priceTemplate(data).then(res => { |
|
|
|
|
console.log(res, '提交成功返回值'); |
|
|
|
|
if (res.data.code == 200) { |
|
|
|
@ -567,7 +668,7 @@ const handleSubmit = async() => {
|
|
|
|
|
}); |
|
|
|
|
emit('request-data', res.data.data); //把获取到的数据传递给父页面 |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
}; |
|
|
|
|