ymy 1 рік тому
батько
коміт
1ac1a0bf90

+ 5 - 5
src/api/delivery.ts

@@ -1,17 +1,17 @@
 import request from '@/benyun/utils/request'
 import store from '@/store/index'
 //查询加个
-export function queryPricePackage(params:any) {
+export function queryPricePackage(data:any) {
 	return request({
-		url: '/omsShippingOrder/queryPricePackage',
-		method: 'GET',
-		params:params
+		url: '/omsOrder/omsShippingOrder/getMultiplePrice',
+		method: 'POST',
+		data:data
 	})
 }
 //单条发货
 export function addmultiple(data?:any) {
 	return request({
-		url: '/omsShippingOrder/addmultiple',
+		url: '/omsOrder/omsShippingOrder/addmultiple',
 		method: 'POST',
 		data:data
 	})

+ 113 - 18
src/views/oms/order/components/batchbyOneModal.vue

@@ -1,5 +1,6 @@
 <template>
   <el-drawer
+    v-loading="load"
     title="订单发货(批量逐一发货)"
     :visible.sync="drawer"
     :direction="direction"
@@ -15,7 +16,7 @@
         </el-pagination>
       </div>
       <deliveryGoodsInfo @editState="editState" @editResult="editResult" ref="info" />
-      <deliveryPrice />
+      <deliveryPrice :data="priceObj[data[currentOrder].omsOrderIds]" v-if="data[currentOrder] && priceObj[data[currentOrder].omsOrderIds]" @prichChange="prichChange" />
     </div>
     <div class="space"></div>
     <div class="deli-footer">
@@ -40,30 +41,37 @@ import { Component, Prop, Vue, Watch } from "vue-property-decorator";
 import DeliveryGoodsInfo from "./deliveryGoodsInfo.vue";
 import DeliveryPrice from "./deliveryPrice.vue";
 import { add,multiply,subtract,divide } from '@/benyun/utils/accuracy'
-import { queryPricePackage } from  '@/api/delivery'
+import { queryPricePackage,addmultiple } from  '@/api/delivery'
+import Format from '@/benyun/utils/dateFormat'
+
 @Component({components:{DeliveryGoodsInfo,DeliveryPrice}})
-export default class DeliveryModal extends Vue {
+export default class BatchbyOneModal extends Vue {
   drawer=false;
   direction='rtl'
   checked=false;
   data:Array<any>=[];
   currentOrder=0;
   load = false;
+  priceObj:any={};
+  currentPrice:any={};
   setShow(v:boolean){
     this.drawer=v;
   }
   editResult(v:any){
     this.data[this.currentOrder] = v;
-    this.getPriceInfo();
+    this.getPriceInfo(v);
+  }
+  prichChange(index:number){
+    this.currentPrice[this.data[this.currentOrder].omsOrderIds] = this.priceObj[this.data[this.currentOrder].omsOrderIds][index];
   }
   currentChange(v:number){
-    this.currentOrder = v;
+    this.currentOrder = v-1;
     this.$nextTick(()=>{
       (this.$refs.info as any).setValue(this.data[this.currentOrder]);
     })
-    // this.getPriceInfo();
   }
   setValue(data:Array<any>){
+    this.data = [];
     if(data && data.length > 0){
       for(const item of data){
         const requestId =  new Date().getTime() + this.getUuid()
@@ -118,22 +126,109 @@ export default class DeliveryModal extends Vue {
     return (((1 + Math.random()) * 0x10000) | 0).toString(16).substring(1);
   }
   btn(){
-    
+    if(!this.data[0].orderType || !this.data[0].tmsShipmentConsignor){
+      this.$message("请编辑订单信息");
+      return
+    }
+    if(this.data.length > 1){
+      let ids='';
+      for(const item of this.data){
+        if(!item.orderType || !item.tmsShipmentConsignor){
+          ids = ids ? ids + ',' + item.omsOrderIds : item.omsOrderIds
+        }
+      }
+      if(ids){
+        this.$confirm('订单'+ids + '未编辑,是否以第一条订单为基准', '提示', {
+          confirmButtonText: '确定',
+          cancelButtonText: '取消',
+          type: 'warning'
+        }).then(() => {
+          this.setOnEditOrderInfo(ids);
+          for(const item of this.data){
+            this.sendGoods(item);
+          }
+        }).catch(() => {});
+      }else{
+        for(const item of this.data){
+          this.sendGoods(item);
+        }
+      }
+    }else{
+      this.sendGoods(this.data[0]);
+    }
+  }
+  sendGoods(item:any){
+    let params:any=(this as any).$lodash.cloneDeep(item);
+    if(this.priceObj[item.omsOrderIds]){
+      try{
+        params.pricePlan = JSON.stringify(this.priceObj[item.omsOrderIds])
+      }catch(e){}
+    }
+    if(this.currentPrice[item.omsOrderIds]){
+      params.priceId = this.currentPrice[item.omsOrderIds].id;
+    }
+    params.omsOrderIds = [item.omsOrderIds];
+    addmultiple(params).then((res:any) => {
+
+    }).catch((err:any) => {
+
+    })
+  }
+  setOnEditOrderInfo(ids:string){
+    let _value = this.data[0]
+    for(const item of this.data){
+      if(ids.indexOf(item.omsOrderIds) > -1){
+        item.orderType = _value.orderType;
+        item.tmsTransportMethod = _value.tmsTransportMethod;
+        item.tmsBusinessMan = _value.tmsBusinessMan;
+        item.tmsBusinessPhone = _value.tmsBusinessPhone;
+        item.tmsShipmentConsignor = _value.tmsShipmentConsignor;
+        item.tmsShipmentContacts = _value.tmsShipmentContacts;
+        item.tmsShipmentProvince = _value.tmsShipmentProvince;
+        item.tmsShipmentProvinceNo = _value.tmsShipmentProvinceNo;
+        item.tmsShipmentCity = _value.tmsShipmentCity;
+        item.tmsShipmentCityNo = _value.tmsShipmentCityNo;
+        item.tmsShipmentRegion = _value.tmsShipmentRegion;
+        item.tmsShipmentRegionNo = _value.tmsShipmentRegionNo;
+        item.tmsShipmentStreetNo = _value.tmsShipmentStreetNo;
+        item.tmsShipmentStreet = _value.tmsShipmentStreet;
+        item.tmsShipmentAddress = _value.tmsShipmentAddress;
+        item.tmsUnloadingConsignor = _value.tmsUnloadingConsignor;
+        item.tmsUnloadingContacts = _value.tmsUnloadingContacts;
+        item.tmsUnloadingProvince = _value.tmsUnloadingProvince;
+        item.tmsUnloadingProvinceNo = _value.tmsUnloadingProvinceNo;
+        item.tmsUnloadingCity = _value.tmsUnloadingCity;
+        item.tmsUnloadingCityNo = _value.tmsUnloadingCityNo;
+        item.tmsUnloadingRegion = _value.tmsUnloadingRegion;
+        item.tmsUnloadingRegionNo = _value.tmsUnloadingRegionNo;
+        item.tmsUnloadingStreetNo = _value.tmsUnloadingStreetNo;
+        item.tmsUnloadingStreet = _value.tmsUnloadingStreet;
+        item.tmsUnloadingAddress = _value.tmsUnloadingAddress;
+      }
+    }
   }
-  getPriceInfo(){
+  getPriceInfo(data:any,callback?:Function){
     let params:any={};
-    let data =  this.data[this.currentOrder];
-    if(!data) return;
-    params.startAddressCode = data.tmsShipmentStreetNo;
-    params.endAddressCode = data.tmsUnloadingStreetNo;
-    params.goodsInfo={}
-    params.weight = 500;
-    params.volume = 100;
-    params.mileage = 1000;
+    params.startAddressCode = data.tmsShipmentCityNo + '000';
+    params.endAddressCode = data.tmsUnloadingCityNo + '000';
+    params.omsIds=[this.data[0].omsOrderIds];
+    this.load = true;
     queryPricePackage(params).then((res:any) => {
-
+      if(this.currentPrice && this.currentPrice[data.omsOrderIds]){
+        delete this.currentPrice[data.omsOrderIds]
+      }
+      
+      this.load=false;
+      for(let item of res.data[0].data){
+        let d = new Date().getTime() + item.duration*60*60*1000;
+        item.endTime=Format(new Date(d),'MM月dd日 HH:mm')
+      }
+      this.priceObj[data.omsOrderIds] = res.data[0].data;
+      if(callback){
+        callback()
+      }
     }).catch((err:any)=>{
-
+      this.load = false;
     })
   }
   editState(v:boolean){

+ 4 - 2
src/views/oms/order/components/deliveryGoodsInfo.vue

@@ -129,10 +129,10 @@
             <span class="name-label">重量合计:</span>
             <span class="total-num">{{totalWeight}}kg</span>
           </div>
-          <div class="g-total">
+          <!-- <div class="g-total">
             <span class="name-label">体积合计:</span>
             <span class="total-num">2.00m³</span>
-          </div>
+          </div> -->
         </div>
       </div>
       <div class="table">
@@ -392,6 +392,8 @@ export default class DeliveryGoodsInfo extends Vue {
     this.$emit('editState',true)
   }
   show(){
+    this.value.tmsBusinessMan = (this as any).$store.getters.userInfo.userName;
+    this.value.tmsBusinessPhone = (this as any).$store.getters.userInfo.phonenumber;
     this.$nextTick(()=>{
       if(this.$refs.form){
         (this.$refs.form as any).clearValue();

+ 2 - 2
src/views/oms/order/components/deliveryModal.vue

@@ -5,8 +5,8 @@
     :direction="direction"
     size="40%">
     <div class="content">
-      <deliveryGoodsInfo />
-      <deliveryPrice />
+      <!-- <deliveryGoodsInfo />
+      <deliveryPrice /> -->
     </div>
     <div class="space"></div>
     <div class="deli-footer">

+ 18 - 7
src/views/oms/order/components/deliveryPrice.vue

@@ -2,18 +2,18 @@
   <div class="send-box">
     <div class="title-label">预计配送和预计费用</div>
     <div class="send-type">
-      <div class="send-item onSend">
+      <!-- <div class="send-item onSend">
         <div class="label-name">整车配送</div>
         <div class="send-info">
           <div class="s-time">7月23 12:23前</div>
           <div class="send-price">¥16.00起</div>
         </div>
-      </div>
-      <div class="send-item">
-        <div class="label-name">标准汽运</div>
+      </div> -->
+      <div class="send-item" v-for="(item,index) of data" :key="index" :title="item.ruleName" :class="{'onSend':onIndex == index}" @click="priceHandle(index)" >
+        <div class="label-name">{{item.ruleName}}</div>
         <div class="send-info">
-          <div class="s-time">7月23 12:23前</div>
-          <div class="send-price">¥22.00起</div>
+          <div class="s-time">{{item.endTime}}前</div>
+          <div class="send-price">¥{{item.estimateFreight}}</div>
         </div>
       </div>
     </div>
@@ -23,7 +23,13 @@
 import { Component, Prop, Vue, Watch } from "vue-property-decorator";
 @Component({components:{}})
 export default class DeliveryPrice extends Vue {
-
+  @Prop()
+  data?:Array<any>=[]
+  onIndex:any=null;
+  priceHandle(index:number){
+    this.onIndex = index;
+    this.$emit('prichChange',index)
+  }
 }
 </script>
 <style lang="scss" scoped>
@@ -55,6 +61,10 @@ export default class DeliveryPrice extends Vue {
         font-weight: 700;
         padding: 2px 0 4px;
         text-align: center;
+        width: 100%;
+        overflow: hidden;
+        text-overflow: ellipsis;
+        white-space: nowrap;
       }
       .send-info{
         padding: 8px 0;
@@ -63,6 +73,7 @@ export default class DeliveryPrice extends Vue {
         .s-time{
           font-size: 14px;
           color: #1684FC;
+          font-weight: 700;
         }
         .send-price{
           font-size: 20px;

+ 4 - 2
src/views/oms/order/index.vue

@@ -543,8 +543,10 @@ export default class Order extends Vue {
     }
   }
   //发货
-  sendGoods(){
-    (this.$refs.deliveryModal as any).setShow(true);
+  sendGoods(item:any){
+    (this.$refs.batchbyOneModal as any).setShow(true);
+    (this.$refs.batchbyOneModal as any).setValue([item]);
+    // (this.$refs.deliveryModal as any).setShow(true);
   }
   //显示标签弹窗
   showLabels(){