From d4f4c52402b91cb8e17c1845da71c5e39662fde0 Mon Sep 17 00:00:00 2001
From: yangfeng <wanwan926_4@163.com>
Date: 星期三, 03 一月 2024 15:28:06 +0800
Subject: [PATCH] 销售报价单列表页增加统计内容及接口联调、添加报价单天天客户名称及对应限制功能

---
 src/views/other/payment/saleInvoice/addSaleInvoice.vue |  314 +++++++++++++++++++++++++++++++++-------------------
 1 files changed, 198 insertions(+), 116 deletions(-)

diff --git a/src/views/other/payment/saleInvoice/addSaleInvoice.vue b/src/views/other/payment/saleInvoice/addSaleInvoice.vue
index d19d174..15b6399 100644
--- a/src/views/other/payment/saleInvoice/addSaleInvoice.vue
+++ b/src/views/other/payment/saleInvoice/addSaleInvoice.vue
@@ -13,7 +13,7 @@
         :model="editConfig.infomation"
         :rules="rules"
         label-position="right"
-        label-width="308px"
+        label-width="168px"
         size="mini"
         style="height: 60vh; overflow-x: hidden"
       >
@@ -24,15 +24,44 @@
           <div class="basic-info-view">
             <el-row>
               <el-col :span="12">
-                <el-form-item label="涓婚" prop="subject">
-                  <el-input v-model="editConfig.infomation.subject"></el-input>
+                <el-form-item label="鍙戠エ缂栧彿" prop="number">
+                  <el-input
+                    v-if="
+                      editConfig.title == '缂栬緫' ||
+                      (editConfig.title == '鏂板缓' && codenumer && (explain != '' || isIdDisabled))
+                    "
+                    :disabled="editConfig.title == '缂栬緫'"
+                    v-model="editConfig.infomation.number"
+                    placeholder="璇疯緭鍏ョ紪鐮�"
+                  >
+                  </el-input>
+                  <span v-else-if="editConfig.title == '鏂板缓'" style="color: #f56c6c"
+                    >璇蜂紭鍏堥厤缃紪鐮佽鑼� <el-button type="text" @click="numberClick"> 閰嶇疆瑙勮寖 </el-button></span
+                  >
+                  <!-- <WordInput
+                    v-if="codenumer && (explain != '' || isIdDisabled)&&method == 0"
+                    :codenumer="codenumer"
+                    :sum="sum"
+                    :disabled="isIdDisabled"
+                    :inputValue="inputValue"
+                    @codeList="codeList"
+                  />
+                  <span v-else-if="method == 0" style="color: #f56c6c"
+                    >璇蜂紭鍏堥厤缃紪鐮佽鑼�
+                    <el-button type="text"  @click="numberClick">
+                        閰嶇疆瑙勮寖
+                      </el-button
+                    ></span
+                  >
+                  <span  v-else>鑷姩鐢熸垚</span> -->
                 </el-form-item>
               </el-col>
               <el-col :span="12">
-                <el-form-item label="鍙戠エ缂栧彿" prop="number">
-                  <el-input v-model="editConfig.infomation.number"></el-input>
+                <el-form-item label="涓婚" prop="subject">
+                  <el-input v-model="editConfig.infomation.subject" style="width: 100%"></el-input>
                 </el-form-item>
               </el-col>
+
               <el-col :span="12">
                 <el-form-item label="瀹㈡埛鍚嶇О" prop="client_name">
                   <div class="custom-name">
@@ -45,12 +74,17 @@
                       "
                       value-key="name"
                       @select="handleSelectClient('client', $event)"
+                      style="width: 100%"
                     ></el-autocomplete>
                     <div class="common-select-btn" @click="selClientClick('client')">
                       <i class="el-icon-circle-plus-outline" title="閫夋嫨"></i>
                     </div>
-                    <div class="common-select-btn" @click="clearupClient('client')">
-                      <i class="el-icon-edit-outline" title="娓呴櫎"></i>
+                    <div
+                      v-if="editConfig.infomation.client_name && editConfig.infomation.client_name.length > 0"
+                      class="common-select-btn"
+                      @click="clearupClient('client')"
+                    >
+                      <i class="el-icon-remove-outline" title="娓呴櫎"></i>
                     </div>
                   </div>
                 </el-form-item>
