Parcourir la source

修改销售钢材

luobang il y a 2 ans
Parent
commit
ea9b6e0efc

+ 49 - 18
src/views/appoint/components/saleContract/addSaleOrder.vue

@@ -1201,6 +1201,15 @@ export default {
     //以上是发货单位边输边查搜索
     //下单客户弹出层
     handleSelectConsignee(item) {
+      this.saleShipperAddressName = null;
+      this.saleShipperAddressId = null;
+      this.addressId = null;
+      this.place1 = null;
+      this.saleMan = null;
+      this.saleOrderConsigneeTel = null;
+      this.province = null;
+      this.city = null;
+      this.county = null;
       this.consigneeName = item.consigneeCompanyName;
       this.consigneeId = item.consigneeId;
       this.isReceiveHaveArea(this.consigneeId);
@@ -1840,27 +1849,49 @@ export default {
     },
     //收货地址弹出层
     handleSelect1(item) {
-      console.log("获取所有下拉值!");
+      console.log(item);
+      this.province = item.province;
+      this.city = item.district;
+      this.county = item.town;
+      this.place1 = item.place;
+      this.addressId = item.shipperAddressId;
+      this.place = item.place;
     },
     //以下是收货地址边输边查搜索
     querySearch1(queryString, cb) {
-      this.axios
-        .post(
-          "/api/v1/ams/getRealAddressByLike?addressId=" +
-            this.addressId +
-            "&index=" +
-            queryString
-        )
-        .then(res => {
-          if (res.data.code == "200") {
-            var restaurants = res.data.data;
-            var results = queryString
-              ? restaurants.filter(this.createFilter1(queryString))
-              : restaurants;
-            // 调用 callback 返回建议列表的数据
-            cb(results);
-          }
-        });
+      if (this.addressId != null) {
+        this.axios
+          .post(
+            "/api/v1/ams/getRealAddressByLike?addressId=" +
+              this.addressId +
+              "&index=" +
+              queryString
+          )
+          .then(res => {
+            if (res.data.code == "200") {
+              var restaurants = res.data.data;
+              var results = queryString
+                ? restaurants.filter(this.createFilter1(queryString))
+                : restaurants;
+              // 调用 callback 返回建议列表的数据
+              cb(results);
+            }
+          });
+      } else {
+        this.axios
+          .post("/api/v1/uc/getPlaceAndAddress?index=" + queryString)
+          .then(res => {
+            if (res.data.code == "200") {
+              console.log(res.data.data);
+              var restaurants = res.data.data;
+              var results = queryString
+                ? restaurants.filter(this.createFilter1(queryString))
+                : restaurants;
+              // 调用 callback 返回建议列表的数据
+              cb(results);
+            }
+          });
+      }
     },
     createFilter1(queryString) {
       return restaurants => {

+ 138 - 7
src/views/appoint/components/saleContract/editSaleOrder.vue

@@ -96,12 +96,17 @@
     <el-form :inline="true" style="margin-top: 1rem;">
       <el-form-item>
         <label class="el-form-item__label" style="width: auto;">收货地址</label>
-        <el-input
-          style="width: 400px"
+        <el-autocomplete
+          style="width:400px"
           v-model="saleShipperAddressName"
-          disabled
+          :fetch-suggestions="querySearchAddress"
+          placeholder="请输入内容"
+          @select="handleSelectAddress"
         >
-        </el-input>
+          <template slot-scope="{ item }">
+            <span class="addr">{{ item.addressPlace }}</span>
+          </template>
+        </el-autocomplete>
         <el-button type="primary" @click="ondrawerOut">选择</el-button>
       </el-form-item>
       <el-form-item>
@@ -289,6 +294,9 @@
           <template slot="scope" v-if="item.label !== '收货方电话'">
             <span>{{ item.label }}</span>
           </template>
+          <template slot="scope" v-if="item.label !== '备注'">
+            <span>{{ item.label }}</span>
+          </template>
           <!-- 插入输入框 -->
           <template slot-scope="scope">
             <template v-if="item.slot">
@@ -366,6 +374,14 @@
                   @change="batchUpdateValue(scope.row, scope.$index)"
                 ></el-input>
               </template>
+              <!-- 备注 -->
+              <template v-if="item.prop == 'truckRemark'">
+                <el-input
+                  class="textinput5"
+                  placeholder="(必填)"
+                  v-model="scope.row.truckRemark"
+                ></el-input>
+              </template>
             </template>
             <template v-else>
               <span>{{ scope.row[item.prop] }}</span>
@@ -373,7 +389,7 @@
           </template>
         </el-table-column>
         <!-- 操作列 -->
-        <el-table-column fixed="right" label="操作" width="100">
+        <el-table-column fixed="right" label="操作" width="200">
           <template slot-scope="scope">
             <el-button
               @click.native.prevent="deleteRow(scope.$index, selectionList)"
@@ -381,6 +397,28 @@
               icon="el-icon-close"
               size="big"
             ></el-button>
+            <el-button
+              @click.native.prevent="copyRow(scope.$index, scope.row)"
+              type="text"
+              size="big"
+              >复制为一车</el-button
+            >
+            <el-button
+              @click.native.prevent="copyRowflu(scope.$index, scope.row)"
+              type="text"
+              size="big"
+              >复制为分录</el-button
+            >
+          </template>
+        </el-table-column>
+        <el-table-column fixed="right" width="80">
+          <template slot-scope="scope">
+            <el-button
+              @click.native.prevent="copyRowfluAll(scope.$index, scope.row)"
+              type="text"
+              size="big"
+              >复制整车</el-button
+            >
           </template>
         </el-table-column>
       </el-table>
@@ -885,6 +923,78 @@ export default {
     this.getAllSaleMessages();
   },
   methods: {
+    handleSelectAddress(item) {
+      this.saleShipperAddressName = item.addressPlace;
+      this.province = item.addressProvince;
+      this.city = item.addressDistrict;
+      this.county = item.addressTown;
+      this.saleShipperAddressId = item.shipperAddressId;
+      this.addressId = item.shipperAddressId;
+      this.place1 = item.place;
+      this.saleOrderConsigneeTel = item.saleOrderConsigneeTel;
+    },
+    querySearchAddress(queryString, cb) {
+      if (this.consigneeId != null) {
+        this.axios
+          .post(
+            "/api/v1/ams/matchingAddressRecently?receiveId=" + this.consigneeId
+          )
+          .then(res => {
+            var restaurants = res.data.data;
+            console.log(restaurants);
+            var results = queryString
+              ? restaurants.filter(this.createStateFilter(queryString))
+              : restaurants;
+            cb(results);
+          });
+      }
+    },
+    createStateFilter(queryString) {
+      return restaurants => {
+        return (
+          restaurants.addressPlace
+            .toLowerCase()
+            .indexOf(queryString.toLowerCase()) > -1
+        );
+      };
+    },
+    copyRow(index, row) {
+      let copyRow = new Object();
+      Object.keys(row).forEach(key => {
+        copyRow[key] = row[key];
+      });
+      copyRow.cxh = this.maxCxh;
+      this.selectionList.push(copyRow);
+      this.getSpanArr(this.selectionList);
+      this.maxCxh++;
+    },
+    copyRowflu(index, row) {
+      console.log(index);
+      let copyRowflu = new Object();
+      Object.keys(row).forEach(key => {
+        copyRowflu[key] = row[key];
+      });
+      this.selectionList.splice(index + 1, 0, copyRowflu);
+      // this.selectionList.push(copyRowflu);
+      this.getSpanArr(this.selectionList);
+    },
+    copyRowfluAll(index, row) {
+      let arr = [];
+      //复制整车,根据车序号去寻找相同的列
+      arr = this.selectionList.concat([]).filter((item, index) => {
+        return item.cxh == row.cxh;
+      });
+      arr.forEach(e => {
+        let copyRow = new Object();
+        Object.keys(e).forEach(key => {
+          copyRow[key] = e[key];
+        });
+        copyRow.cxh = this.maxCxh;
+        this.selectionList.push(copyRow);
+      });
+      this.getSpanArr(this.selectionList);
+      this.maxCxh++;
+    },
     onblur() {
       this.isCellClick = 0;
       console.log("我这里值也变化了");
@@ -907,7 +1017,7 @@ export default {
         )
         .then(res => {
           //销售订单基础数据
-          console.log(res);
+          console.log(res.data.data);
           this.shipperName = res.data.data.shipperName;
           this.shipperId = res.data.data.shipperId;
           this.consigneeName = res.data.data.receiveName;
@@ -1319,6 +1429,7 @@ export default {
               saleShipperAddressName: this.saleShipperAddressName,
               saleDateOfReceipt: this.saleDateOfReceipt,
               saleOrderConsigneeTel: this.saleOrderConsigneeTel,
+              truckRemark: this.truckRemark,
               materialId: e.materialId,
               haveMeter: e.haveMeter,
               isDisable: e.isDisable
@@ -1349,6 +1460,7 @@ export default {
             saleShipperAddressName: this.saleShipperAddressName,
             saleDateOfReceipt: this.saleDateOfReceipt,
             saleOrderConsigneeTel: this.saleOrderConsigneeTel,
+            truckRemark: this.truckRemark,
             materialId: e.materialId,
             haveMeter: e.haveMeter,
             isDisable: e.isDisable
@@ -1616,6 +1728,22 @@ export default {
           colspan: _col
         };
       }
+      if (columnIndex === 8) {
+        const _row = this.spanArr[rowIndex];
+        const _col = _row > 0 ? 1 : 0;
+        return {
+          rowspan: _row,
+          colspan: _col
+        };
+      }
+      if (columnIndex === 10) {
+        const _row = this.spanArr[rowIndex];
+        const _col = _row > 0 ? 1 : 0;
+        return {
+          rowspan: _row,
+          colspan: _col
+        };
+      }
     },
     //点击外层收货地址浏览事件
     ondrawerOut() {
@@ -1807,6 +1935,7 @@ export default {
             var orderPlanWeightAllFill = 0;
             //初始化maplist
             var mapList = [];
+            console.log(this.selectionList);
             this.selectionList.forEach(item => {
               if (!item.orderPlanWeight) {
                 orderPlanWeightAllFill++;
@@ -1830,7 +1959,8 @@ export default {
                 //米数
                 steelMeters: 0,
                 //是否磅重销售
-                isPoundSale: 0
+                isPoundSale: 0,
+                truckRemark: null
               };
               mapItem.truckNo = item.cxh;
               mapItem.shipperAddressId = item.saleShipperAddressId;
@@ -1841,6 +1971,7 @@ export default {
               mapItem.materialNumber = item.orderPlanWeight;
               mapItem.steelMeters = item.meterNumber;
               mapItem.isPoundSale = item.isPound;
+              mapItem.truckRemark = item.truckRemark;
               mapList.push(mapItem);
             });
             let mapValue = {