From ea2b5a4a2779a2a94c4846b110c5507a248ffeb5 Mon Sep 17 00:00:00 2001
From: zuozhengqing <a13193816592@163.com>
Date: 星期三, 20 三月 2024 19:50:25 +0800
Subject: [PATCH] 销售明细发货添加确认完成,格式化列表状态展示

---
 src/views/sales/salesOpportunity/AddSalesOpportunityDialog.vue |   50 +++++++++++++++++++++++++++++++++-----------------
 1 files changed, 33 insertions(+), 17 deletions(-)

diff --git a/src/views/sales/salesOpportunity/AddSalesOpportunityDialog.vue b/src/views/sales/salesOpportunity/AddSalesOpportunityDialog.vue
index 62d4db1..c35a201 100644
--- a/src/views/sales/salesOpportunity/AddSalesOpportunityDialog.vue
+++ b/src/views/sales/salesOpportunity/AddSalesOpportunityDialog.vue
@@ -316,13 +316,13 @@
           <!-- 浜у搧绠$悊 -->
           <div class="basic-info-title" style="display: flex">
             浜у搧绠$悊
-            <div style="margin-left: 400px">
+            <!-- <div style="margin-left: 400px">
               甯佺
               <el-select v-model="editConfig.infomation.currency" placeholder="璇烽�夋嫨" size="mini" style="width: 63%">
                 <el-option v-for="item in currencyOptions" :key="item.id" :label="item.name" :value="item.id">
                 </el-option>
               </el-select>
-            </div>
+            </div> -->
           </div>
           <div class="product-view">
             <CommonFormTableView
@@ -746,6 +746,10 @@
           this.businessTypeOptions = res.data.sale_type
           this.oldCustomerMarketOptions = res.data.regular_customers
           this.saleStageOptions = res.data.sale_stage
+          if (this.editConfig.title === "鏂板缓") {
+            this.editConfig.infomation.sale_stage_id=1
+          }
+          
           this.provinceOptions = res.data.province
           this.regionOptions = res.data.region
           this.possibleOptions = res.data.possibility
@@ -767,11 +771,11 @@
     saveClick(formName) {
       this.$refs[formName].validate((valid) => {
         if (valid) {
-          const hasProduct = this.tableData.every((ele) => !!ele.name)
-          if (!hasProduct) {
-            this.$message.error("浜у搧鍚嶇О涓嶈兘涓虹┖")
-            return
-          }
+          // const hasProduct = this.tableData.every((ele) => !!ele.name)
+          // if (!hasProduct) {
+          //   this.$message.error("浜у搧鍚嶇О涓嶈兘涓虹┖")
+          //   return
+          // }
 
           const params = this.saveParams()
           console.log(params)
@@ -810,6 +814,12 @@
     },
     saveParams() {
       let data = this.editConfig.infomation
+      let products = []
+      this.tableData.map((item) => {
+        if (item.number.length > 0) {
+          products.push(item)
+        }
+      })
       let params = {
         id: this.editConfig.title === "鏂板缓" ? 0 : data.id,
         advantages: data.advantages || "",
@@ -847,7 +857,7 @@
         detail_address: data.detail_address || "",
 
         codeStandID: data.ID,
-        products: this.tableData
+        products: products
       }
       return params
     },
@@ -981,8 +991,9 @@
       }
       this.productTableList = {
         tableData: this.tableData,
+        isReturn: true,
         tableColumn: [
-          { label: "#", prop: "productId", width: 40 },
+          // { label: "#", prop: "productId", width: 40 },
           { label: "浜у搧鍚嶇О", prop: "name", productName: true, isRequird: true },
           { label: "浜у搧缂栧彿", prop: "number" },
           { label: "鏁伴噺", prop: "amount", inputNumber: true, isRequird: true },
@@ -993,9 +1004,9 @@
     },
     // 浜у搧鍒楄〃杈撳叆
     inputContent(val, prop, row) {
-      this.productId = row.productId
+      // this.productId = row.productId
       this.tableData.map((item) => {
-        if (item.productId === row.productId) {
+        if (item.number === row.number) {
           item[prop] = val
         }
       })
@@ -1016,13 +1027,18 @@
       // this.showSummary.show = true
     },
     // 鏂板鏂瑰紡淇敼
-    getSelectArray(val) {
-      if (val.length > 0) {
-        val.map((item, index) => {
-          item.productId = this.tableData.length + index + 1
-        })
+    getSelectArray(val, index) {
+      if (this.tableData.length == 1 && this.tableData[0].number.length == 0) {
+        this.tableData = []
       }
-      this.tableData = this.tableData.concat(val)
+      if (index < this.tableData.length) {
+        this.tableData.splice(index, 1)
+        val.map((item, ind) => {
+          this.tableData.splice(index + ind, 0, item)
+        })
+      } else {
+        this.tableData = this.tableData.concat(val)
+      }
       this.productTableList.tableData = this.tableData
       this.showSummary.show = true
     },

--
Gitblit v1.8.0