@@ -63,6 +97,7 @@
                       placeholder="璇烽�夋嫨"
                       class="common-select-sel"
                       size="mini"
+                      style="width: 100%"
                     >
                       <el-option v-for="item in invoiceTypeOptions" :key="item.id" :label="item.name" :value="item.id">
                       </el-option>
@@ -79,6 +114,7 @@
                       placeholder="璇烽�夋嫨"
                       class="common-select-sel"
                       size="mini"
+                      style="width: 100%"
                     >
                       <el-option
                         v-for="item in invoiceStatusOptions"
@@ -98,7 +134,7 @@
                     v-model="editConfig.infomation.principalId"
                     placeholder="璇烽�夋嫨"
                     size="mini"
-                    style="width: 63%"
+                    style="width: 100%"
                   >
                     <el-option v-for="item in memberOptions" :key="item.id" :label="item.username" :value="item.id">
                     </el-option>
@@ -116,14 +152,25 @@
                         }
                       "
                       value-key="number"
+                      :disabled="this.editCommonConfig.infomation.id ? true : false"
                       @select="handleSelectClient('serviceContract', $event)"
+                      style="width: 100%"
                     ></el-autocomplete>
-                    <div class="common-select-btn" @click="selClientClick('serviceContract')">
-                      <i class="el-icon-circle-plus-outline" title="閫夋嫨"></i>
-                    </div>
-                    <div class="common-select-btn" @click="clearupClient('serviceContract')">
-                      <i class="el-icon-edit-outline" title="娓呴櫎"></i>
-                    </div>
+                    <template v-if="!this.editCommonConfig.infomation.id">
+                      <div class="common-select-btn" @click="selClientClick('serviceContract')">
+                        <i class="el-icon-circle-plus-outline" title="閫夋嫨"></i>
+                      </div>
+                      <div
+                        v-if="
+                          editConfig.infomation.serviceContract_Number &&
+                          editConfig.infomation.serviceContract_Number.length > 0
+                        "
+                        class="common-select-btn"
+                        @click="clearupClient('serviceContract')"
+                      >
+                        <i class="el-icon-remove-outline" title="娓呴櫎"></i>
+                      </div>
+                    </template>
                   </div>
                 </el-form-item>
               </el-col>
@@ -131,27 +178,35 @@
                 <el-form-item label="鍚堝悓璁㈠崟">
                   <div class="custom-name">
                     <el-autocomplete
-                      v-model="editConfig.infomation.number"
+                      v-model="editConfig.infomation.contract_number"
                       :fetch-suggestions="
                         (queryString, callback) => {
                           querySearchAsync(queryString, callback, 'contract')
                         }
                       "
                       value-key="number"
+                      :disabled="this.editCommonConfig.infomation.id ? true : false"
                       @select="handleSelectClient('contract', $event)"
+                      style="width: 100%"
                     ></el-autocomplete>
-                    <div class="common-select-btn" @click="selClientClick('contract')">
-                      <i class="el-icon-circle-plus-outline" title="閫夋嫨"></i>
-                    </div>
-                    <div class="common-select-btn" @click="clearupClient('contract')">
-                      <i class="el-icon-edit-outline" title="娓呴櫎"></i>
-                    </div>
+                    <template v-if="!this.editCommonConfig.infomation.id">
+                      <div class="common-select-btn" @click="selClientClick('contract')">
+                        <i class="el-icon-circle-plus-outline" title="閫夋嫨"></i>
+                      </div>
+                      <div
+                        v-if="editConfig.infomation.contract_number && editConfig.infomation.contract_number.length > 0"
+                        class="common-select-btn"
+                        @click="clearupClient('contract')"
+                      >
+                        <i class="el-icon-remove-outline" title="娓呴櫎"></i>
+                      </div>
+                    </template>
                   </div>
                 </el-form-item>
               </el-col>
               <el-col :span="12">
                 <el-form-item label="绾崇◣璇嗗埆鍙�" prop="taxpayerIdNumber">
-                  <el-input v-model="editConfig.infomation.taxpayerIdNumber"></el-input>
+                  <el-input v-model="editConfig.infomation.taxpayerIdNumber" style="width: 100%"></el-input>
                 </el-form-item>
               </el-col>
             </el-row>
@@ -168,6 +223,7 @@
                       placeholder="璇烽�夋嫨"
                       class="common-select-sel"
                       size="mini"
