From 2621fec0d7ce1db0a2302c6c1ac0f08b36ae8a63 Mon Sep 17 00:00:00 2001
From: chenwei <chenwei@cqprow.com>
Date: 星期三, 09 六月 2021 17:30:25 +0800
Subject: [PATCH] 港口达下单的完善

---
 src/components/agopage/comment/GoodsClassify.vue |  111 +++++++++++++
 src/components/agopage/comment/CarSharing.vue    |   59 +++++-
 src/views/agomiddle/InquiryCenter.vue            |    6 
 src/components/agopage/home/Harbour.vue          |  122 ++++----------
 src/components/agopage/comment/AddBox.vue        |  112 +++++++++++--
 src/components/agopage/comment/BoxType.vue       |   43 ++++
 6 files changed, 326 insertions(+), 127 deletions(-)

diff --git a/src/components/agopage/comment/AddBox.vue b/src/components/agopage/comment/AddBox.vue
index e4da858..c1651cc 100644
--- a/src/components/agopage/comment/AddBox.vue
+++ b/src/components/agopage/comment/AddBox.vue
@@ -2,11 +2,17 @@
   <div>
     <el-tabs v-model="activeName" @tab-click="handleClick">
       <el-tab-pane label="甯歌绠卞瓙" name="first">
-        <div class="show-box" v-for="(item, index) in allData.ContainerList" :key="index">
-          <div class="box">
+        <div
+          class="show-box"
+          v-for="(item, index) in commonBox"
+          :key="index"
+          @click="generalBox(item)"
+         
+        >
+          <div class="box"  :class="{generalactive:item.CntrId==generalActive}">
             <i class="iconfont icon-jizhuangxiang_container"></i>
-            <span>{{item.CntrName}}</span>
-            <span>{{item.CntrSubtitle}}</span>
+            <span>{{ item.CntrName }}</span>
+            <span>{{ item.CntrSubtitle }}</span>
           </div>
           <!-- <div class="switch">
             <el-switch v-model="value1" active-text="鎷艰溅"> </el-switch>
@@ -14,11 +20,16 @@
         </div>
       </el-tab-pane>
       <el-tab-pane label="鐗圭绠�" name="second">
-        <div class="show-box" v-for="(sitem, sindex) in allData.SpecialContainerList" :key="sindex">
-          <div class="box">
+        <div
+          class="show-box"
+          v-for="(sitem, sindex) in allData.SpecialContainerList"
+          :key="sindex"
+          @click="specialBox(sitem)"
+        >
+          <div class="box" :class="{generalactive:sitem.CntrId==generalActive}">
             <i class="iconfont icon-jizhuangxiang_container"></i>
-            <span>{{sitem.CntrName}}</span>
-            <span>{{sitem.CntrSubtitle}}</span>
+            <span>{{ sitem.CntrName }}</span>
+            <span>{{ sitem.CntrSubtitle }}</span>
           </div>
           <!-- <div class="switch">
             <el-switch v-model="value1" active-text="鎷艰溅"> </el-switch>
@@ -26,7 +37,7 @@
         </div>
       </el-tab-pane>
       <div class="btn">
-        <button>娣� 鍔�</button>
+        <button @click="addBox">娣� 鍔�</button>
       </div>
     </el-tabs>
   </div>
