From 6050b02cd808a9af2070d61e3b278e3407b845ca Mon Sep 17 00:00:00 2001
From: yangfeng <wanwan926_4@163.com>
Date: 星期四, 30 十一月 2023 14:17:36 +0800
Subject: [PATCH] 新建选择负责人修改

---
 src/views/sales/refundForm/AddRefundFormDialog.vue |   60 +++++++++++++++++++++++++++++++++++++++---------------------
 1 files changed, 39 insertions(+), 21 deletions(-)

diff --git a/src/views/sales/refundForm/AddRefundFormDialog.vue b/src/views/sales/refundForm/AddRefundFormDialog.vue
index 11fedd0..2d116cb 100644
--- a/src/views/sales/refundForm/AddRefundFormDialog.vue
+++ b/src/views/sales/refundForm/AddRefundFormDialog.vue
@@ -28,16 +28,14 @@
                   <el-input
                     v-if="
                       editConfig.title == '缂栬緫' ||
-                      (editConfig.title == '鏂板缓' &&
-                        codenumer &&
-                        (explain != '' || isIdDisabled))
+                      (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"
+                  <span v-else-if="editConfig.title == '鏂板缓'" style="color: #f56c6c"
                     >璇蜂紭鍏堥厤缃紪鐮佽鑼� <el-button type="text" @click="numberClick"> 閰嶇疆瑙勮寖 </el-button></span
                   >
                   <!-- <WordInput
@@ -327,7 +325,7 @@
 import { getAddSalesRefund, getUpdateSalesRefund } from "@/api/sales/refundForm"
 import SelectClientDialog from "@/views/other/commonDialog/SelectClientDialog"
 import SelectCommonDialog from "@/views/other/commonDialog/SelectCommonDialog"
-import {getBankAccountList, getPaymentTypeList} from "@/api/common/payment"
+import { getBankAccountList, getPaymentTypeList } from "@/api/common/payment"
 import codeMixin from "@/components/makepager/mixin/codeMixin"
 import { getSalesReturnList } from "@/api/sales/salesReturn"
 import { mapActions } from "vuex"
@@ -362,9 +360,9 @@
       editConfig: this.editCommonConfig,
       rules: {
         client_name: [{ required: true, message: "璇烽�夋嫨瀹㈡埛鍚嶇О", trigger: "change" }],
-        number: [{ required: true,  validator: this.validateCheckCode, trigger: ["blur",'change'] }],
+        number: [{ required: true, validator: this.validateCheckCode, trigger: ["blur", "change"] }],
         refundDate: [{ required: true, message: "璇烽�夋嫨閫�娆炬棩鏈�", trigger: "change" }],
-        memberId: [{ required: true, message: "璇烽�夋嫨閿�鍞礋璐d汉", trigger: "change" }],
+        memberId: [{ required: true, validator: this.validateMemberId, trigger: "change" }],
         sale_return_nunber: [{ required: true, message: "璇烽�夋嫨閿�鍞��璐у崟", trigger: "change" }]
       },
       memberOptions: [],
@@ -411,7 +409,7 @@
       if (val) {
         this.formInfo()
       }
-    },
+    }
   },
   methods: {
     ...mapActions(["getReturnListFliter"]),
@@ -425,27 +423,35 @@
       this.getBankAccountList()
     },
     async getCommonData() {
-      const res=await getAllData()
-      if(res.code==200){
-        this.memberOptions = res.data.member? res.data.member:[]
+      const res = await getAllData()
+      if (res.code == 200) {
+        this.memberOptions = res.data.member ? res.data.member : []
+        if (this.editConfig.title === "鏂板缓") {
+          let username = document.cookie.replace(/(?:(?:^|.*;\s*)username\s*=\s*([^;]*).*$)|^.*$/, "$1")
+          this.memberOptions.map((item) => {
+            if (item.username == username) {
+              this.$set(this.editConfig.infomation, "memberId", item.id)
+            }
+          })
+        }
       }
-      this.$set(this.editConfig.infomation,'memberId',this.editConfig.infomation.memberId)
+      this.$set(this.editConfig.infomation, "memberId", this.editConfig.infomation.memberId)
       this.getPaymentTypeList()
     },
     getPaymentTypeList() {
-       getPaymentTypeList().then(res=>{
+      getPaymentTypeList().then((res) => {
         if (res.code === 200) {
           this.paymentTypeListOptions = res.data.data ?? []
         }
-        this.$set(this.editConfig.infomation,'paymentTypeId',this.editConfig.infomation.paymentTypeId)
+        this.$set(this.editConfig.infomation, "paymentTypeId", this.editConfig.infomation.paymentTypeId)
       })
     },
     getBankAccountList() {
-      getBankAccountList().then(res=>{
+      getBankAccountList().then((res) => {
         if (res.code === 200) {
-          this.accountOptions = res.data.data? res.data.data:[]
+          this.accountOptions = res.data.data ? res.data.data : []
         }
-        this.$set(this.editConfig.infomation,'bankAccountId',this.editConfig.infomation.bankAccountId)
+        this.$set(this.editConfig.infomation, "bankAccountId", this.editConfig.infomation.bankAccountId)
       })
     },
     // 淇濆瓨
@@ -505,7 +511,7 @@
           reason: data.reason || "",
           refundDate: data.refundDate || "",
           sourceId: this.sourceId || 0,
-          sourceType: 1,
+          sourceType: 1
         }
       }
       return params
@@ -595,7 +601,8 @@
             name: "",
             number: "",
             price: 0,
-            total: 0
+            total: 0,
+            unit: ""
           }
         ]
       } else {
@@ -612,6 +619,7 @@
           { label: "浜у搧鍚嶇О", prop: "name", productName: true, isRequird: true },
           { label: "浜у搧缂栧彿", prop: "number" },
           { label: "鏁伴噺", prop: "amount", inputNumber: true, isRequird: true },
+          { label: "鍗曚綅", prop: "unit" },
           { label: "閿�鍞崟浠�", prop: "price", inputFloat: true },
           { label: "浠风◣鍚堣", prop: "total", inputFloat: true }
         ]
@@ -637,7 +645,8 @@
         name: "",
         number: "",
         price: 0,
-        total: 0
+        total: 0,
+        unit: ""
       })
       this.showSummary.show = true
     },
@@ -653,7 +662,8 @@
           name: "",
           number: "",
           price: 0,
-          total: 0
+          total: 0,
+          unit: ""
         }
       ]
       this.productTableList.tableData = this.tableData
@@ -663,6 +673,14 @@
     clearupProduct(data) {
       this.tableData = data
       this.productTableList.tableData = this.tableData
+    },
+    // 閿�鍞礋璐d汉鑷畾涔夋牎楠岃鍒�
+    validateMemberId(rule, value, callback) {
+      if (this.editConfig.infomation?.memberId > 0) {
+        callback()
+      } else {
+        callback(new Error("璇烽�夋嫨閿�鍞礋璐d汉"))
+      }
     }
   }
 }

--
Gitblit v1.8.0