+                      style="width: 100%"
                     >
                       <el-option
                         v-for="item in courierCompanyOptions"
@@ -183,7 +239,7 @@
               </el-col>
               <el-col :span="12">
                 <el-form-item label="鐗╂祦鍗曞彿" prop="courierNumber">
-                  <el-input v-model="editConfig.infomation.courierNumber"></el-input>
+                  <el-input v-model="editConfig.infomation.courierNumber" style="width: 100%"></el-input>
                 </el-form-item>
               </el-col>
               <el-col :span="12">
@@ -193,13 +249,14 @@
                     value-format="yyyy-MM-dd"
                     type="date"
                     placeholder="閫夋嫨鏃ユ湡"
+                    style="width: 100%"
                   >
                   </el-date-picker>
                 </el-form-item>
               </el-col>
               <el-col :span="12">
                 <el-form-item label="鍙戠エ鍙风爜" prop="invoiceNumber">
-                  <el-input v-model="editConfig.infomation.invoiceNumber"></el-input>
+                  <el-input v-model="editConfig.infomation.invoiceNumber" style="width: 100%"></el-input>
                 </el-form-item>
               </el-col>
             </el-row>
@@ -266,6 +323,7 @@
               @addProductClick="addProductClick"
               @emptyProductClick="emptyProductClick"
               @recalculateProductClick="recalculateProductClick"
+              @clearupProduct="clearupProduct"
             />
           </div>
           <!-- 閫夋嫨瀹℃壒娴佺▼ -->
@@ -339,8 +397,10 @@
 import SelectClientDialog from "@/views/other/commonDialog/SelectClientDialog"
 import SelectCommonDialog from "@/views/other/commonDialog/SelectCommonDialog"
 import { addInvoice, getInvoiceTypeList, getInvoiceStatusList, getCourierCompanyList } from "@/api/common/payment"
