diff --git a/src/components/pric/tablePric.vue b/src/components/pric/tablePric.vue index f4fb0ecf..94d59aff 100644 --- a/src/components/pric/tablePric.vue +++ b/src/components/pric/tablePric.vue @@ -15,6 +15,7 @@ :min="0" :max="999999" :controls="false" + :value-on-clear="0" placeholder="请输入价格" /> @@ -31,6 +32,7 @@ :loading=scope.row.loading loading-text='正在查询中...' @focus="categoriesSearchfocus(column, scope.row)" + :disabled=column.show > + + diff --git a/src/views/Pricesystem/Price/PriceDelivery.vue b/src/views/Pricesystem/Price/PriceDelivery.vue index 32a0d829..b83d677f 100644 --- a/src/views/Pricesystem/Price/PriceDelivery.vue +++ b/src/views/Pricesystem/Price/PriceDelivery.vue @@ -1,242 +1,135 @@ @@ -379,6 +420,7 @@ import { putBasicdataPrice } from '@/api/Pricesystem/index'; import { useRoute } from 'vue-router'; import { deepClone } from '@/utils/util'; import { getDictionaryBiz } from '@/api/system/dict'; //字典 +import { ElMessage, ElMessageBox } from 'element-plus'; const $route = useRoute(); //获取地址栏参数 const emit = defineEmits(['request-data']); defineComponent({ @@ -394,11 +436,35 @@ const requestInfo = ref({}); //价格回显 const request = ref({}); const Warehousebillingmode = ref([]); //服务类型 const pricevehicle = ref([]); //车型 +const loading = ref(true); +const formCopy = ref({}); //重置对象 const form = ref({ + kilometerCost: 0, //按公里计费 + tonKilometerCost: 0, //按吨公里计费 + tonCost: 0, //按吨计费 + handlingPrice: 0, //装卸费 + relocationPrice: 0, //平移费 + sortPrice: 0, //分货费 + upstairsDeliveryPrice: 0, //上楼费 + dispatchStairsCarryingCharge: 0, //上楼费免费楼层 + additionalCost: 0, //加算价格 + leaveBehindAdditionalCost: 0, //遗留加算 + dispatchUpwardJudgment: 0, //向上判断件数 + dispatchUpwardJudgmentCost: 0, //向上判断加价 + pieceCategoryInput: 0, //按件统一计费 + weightCategoryInput: 0, //按重量 + cubeCategoryInput: 0, //按方 // 按件计费 pieceCategory: [ { label: '序号', prop: 'index', type: 'string', width: '78', disabled: true }, - { label: '产品品类', prop: 'categoryId', type: 'select', width: 'auto', disabled: true }, + { + label: '产品品类', + prop: 'categoryId', + type: 'select', + width: 'auto', + disabled: true, + show: true, + }, { label: '单价(元/件)', prop: 'price', @@ -420,7 +486,14 @@ const form = ref({ // 按方品类计费 cubeCategory: [ { label: '序号', prop: 'index', type: 'string', width: '78', disabled: true }, - { label: '产品品类', prop: 'categoryId', type: 'select', width: 'auto', disabled: true }, + { + label: '产品品类', + prop: 'categoryId', + type: 'select', + width: 'auto', + disabled: true, + show: true, + }, { label: '单价(元/m³)', prop: 'price', type: 'number', width: 'auto', disabled: true }, { label: '遗留单价(元/m³)', @@ -435,7 +508,14 @@ const form = ref({ // 按重量品类计费 weightCategory: [ { label: '序号', prop: 'index', type: 'string', width: '78', disabled: true }, - { label: '产品品类', prop: 'categoryId', type: 'select', width: 'auto', disabled: true }, + { + label: '产品品类', + prop: 'categoryId', + type: 'select', + width: 'auto', + disabled: true, + show: true, + }, { label: '单价(元/kg)', prop: 'price', type: 'number', width: 'auto', disabled: true }, { label: '遗留单价(元/kg)', @@ -517,7 +597,7 @@ const form = ref({ width: 'auto', disabled: true, }, - { label: '操作', prop: '', type: '', width: '130', disabled: true }, + { label: '操作', prop: '', type: '', width: 'auto', disabled: true }, ], // 附加费品类 @@ -529,6 +609,7 @@ const form = ref({ type: 'select', width: 'auto', disabled: true, + show: true, }, { label: '操作/装卸费(元/件)', @@ -575,69 +656,59 @@ const form = ref({ Minimumbilling: [ { label: '最低计费价格', - input: 0, disabled: true, index: 1, + minCost: 0, //价格 }, { label: '最低计费件数', - input: 0, disabled: true, index: 2, + minCost: 0, //价格 }, { label: '最低计费方数', - input: 0, disabled: true, index: 3, + minCost: 0, //价格 }, { label: '最低计费重量', - input: 0, disabled: true, index: 4, - }, - { - label: '加算价格', - input: 0, - disabled: true, + minCost: 0, //价格 }, ], // 最低级计费遗留 Minimumlegacy: [ { label: '遗留件低于最低件数收费(元)', - input: 0, index: 1, disabled: true, + leaveBehindMinCost: 0, //价格 }, { label: '遗留件最最低计费件数', - input: 0, index: 2, disabled: true, + leaveBehindMinCost: 0, //价格 }, { label: '遗留件最低计费方数', - input: 0, index: 3, disabled: true, + leaveBehindMinCost: 0, //价格 }, { label: '遗留件最低计费重量', - input: 0, index: 4, disabled: true, - }, - { - label: '遗留加算', - input: 0, - disabled: true, + leaveBehindMinCost: 0, //价格 }, ], }); -function updateDictionary(targetArray, dictionaryType) { - getDictionaryBiz(dictionaryType) +async function updateDictionary(targetArray, dictionaryType) { + await getDictionaryBiz(dictionaryType) .then(res => { console.log(res, '字典'); if (res.data.code == 200) { @@ -655,7 +726,24 @@ function updateDictionary(targetArray, dictionaryType) { .catch(() => {}) .finally(() => {}); } - +// 重置表单 +const resetFormData = () => { + ElMessageBox.confirm('是否重置数据?', '提示', { + confirmButtonText: '确定', + cancelButtonText: '取消', + type: 'warning', + }).then(() => { + loading.value = true; + form.value = deepClone(formCopy.value); + setTimeout(() => { + loading.value = false; + ElMessage({ + message: '重置成功', + type: 'success', + }); + }, 300); + }); +}; // 移除对象 function removeItemById(array, id) { const index = array.findIndex(item => item.index === id); @@ -666,7 +754,7 @@ function removeItemById(array, id) { }); } } -function addItemAfterId(array) { +async function addItemAfterId(array) { console.log(array); const newItem = { index: array.length + 1, // 新对象的 ID 为当前数组长度加 1 @@ -677,10 +765,11 @@ function addItemAfterId(array) { price: 0, //价格 options: pricevehicle.value, //选择框列表 }; - array.push(newItem); + await array.push(newItem); } // 仓储减 const storagereduce = id => { + console.log(id, 'id'); removeItemById(form.value.fullVehicleData, id); //传入配置项和对应的ID }; @@ -688,9 +777,6 @@ const storagereduce = id => { const storageplus = data => { addItemAfterId(form.value.fullVehicleData); }; -// const display=computed(()=>{ - -// }) const billing = async () => { // 服务类型转换为数字数组 @@ -736,46 +822,54 @@ const onLoad = async () => { ? request.value.dispatchPricingType.split(',').map(Number) : []; //服务类型 billing(); //显示条件 - addItemAfterId(form.value.fullVehicleData); //整车计费(缺少判断) - // 缺少判断 - // 按件品类计费 - if (form.value.dispatchPricingType.includes(1)) { - request.value.dispatchPieceCategorys.forEach((item, index) => { - form.value.pieceCategoryData.push({ - index: index + 1, - categoryId: item.id, //品类 - price: 0, //价格 - leaveBehindPrice: 0, //遗留单价 - options: [{ label: item.name, value: item.id }], - }); - }); + if (form.value.dispatchPricingType.includes(4)) { + addItemAfterId(form.value.fullVehicleData); } - // 按方计费 - if (form.value.dispatchPricingType.includes(3)) { - request.value.dispatchCubeCategorys.forEach((item, index) => { - form.value.cubeCategoryData.push({ - index: index + 1, - categoryId: item.id, //品类 - price: 0, //价格 - leaveBehindPrice: 0, //遗留单价 - options: [{ label: item.name, value: item.id }], + + // 按件品类计费 + if (request.value.dispatchIsByCategory) { + if (form.value.dispatchPricingType.includes(1)) { + if (request.value.dispatchPieceCategorys && request.value.dispatchPieceCategorys.length) { + request.value.dispatchPieceCategorys.forEach((item, index) => { + form.value.pieceCategoryData.push({ + index: index + 1, + categoryId: item.id, //品类 + price: 0, //价格 + leaveBehindPrice: 0, //遗留单价 + options: [{ label: item.name, value: item.id }], + }); + }); + } + } + // 按方计费 + if (form.value.dispatchPricingType.includes(3)) { + request.value.dispatchCubeCategorys.forEach((item, index) => { + form.value.cubeCategoryData.push({ + index: index + 1, + categoryId: item.id, //品类 + price: 0, //价格 + leaveBehindPrice: 0, //遗留单价 + options: [{ label: item.name, value: item.id }], + }); }); - }); - } - // 按重量 - if (form.value.dispatchPricingType.includes(3)) { - request.value.dispatchWeightCategorys.forEach((item, index) => { - form.value.weightCategoryData.push({ - index: index + 1, - categoryId: item.id, //品类 - price: 0, //价格 - leaveBehindPrice: 0, //遗留单价 - options: [{ label: item.name, value: item.id }], + } + // 按重量 + if (form.value.dispatchPricingType.includes(3)) { + request.value.dispatchWeightCategorys.forEach((item, index) => { + form.value.weightCategoryData.push({ + index: index + 1, + categoryId: item.id, //品类 + price: 0, //价格 + leaveBehindPrice: 0, //遗留单价 + options: [{ label: item.name, value: item.id }], + }); }); - }); + } + } else { } + console.log(request.value, ' request.value'); - // 附加费品类(缺少if) + // 附加费品类 if (request.value.dispatchSubjoinCategorys && request.value.dispatchSubjoinCategorys.length) { request.value.dispatchSubjoinCategorys.forEach((item, index) => { form.value.additionalCategoryData.push({ @@ -797,7 +891,7 @@ const onLoad = async () => { // 最低计费等级 console.log(form.value.Minimumbilling, 'Minimumbilling'); - console.log(request.dispatchMinCostType); + console.log(request.value.dispatchMinCostType); form.value.Minimumbilling.forEach(res => { if (res.index == request.value.dispatchMinCostType) { res.disabled = true; @@ -805,81 +899,397 @@ const onLoad = async () => { res.disabled = false; } }); - if(request.dispatchMinCostType !=1){ - form.value.Minimumbilling.find(res=>res.label=='加算价格').disabled=true - } + // if (request.value.dispatchMinCostType != 1) { + // form.value.Minimumbilling.find(res => res.label == '加算价格').disabled = true; + // console.log('有加算价格'); + // } else { + // form.value.Minimumbilling.find(res => res.label == '加算价格').disabled = false; + // console.log('加算价格没有'); + // } // 遗留控制 - form.value.Minimumlegacy.forEach(res => { + form.value.Minimumlegacy.forEach(res => { if (res.index == request.value.dispatchMinCostType) { res.disabled = true; } else { res.disabled = false; } }); - if(request.dispatchMinCostType !=1){ - form.value.Minimumlegacy.find(res=>res.label=='遗留加算').disabled=true + + // 附加费用 + // 是否有操作/装卸费 + if (!request.value.dispatchIsOperateFee) { + form.value.additionalCategory.find(res => res.prop === 'handlingPrice').disabled = false; + } else { + form.value.additionalCategory.find(res => res.prop === 'handlingPrice').disabled = true; + } + // 是否有上楼费 + if (!request.value.dispatchIsStairsCarryingCharge) { + form.value.additionalCategory.find( + res => res.prop === 'upstairsDeliveryPrice' + ).disabled = false; + } else { + form.value.additionalCategory.find( + res => res.prop === 'upstairsDeliveryPrice' + ).disabled = true; + } + // 是否有分货费 + + if (!request.value.dispatchIsSortFee) { + form.value.additionalCategory.find(res => res.prop === 'sortPrice').disabled = false; + } else { + form.value.additionalCategory.find(res => res.prop === 'sortPrice').disabled = true; + } + // 是否有平移费 + if (!request.value.dispatchIsShiftingCharge) { + form.value.additionalCategory.find(res => res.prop === 'relocationPrice').disabled = false; + } else { + form.value.additionalCategory.find(res => res.prop === 'relocationPrice').disabled = true; } + // (品类计费按件)是否有遗留 + if (!request.value.dispatchIsLeaveBehind) { + form.value.pieceCategory.find(res => res.prop === 'leaveBehindPrice').disabled = false; + } else { + form.value.pieceCategory.find(res => res.prop === 'leaveBehindPrice').disabled = true; + } + + // (品类计费按方)是否有遗留 + if (!request.value.dispatchIsLeaveBehind) { + form.value.cubeCategory.find(res => res.prop === 'leaveBehindPrice').disabled = false; + } else { + form.value.cubeCategory.find(res => res.prop === 'leaveBehindPrice').disabled = true; + } + // (品类计费重量)是否有遗留 + if (!request.value.dispatchIsLeaveBehind) { + form.value.weightCategory.find(res => res.prop === 'leaveBehindPrice').disabled = false; + } else { + form.value.weightCategory.find(res => res.prop === 'leaveBehindPrice').disabled = true; + } + + // if (request.value.dispatchMinCostType != 1) { + // form.value.Minimumlegacy.find(res => res.label == '遗留加算').disabled = true; + // } else { + // form.value.Minimumlegacy.find(res => res.label == '遗留加算').disabled = false; + // } + } + if (Object.keys(props.templateData.requestInfo).length > 0) { + if (props.templateData.requestInfo.dispatch) { + requestInfo.value = await deepClone(props.templateData.requestInfo.dispatch); + // 是否区分品类 + if (request.value.dispatchIsByCategory) { + // 按件品类计费 + if (form.value.dispatchPricingType.includes(1) && form.value.pieceCategoryData.length) { + requestInfo.value.pieceCategory.forEach(item => { + let data = form.value.pieceCategoryData.find(res => res.categoryId == item.categoryId); + if (data) { + data.leaveBehindPrice = item.leaveBehindPrice || 0; + data.price = item.price || 0; + } + }); + } + + if (form.value.dispatchPricingType.includes(2) && form.value.weightCategoryData.length) { + // 按重量品类计费 + requestInfo.value.weightCategory.forEach(item => { + let data = form.value.weightCategoryData.find(res => res.categoryId == item.categoryId); + if (data) { + data.leaveBehindPrice = item.leaveBehindPrice || 0; // 遗留单价 + data.price = item.price || 0; //单价 + } + }); + } + + if (form.value.dispatchPricingType.includes(3) && form.value.cubeCategoryData.length) { + // 按方品类计费 + + requestInfo.value.cubeCategory.forEach(item => { + let data = form.value.cubeCategoryData.find(res => res.categoryId == item.categoryId); + if (data) { + data.leaveBehindPrice = item.leaveBehindPrice || 0; // 遗留单价 + data.price = item.price || 0; //单价 + } + }); + } + } else { + // 按件品类计费 + if (form.value.dispatchPricingType.includes(1)) { + let data = requestInfo.value.pieceCategory[0] || []; + form.value.pieceCategoryInput = data.price || 0; + } + + if (form.value.dispatchPricingType.includes(2)) { + // 按重量品类计费 + let data = requestInfo.value.weightCategory[0] || []; + form.value.weightCategoryInput = data.price || 0; + } + if (form.value.dispatchPricingType.includes(3)) { + // 按方品类计费 + let data = requestInfo.value.cubeCategory[0] || []; + form.value.cubeCategoryInput = data.price || 0; + } + } + // 按公里 + if (form.value.dispatchPricingType.includes(7)) { + form.value.kilometerCost = requestInfo.value.kilometerCost[0].price || 0; + } + //按吨公里 + if (form.value.dispatchPricingType.includes(6)) { + form.value.tonKilometerCost = requestInfo.value.tonKilometerCost[0].price || 0; + } + //按吨 + if (form.value.dispatchPricingType.includes(8)) { + form.value.tonCost = requestInfo.value.tonCost[0].price || 0; + } + //按整车 + if (form.value.dispatchPricingType.includes(4)) { + form.value.fullVehicleData = []; + requestInfo.value.fullVehicle.forEach((item, index) => { + form.value.fullVehicleData.push({ + index: index + 1, + loading: false, + options: pricevehicle.value, + plus: true, + price: item.price || 0, + vehicleType: item.vehicleType, + }); + }); + } + + // 附加费用 + if (request.value.dispatchIsCategorySubjoin) { + requestInfo.value.additionalCategory.forEach(item => { + let data = form.value.additionalCategoryData.find( + res => res.categoryId == item.categoryId + ); + if (data) { + data.handlingPrice = item.handlingPrice || 0; + data.relocationPrice = item.relocationPrice || 0; + data.sortPrice = item.sortPrice || 0; + data.upstairsDeliveryPrice = item.upstairsDeliveryPrice || 0; + } + }); + } else { + const data = requestInfo.value.additionalCategory[0]; + console.log(data, 'data===>'); + form.value.handlingPrice = data.handlingPrice || 0; + form.value.relocationPrice = data.relocationPrice || 0; + form.value.sortPrice = data.sortPrice || 0; + form.value.upstairsDeliveryPrice = data.upstairsDeliveryPrice || 0; + } + // 上楼费免费楼层(缺少判断) + form.value.dispatchStairsCarryingCharge = requestInfo.value.dispatchStairsCarryingCharge; + // 最低计费 + if (request.value.dispatchIsMinCost) { + form.value.Minimumbilling.find(res => res.disabled).minCost = + requestInfo.value.minCost || 0; + + // 遗留最低计费 + form.value.Minimumlegacy.find(res => res.disabled).leaveBehindMinCost = + requestInfo.value.leaveBehindMinCost || 0; + + // 加算价格 + if (request.value.dispatchMinCostType == 1) { + // 最低加算价格 + form.value.additionalCost = requestInfo.value.additionalCost || 0; + // 遗留加算价格 + form.value.leaveBehindAdditionalCost = requestInfo.value.leaveBehindAdditionalCost || 0; + } + } + // 是否向上判断 + if (request.value.dispatchIsUpwardJudgment) { + form.value.dispatchUpwardJudgment = requestInfo.value.dispatchUpwardJudgment || 0; //向上判断件数 + form.value.dispatchUpwardJudgmentCost = requestInfo.value.dispatchUpwardJudgmentCost || 0; //向上判断加价 + } + } } + +let setTime = setTimeout(()=>{ + formCopy.value = deepClone(form.value); + loading.value = false; + clearTimeout(setTime); + },500) + }; onLoad(); -const btn = () => { - console.log(form.value); -}; -const view = val => { - console.log(val); -}; -const handleSubmit=()=>{ - let data={ +// 提交信息 +const handleSubmit = () => { + loading.value = true; + let data = { checkType: '4', id: $route.query.id, - dispatch:{ - pieceCategory:[],// 按件品类计费 - cubeCategory:[],//按方品类计费 - weightCategory:[],//按重量品类计费 - tonKilometerCost:[],//按公里计费 + dispatch: { + pieceCategory: [], // 按件品类计费 + cubeCategory: [], //按方品类计费 + weightCategory: [], //按重量品类计费 + tonKilometerCost: [], //按公里计费 + kilometerCost: [], //按公里品类计费 + tonKilometerCost: [], //按吨公里计费 + tonCost: [], //按吨计费 + fullVehicle: [], //整车计费 + additionalCategory: [], //附加费品类 + }, + }; + // 是否区分品类 + if (request.value.dispatchIsByCategory) { + console.log('区分品类'); + // 按件品类计费 + if (form.value.dispatchPricingType.includes(1) && form.value.pieceCategoryData.length) { + form.value.pieceCategoryData.forEach(item => { + data.dispatch['pieceCategory'].push({ + categoryId: item.categoryId, //品类id + leaveBehindPrice: item.leaveBehindPrice, // 遗留单价 + price: item.price, //单价 + }); + }); + } + + if (form.value.dispatchPricingType.includes(2) && form.value.weightCategoryData.length) { + // 按重量品类计费 + form.value.weightCategoryData.forEach(item => { + data.dispatch['weightCategory'].push({ + categoryId: item.categoryId, //品类id + leaveBehindPrice: item.leaveBehindPrice, // 遗留单价 + price: item.price, //单价 + }); + }); + } + + if (form.value.dispatchPricingType.includes(3) && form.value.cubeCategoryData.length) { + // 按方品类计费 + form.value.cubeCategoryData.forEach(item => { + data.dispatch['cubeCategory'].push({ + categoryId: item.categoryId, //品类id + leaveBehindPrice: item.leaveBehindPrice, // 遗留单价 + price: item.price, //单价 + }); + }); + } + } else { + // 按件统一计费 + if (form.value.dispatchPricingType.includes(1)) { + data.dispatch['pieceCategory'].push({ + price: form.value.pieceCategoryInput, //单价 + }); + } + // 按重量品类计费 + if (form.value.dispatchPricingType.includes(2)) { + data.dispatch['weightCategory'].push({ + price: form.value.weightCategoryInput, //单价 + }); + } + // 按方品类计费 + if (form.value.dispatchPricingType.includes(3)) { + data.dispatch['cubeCategory'].push({ + price: form.value.cubeCategoryInput, //单价 + }); } } - // 按件品类计费 - form.value.pieceCategoryData.forEach(item=>{ - data.dispatch['pieceCategory'].push({ - categoryId:item.categoryId,//品类id - leaveBehindPrice:item.leaveBehindPrice,// 遗留单价 - price:item.price,//单价 - }) - }) - // 按方品类计费 - form.value.cubeCategoryData.forEach(item=>{ - data.dispatch['cubeCategory'].push({ - categoryId:item.categoryId,//品类id - leaveBehindPrice:item.leaveBehindPrice,// 遗留单价 - price:item.price,//单价 - }) - }) + // 按公里品类计费 + if (form.value.dispatchPricingType.includes(7)) { + data.dispatch['kilometerCost'].push({ + price: form.value.kilometerCost || 0, //价格 + }); + } + // 按吨公里计费 + if (form.value.dispatchPricingType.includes(6)) { + data.dispatch['tonKilometerCost'].push({ + price: form.value.tonKilometerCost || 0, //价格 + }); + } + // 按吨计费 + if (form.value.dispatchPricingType.includes(8)) { + data.dispatch['tonCost'].push({ + price: form.value.tonCost || 0, //价格 + }); + } + // 整车计费 + let fullVehicleDataState = form.value.fullVehicleData.every(res => res.vehicleType); + if (fullVehicleDataState && form.value.fullVehicleData.length) { + form.value.fullVehicleData.forEach(item => { + data.dispatch['fullVehicle'].push({ + price: item.price || 0, // 整车计费(元/车) + vehicleType: item.vehicleType, //车型 + }); + }); + } else { + ElMessage({ + message: '整车计费有未选择车型', + type: 'warning', + }); + return; + } - // 按重量品类计费 - form.value.weightCategoryData.forEach(item=>{ - data.dispatch['weightCategory'].push({ - categoryId:item.categoryId,//品类id - leaveBehindPrice:item.leaveBehindPrice,// 遗留单价 - price:item.price,//单价 - }) - }) -// 按公里品类计费 - data.dispatch['weightCategory'].push({ - categoryId:item.categoryId,//品类id - leaveBehindPrice:item.leaveBehindPrice,// 遗留单价 - price:item.price,//单价 - }) + // 附加费用 + if (request.value.dispatchIsCategorySubjoin && form.value.additionalCategoryData.length) { + form.value.additionalCategoryData.forEach(res => { + data.dispatch['additionalCategory'].push({ + categoryId: res.categoryId, //品类id + handlingPrice: res.handlingPrice || 0, //装卸费 + relocationPrice: res.relocationPrice || 0, //平移费 + sortPrice: res.sortPrice || 0, //分货费 + upstairsDeliveryPrice: res.upstairsDeliveryPrice || 0, //上楼费 + }); + }); + } else { + data.dispatch['additionalCategory'].push({ + handlingPrice: form.value.handlingPrice || 0, //装卸费 + relocationPrice: form.value.relocationPrice || 0, //平移费 + sortPrice: form.value.sortPrice || 0, //分货费 + upstairsDeliveryPrice: form.value.upstairsDeliveryPrice || 0, //上楼费 + }); + } + // 上楼费免费楼层 + if (request.value.dispatchIsStairsCarryingCharge && request.value.dispatchIsFeeFloor) { + data.dispatch.dispatchStairsCarryingCharge = form.value.dispatchStairsCarryingCharge || 0; + } + // 最低计费 + if (request.value.dispatchIsMinCost) { + data.dispatch.minCost = form.value.Minimumbilling.find(res => res.disabled).minCost || 0; + // 加算价格 + if (request.value.dispatchMinCostType == 1) { + data.dispatch.additionalCost = form.value.additionalCost || 0; + } + } + + // 遗留最低计费 + if (request.value.dispatchIsLeaveBehind && request.value.dispatchIsMinCost) { + data.dispatch.leaveBehindMinCost = + form.value.Minimumlegacy.find(res => res.disabled).leaveBehindMinCost || 0; + // 遗留加算价格 + if (request.value.dispatchMinCostType == 1) { + data.dispatch.leaveBehindAdditionalCost = form.value.leaveBehindAdditionalCost || 0; + } + } - console.log(data,'准备提交的数据'); - return - putBasicdataPrice(data).then(res=>{ - console.log(res,'处理好的值'); + // 是否向上判断 + if (!request.value.dispatchIsMinCost && request.value.dispatchIsUpwardJudgment) { + data.dispatch.dispatchUpwardJudgment = form.value.dispatchUpwardJudgment; //向上判断件数 + data.dispatch.dispatchUpwardJudgmentCost = form.value.dispatchUpwardJudgmentCost; //向上判断加价 + } + console.log(data, '要提交的数据'); + putBasicdataPrice(data).then(res => { + console.log(res, '处理好的值'); + if (res.data.code == 200) { + ElMessage({ + message: res.data.msg, + type: 'success', + }); + } + }).catch(res=>{ + console.log(res,'错误信息'); + }).finally(()=>{ + loading.value = false; }) -} +}; + +// 返回 +const handleBack = () => { + router.push({ + path: '/pricesystem/price', + }); +}; diff --git a/src/views/Pricesystem/Price/PriceWarehousing.vue b/src/views/Pricesystem/Price/PriceWarehousing.vue index 7b0f6356..d6f9d796 100644 --- a/src/views/Pricesystem/Price/PriceWarehousing.vue +++ b/src/views/Pricesystem/Price/PriceWarehousing.vue @@ -1,179 +1,141 @@ @@ -182,7 +144,7 @@ import { ref, defineEmits, defineComponent, computed } from 'vue'; import SurchargeTable from '@/components/pric/tablePric.vue'; import { getDictionaryBiz } from '@/api/system/dict'; //字典 import { deepClone } from '@/utils/util'; -import { ElMessage } from 'element-plus'; +import { ElMessage, ElMessageBox } from 'element-plus'; import { putBasicdataPrice } from '@/api/Pricesystem/index'; import { useRoute } from 'vue-router'; const $route = useRoute(); //获取地址栏参数 @@ -205,8 +167,8 @@ const Warehousebillingmode = ref([]); const CalculationBasis = ref([]); const request = ref({}); const Surchargepricingunit = ref([]); -function updateDictionary(targetArray, dictionaryType) { - getDictionaryBiz(dictionaryType) +async function updateDictionary(targetArray, dictionaryType) { +await getDictionaryBiz(dictionaryType) .then(res => { console.log(res, '字典'); if (res.data.code == 200) { @@ -224,7 +186,8 @@ function updateDictionary(targetArray, dictionaryType) { .catch(() => {}) .finally(() => {}); } - +const loading = ref(true); +const formCopy = ref({}); //拷贝数据 const form = ref({ operatePrice: 0, //操作/装卸费 warehouseManagementPrice: 0, //仓储管理费 @@ -232,26 +195,33 @@ const form = ref({ // 附加费 Surcharge: [ { label: '序号', prop: 'index', type: 'string', width: '80', disabled: true }, - { label: '产品品类', prop: 'categoryId', type: 'select', width: '150', disabled: true }, + { + label: '产品品类', + prop: 'categoryId', + type: 'select', + width: '150', + disabled: true, + show: true, + }, { label: '仓储操作/装卸费', prop: 'operatePrice', type: 'number', - width: '180', + width: 'auto', disabled: true, }, { label: '仓储管理费', prop: 'warehouseManagementPrice', type: 'number', - width: '180', + width: 'auto', disabled: true, }, { label: '仓储分货费', prop: 'warehouseSortPrice', type: 'number', - width: '180', + width: 'auto', disabled: true, }, ], @@ -259,33 +229,40 @@ const form = ref({ // 按吨计费 publicTable: [ { label: '序号', prop: 'index', type: 'string', width: '80', disabled: true }, - { label: '产品品类', prop: 'categoryId', type: 'select', width: '150', disabled: true }, + { + label: '产品品类', + prop: 'categoryId', + type: 'select', + width: '150', + disabled: true, + show: true, + }, { label: '30天内', prop: 'withinThirtyPrice', type: 'number', - width: '180', + width: 'auto', disabled: true, }, { label: '30天-60天', prop: 'betweenThirtySixtyPrice', type: 'number', - width: '180', + width: 'auto', disabled: true, }, { label: '60天外', prop: 'beyondSixtyPrice', type: 'number', - width: '180', + width: 'auto', disabled: true, }, { label: '上限', prop: 'maximumPrice', type: 'number', - width: '180', + width: 'auto', disabled: true, }, ], @@ -293,14 +270,14 @@ const form = ref({ publicData: [], }); const onLoad = async () => { - updateDictionary(Storagebillingtype.value, 'warehouse_pricing_type'); //仓储计费类型 - updateDictionary(Warehousebillingmode.value, 'warehouse_pricing_mode'); //仓储计费模式 - updateDictionary(CalculationBasis.value, 'warehouse_calculation_basis'); //计算基准 + await Promise.all([ + updateDictionary(Storagebillingtype.value, 'warehouse_pricing_type'), // 仓储计费类型 + updateDictionary(Warehousebillingmode.value, 'warehouse_pricing_mode'), // 仓储计费模式 + updateDictionary(CalculationBasis.value, 'warehouse_calculation_basis'), // 计算基准 + ]); // updateDictionary(Surchargepricingunit.value, 'warehouse_pricing_unit'); //附加费计价单位 - // 价格回显 - + // 回显 if (props.templateData.request) { - form.value.warehousePricingType = request.value.warehousePricingType; //计算类型 form.value.warehousePricingMode = request.value.warehousePricingMode; //计费模式 form.value.warehouseCalculationBasis = request.value.warehouseCalculationBasis; //计算基准 @@ -328,13 +305,13 @@ const onLoad = async () => { }); }); } - }else{ + } else { console.log('没有附加品类'); - let data= requestInfo.value.additionalCategory[0] - console.log(data,'data数据'); - form.value.operatePrice=data.operatePrice - form.value.warehouseManagementPrice=data.warehouseManagementPrice - form.value.warehouseSortPrice=data.warehouseSortPrice + let data = requestInfo.value.additionalCategory[0]; + console.log(data, 'data数据'); + form.value.operatePrice = data.operatePrice || 0; + form.value.warehouseManagementPrice = data.warehouseManagementPrice || 0; + form.value.warehouseSortPrice = data.warehouseSortPrice || 0; } form.value.publicData = []; //清空数据 // 仓储回显 @@ -416,6 +393,46 @@ const onLoad = async () => { handleFormUpdate(isByCategory, '(元/t)', '按吨计费(t)'); break; } + // 附加费是否有操作装/装卸费 + if (!request.value.warehouseIsOperateFee) { + form.value.Surcharge.find(res => res.prop === 'operatePrice').disabled = false; + } else { + form.value.Surcharge.find(res => res.prop === 'operatePrice').disabled = true; + } + // 附加费是否有仓储管理费 + if (!request.value.warehouseIsManageFee) { + form.value.Surcharge.find(res => res.prop === 'warehouseManagementPrice').disabled = false; + } else { + form.value.Surcharge.find(res => res.prop === 'warehouseManagementPrice').disabled = true; + } + // 附加费是否有仓储分货费 + if (!request.value.warehouseIsSortFee) { + form.value.Surcharge.find(res => res.prop === 'warehouseSortPrice').disabled = false; + } else { + form.value.Surcharge.find(res => res.prop === 'warehouseSortPrice').disabled = true; + } + + // { + // label: '仓储操作/装卸费', + // prop: 'operatePrice', + // type: 'number', + // width: 'auto', + // disabled: true, + // }, + // { + // label: '仓储管理费', + // prop: 'warehouseManagementPrice', + // type: 'number', + // width: 'auto', + // disabled: true, + // }, + // { + // label: '仓储分货费', + // prop: 'warehouseSortPrice', + // type: 'number', + // width: 'auto', + // disabled: true, + // }, // if(request.value.warehouseSubjoinFeeUnit==4){ // form.value.publicTable.forEach(res=>{ @@ -467,45 +484,46 @@ const onLoad = async () => { // } // } } - - console.log(request.value, '初始化页面'); -}; - -const price = async () => { - + // 价格处理 if (Object.keys(requestInfo.value).length > 0) { if (requestInfo.value.catergory && requestInfo.value.catergory.length) { // 仓储 requestInfo.value.catergory.forEach(res => { let data = form.value.publicData.find(temp => temp.categoryId == res.categoryId); if (data) { - data.betweenThirtySixtyPrice = res.betweenThirtySixtyPrice; - data.beyondSixtyPrice = res.beyondSixtyPrice; - data.maximumPrice = res.maximumPrice; - data.withinThirtyPrice = res.withinThirtyPrice; + data.betweenThirtySixtyPrice = res.betweenThirtySixtyPrice || 0; + data.beyondSixtyPrice = res.beyondSixtyPrice || 0; + data.maximumPrice = res.maximumPrice || 0; + data.withinThirtyPrice = res.withinThirtyPrice || 0; } }); } - // 附加费(还差状态) + // 附加费 if (requestInfo.value.additionalCategory && requestInfo.value.additionalCategory.length) { requestInfo.value.additionalCategory.forEach(res => { let data = form.value.SurchargeData.find(temp => temp.categoryId == res.categoryId); if (data) { - data.operatePrice = res.operatePrice;//操作/装卸费 - data.managementFee = res.managementFee; - data.warehouseManagementPrice = res.warehouseManagementPrice;// 仓储管理费 - data.warehouseSortPrice = res.warehouseSortPrice;//仓储分货费 + data.operatePrice = res.operatePrice || 0; //操作/装卸费 + data.managementFee = res.managementFee || 0; + data.warehouseManagementPrice = res.warehouseManagementPrice || 0; // 仓储管理费 + data.warehouseSortPrice = res.warehouseSortPrice || 0; //仓储分货费 } }); + } } - } + let setTime = setTimeout(async () => { + formCopy.value = await deepClone(form.value); + loading.value = false; + clearTimeout(setTime); + }, 500); + console.log(request.value, '初始化页面'); }; +// 页面初始化 const pageonload = async () => { request.value = await deepClone(props.templateData.request); requestInfo.value = await deepClone(props.templateData.requestInfo.warehouse); onLoad(); //页面渲染 - price(); //处理价格 }; pageonload(); const Surchargecd = computed(() => { @@ -526,7 +544,24 @@ const Surchargecd = computed(() => { return true; } }); - +// 重置表单 +const resetFormData = () => { + ElMessageBox.confirm('是否重置数据?', '提示', { + confirmButtonText: '确定', + cancelButtonText: '取消', + type: 'warning', + }).then(() => { + loading.value = true; + form.value = deepClone(formCopy.value); + setTimeout(() => { + loading.value = false; + ElMessage({ + message: '重置成功', + type: 'success', + }); + }, 300); + }); +}; // 保存数据 const handleSubmit = () => { let data = { @@ -584,7 +619,6 @@ const handleSubmit = () => { // 数据处理 if (!request.value.warehouseIsCategorySubjoin) { - // 不存在填写统一单价 // data.warehouse['additionalCategory'].push({ // operatePrice: form.value.operatePrice, //操作/装卸费 @@ -593,7 +627,7 @@ const handleSubmit = () => { // name: 'fj', // }); let mox = data.warehouse['additionalCategory'].find(res => res.name == 'fj'); - delete mox.name + delete mox.name; if (!request.value.warehouseIsManageFee) { //删除管理费 delete mox.warehouseManagementPrice; diff --git a/src/views/Pricesystem/PricesyHome.vue b/src/views/Pricesystem/PricesyHome.vue index 9346a16e..cc7d0c8b 100644 --- a/src/views/Pricesystem/PricesyHome.vue +++ b/src/views/Pricesystem/PricesyHome.vue @@ -18,10 +18,10 @@ :templateData="templateInfo" /> 安装 @@ -70,6 +70,9 @@ const financialBill = ref(); const financialTrunkLine = ref(); +const financialDelivery=ref() + +const financialWarehousing=ref() // 字典公共函数 function updateDictionary(targetArray, dictionaryType) { getDictionaryBiz(dictionaryType) @@ -170,8 +173,12 @@ const onLoad = async () => { await nextTick(); setTimeout(() => { console.log('financialBill :>> ', financialBill); - financialBill.value[0].initDictionaryBiz(); - financialTrunkLine.value[0].initDictionaryBiz(); + if( financialBill.value && financialBill.value.length){ + financialBill.value[0].initDictionaryBiz(); + } + if(financialTrunkLine.value && financialTrunkLine.value.length){ + financialTrunkLine.value[0].initDictionaryBiz(); + } }, 1000); }); } catch (error) { diff --git a/src/views/distribution/checkInventoryTask/createTask.vue b/src/views/distribution/checkInventoryTask/createTask.vue index e5a64da7..e73ff931 100644 --- a/src/views/distribution/checkInventoryTask/createTask.vue +++ b/src/views/distribution/checkInventoryTask/createTask.vue @@ -1125,6 +1125,17 @@ const InventoryDetails = ref([ search: false, head: true, }, + { + prop: 'newTrayName', + label: '移动托盘名称', + type: 1, + values: '', + width: '150', + checkarr: [], + fixed: false, + search: false, + head: true, + }, { prop: 'isChange', label: '是否数量变更', diff --git a/src/views/distribution/reservation/reservation.vue b/src/views/distribution/reservation/reservation.vue index 6273ed5b..9f0e095a 100644 --- a/src/views/distribution/reservation/reservation.vue +++ b/src/views/distribution/reservation/reservation.vue @@ -280,7 +280,7 @@ - +