diff --git a/src/views/aftersales/aftersalesWorkOrder.vue b/src/views/aftersales/aftersalesWorkOrder.vue index 61025c5a..db3680c7 100644 --- a/src/views/aftersales/aftersalesWorkOrder.vue +++ b/src/views/aftersales/aftersalesWorkOrder.vue @@ -103,7 +103,7 @@ type="primary" @click="exportReport" > - 导出报表EXCEL导出 地 图 取消配送 @@ -808,13 +808,16 @@ export default { getDriverList().then(res => { const data = res.data.data; let po = []; - data.forEach(item => { + if(data && data.length){ + data.forEach(item => { let a = { dictKey: item.id, dictValue: item.name, }; po.push(a); }); + } + this.driverData = po; console.log('===============>', res.data.data); rv(res.data.data); @@ -871,6 +874,14 @@ export default { }, // 取消配送 CancelDelivery(scope) { + if(!JSON.parse(localStorage.getItem('my_data'))){ + ElMessage({ + message: '请选择仓库!', + type: 'warning', + }) + return + } + console.log(scope, 'scope'); let data = { deliveryId: scope.row.id, @@ -1114,6 +1125,14 @@ export default { this.box = true; }, handleEdit(scope) { + if(!JSON.parse(localStorage.getItem('my_data'))){ + ElMessage({ + message: '请选择仓库!', + type: 'warning', + }) + return + } + const { row } = scope; this.$store.commit('DEL_ONCE_TAG', 'deliveryDiscuss'); this.$router.push({ diff --git a/src/views/distribution/deliverylist/distributionDeliveryListedt.vue b/src/views/distribution/deliverylist/distributionDeliveryListedt.vue index aac81c05..42a5104c 100644 --- a/src/views/distribution/deliverylist/distributionDeliveryListedt.vue +++ b/src/views/distribution/deliverylist/distributionDeliveryListedt.vue @@ -510,8 +510,10 @@ > { console.log('row', row); console.log('deliveryId', this.deliveryId); console.log('reservationId', this.wid); @@ -4366,13 +4379,20 @@ export default { type: 1, packageIds: row.id, }; - + this.loading=true cancelReservationPackage(data).then(res => { if (res.data.code === 200) { + this.$message.success(res.data.msg); this.getWrapdetails(this.page); } + }).catch(()=>{ + this.loading=false }); + }) + + + }, ViewingTrajectories(val) { this.$router.push({ @@ -4400,14 +4420,23 @@ export default { this.getReservationInventoryPackageListInfo(this.page); } }) - .catch(res => {}) - .finally(() => { - this.loading = false; - }); + .catch(res => { this.loading = false;}) + }) .catch(() => {}); }, signingReservationPackage(row) { + ElMessageBox.confirm( + '是否确认签收?', + '提示', + { + confirmButtonText: '确认', + cancelButtonText: '取消', + type: 'warning', + } + ) + .then(() => { + this.loading=true console.log('row', row); console.log('wid', this.wid); console.log('deliveryId', this.deliveryId); @@ -4420,12 +4449,18 @@ export default { deliverySign(data).then(res => { console.log('res>>>>>>>>>>>>>>>>>>>>>>>', res); if (res.data.code === 200) { + this.$message.success(res.data.msg); this.getWrapdetails(this.page); } - }); - // this.$message.warning('功能维护中...'); - // return; + }).catch(res=>{ + this.loading=false + }) + }) + + + + }, signingReservationInventoryPackage(row) { console.log('row', row); diff --git a/src/views/distribution/reservation/reservationAddFrom.vue b/src/views/distribution/reservation/reservationAddFrom.vue index 61472a58..e6c2772e 100644 --- a/src/views/distribution/reservation/reservationAddFrom.vue +++ b/src/views/distribution/reservation/reservationAddFrom.vue @@ -493,6 +493,7 @@ import { getReservationInfo, getReservationZeroOrderDetail, getReservationPackageListByOrderId, + cancelReservation, } from '@/api/distribution/distributionReservation'; import { getStockArticleList, @@ -503,6 +504,7 @@ import { updateClient, $_updateBatchClient, } from '@/api/distribution/distributionStockArticle'; + import { getDetailDelivery } from '@/api/distribution/distributionDelivery'; import { getInventoryList, selectInventoryDetail } from '@/api/distribution/distributionStockList'; import option from '@/option/distribution/distributionStockArticle'; @@ -512,6 +514,7 @@ import dayjs from 'dayjs'; import { entryNum, updateEntryNum } from '@/api/distribution/distributionParcelNumber'; import { setNodeHeight, removeZeroWidth } from '@/utils/util.js'; import { ElMessage, ElMessageBox } from 'element-plus' +import error from '@/error'; export default { name: '/distribution/reservation/reservationAddFrom', data() { @@ -2556,9 +2559,7 @@ this.$refs.ruleForm.validate(async valid => { return; } } - // 开启提交按钮loading - this.loadingObj.submitBtnLoading = true; - this.reservationloading = true; //开启全屏加载 + // 日期必填 if (!this.form.reservationDate) { this.$message({ @@ -2644,8 +2645,72 @@ this.$refs.ruleForm.validate(async valid => { // this.form.stockArticleList = this.packageList; console.log('>>>>>>>>', this.form); if (this.reservationId) { - this.form.id = this.reservationId; - const res = await update(this.form); +// 判断是否都没有选择包件 +const checkInfoValues = this.form.stockArticleList.every(item => !item.packageListInfo || !item.packageListInfo.length); +if(checkInfoValues){ +ElMessageBox.prompt('当前所有订单都没有选择包件是否确认"取消本次计划"?', '请填写取消原因', { + confirmButtonText: '确认', + cancelButtonText: '关闭', + inputPattern: /^\S+$/, + inputErrorMessage: '请填写取消原因', + }) + .then((value) => { + let data={ + cancelReason:value.value, + id:this.$route.query.reservationId + } + this.reservationloading=true + cancelReservation(data).then(res=>{ + console.log(res); + if(res.data.code ==200){ + ElMessage({ + message: res.data.msg, + type: 'success', + }) + this.$router.push('/distribution/reservation/reservation'); + this.$store.commit('DEL_TAG_CURRENT'); + } + + }).catch((error)=>{ + this.reservationloading=false + console.log(error); + }) + console.log(data,'要提交的数据'); + }) + .catch(() => { + + }) + +}else{ + for(let i=0;i< this.form.stockArticleList.length;i++){ + if(!this.form.stockArticleList[i].packageListInfo || !this.form.stockArticleList[i].packageListInfo.length ){ + ElMessageBox.confirm( + `订单自编号:${this.form.stockArticleList[i].orderCode}没有选择包件是否移除!`, + '提示', + { + confirmButtonText: '确认', + cancelButtonText: '取消', + type: 'warning', + } + ) + .then(() => { + this.renderOrderData.splice(i, 1); + this.form.stockArticleList.splice(i,1) + }) + .catch(() => { + + }) + return + } + } + +} + // 开启提交按钮loading + this.loadingObj.submitBtnLoading = true; + this.reservationloading = true; //开启全屏加载 + this.form.id = this.reservationId; + + const res = await update(this.form); console.log('res :>> ', res); if (res.data.code !== 200) return; this.$message({ @@ -2654,6 +2719,9 @@ this.$refs.ruleForm.validate(async valid => { }); this.back(); } else { + // 开启提交按钮loading + this.loadingObj.submitBtnLoading = true; + this.reservationloading = true; //开启全屏加载 this.form.reservationStatus = '20'; const res = await autonomouslySave(this.form); console.log('res :>> ', res); @@ -3372,7 +3440,14 @@ console.log(this.orderList,''); this.form.collectionFee = 0; this.form.isUrgent = '1'; // this.form.reservationDate = new Date(); + + if (this.orderIds) { + this.reservationloading=true + if(res.data.code !==200){ + this.reservationloading=false + return + } getStockArticleList(this.orderIds).then(res => { console.log(res.data.data); const data = res.data.data; @@ -3396,11 +3471,18 @@ console.log(this.orderList,''); this.form.deliveryAddress = address; this.orderData = data; this.renderOrderData = [...this.orderData]; - }); + this.reservationloading=false + + }) } if (this.reservationId) { + this.reservationloading=true this.inventoryShow = true; getReservationInfo(this.reservationId).then(res => { + if(res.data.code !==200){ + this.reservationloading=false + return + } const reservation = res.data.data; const stockArticleListInfo = res.data.data.stockArticleList; // stockArticleListInfo.forEach(item=>{ @@ -3426,7 +3508,8 @@ console.log(this.orderList,''); }); } this.form = reservation; - }); + this.reservationloading=false + }) } else { this.form.deliveryType = '2'; } diff --git a/src/views/distribution/stockup/distributionStockupSelf.vue b/src/views/distribution/stockup/distributionStockupSelf.vue index 7cfadcc7..ea13e105 100644 --- a/src/views/distribution/stockup/distributionStockupSelf.vue +++ b/src/views/distribution/stockup/distributionStockupSelf.vue @@ -141,7 +141,7 @@ - + { 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; + }); } }); };