+import codeMixin from "@/components/makepager/mixin/codeMixin"
 export default {
   name: "AddSaleInvoiceDialog",
+  mixins: [codeMixin],
   props: {
     editCommonConfig: {
       type: Object,
@@ -368,9 +428,10 @@
   },
   data() {
     return {
-      dialogWidth: "80%",
+      dialogWidth: "50%",
       editConfig: this.editCommonConfig,
       rules: {
+        number: [{ required: true, validator: this.validateCheckCode, trigger: ["change", "blur"] }],
         subject: [{ required: true, message: "璇疯緭鍏ヤ富棰�", trigger: "blur" }],
         client_name: [{ required: true, message: "璇烽�夋嫨瀹㈡埛鍚嶇О", trigger: "change" }],
         invoiceTypeId: [{ required: true, message: "璇烽�夋嫨绁ㄦ嵁绫诲瀷", trigger: "change" }],
@@ -387,7 +448,7 @@
         show: true,
         total: true,
         sumProp: ["Amount", "Unit", "total"],
-        mergeNumber: 3
+        mergeNumber: 2
       },
       editSelectClientConfig: {
         editVisible: false,
@@ -410,10 +471,11 @@
         infomation: {}
       },
       clientId: this.editCommonConfig.infomation.client_id,
-      SalesDetailsId: this.editCommonConfig.infomation.SalesDetailsId,
+      SalesDetailsId: this.editCommonConfig.infomation.id,
       serviceContractId: this.editCommonConfig.infomation.id,
       tableData: [],
-      productId: 1
+      productId: 1,
+      isNoProduct: true
     }
   },
   created() {
@@ -422,8 +484,24 @@
     this.$store.dispatch("geSalesDetails")
     this.setTableForm()
     this.getCommonData()
+    this.formInfo()
+  },
+  watch: {
+    "editCommonConfig.visible"(val) {
+      if (val) {
+        this.formInfo()
+      }
+    }
   },
   methods: {
+    formInfo() {
+      this.objCode.type = "閿�鍞彂绁ㄧ紪鐮�"
+      this.objCode.codeStandID = ""
+      if (this.editConfig.infomation.codeStandID) {
+        this.objCode.codeStandID = this.editConfig.infomation.codeStandID
+      }
+      this.getRCodeStandardList()
+    },
     getCommonData() {
       getAllData().then((res) => {
         if (res.code === 200) {
@@ -433,59 +511,64 @@
       this.getInvoiceTypeList()
       this.getInvoiceStatusList()
       this.getCourierCompanyList()
+      this.$set(this.editConfig.infomation, "serviceContract_Number", this.editCommonConfig.infomation.keyword)
+      this.$set(this.editConfig.infomation, "contract_number", this.editCommonConfig.infomation.keyword)
     },
     async getInvoiceTypeList() {
-      await getInvoiceTypeList().then((res) => {
-        console.log("绁ㄦ嵁绫诲瀷")
-        console.log(res.data)
-        if (res.data.code === 200) {
-          this.invoiceTypeOptions = res.data.data.data
-        }
-      })
+      const res = await getInvoiceTypeList()
+      if (res.code == 200) {
+        this.invoiceTypeOptions = res.data.data
+      }
     },
     async getInvoiceStatusList() {
-      await getInvoiceStatusList().then((res) => {
-        console.log("绁ㄦ嵁鐘舵��")
-        console.log(res.data)
-        if (res.data.code === 200) {
-          this.invoiceStatusOptions = res.data.data.data
-        }
-      })
+      const res = await getInvoiceStatusList()
+      if (res.code == 200) {
+        this.invoiceStatusOptions = res.data.data
+      }
     },
     async getCourierCompanyList() {
-      await getCourierCompanyList().then((res) => {
-        console.log("鐗╂祦鍏徃")
-        console.log(res.data)
-        if (res.data.code === 200) {
-          this.courierCompanyOptions = res.data.data.data
-        }
-      })
+      const res = await getCourierCompanyList()
+      if (res.code == 200) {
+        this.courierCompanyOptions = res.data.data
+      }
     },
     // 淇濆瓨
     saveClick(formName) {
       this.$refs[formName].validate((valid) => {
         if (valid) {
           console.log(this.editConfig.infomation)
-          const params = this.saveParams()
-          console.log(params)
-          if (this.editConfig.title === "鏂板缓") {
-            addInvoice(params).then((res) => {
-              console.log(res)
-              this.editConfig.visible = false
-              if (res.code === 200) {
-                this.$message.success("娣诲姞鎴愬姛")
-                this.$parent.getData()
-              }
-            })
+          for (let i = 0; i < this.tableData.length; i++) {
+            if (this.tableData[i].name.length === 0) {
+              this.isNoProduct = true
+              break
+            } else {
+              this.isNoProduct = false
+            }
+          }
+          if (this.isNoProduct) {
+            this.$message.error("浜у搧鍚嶇О涓嶈兘涓虹┖")
           } else {
-            // getUpdateServiceContract(params).then((res) => {
-            //   console.log(res)
-            //   this.editConfig.visible = false
-            //   if (res.code === 200) {
-            //     this.$message.success("缂栬緫鎴愬姛")
-            //     this.$parent.getData()
-            //   }
-            // })
+            const params = this.saveParams()
+            console.log(params)
+            if (this.editConfig.title === "鏂板缓") {
+              addInvoice(params).then((res) => {
+                console.log(res)
+                this.editConfig.visible = false
+                if (res.code === 200) {
+                  this.$message.success("娣诲姞鎴愬姛")
+                  this.$parent.getData()
+                }
+              })
+            } else {
+              // getUpdateServiceContract(params).then((res) => {
+              //   console.log(res)
+              //   this.editConfig.visible = false
+              //   if (res.code === 200) {
+              //     this.$message.success("缂栬緫鎴愬姛")
+              //     this.$parent.getData()
+              //   }
+              // })
+            }
           }
         } else {
           console.log("error submit")
@@ -507,6 +590,7 @@
         products: this.tableData,
         sourceId: this.editConfig.sourceType === 1 ? this.SalesDetailsId : this.serviceContractId,
         sourceType: this.editConfig.sourceType,
+        number: data.number || "",
         subject: data.subject || "",
         taxpayerIdNumber: data.taxpayerIdNumber || ""
       }
@@ -558,14 +642,14 @@
       }
     },
     selClient(row, value) {
-      if (value === "contact") {
-        this.editConfig.infomation.contact_name = row.name
+      if (value === "client") {
+        this.editConfig.infomation.client_name = row.name
         this.contactId = row.id
       } else if (value === "serviceContract") {
         this.editConfig.infomation.serviceContract_Number = row.number
         this.serviceContractId = row.id
       } else if (value === "contract") {
-        this.editConfig.infomation.number = row.number
+        this.editConfig.infomation.contract_number = row.number
         this.SalesDetailsId = row.id
       }
     },
@@ -578,7 +662,7 @@
         this.editConfig.infomation.serviceContract_Number = ""
         this.serviceContractId = 0
       } else if (value === "contract") {
-        this.editConfig.infomation.number = ""
+        this.editConfig.infomation.contract_number = ""
         this.SalesDetailsId = 0
       }
     },
@@ -587,86 +671,84 @@
     // 璁剧疆鍏佽涓婁紶鏂囦欢鏍煎紡
     setFormatClick() {},
     setTableForm() {
-      if (this.editConfig.title === "鏂板缓") {
+      if (this.editConfig.title === "鏂板缓" || this.editConfig.infomation.products.length === 0) {
         this.tableData = [
           {
-            id: 1,
-            Amount: 0,
-            IsSale: true,
-            MaterialMode: "",
-            MinInventory: 0,
-            Name: "",
-            Number: "",
-            PurchaseType: "",
-            SalePrice: 0,
-            Unit: ""
+            productId: this.productId,
+            id: 0,
+            amount: 0,
+            desc: "",
+            name: "",
+            number: "",
+            price: 0,
+            total: 0
           }
         ]
       } else {
         this.tableData = this.editConfig.infomation.products
+        this.tableData.map((item, index) => {
+          item.productId = index + 1
+        })
       }
       this.productTableList = {
         tableData: this.tableData,
         tableColumn: [
-          { label: "#", prop: "id", width: 40 },
-          { label: "浜у搧鍚嶇О", prop: "Name", input: true, isRequird: true },
-          { label: "浜у搧缂栧彿", prop: "Number" },
-          { label: "鏁伴噺", prop: "Amount", input: true, isRequird: true },
-          { label: "閿�鍞崟浠�", prop: "Unit", input: true },
-          { label: "浠风◣鍚堣", prop: "total", input: true },
-          { label: "鎻忚堪", prop: "other8" }
+          { label: "#", prop: "productId", width: 40 },
+          { label: "浜у搧鍚嶇О", prop: "name", productName: true, isRequird: true },
+          { label: "浜у搧缂栧彿", prop: "number" },
+          { label: "鏁伴噺", prop: "amount", inputNumber: true, isRequird: true },
+          { label: "閿�鍞崟浠�", prop: "price", inputFloat: true },
+          { label: "浠风◣鍚堣", prop: "total", inputFloat: true }
         ]
       }
     },
     // 浜у搧鍒楄〃杈撳叆
     inputContent(val, prop, row) {
-      console.log("aaaaaaaa")
-      console.log(val, prop)
-      this.productId = row.id
+      this.productId = row.productId
       this.tableData.map((item) => {
-        if (item.id === row.id) {
+        if (item.productId === row.productId) {
           item[prop] = val
         }
       })
-      console.log(this.tableData)
     },
     // 浜у搧鏂板
     addProductClick() {
       this.productId++
       this.tableData.push({
-        id: this.productId,
-        Amount: 0,
-        IsSale: true,
-        MaterialMode: "",
-        MinInventory: 0,
-        Name: "",
-        Number: "",
-        PurchaseType: "",
-        SalePrice: 0,
-        Unit: ""
+        productId: this.productId,
+        id: 0,
+        amount: 0,
+        desc: "",
+        name: "",
+        number: "",
+        price: 0,
+        total: 0
       })
+      this.showSummary.show = true
     },
     //  浜у搧娓呯┖
     emptyProductClick() {
       this.productId = 1
       this.tableData = [
         {
-          id: 1,
-          Amount: 0,
-          IsSale: true,
-          MaterialMode: "",
-          MinInventory: 0,
-          Name: "",
-          Number: "",
-          PurchaseType: "",
-          SalePrice: 0,
-          Unit: ""
+          productId: this.productId,
+          id: 0,
+          amount: 0,
+          desc: "",
+          name: "",
+          number: "",
+          price: 0,
+          total: 0
         }
       ]
       this.productTableList.tableData = this.tableData
     },
     // 浜у搧閲嶇畻
-    recalculateProductClick() {}
+    recalculateProductClick() {},
+    clearupProduct(data) {
+      this.tableData = data
+      this.productTableList.tableData = this.tableData
+    }
   }
 }
 </script>

--
Gitblit v1.8.0