|
|
|
@ -550,19 +550,19 @@ const MinimumChange = val => {
|
|
|
|
|
console.log(val); |
|
|
|
|
if (val) { |
|
|
|
|
form.value.dispatchMinCostMode = 1; |
|
|
|
|
form.value.dispatchMinCostType=1 |
|
|
|
|
form.value.dispatchMinCostType = 1; |
|
|
|
|
form.value.dispatchIsUpwardJudgment = 0; |
|
|
|
|
} else { |
|
|
|
|
form.value.dispatchMinCostMode = 0; |
|
|
|
|
form.value.dispatchIsUpwardJudgment = 0; //向上判断 |
|
|
|
|
form.value.dispatchMinCostType=null |
|
|
|
|
form.value.dispatchMinCostType = null; |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
// 根据当前选择的服务类型来选择是否显示框框 |
|
|
|
|
|
|
|
|
|
const CommercialcialDisplay = id => { |
|
|
|
|
let data = ServiceList.value.find(res => res.value == id); |
|
|
|
|
const CommercialcialDisplay = async id => { |
|
|
|
|
let data = await ServiceList.value.find(res => res.value == id); |
|
|
|
|
console.log(ServiceList.value, 'ServiceList.value'); |
|
|
|
|
if (data.value == 1) { |
|
|
|
|
form.value.dispatchPieceCategoryState = true; //按件是否显示 |
|
|
|
@ -622,30 +622,43 @@ const CommercialcialDisplay = id => {
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
// 点击菜单 |
|
|
|
|
const isChecked = item => { |
|
|
|
|
const isChecked = async item => { |
|
|
|
|
console.log(item.value, '点击菜单value'); |
|
|
|
|
console.log(item, 'item='); |
|
|
|
|
if (!form.value.WarehousebillingmodeTitle) { |
|
|
|
|
ElMessage({ |
|
|
|
|
message: '请先选择仓储计费类型', |
|
|
|
|
type: 'warning', |
|
|
|
|
}); |
|
|
|
|
form.value.dispatchPricingType = []; //清空选择 |
|
|
|
|
|
|
|
|
|
item.check = false; //取消当前勾选 |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
CommercialcialDisplay(item.value); // 根据当前选择的服务类型来选择是否显示框框 |
|
|
|
|
Timedelive(); //加载效果 |
|
|
|
|
await CommercialcialDisplay(item.value); // 根据当前选择的服务类型来选择是否显示框框 |
|
|
|
|
if (form.value.dispatchPricingType && form.value.dispatchPricingType.length) { |
|
|
|
|
form.value.dispatchPricingType.forEach(id => { |
|
|
|
|
console.log(item, 'item'); |
|
|
|
|
let data = ServiceList.value.find(res => res.value == id); |
|
|
|
|
if (data) { |
|
|
|
|
data.check = true; |
|
|
|
|
} else { |
|
|
|
|
data.check = false; |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
// 点击移除 |
|
|
|
|
const removeTag = value => { |
|
|
|
|
console.log(value, '点击移除value'); |
|
|
|
|
Deliveryloading.value = true; |
|
|
|
|
// 根据当前选择的服务类型来选择是否显示框框 |
|
|
|
|
|
|
|
|
|
let data = ServiceList.value.find(res => res.value == value); |
|
|
|
|
data.check = false; |
|
|
|
|
data.state = false; |
|
|
|
|
if (ServiceList.value.length) { |
|
|
|
|
let data = ServiceList.value.find(res => res.value == value); |
|
|
|
|
if (data) { |
|
|
|
|
data.check = false; |
|
|
|
|
data.state = false; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
CommercialcialDisplay(value); // 根据当前选择的服务类型来选择是否显示框框 |
|
|
|
|
Timedelive(); //加载效果 |
|
|
|
|
}; |
|
|
|
@ -655,12 +668,11 @@ function removeItemById(array, id) {
|
|
|
|
|
const index = array.findIndex(item => item.index === id); |
|
|
|
|
if (index !== -1) { |
|
|
|
|
array.splice(index, 1); |
|
|
|
|
if(array.length){ |
|
|
|
|
if (array.length) { |
|
|
|
|
array.forEach((item, index) => { |
|
|
|
|
item.index = index + 1; |
|
|
|
|
}); |
|
|
|
|
item.index = index + 1; |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
// 添加对象 |
|
|
|
@ -717,12 +729,11 @@ function FmremoveItemById(array, id) {
|
|
|
|
|
const index = array.findIndex(item => item.id === id); |
|
|
|
|
if (index !== -1) { |
|
|
|
|
array.splice(index, 1); |
|
|
|
|
if(array.length){ |
|
|
|
|
if (array.length) { |
|
|
|
|
array.forEach((item, index) => { |
|
|
|
|
item.id = index + 1; |
|
|
|
|
}); |
|
|
|
|
item.id = index + 1; |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
let timerId = setTimeout(() => { |
|
|
|
|
goriesloading.value = false; |
|
|
|
@ -760,41 +771,37 @@ async function updateDictionary(targetArray, dictionaryType) {
|
|
|
|
|
//服务类型 |
|
|
|
|
if (dictionaryType === 'dispatch_pricing_type') { |
|
|
|
|
Commercialcial.value = []; //清空服务类型 |
|
|
|
|
if(res.data.data && res.data.data.length){ |
|
|
|
|
if (res.data.data && res.data.data.length) { |
|
|
|
|
res.data.data.forEach(res => { |
|
|
|
|
let data = { |
|
|
|
|
title: res.dictValue, // 标题 |
|
|
|
|
id: Number(res.dictKey), //码表ID |
|
|
|
|
state: false, //是否显示 |
|
|
|
|
Storageloading: false, //加载效果 |
|
|
|
|
sequence: [ |
|
|
|
|
//表格 |
|
|
|
|
{ |
|
|
|
|
id: 1, //序号 |
|
|
|
|
plus: true, //加号显示 |
|
|
|
|
reduce: false, //减号显示 |
|
|
|
|
Additionalcategories: [], //品类 |
|
|
|
|
Warehousecategory: '', //选择的值 |
|
|
|
|
StateName: 'storage', //附加费标识 |
|
|
|
|
}, |
|
|
|
|
], |
|
|
|
|
}; |
|
|
|
|
Commercialcial.value.push({ |
|
|
|
|
...data, |
|
|
|
|
let data = { |
|
|
|
|
title: res.dictValue, // 标题 |
|
|
|
|
id: Number(res.dictKey), //码表ID |
|
|
|
|
state: false, //是否显示 |
|
|
|
|
Storageloading: false, //加载效果 |
|
|
|
|
sequence: [ |
|
|
|
|
//表格 |
|
|
|
|
{ |
|
|
|
|
id: 1, //序号 |
|
|
|
|
plus: true, //加号显示 |
|
|
|
|
reduce: false, //减号显示 |
|
|
|
|
Additionalcategories: [], //品类 |
|
|
|
|
Warehousecategory: '', //选择的值 |
|
|
|
|
StateName: 'storage', //附加费标识 |
|
|
|
|
}, |
|
|
|
|
], |
|
|
|
|
}; |
|
|
|
|
Commercialcial.value.push({ |
|
|
|
|
...data, |
|
|
|
|
}); |
|
|
|
|
}); |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
CommercialcialCopy.value = deepClone(Commercialcial.value); |
|
|
|
|
// 配送服务类型标题 |
|
|
|
|
|
|
|
|
|
console.log(form.value.dispatchServiceType,'服务类型aa'); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
console.log(form.value.dispatchServiceType, '服务类型aa'); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 是否类型 |
|
|
|
|
if (dictionaryType == 'price_yes_no') { |
|
|
|
|
Leftoverparts.value = { ...Distinguishcategories.value }; //是否有遗留件 |
|
|
|
@ -834,29 +841,28 @@ const search = val => {
|
|
|
|
|
let data = null; |
|
|
|
|
SelectData.value.options = []; //如果有新的参数就清空之前的 |
|
|
|
|
console.log(SelectData.value.StateName, 'SelectData.value.StateName'); |
|
|
|
|
if(res.data.data && res.data.data.length){ |
|
|
|
|
if (res.data.data && res.data.data.length) { |
|
|
|
|
res.data.data.forEach(item => { |
|
|
|
|
if (SelectData.value.StateName == 'storage') { |
|
|
|
|
//仓储 |
|
|
|
|
concatdata = form.value.dispatchCubeCategoryData.concat( |
|
|
|
|
form.value.dispatchWeightCategoryData, |
|
|
|
|
form.value.dispatchPieceCategoryData |
|
|
|
|
); |
|
|
|
|
data = concatdata.find(res => res.Warehousecategory == item.goodsId); |
|
|
|
|
} else if (SelectData.value.StateName == 'Commercialcial') { |
|
|
|
|
//附加费 |
|
|
|
|
data = form.value.dispatchSubjoinCategoryData.find( |
|
|
|
|
res => res.Warehousecategory == item.goodsId |
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
SelectData.value.options.push({ |
|
|
|
|
label: item.goodsName, |
|
|
|
|
value: item.goodsId, |
|
|
|
|
disabled: data ? true : false, |
|
|
|
|
if (SelectData.value.StateName == 'storage') { |
|
|
|
|
//仓储 |
|
|
|
|
concatdata = form.value.dispatchCubeCategoryData.concat( |
|
|
|
|
form.value.dispatchWeightCategoryData, |
|
|
|
|
form.value.dispatchPieceCategoryData |
|
|
|
|
); |
|
|
|
|
data = concatdata.find(res => res.Warehousecategory == item.goodsId); |
|
|
|
|
} else if (SelectData.value.StateName == 'Commercialcial') { |
|
|
|
|
//附加费 |
|
|
|
|
data = form.value.dispatchSubjoinCategoryData.find( |
|
|
|
|
res => res.Warehousecategory == item.goodsId |
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
SelectData.value.options.push({ |
|
|
|
|
label: item.goodsName, |
|
|
|
|
value: item.goodsId, |
|
|
|
|
disabled: data ? true : false, |
|
|
|
|
}); |
|
|
|
|
}); |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
@ -868,47 +874,51 @@ const search = val => {
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
function updateOptions(allDropdowns) { |
|
|
|
|
// 拉平所有的下拉框组到一个单一数组中 |
|
|
|
|
let dropdowns = [].concat(...allDropdowns); |
|
|
|
|
|
|
|
|
|
// 遍历每个下拉框 |
|
|
|
|
dropdowns.forEach((dropdown, index, self) => { |
|
|
|
|
// 取出当前下拉框选中的值 |
|
|
|
|
let selectedValue = dropdown.Warehousecategory; |
|
|
|
|
|
|
|
|
|
// 更新其他下拉框的options状态 |
|
|
|
|
self.forEach(otherDropdown => { |
|
|
|
|
if (dropdown !== otherDropdown) { // 确保不是自身 |
|
|
|
|
otherDropdown.options.forEach(option => { |
|
|
|
|
// 如果选项值和当前下拉框选中值相同,则禁用该选项 |
|
|
|
|
if (option.value === selectedValue) { |
|
|
|
|
option.disabled = true; |
|
|
|
|
} else { |
|
|
|
|
// 如果其他逻辑导致应保持禁用,可以在这里加上,下面的语句是检查是否已在别处被选中 |
|
|
|
|
let isSelectedSomewhereElse = self.some(d => d !== otherDropdown && d.Warehousecategory === option.value); |
|
|
|
|
option.disabled = isSelectedSomewhereElse; |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
// 拉平所有的下拉框组到一个单一数组中 |
|
|
|
|
let dropdowns = [].concat(...allDropdowns); |
|
|
|
|
|
|
|
|
|
// 遍历每个下拉框 |
|
|
|
|
dropdowns.forEach((dropdown, index, self) => { |
|
|
|
|
// 取出当前下拉框选中的值 |
|
|
|
|
let selectedValue = dropdown.Warehousecategory; |
|
|
|
|
|
|
|
|
|
// 更新其他下拉框的options状态 |
|
|
|
|
self.forEach(otherDropdown => { |
|
|
|
|
if (dropdown !== otherDropdown) { |
|
|
|
|
// 确保不是自身 |
|
|
|
|
otherDropdown.options.forEach(option => { |
|
|
|
|
// 如果选项值和当前下拉框选中值相同,则禁用该选项 |
|
|
|
|
if (option.value === selectedValue) { |
|
|
|
|
option.disabled = true; |
|
|
|
|
} else { |
|
|
|
|
// 如果其他逻辑导致应保持禁用,可以在这里加上,下面的语句是检查是否已在别处被选中 |
|
|
|
|
let isSelectedSomewhereElse = self.some( |
|
|
|
|
d => d !== otherDropdown && d.Warehousecategory === option.value |
|
|
|
|
); |
|
|
|
|
option.disabled = isSelectedSomewhereElse; |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 构造一个包括所有下拉列表的数组 |
|
|
|
|
|
|
|
|
|
// 选择框值发生改变 |
|
|
|
|
const selectChange = data => { |
|
|
|
|
// console.log(data, 'data'); |
|
|
|
|
// console.log(form.value.dispatchCubeCategoryData,'dispatchCubeCategoryData111'); |
|
|
|
|
// console.log(form.value.dispatchWeightCategoryData,'dispatchWeightCategoryData222'); |
|
|
|
|
// console.log(form.value.dispatchPieceCategoryData,'dispatchPieceCategoryData333'); |
|
|
|
|
|
|
|
|
|
let allDropdowns = [form.value.dispatchCubeCategoryData, form.value.dispatchWeightCategoryData, form.value.dispatchPieceCategoryData]; |
|
|
|
|
// 更新选项 |
|
|
|
|
updateOptions(allDropdowns); |
|
|
|
|
|
|
|
|
|
// console.log(data, 'data'); |
|
|
|
|
// console.log(form.value.dispatchCubeCategoryData,'dispatchCubeCategoryData111'); |
|
|
|
|
// console.log(form.value.dispatchWeightCategoryData,'dispatchWeightCategoryData222'); |
|
|
|
|
// console.log(form.value.dispatchPieceCategoryData,'dispatchPieceCategoryData333'); |
|
|
|
|
|
|
|
|
|
let allDropdowns = [ |
|
|
|
|
form.value.dispatchCubeCategoryData, |
|
|
|
|
form.value.dispatchWeightCategoryData, |
|
|
|
|
form.value.dispatchPieceCategoryData, |
|
|
|
|
]; |
|
|
|
|
// 更新选项 |
|
|
|
|
updateOptions(allDropdowns); |
|
|
|
|
}; |
|
|
|
|
const categoriesSearchfocus = item => { |
|
|
|
|
console.log(item, 'item'); |
|
|
|
@ -918,16 +928,16 @@ const categoriesSearchfocus = item => {
|
|
|
|
|
const SurchargeChange = val => { |
|
|
|
|
if (val) { |
|
|
|
|
form.value.dispatchSubjoinCategoryData = [ |
|
|
|
|
{ |
|
|
|
|
index: 1, |
|
|
|
|
Warehousecategory: '', |
|
|
|
|
options: [], |
|
|
|
|
plus: true, |
|
|
|
|
reduce: false, |
|
|
|
|
StateName: 'Commercialcial', |
|
|
|
|
loading: false, |
|
|
|
|
}, |
|
|
|
|
]; |
|
|
|
|
{ |
|
|
|
|
index: 1, |
|
|
|
|
Warehousecategory: '', |
|
|
|
|
options: [], |
|
|
|
|
plus: true, |
|
|
|
|
reduce: false, |
|
|
|
|
StateName: 'Commercialcial', |
|
|
|
|
loading: false, |
|
|
|
|
}, |
|
|
|
|
]; |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
@ -948,20 +958,19 @@ const resetFormData = () => {
|
|
|
|
|
if ($route.query.id) { |
|
|
|
|
console.log(form.value.dispatchPricingType, 'form.value.dispatchPricingType'); |
|
|
|
|
form.value = await deepClone(formedit.value); |
|
|
|
|
if(ServiceList.value.length){ |
|
|
|
|
if (ServiceList.value.length) { |
|
|
|
|
ServiceList.value.forEach((res, index) => { |
|
|
|
|
console.log(res); |
|
|
|
|
|
|
|
|
|
if (form.value.dispatchPricingType.includes(res.value)) { |
|
|
|
|
console.log(res, '选中的'); |
|
|
|
|
res.check = true; |
|
|
|
|
} else { |
|
|
|
|
console.log(res, '未选中的'); |
|
|
|
|
res.check = false; |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
console.log(res); |
|
|
|
|
|
|
|
|
|
if (form.value.dispatchPricingType.includes(res.value)) { |
|
|
|
|
console.log(res, '选中的'); |
|
|
|
|
res.check = true; |
|
|
|
|
} else { |
|
|
|
|
console.log(res, '未选中的'); |
|
|
|
|
res.check = false; |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} else { |
|
|
|
|
clink(); |
|
|
|
|
Commercialcial.value = deepClone(CommercialcialCopy.value); |
|
|
|
@ -995,22 +1004,21 @@ const onLoad = async () => {
|
|
|
|
|
form.value.dispatchPricingType = request.value.dispatchPricingType |
|
|
|
|
? request.value.dispatchPricingType.split(',').map(Number) |
|
|
|
|
: []; //服务类型 |
|
|
|
|
if(ServiceList.value.length){ |
|
|
|
|
if (ServiceList.value.length) { |
|
|
|
|
ServiceList.value.forEach(dataItem => { |
|
|
|
|
if (form.value.dispatchPricingType.includes(dataItem.value)) { |
|
|
|
|
dataItem.check = true; |
|
|
|
|
if (dataItem.value == 1) { |
|
|
|
|
form.value.dispatchPieceCategoryState = true; //按件是否显示 |
|
|
|
|
} else if (dataItem.value == 2) { |
|
|
|
|
form.value.dispatchWeightCategoryState = true; //按重量是否显示 |
|
|
|
|
} else if (dataItem.value == 3) { |
|
|
|
|
form.value.dispatchCubeCategoryState = true; //按方是否显示 |
|
|
|
|
if (form.value.dispatchPricingType.includes(dataItem.value)) { |
|
|
|
|
dataItem.check = true; |
|
|
|
|
if (dataItem.value == 1) { |
|
|
|
|
form.value.dispatchPieceCategoryState = true; //按件是否显示 |
|
|
|
|
} else if (dataItem.value == 2) { |
|
|
|
|
form.value.dispatchWeightCategoryState = true; //按重量是否显示 |
|
|
|
|
} else if (dataItem.value == 3) { |
|
|
|
|
form.value.dispatchCubeCategoryState = true; //按方是否显示 |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
StateDelivery.value = true; //显示表格 |
|
|
|
|
form.value.dispatchPieceCategoryData = []; |
|
|
|
|
if (request.value.dispatchPieceCategory) { |
|
|
|
@ -1140,14 +1148,13 @@ const onLoad = async () => {
|
|
|
|
|
loading: false, |
|
|
|
|
}, |
|
|
|
|
]; |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
if (form.value.dispatchServiceType) { |
|
|
|
|
form.value.WarehousebillingmodeTitle = Warehousebillingmode.value.find( |
|
|
|
|
res => res.value == form.value.dispatchServiceType |
|
|
|
|
).label; |
|
|
|
|
} |
|
|
|
|
form.value.WarehousebillingmodeTitle = Warehousebillingmode.value.find( |
|
|
|
|
res => res.value == form.value.dispatchServiceType |
|
|
|
|
).label; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
formedit.value = await deepClone(form.value); |
|
|
|
|
pageLoading.value = false; |
|
|
|
@ -1194,87 +1201,86 @@ const handleSubmit = async () => {
|
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
form.value.serviceType = props.templateData.ServiceType.join(','); //顶部选择的服务类型 |
|
|
|
|
// 初始化数据 |
|
|
|
|
const Submit = deepClone(form.value); //拷贝一份要提交的数据 |
|
|
|
|
|
|
|
|
|
form.value.serviceType = props.templateData.ServiceType.join(','); //顶部选择的服务类型 |
|
|
|
|
// 初始化数据 |
|
|
|
|
const Submit = deepClone(form.value); //拷贝一份要提交的数据 |
|
|
|
|
|
|
|
|
|
Submit.dispatchPricingType = Submit.dispatchPricingType.join(','); //服务类型处理 |
|
|
|
|
|
|
|
|
|
// 选择了是否区分品类才进行处理数据 |
|
|
|
|
if (form.value.dispatchIsByCategory) { |
|
|
|
|
console.log('区分品类了'); |
|
|
|
|
if (!form.value.dispatchPricingType.includes(1)) { |
|
|
|
|
Submit.dispatchPieceCategory = ''; |
|
|
|
|
} else { |
|
|
|
|
if (form.value.dispatchPieceCategoryData.find(res => !res.Warehousecategory)) { |
|
|
|
|
ElMessage({ |
|
|
|
|
message: '请填写完整按件计费品类', |
|
|
|
|
type: 'warning', |
|
|
|
|
}); |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
Submit.dispatchPieceCategory = form.value.dispatchPieceCategoryData |
|
|
|
|
.map(res => res.Warehousecategory) |
|
|
|
|
.join(','); |
|
|
|
|
// dispatchPieceCategoryData 件 |
|
|
|
|
// dispatchWeightCategoryData 重量 |
|
|
|
|
// dispatchCubeCategoryData 方 |
|
|
|
|
} |
|
|
|
|
if (!form.value.dispatchPricingType.includes(2)) { |
|
|
|
|
Submit.dispatchWeightCategory = ''; |
|
|
|
|
} else { |
|
|
|
|
if (form.value.dispatchWeightCategoryData.find(res => !res.Warehousecategory)) { |
|
|
|
|
ElMessage({ |
|
|
|
|
message: '请填写完整按重量计费品类', |
|
|
|
|
type: 'warning', |
|
|
|
|
}); |
|
|
|
|
console.log(form.value.dispatchWeightCategoryData, 'cascasdasd=>>'); |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
Submit.dispatchWeightCategory = form.value.dispatchWeightCategoryData |
|
|
|
|
.map(res => res.Warehousecategory) |
|
|
|
|
.join(','); |
|
|
|
|
} |
|
|
|
|
if (!form.value.dispatchPricingType.includes(3)) { |
|
|
|
|
Submit.dispatchCubeCategory = ''; |
|
|
|
|
} else { |
|
|
|
|
if (form.value.dispatchCubeCategoryData.find(res => !res.Warehousecategory)) { |
|
|
|
|
ElMessage({ |
|
|
|
|
message: '请填写完整按方计费品类', |
|
|
|
|
type: 'warning', |
|
|
|
|
}); |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
Submit.dispatchPricingType = Submit.dispatchPricingType.join(','); //服务类型处理 |
|
|
|
|
|
|
|
|
|
Submit.dispatchCubeCategory = form.value.dispatchCubeCategoryData |
|
|
|
|
.map(res => res.Warehousecategory) |
|
|
|
|
.join(','); |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
// 选择了是否区分品类才进行处理数据 |
|
|
|
|
if (form.value.dispatchIsByCategory) { |
|
|
|
|
console.log('区分品类了'); |
|
|
|
|
if (!form.value.dispatchPricingType.includes(1)) { |
|
|
|
|
Submit.dispatchPieceCategory = ''; |
|
|
|
|
Submit.dispatchWeightCategory = ''; |
|
|
|
|
Submit.dispatchCubeCategory = ''; |
|
|
|
|
} else { |
|
|
|
|
if (form.value.dispatchPieceCategoryData.find(res => !res.Warehousecategory)) { |
|
|
|
|
ElMessage({ |
|
|
|
|
message: '请填写完整按件计费品类', |
|
|
|
|
type: 'warning', |
|
|
|
|
}); |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
Submit.dispatchPieceCategory = form.value.dispatchPieceCategoryData |
|
|
|
|
.map(res => res.Warehousecategory) |
|
|
|
|
.join(','); |
|
|
|
|
// dispatchPieceCategoryData 件 |
|
|
|
|
// dispatchWeightCategoryData 重量 |
|
|
|
|
// dispatchCubeCategoryData 方 |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// 附加费是否按品类计费选择了是才进行处理 |
|
|
|
|
if (form.value.dispatchIsCategorySubjoin) { |
|
|
|
|
Submit.dispatchSubjoinCategory = form.value.dispatchSubjoinCategoryData |
|
|
|
|
if (!form.value.dispatchPricingType.includes(2)) { |
|
|
|
|
Submit.dispatchWeightCategory = ''; |
|
|
|
|
} else { |
|
|
|
|
if (form.value.dispatchWeightCategoryData.find(res => !res.Warehousecategory)) { |
|
|
|
|
ElMessage({ |
|
|
|
|
message: '请填写完整按重量计费品类', |
|
|
|
|
type: 'warning', |
|
|
|
|
}); |
|
|
|
|
console.log(form.value.dispatchWeightCategoryData, 'cascasdasd=>>'); |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
Submit.dispatchWeightCategory = form.value.dispatchWeightCategoryData |
|
|
|
|
.map(res => res.Warehousecategory) |
|
|
|
|
.join(','); //附加费品类 |
|
|
|
|
.join(','); |
|
|
|
|
} |
|
|
|
|
if (!form.value.dispatchPricingType.includes(3)) { |
|
|
|
|
Submit.dispatchCubeCategory = ''; |
|
|
|
|
} else { |
|
|
|
|
if (Submit.dispatchSubjoinCategory) { |
|
|
|
|
Submit.dispatchSubjoinCategory = ''; |
|
|
|
|
if (form.value.dispatchCubeCategoryData.find(res => !res.Warehousecategory)) { |
|
|
|
|
ElMessage({ |
|
|
|
|
message: '请填写完整按方计费品类', |
|
|
|
|
type: 'warning', |
|
|
|
|
}); |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
Submit.dispatchCubeCategory = form.value.dispatchCubeCategoryData |
|
|
|
|
.map(res => res.Warehousecategory) |
|
|
|
|
.join(','); |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
Submit.dispatchPieceCategory = ''; |
|
|
|
|
Submit.dispatchWeightCategory = ''; |
|
|
|
|
Submit.dispatchCubeCategory = ''; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// 附加费是否按品类计费选择了是才进行处理 |
|
|
|
|
if (form.value.dispatchIsCategorySubjoin) { |
|
|
|
|
Submit.dispatchSubjoinCategory = form.value.dispatchSubjoinCategoryData |
|
|
|
|
.map(res => res.Warehousecategory) |
|
|
|
|
.join(','); //附加费品类 |
|
|
|
|
} else { |
|
|
|
|
if (Submit.dispatchSubjoinCategory) { |
|
|
|
|
Submit.dispatchSubjoinCategory = ''; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
console.log(Submit, '要提交的数据'); |
|
|
|
|
ElMessageBox.confirm('是否保存?', '提示', { |
|
|
|
|
console.log(Submit, '要提交的数据'); |
|
|
|
|
ElMessageBox.confirm('是否保存?', '提示', { |
|
|
|
|
confirmButtonText: '确定', |
|
|
|
|
cancelButtonText: '取消', |
|
|
|
|
type: 'warning', |
|
|
|
|
}).then(async () => { |
|
|
|
|
pageLoading.value=true |
|
|
|
|
pageLoading.value = true; |
|
|
|
|
if (props.templateData.code || $route.query.id) { |
|
|
|
|
console.log('走编辑接口'); |
|
|
|
|
// 编辑接口 |
|
|
|
@ -1283,39 +1289,45 @@ const handleSubmit = async () => {
|
|
|
|
|
...Submit, |
|
|
|
|
checkType: 4, //服务类型 |
|
|
|
|
}; |
|
|
|
|
$_putpriceTemplate(data).then(res => { |
|
|
|
|
console.log(res, '提交成功后返回值'); |
|
|
|
|
if (res.data.code == 200) { |
|
|
|
|
ElMessage({ |
|
|
|
|
message: res.data.msg, |
|
|
|
|
type: 'success', |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
}).catch(res=>{ |
|
|
|
|
console.log(res,'错误信息'); |
|
|
|
|
}).finally(()=>{ |
|
|
|
|
pageLoading.value=false |
|
|
|
|
}); |
|
|
|
|
$_putpriceTemplate(data) |
|
|
|
|
.then(res => { |
|
|
|
|
console.log(res, '提交成功后返回值'); |
|
|
|
|
if (res.data.code == 200) { |
|
|
|
|
ElMessage({ |
|
|
|
|
message: res.data.msg, |
|
|
|
|
type: 'success', |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
.catch(res => { |
|
|
|
|
console.log(res, '错误信息'); |
|
|
|
|
}) |
|
|
|
|
.finally(() => { |
|
|
|
|
pageLoading.value = false; |
|
|
|
|
}); |
|
|
|
|
} else { |
|
|
|
|
// 新增接口 |
|
|
|
|
let data = { |
|
|
|
|
...Submit, |
|
|
|
|
}; |
|
|
|
|
console.log('走新增接口'); |
|
|
|
|
$_priceTemplate(data).then(res => { |
|
|
|
|
console.log(res, '提交成功后返回值'); |
|
|
|
|
if (res.data.code == 200) { |
|
|
|
|
ElMessage({ |
|
|
|
|
message: res.data.msg, |
|
|
|
|
type: 'success', |
|
|
|
|
}); |
|
|
|
|
emit('request-data', res.data.data); //把获取到的数据传递给父页面 |
|
|
|
|
} |
|
|
|
|
}).catch(res=>{ |
|
|
|
|
console.log(res,'错误信息'); |
|
|
|
|
}).finally(()=>{ |
|
|
|
|
pageLoading.value=false |
|
|
|
|
});; |
|
|
|
|
$_priceTemplate(data) |
|
|
|
|
.then(res => { |
|
|
|
|
console.log(res, '提交成功后返回值'); |
|
|
|
|
if (res.data.code == 200) { |
|
|
|
|
ElMessage({ |
|
|
|
|
message: res.data.msg, |
|
|
|
|
type: 'success', |
|
|
|
|
}); |
|
|
|
|
emit('request-data', res.data.data); //把获取到的数据传递给父页面 |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
.catch(res => { |
|
|
|
|
console.log(res, '错误信息'); |
|
|
|
|
}) |
|
|
|
|
.finally(() => { |
|
|
|
|
pageLoading.value = false; |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
}; |
|
|
|
|