From 8e5ec095fc4ba9cac7c91b681b06846d3e4155ae Mon Sep 17 00:00:00 2001
From: zuozhengqing <a13193816592@163.com>
Date: 星期一, 16 十月 2023 21:17:29 +0800
Subject: [PATCH] 销售明细,退货单、退款单根据客户进行筛选

---
 src/components/makepager/CommonFormTableView.vue |   56 ++++++++++++++++++++++++++++++++++++++++----------------
 1 files changed, 40 insertions(+), 16 deletions(-)

diff --git a/src/components/makepager/CommonFormTableView.vue b/src/components/makepager/CommonFormTableView.vue
index 3981921..fbdc6fe 100644
--- a/src/components/makepager/CommonFormTableView.vue
+++ b/src/components/makepager/CommonFormTableView.vue
@@ -8,6 +8,7 @@
         :span-method="arraySpanMethod"
         style="width: 100%"
       >
+        <el-table-column v-if="tableList.isReturn" type="index" label="#" width="50" align="center"></el-table-column>
         <el-table-column
           v-for="(item, i) in tableList.tableColumn"
           :key="i"
@@ -46,7 +47,6 @@
                 v-else-if="item.productName"
                 label=" "
                 :prop="'tableData.' + scope.$index + '.' + item.prop"
-                :rules="[{ required: item.isRequird ? true : false, message: '浜у搧鍚嶇О涓嶈兘涓虹┖' }]"
               >
                 <div class="custom-name">
                   <el-autocomplete
@@ -63,8 +63,12 @@
                   <div class="common-select-btn" @click="selClientClick(scope.row, item.prop)">
                     <i class="el-icon-circle-plus-outline" title="閫夋嫨"></i>
                   </div>
-                  <div class="common-select-btn" @click="clearupClient(scope.row)">
-                    <i class="el-icon-edit-outline" title="娓呴櫎"></i>
+                  <div
+                    v-if="scope.row[item.prop] && scope.row[item.prop].length > 0"
+                    class="common-select-btn"
+                    @click="clearupClient(scope.row)"
+                  >
+                    <i class="el-icon-remove-outline" title="娓呴櫎"></i>
                   </div>
                 </div>
               </el-form-item>
@@ -121,7 +125,7 @@
               </el-form-item>
               <span v-else>{{ scope.row[item.prop] }}</span>
             </template>
-            <span v-else>{{ scope.row[item.prop] }}</span>
+            <span v-else style="text-align: right">{{ scope.row[item.prop] }}</span>
           </template>
         </el-table-column>
       </el-table>
@@ -130,15 +134,17 @@
       <el-button size="small" type="primary" @click="add">鏂板</el-button>
       <!-- <el-button size="small" type="primary" disabled>瀵煎叆鏄庣粏</el-button> -->
       <el-button size="small" type="primary" @click="empty">娓呯┖</el-button>
-      <el-button size="small" type="primary" @click="recalculate">閲嶇畻</el-button>
+      <el-button size="small" type="primary" @click="recalculate" :disabled="isRecalculate ? false : true"
+        >閲嶇畻</el-button
+      >
     </div>
-    <div v-if="showSummary.total || showSummary.refundable" style="height: 42px; line-height: 42px">
+    <div v-if="false && (showSummary.total || showSummary.refundable)" style="height: 42px; line-height: 42px" >
       <el-row :gutter="10">
-        <el-col v-if="showSummary.total" :span="2" :offset="22">
+        <el-col v-if="showSummary.total" :span="3" :offset="21">
           <span style="font-weight: bold">鍚堣</span>
           <span style="margin-left: 10px">{{ total }}</span>
         </el-col>
-        <el-col v-if="showSummary.refundable" :span="2" :offset="22">
+        <el-col v-if="showSummary.refundable" :span="3" :offset="21">
           <span style="font-weight: bold">搴旈��娆�</span>
           <span style="margin-left: 10px">0.00</span>
         </el-col>
@@ -169,6 +175,7 @@
       default: () => {
         return {
           tableData: [], // 鎺ュ彛杩斿洖鏁版嵁
+          isReturn: false,
           tableColumn: [
             // table琛ㄥ崟
             { label: "", prop: "", min: 200, tooltip: true }
@@ -199,12 +206,18 @@
         title: "",
         infomation: {}
       },
-      productIndex: 0
+      productIndex: 0,
+      isRecalculate: true
     }
   },
   created() {
     this.getProductList()
     this.tableList = this.productTableList
+    if (this.tableList.tableData.length === 1 && this.tableList.tableData[0].name === "") {
+      this.isRecalculate = false
+    } else {
+      this.isRecalculate = true
+    }
   },
   computed: {},
   methods: {
@@ -216,10 +229,10 @@
         page: 1,
         pageSize: 5
       }).then((res) => {
-        console.log(res.data)
-        if (res.data.code === 200) {
-          if (res.data.data.data && res.data.data.data.length > 0) {
-            this.productList = res.data.data.data
+        console.log(res,"浜у搧鍚嶇О")
+        if (res.code === 200) {
+          if (res.data.data && res.data.data.length > 0) {
+            this.productList = res.data.data
           }
         }
       })
@@ -256,7 +269,7 @@
           sums[index] = "灏忚:"
           return
         }
-        const title = ["#"]
+        const title = ["#", "浜у搧鍚嶇О"]
         // 鍘婚櫎鏌愪簺涓嶉渶瑕佽绠楃殑鏁版嵁
         if (title.includes(column.label)) {
           sums[index] = ""
@@ -319,10 +332,18 @@
     commonInputChange(val, prop, row) {
       console.log(val, prop)
       console.log(row)
+      if (prop === "amount") {
+        this.tableList.tableData.map((ite) => {
+          if (ite.name === row.name) {
+            ite.total = row.amount * row.price
+          }
+        })
+      }
       this.$emit("inputContent", val, prop, row)
     },
     // 娓呯┖
     empty() {
+      this.isRecalculate = false
       this.$emit("emptyProductClick")
     },
     // 閲嶇畻
@@ -353,6 +374,7 @@
     },
     handleSelectClient(item, prop, row) {
       // this.clientId = item.id
+      this.isRecalculate = true
       console.log(item, prop, row)
       this.tableList.tableData.map((ite) => {
         if (ite.name === item.name) {
@@ -372,6 +394,7 @@
     selClient(item) {
       console.log(item)
       console.log(this.tableList.tableData)
+      this.isRecalculate = true
       // this.editConfig.infomation.client_name = row.name
       this.tableList.tableData.map((ite, index) => {
         if (index === this.productIndex) {
@@ -422,7 +445,7 @@
   }
   .el-table__footer-wrapper tbody td.el-table__cell {
     background-color: #fff;
-    text-align: right;
+    // text-align: right;
     font-weight: bold;
   }
   .el-input--suffix .el-input__inner {
@@ -433,7 +456,8 @@
     padding: 0 5px;
   }
   .el-input__inner {
-    text-align: left;
+    // text-align: left;
+    text-align: center !important;
   }
 }
 </style>

--
Gitblit v1.8.0