@@ -35,24 +46,79 @@
 export default {
   data() {
     return {
-      activeName: "second",
+      activeName: "first",
       value1: true,
-      allData:{}
+      allData: {},
+      commonBox: [],
+      generalActive:""
     };
   },
-  created(){
+  created() {
     this.getBoxList();
   },
   methods: {
+    generalBox(item){
+       
+      if(this.generalActive==""){
+           this.generalActive = item.CntrId;
+      }else if(this.generalActive==item.CntrId){
+        this.generalActive="";
+      }else{
+        this.generalActive = item.CntrId;
+      }
+        console.log(this.generalActive);
+    },
+     specialBox(item){
+      
+      if(this.generalActive==""){
+           this.generalActive = item.CntrId;
+      }else if(this.generalActive==item.CntrId){
+        this.generalActive="";
+      }else{
+        this.generalActive = item.CntrId;
+      }
+       console.log(this.generalActive);
+    },
+    addBox(){
+      if(this.generalActive==""){
+        this.$message({message:"璇烽�夋嫨绠卞瓙",type:"warning"})
+      }else{
+        this.addNewBox({cnterId:this.generalActive});
+           
+      }     
+    },
+    async addNewBox(model){
+        
+           await this.$axios.post("/api/Order/AddSingeContainner",this.$qs.stringify(model)).then(res=>{
+             console.log(res);
+             //寮圭獥閲岄潰鏄睘浜庝簩绾�
+             this.$parent.$parent.getTempOrder();
+             this.$emit("newbox",false);
+          
+           }).catch(err=>{
+             this.$message.error("娣诲姞绠卞瓙鍑洪敊鍟�!");
+             console.log(err)
+           })
+    },
     //璇锋眰绠卞瀷鍒楄〃
-    async getBoxList(){
-      await this.$axios.get("/api/HomePage/GetOrderForm").then(res=>{
-            this.allData = res.data;
-      }).catch(err=>{
+    async getBoxList() {
+      await this.$axios
+        .get("/api/HomePage/GetOrderForm")
+        .then((res) => {
+          var general = res.data.ContainerList;
+          for (var j = 0; j < general.length; j++) {
+            if (general[j].CnterNub != 0) {
+              this.commonBox.push(general[j]);
+            }
+          }
+          this.allData = res.data;
+        })
+        .catch((err) => {
           console.log(err);
-      })
+        });
     },
     handleClick(tab, event) {
+     
       console.log(tab, event);
     },
   },
@@ -84,17 +150,21 @@
 .btn {
   text-align: center;
 }
-.btn button{
+.btn button {
   cursor: pointer;
   border: none;
   outline: none;
   padding: 6px 15px;
-  background-color: #F59A23;
+  background-color: #f59a23;
   color: #fff;
   font-weight: bold;
   border-radius: 6px;
 }
-.btn button:hover{
-    background-color: #f3a641;
+.btn button:hover {
+  background-color: #f3a641;
+}
+.generalactive{
+  background-color: #f59a23;
+  color: #fff;
 }
 </style>
\ No newline at end of file
diff --git a/src/components/agopage/comment/BoxType.vue b/src/components/agopage/comment/BoxType.vue
index 5d30119..6e38f03 100644
--- a/src/components/agopage/comment/BoxType.vue
+++ b/src/components/agopage/comment/BoxType.vue
@@ -453,6 +453,7 @@
     orderall: {
       handler(val) {
         this.orderType = val.OrderType;
+        this.pollArr =[];
         for (var i = 0; i < val.tempOrderForms.length; i++) {
        
           val.tempOrderForms[i].isNumDisable = false;
@@ -483,6 +484,11 @@
           } else {
             val.tempOrderForms[i].tempOrder.IsCarPooling = true;
           }
+          // //鍒锋柊鍚庤繕娌¤繑鍥炰环鏍肩殑
+          // if( val.tempOrderForms[i].tempOrder.IsInquiryAllowed==2){
+
+          //   this.pollArr.push(val.tempOrderForms[i].tempOrder.TempOrderID)
+          // }
         }
         this.tempOrderForms = val.tempOrderForms;
       },
@@ -621,6 +627,10 @@
         type: "warning",
       })
         .then(() => {
+          if(this.tempOrderForms.length==1){
+            this.$message.error("璇蜂繚鎸佽嚦灏戜竴鏉℃暟鎹�");
+            return;
+          }
           this.$axios
             .post(
               "/api/Order/DeleteSingeTmpOrder",
@@ -639,9 +649,29 @@
     },
     //璇环
     enquiry(id, item,index) {
-      this.tempOrderForms[index].tempOrder.IsInquiryAllowed = 2;
+     
       item.orderData.TempOrderID = id;
-      this.getEnquiry(item.orderData);
+              this.tempOrderForms[index].tempOrder.IsInquiryAllowed = 2;
+            this.getEnquiry(item.orderData);
+      // //鍒ゆ柇鏅�氱瀛愮殑璇环鍜岀壒娈婄瀛愮殑璇环鎵�瑕佷紶鐨勫唴瀹�
+      // if(item.tempOrder.Container.CntrType==2){
+      //     var isNull = false
+      //     for(let key in item.orderData){
+      //         if(item.orderData[key]==""){
+      //           isNull = true;
+      //         }
+      //     }
+      //     if(isNull){
+      //         this.$message.error("璇峰~鍐欎俊鎭�");
+      //     }else{
+      //        this.tempOrderForms[index].tempOrder.IsInquiryAllowed = 2;
+      //       this.getEnquiry(item.orderData);
+      //     } 
+      // }else{
+      //    this.tempOrderForms[index].tempOrder.IsInquiryAllowed = 2;
+      //      this.getEnquiry(item.orderData);
+      // }
+     
     },
     //瀹氭椂鍣ㄨ疆璇环鏍�
     async getPolling(model) {
@@ -650,14 +680,15 @@
         .then((res) => {
           // this.pollData = res.data;
           // 鏄惁杩斿洖璇环鐨勬帴鍙�
-          if(res.data.length>0 &&this.tempOrderForms.length>0){
-            for(var i=0,j=0;i<res.data.length,j<this.tempOrderForms.length;i++,j++){
-                if(res.data[i].TempOrderID==this.tempOrderForms[j].tempOrder.TempOrderID){
+          if(res.data.length>0 && this.pollArr.length>0){
+            for(var i=0;i<res.data.length;i++){
+              for(var j=0;j<this.tempOrderForms.length;j++){
+                    if(res.data[i].TempOrderID==this.tempOrderForms[j].tempOrder.TempOrderID){
                   this.tempOrderForms[j].tempOrder.BaseMoney = res.data[i].OdiqMoney;
                   this.tempOrderForms[j].tempOrder.IsInquiryAllowed = 0;
                    this.pollArr.splice(i, 1);
-                  console.log("鎷垮埌杩斿洖璇环鐨勫��",res.data[i].TempOrderID);
                 }
+              }
             }
           }
         })
diff --git a/src/components/agopage/comment/CarSharing.vue b/src/components/agopage/comment/CarSharing.vue
index 17d82b6..1b2c5f2 100644
--- a/src/components/agopage/comment/CarSharing.vue
+++ b/src/components/agopage/comment/CarSharing.vue
@@ -9,11 +9,11 @@
       </div>
     </div>
     <div class="oprator">
-      <div>
-        <span>閰嶆嫋绠�:</span>
-        <div>
+      <div class="box-content">
+        <div class="title">閰嶆嫋绠�:</div>
+        <div class="box">
           <i class="iconfont icon-jizhuangxiang_container"></i>
-          <span>20GP</span>
+          <div>20GP</div>
         </div>
       </div>
       <el-button plain size="mini">鍚堝苟鏁磋溅</el-button>
@@ -21,17 +21,17 @@
     </div>
     <div class="car-pool-show">
       <div>
-        <div>
+        <div class="one">
           <el-tag effect="dark" type="warning" size="mini">杞�</el-tag>
         </div>
-        <div>
+        <div class="two">
           <el-checkbox></el-checkbox>
         </div>
       </div>
       <div>
-        <div>
-          <div>鎻愮鍦�</div>
-          <div>
+        <div class="one">
+          <div >鎻愮鍦�</div>
+          <div >
             <el-select v-model="value" placeholder="璇烽�夋嫨">
               <el-option
                 v-for="item in options"
@@ -43,7 +43,7 @@
             </el-select>
           </div>
         </div>
-        <div>
+        <div class="two">
           <el-select v-model="value" placeholder="璇烽�夋嫨">
             <el-option
               v-for="item in options"
@@ -56,14 +56,14 @@
         </div>
       </div>
       <div class="three">
-        <div>
+        <div class="one">
           <div>瑁呭嵏鍦�</div>
           <div>
             <span>閲嶅簡甯傛笣鍖楀尯榫欐邯闀囧浗瀹惧煄12鏍�</span>
             <i class="el-icon-caret-bottom"></i>
           </div>
         </div>
-        <div>
+        <div class="two">
           <el-date-picker
             v-model="value1"
             type="daterange"
@@ -75,8 +75,8 @@
         </div>
       </div>
       <div class="four">
-          <div></div>
-          <div>
+          <div class="one"></div>
+          <div class="two">
               <span>鏁伴噺:1</span>
               <el-button icon="el-icon-close" size="mini" title="鍒犻櫎"></el-button>
               <el-button icon="el-icon-document-copy" size="mini" title="澶嶅埗"></el-button>
@@ -101,7 +101,38 @@
     display: flex;
   justify-content: space-between;
 }
+.oprator,.box-content,.box-content .box{
+  display: flex;
+  align-items: center;
+}
+.oprator{
+  width: 40%;
+  justify-content: space-between;
+}
+.box-content .box{
+  border: 1px solid #c3c3c3;
+  padding: 3px 6px;
+  border-radius: 3px;
+}
+.box-content .title{
+  font-weight: bold;
+}
 .title{
     display: flex;
+    justify-content: space-between;
 }
+.one,.two{
+  display: flex;
+  flex-direction: column;
+align-items: center;
+justify-content: center;  
+  height: 70px;
+}
+.four{
+  .two{
+    flex-direction: inherit;
+  }
+  
+}
+
 </style>
\ No newline at end of file
diff --git a/src/components/agopage/comment/GoodsClassify.vue b/src/components/agopage/comment/GoodsClassify.vue
new file mode 100644
index 0000000..05307f2
--- /dev/null
+++ b/src/components/agopage/comment/GoodsClassify.vue
@@ -0,0 +1,111 @@
+<template>
+  <div class="form-input">
+    <div
+      class="product"
+      v-for="(item, indexp) in productData"
+      :key="indexp"
+    
+      @click="selProeuct(item,indexp)"
+    >
+      <div>{{ item.GoodsTypeName }}</div>
+      <div class="child-classify" v-if="item.isShow">
+          <div v-for="(citem,cindex) in item.GoodsBaseList" :key="cindex" @click="selecProdcut(citem)" class="single-pro">
+              {{citem}}
+          </div>
+      </div>
+    </div>
+   
+    <div class="pro-input">
+      <el-input
+        placeholder="杈撳叆鐗╁搧"
+        v-model="productVal"
+        @blur="proInput"
+        clearable
+      ></el-input>
+    </div>
+  </div>
+</template>
+<script>
+export default {
+  data() {
+    return {
+       productVal:"",
+      productData: [
+        {
+          GoodsTypeName: "甯哥敤鍒嗙被1",
+          isShow:false,
+          GoodsBaseList: ["姹借溅绫�", "娴嬭瘯绫�"],
+        },
+        {
+            isShow:false,
+          GoodsTypeName: "甯哥敤鍒嗙被2",
+          GoodsBaseList: ["閽㈡潗绫�"],
+        },
+      ],
+    };
+  },
+  props:["goodslist"],
+  methods:{
+    proInput(){
+      this.$emit("acceptgoods",this.productVal);
+    },
+      selProeuct(item,index){
+          //鍙兘鏄剧ず涓�涓鍏堕�夋嫨
+           item.isShow = !item.isShow;
+        
+        //   if(!(item.isShow)){
+         
+        // for(var i =0;i<this.productData.length;i++){
+          
+        //     if(i!=index){
+              
+        //         this.productData[i].isShow=false;
+        //     }else{
+             
+        //         item.isShow = !item.isShow;
+        //     }
+        //   }
+        //   }
+        
+
+            
+      },
+      selecProdcut(item){
+          this.productVal = item;
+          this.$emit("acceptgoods",item);
+          // console.log(item)
+      },
+  }
+};
+</script>
+<style lang="less" scoped>
+
+.child-classify,.product{
+    width: 110px;
+   text-align: center;
+   border-radius: 3px;
+   border: 1px solid #e4e4e4;
+}
+.child-classify{
+    position:absolute;
+    background-color: #fff;
+}
+.single-pro:hover{
+    background-color: #e6a23c;
+  color: #fff;
+}
+.product {  
+  margin-right: 30px;
+  margin-bottom: 10px;
+  cursor: pointer;
+}
+.form-input {
+  display: flex;
+  flex-wrap: wrap;
+}
+.pro-input {
+  /deep/.el-input {
+    width: 110px;
+  }
+}
+</style>
\ No newline at end of file
diff --git a/src/components/agopage/home/Harbour.vue b/src/components/agopage/home/Harbour.vue
index 62b9d04..b47883e 100644
--- a/src/components/agopage/home/Harbour.vue
+++ b/src/components/agopage/home/Harbour.vue
@@ -21,49 +21,10 @@
                 <span>鎻愮鍦� : </span>
               </div>
             </template>
-            <div class="form-input">
-              <div class="tibox-adres">
-                <el-input
-                  @focus="tiFocus"
-                  readonly
-                  v-model="playBox"
-                ></el-input>
-                <div class="select-tibox" v-if="isTShow">
-                  <div v-if="pickPlaceList.length == 0">鏆� 鏃� 鏁� 鎹�</div>
-                  <el-tabs v-model="submitForm.CityId" @tab-click="handleClick">
-                    <el-tab-pane
-                      v-for="item in pickPlaceList"
-                      :key="item.CityId"
-                      :label="item.CityName"
-                      :name="item.CityId"
-                    >
-                      <el-radio-group v-model="radio" @change="selectPort">
-                        <el-radio
-                          @change="boxRadio"
-                          v-for="ritem in item.PortList"
-                          :key="ritem.PortId"
-                          :label="ritem"
-                          >{{ ritem.PortName }}</el-radio
-                        >
-                      </el-radio-group>
-                    </el-tab-pane>
-                  </el-tabs>
-                </div>
-              </div>
-
-              <div class="suffix-txt">
-                <div v-for="(item, pindex) in pickPlaceList" :key="pindex">
-                  <div
-                    class="shortcut"
-                    v-for="(shortcut, sindex) in item.PortList"
-                    :key="sindex"
-                    @click="shortCut(item, shortcut)"
-                  >
-                    <span v-if="sindex < 3">{{ shortcut.PortName }}</span>
-                  </div>
-                </div>
-              </div>
-            </div>
+               <box-adress
+              :boxaddress="pickPlaceList"
+              @acceptreturn="acceptPickAdress"
+            ></box-adress>
           </el-form-item>
           <el-form-item>
             <template slot="label">
@@ -230,22 +191,7 @@
               </div>
             </template>
             <div class="form-input">
-              <div
-                class="product"
-                v-for="(item, indexp) in productData"
-                :key="indexp"
-                :class="{ activebox: activeProduct == item }"
-                @click="selProeuct(item)"
-              >
-                {{ item.GoodsTypeName }}
-              </div>
-              <div class="pro-input">
-                <el-input
-                  placeholder="杈撳叆鐗╁搧"
-                  v-model="productVal"
-                  @focus="proInput"
-                ></el-input>
-              </div>
+                <goods-classify :goodslist="productData" @acceptgoods="acceptProduct"></goods-classify>
             </div>
           </el-form-item>
         </el-form>
@@ -293,6 +239,7 @@
 </template>
 <script>
 import BoxAdress from "../comment/BoxAdress";
+import GoodsClassify from"../comment/GoodsClassify.vue";
 export default {
   data() {
     return {
@@ -315,9 +262,6 @@
         // OnlyInput:""
       },
       timeUrgent: false,
-      value1: "",
-      radio1: "",
-      value4: "",
       productData: [],
       factory: [],
 
@@ -335,8 +279,6 @@
       isSpecial: false,
       pickPlaceList: [],
       retrunPlaceList: [],
-      activeProduct: "",
-      productVal: "",
       isSelect: "",
       urgentBeginTime:"",
       urgentEndTime:"",
@@ -358,7 +300,7 @@
       },
     };
   },
-  components: { BoxAdress },
+  components: { BoxAdress,GoodsClassify },
   props: ["alldata"],
   watch: {
     alldata(val) {
@@ -367,7 +309,12 @@
         val.ContainerList[i].select = false;
         val.ContainerList[i].pinche = false;
       }
-      this.boxType = val.ContainerList;
+      // 鍓旈櫎閭d釜鍗曠
+      for(var j =0;j<val.ContainerList.length;j++){
+         if(val.ContainerList[j].CnterNub!=0){
+             this.boxType.push(val.ContainerList[j]);
+          }
+      }
       val.SpecialContainerList.forEach((item) => {
         item.select = false;
         item.pinche = false;
@@ -386,11 +333,16 @@
         this.searchSpecial(val);
     },
   },
-  mounted() {
-   
-  },
+
   methods: {
-  
+    //鎺ユ敹鐗╁搧缁勪欢浼犳潵鐨勫��
+    acceptProduct(e){
+        this.submitForm.TransportGoods = e;
+    },
+    acceptPickAdress(e){
+      this.submitForm.PickPlace = e;
+    },
+    //鎺ユ敹杩樼鍦板潃
     acceptReturnAdress(e) {
       this.submitForm.ReturnPlace = e;
     },
@@ -475,34 +427,33 @@
       }
     },
     inquiryOrder() {
-      if (this.activeProduct == "") {
-        this.submitForm.TransportGoods = this.productVal;
-      }
-      // this.submitForm.ArriveTime = this.value1;
+    
+       this.submitForm.TempOrderContainerList=[];
       this.getForBox(this.boxType);
       this.getForBox(this.SpecialContainerList);
+      var judge = false;
+      for(var key in this.submitForm){
+        if(this.submitForm[key]==""||this.submitForm[key].length==0){
+             judge = true;
+        }
+      }
+      if(judge){
+         this.$message.error("璇峰厛瀹屽杽涓嬪崟淇℃伅");
+         return;
+      }
       console.log(this.submitForm);
       this.$axios
         .post("/api/Order/SaveTempOrder", this.$qs.stringify(this.submitForm))
         .then((res) => {
           console.log(res);
-          console.log(this.value4);
           this.$router.push("/inquiry");
         })
         .catch((err) => {
+          this.$message.error("璇峰厛鐧诲綍锛�")
           console.log(err);
         });
     },
-    //閫変腑鐗╁搧
-    selProeuct(content) {
-      this.productVal = "";
-      this.activeProduct = content;
-      this.submitForm.TransportGoods = content;
-    },
-    //杈撳叆鐗╁搧
-    proInput() {
-      this.activeProduct = "";
-    },
+
     // urgentChange(val) {
     //   if (val) {
     //      let year = this.urgentEndTime.slice(0,10)
@@ -514,6 +465,7 @@
     selAdress(content) {
       this.submitForm.OrderAddressLongitude = content.ComLongitude;
       this.submitForm.OrderAddressLatitude = content.ComLatitude;
+      this.submitForm.OrderAddress =  content.ComAdress;
       this.mapVal = content.ComAdress;
       this.usualAdrDialog = false;
     },
diff --git a/src/views/agomiddle/InquiryCenter.vue b/src/views/agomiddle/InquiryCenter.vue
index 28bcea4..4072c1d 100644
--- a/src/views/agomiddle/InquiryCenter.vue
+++ b/src/views/agomiddle/InquiryCenter.vue
@@ -79,7 +79,7 @@
     </div>
 
     <el-dialog title="鏂板绠卞瓙" :visible.sync="addBoxDialog" width="300px">
-      <add-box></add-box>
+      <add-box @newbox="acceptNewBox"></add-box>
     </el-dialog>
     <!-- 涓嬪崟鐨勫脊绐� -->
     <el-dialog
@@ -277,6 +277,10 @@
     this.getTempOrder();
   },
   methods: {
+    //鎺ユ敹娣诲姞鏂扮瀛愪紶杩囨潵鐨勫��
+    acceptNewBox(e){
+        this.addBoxDialog = e;
+    },
     orderSure() {
       console.log(this.allOrder);
       this.portOrderSave.CityId = "5dc90c98-475e-4529-bb3a-c3010a82b0e1";

--
Gitblit v1.9.1