From 30c69636ebf375e285f04cbd5f2a1abce435ceca Mon Sep 17 00:00:00 2001 From: kilo Date: Mon, 24 Jul 2023 18:13:49 +0800 Subject: [PATCH] =?UTF-8?q?=E5=95=86=E9=85=8D=E4=BB=BB=E5=8A=A1=E7=BC=96?= =?UTF-8?q?=E8=BE=91=E9=A1=B5=E9=9D=A2=E5=9B=9E=E6=98=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../turndelivery/deliveryDiscuss.vue | 372 ++++++++++++------ 1 file changed, 250 insertions(+), 122 deletions(-) diff --git a/src/views/distribution/turndelivery/deliveryDiscuss.vue b/src/views/distribution/turndelivery/deliveryDiscuss.vue index 9a7601d7..6a3ecb9d 100644 --- a/src/views/distribution/turndelivery/deliveryDiscuss.vue +++ b/src/views/distribution/turndelivery/deliveryDiscuss.vue @@ -26,11 +26,11 @@ - + @@ -63,8 +63,9 @@ v-model="deliveryDriver" multiple filterable - placeholder="请选择司机" @change="changeDriver" + + placeholder="请选择司机" > @@ -304,6 +306,7 @@ :key="item.dictKey" :label="item.dictValue" :value="item.dictKey" + :disabled="isDisable" > @@ -319,6 +322,7 @@ v-for="item in loadAndUnloadData" :label="item.dictKey" :value="item.dictKey" + :disabled="isDisable" > {{ item.dictValue }} @@ -345,6 +349,7 @@ :key="item.dictKey" :label="item.dictValue" :value="item.dictKey" + :disabled="isDisable" > @@ -352,7 +357,7 @@ - + @@ -865,6 +870,24 @@ //外协数据来源 tripartiteSourceData:[], deliveryListId:'', + isDisable:false, + options: [{ + value: '选项1', + label: '黄金糕' + }, { + value: '选项2', + label: '双皮奶' + }, { + value: '选项3', + label: '蚵仔煎' + }, { + value: '选项4', + label: '龙须面' + }, { + value: '选项5', + label: '北京烤鸭' + }], + value1: [], }; @@ -967,19 +990,26 @@ }, //查询司机信息 getMasterDriverData() { - getDriverList(1, 10, '').then(res => { - this.driverData = res.data.data.records; - }); + return new Promise((rv,rev)=>{ + getDriverList(1, 10, '').then(res => { + this.driverData = res.data.data.records; + console.log("===============>",res.data.data); + rv(res.data.data.records) + }); + }) }, selectionChange(list) { this.selectionList = list; }, //查询车辆信息 getvehicleData() { - getVehicleList(1, 10, '').then(res => { - this.vehicleData = res.data.data.records; - console.log(res.data.data); - }); + return new Promise((rv,rev)=>{ + getVehicleList(1, 10, '').then(res => { + this.vehicleData = res.data.data.records; + console.log("^^^^^^^^^^^^^^^^",res.data.data); + rv(res.data.data.records) + }); + }) }, fetchData() { this.error = this.post = null; @@ -1095,110 +1125,185 @@ // this.form.orderInfo = this.orderData; // } const params = this.form; - let stockup = {}; - let tripartite = {}; - let allocationInfo = []; - //备货区数据构建 - if (params.loader) { - this.loaderData.forEach(a => { - if (params.loader === a.dictKey) { - stockup.loaderName = a.dictValue; - stockup.loaderId = a.dictKey; - } + + if (this.deliveryListId){ + let tripartite = {}; + let allocationInfo = []; + //将服务类型转为数组 + let serve = Object.values(this.serveType); + serve = serve.sort((a, b) => { + return a - b; }); - } - this.forkliftData.forEach(b => { - if (params.forklift === b.dictKey) { - stockup.forkliftName = b.dictValue; - stockup.forkliftId = b.dictKey; - } - }); - this.goodsAreaData.forEach(c => { - if (params.goodsAreaId === c.dictKey) { - stockup.goodsAreaId = c.dictKey; - stockup.goodsAreaName = c.dictValue; - } - }); - if (params.stockupDate) { - stockup.stockupDate = params.stockupDate; - } - if (params.remarks) { - stockup.remarks = params.remarks; - } - //将服务类型转为数组 - let serve = Object.values(this.serveType); - serve = serve.sort((a, b) => { - return a - b; - }); - console.log('5555555555', serve); - this.form.serveType = serve.join(','); - stockup.loadAndUnload = this.loadAndUnload.join(','); - //判断是否是三方配送 - if (params.tripartiteSource) { - //三方配送数据构建 - if (params.driverName) { - tripartite.driverName = params.driverName; + this.form.serveType = serve.join(','); + // stockup.loadAndUnload = this.loadAndUnload.join(','); + //判断是否是三方配送 + if (params.tripartiteSource) { + //三方配送数据构建 + if (params.driverName) { + tripartite.driverName = params.driverName; + } + if (params.deiverPhone) { + tripartite.deiverPhone = params.deiverPhone; + } + if (params.vehicleNum) { + tripartite.vehicleNum = params.vehicleNum; + } + if (params.deliveryFee) { + tripartite.deliveryFee = params.deliveryFee; + } + if (params.tripartiteSource) { + this.tripartiteSourceData.forEach(item => { + if (params.tripartiteSource === item.dictValue) { + tripartite.distributionCompanyId = item.dictKey; + tripartite.distributionCompany = item.dictValue; + } + }); + } + } else { + //自主配送数据构建 + console.log("this.driverList----------->",this.driverList); + console.log("this.vehticleList----------->",this.vehticleList); + if (this.driverList.length !== this.vehticleList.length) { + this.$message({ + message: '司机车辆数量有误!!!', + type: 'warning' + }); + return; + } else { + let info = []; + for (let i = 0; i < this.driverInfo.length; i++) { + let obj = {}; + obj.driverName = this.driverInfo[i].name; + obj.driverPhone = this.driverInfo[i].phone; + obj.driverId = this.driverInfo[i].id; + obj.vehicleNub = this.vehticleInfo[i].vehicleNub; + obj.vehicleId = this.vehticleInfo[i].id; + info.push(obj); + this.driverInfo[i].name; + } + allocationInfo = info; + } } - if (params.deiverPhone) { - tripartite.deiverPhone = params.deiverPhone; + let data = {}; + data.masterDriverName = this.form.masterDriverName; + data.masterVehicleNub = this.form.masterVehicleNub; + data.allocationInfo = allocationInfo; + data.tripartite = tripartite; + data.stockArticle = this.orderData; + let reservation = {}; + reservation.deliveryType = this.form.deliveryType; + reservation.deliveryWay = this.form.deliveryWay; + reservation.serveType = this.form.serveType; + reservation.otherFee = this.form.otherFee; + data.reservation = reservation; + // data.reservationIds = this.ids; + console.log('data>>>>>>>>>>>', data); + }else { + let stockup = {}; + let tripartite = {}; + let allocationInfo = []; + //备货区数据构建 + if (params.loader) { + this.loaderData.forEach(a => { + if (params.loader === a.dictKey) { + stockup.loaderName = a.dictValue; + stockup.loaderId = a.dictKey; + } + }); } - if (params.vehicleNum) { - tripartite.vehicleNum = params.vehicleNum; + this.forkliftData.forEach(b => { + if (params.forklift === b.dictKey) { + stockup.forkliftName = b.dictValue; + stockup.forkliftId = b.dictKey; + } + }); + this.goodsAreaData.forEach(c => { + if (params.goodsAreaId === c.dictKey) { + stockup.goodsAreaId = c.dictKey; + stockup.goodsAreaName = c.dictValue; + } + }); + if (params.stockupDate) { + stockup.stockupDate = params.stockupDate; } - if (params.deliveryFee) { - tripartite.deliveryFee = params.deliveryFee; + if (params.remarks) { + stockup.remarks = params.remarks; } + //将服务类型转为数组 + let serve = Object.values(this.serveType); + serve = serve.sort((a, b) => { + return a - b; + }); + this.form.serveType = serve.join(','); + stockup.loadAndUnload = this.loadAndUnload.join(','); + //判断是否是三方配送 if (params.tripartiteSource) { - this.tripartiteSourceData.forEach(item => { - if (params.tripartiteSource === item.dictValue) { - tripartite.distributionCompanyId = item.dictKey; - tripartite.distributionCompany = item.dictValue; - } - }); - } - } else { - //自主配送数据构建 - if (this.driverList.length !== this.vehticleList.length) { - this.$message({ - message: '司机车辆数量有误!!!', - type: 'warning', - }); - return; + //三方配送数据构建 + if (params.driverName) { + tripartite.driverName = params.driverName; + } + if (params.deiverPhone) { + tripartite.deiverPhone = params.deiverPhone; + } + if (params.vehicleNum) { + tripartite.vehicleNum = params.vehicleNum; + } + if (params.deliveryFee) { + tripartite.deliveryFee = params.deliveryFee; + } + if (params.tripartiteSource) { + this.tripartiteSourceData.forEach(item => { + if (params.tripartiteSource === item.dictValue) { + tripartite.distributionCompanyId = item.dictKey; + tripartite.distributionCompany = item.dictValue; + } + }); + } } else { - let info = []; - for (let i = 0; i < this.driverInfo.length; i++) { - let obj = {}; - obj.driverName = this.driverInfo[i].name; - obj.driverPhone = this.driverInfo[i].phone; - obj.driverId = this.driverInfo[i].id; - obj.vehicleNub = this.vehticleInfo[i].vehicleNub; - obj.vehicleId = this.vehticleInfo[i].id; - info.push(obj); - this.driverInfo[i].name; + //自主配送数据构建 + if (this.driverList.length !== this.vehticleList.length) { + this.$message({ + message: '司机车辆数量有误!!!', + type: 'warning' + }); + return; + } else { + let info = []; + for (let i = 0; i < this.driverInfo.length; i++) { + let obj = {}; + obj.driverName = this.driverInfo[i].name; + obj.driverPhone = this.driverInfo[i].phone; + obj.driverId = this.driverInfo[i].id; + obj.vehicleNub = this.vehticleInfo[i].vehicleNub; + obj.vehicleId = this.vehticleInfo[i].id; + info.push(obj); + this.driverInfo[i].name; + } + allocationInfo = info; } - allocationInfo = info; } - } - let data = {}; - data.stockup = stockup; - data.masterDriverName = this.form.masterDriverName; - data.masterVehicleNub = this.form.masterVehicleNub; - data.allocationInfo = allocationInfo; - data.tripartite = tripartite; - data.stockArticle = this.orderData; - let reservation = {}; - reservation.deliveryType = this.form.deliveryType; - reservation.deliveryWay = this.form.deliveryWay; - reservation.serveType = this.form.serveType; - reservation.otherFee = this.form.otherFee; - data.reservation = reservation; - // data.reservationIds = this.ids; - console.log('data>>>>>>>>>>>', data); - deliveryBusinessTask(data).then(res => { - this.$router.push({ - path: '/distribution/deliverylist/distributionDeliveryListdis', + let data = {}; + data.stockup = stockup; + data.masterDriverName = this.form.masterDriverName; + data.masterVehicleNub = this.form.masterVehicleNub; + data.allocationInfo = allocationInfo; + data.tripartite = tripartite; + data.stockArticle = this.orderData; + let reservation = {}; + reservation.deliveryType = this.form.deliveryType; + reservation.deliveryWay = this.form.deliveryWay; + reservation.serveType = this.form.serveType; + reservation.otherFee = this.form.otherFee; + data.reservation = reservation; + // data.reservationIds = this.ids; + console.log('data>>>>>>>>>>>', data); + + deliveryBusinessTask(data).then((res) => { + this.$router.push({ + path: '/distribution/deliverylist/distributionDeliveryListdis' + }); }); - }); + } }, changeVehicle(params) { console.log(params); @@ -1317,12 +1422,14 @@ this.bbb = false; this.form = {}; this.loadAndUnload = []; + this.onLoad(this.page); }, ddd() { this.aaa = false; this.bbb = true; this.form = {}; this.loadAndUnload = []; + this.onLoad(this.page); }, handleAddOrder() { this.query.typeService=1; @@ -1367,15 +1474,16 @@ this.selectionList = []; // this.$refs.table.clearSelection(); }, - onLoad(page, params = {}) { + async onLoad(page, params = {}) { console.log("》》》》》》》》》》》》》》》",this.deliveryListId); if (this.deliveryListId){ - getDeliveryList(this.deliveryListId).then(res=>{ + getDeliveryList(this.deliveryListId).then( async res=>{ let data = res.data.data; Object.assign(this.form,data.reservationInfo) Object.assign(this.form,data.stockupInfo) this.form.deliveryType = '2'; + this.form.deliveryWay = data.reservationInfo.deliveryWay; this.serveType = data.reservationInfo.serveType.split(","); if (data.stockupInfo){ this.loadAndUnload = data.stockupInfo.teamResponsibility.split(","); @@ -1383,36 +1491,56 @@ this.form.loader = data.stockupInfo.loaderName; this.form.forklift = data.stockupInfo.forkliftName; this.form.remarks = data.stockupInfo.remarks; - + this.orderData = data.stockArticleList; if (data.kind === "1"){ //自主配送 let self = data.deliverySelfVO; - let vehicle = this.vehicleData; - console.log("___________________vahicle",vahicle); + let vehicle =await this.getvehicleData(); + console.log("___________________-->",vehicle); + let driver =await this.getMasterDriverData(); + let a = []; + let b = []; + let vehicleInfo = []; + vehicle.forEach(item => { + self.forEach(s => { + if (item.id === s.vehicleId) { + a.push(s.vehicleId); + vehicleInfo.push(item); + } + if (s.isMaster === 2) { + this.form.masterVehicleNub = s.vehicleNub; - vehicle.forEach(item=>{ - console.log("___________________",item); - self.forEach(s=>{ - }) + } + }); }) + this.vehicleIds = a; + console.log(" this.vehicleIds", this.vehicleIds); + this.vehticleInfo = vehicleInfo; + let driverInfo = []; + driver.forEach(item => { + self.forEach(s => { + if (item.id === s.driverId) { + b.push(s.driverId); + driverInfo.push(item); + } + if (s.isMaster === 2) { + this.form.masterDriverName = s.driverName; + } + }); + }); + this.deliveryDriver = b; + this.driverInfo = driverInfo; }else { this.aaa = false; this.bbb = true; //外协配送 } - this.vehicleData.forEach(item=>{ - - }) - - - - console.log(">>>>>>>>this.form",this.form); console.log(res.data.data); - this.orderData = data.stockArticleList; }) } + this.isDisable=true; this.loading = false; // Object.assign(this.form, data.reservationInfo);