From 4fc4068252f1a07e0f42c20ad058a32c87f85a28 Mon Sep 17 00:00:00 2001
From: yangfeng <wanwan926_4@163.com>
Date: 星期五, 28 七月 2023 16:24:52 +0800
Subject: [PATCH] 手机号增加校验

---
 src/views/sales/salesDetails/AddSalesDetailsDialog.vue |  102 ++++++++++++++++++++++++++++++++++++++++++---------
 1 files changed, 84 insertions(+), 18 deletions(-)

diff --git a/src/views/sales/salesDetails/AddSalesDetailsDialog.vue b/src/views/sales/salesDetails/AddSalesDetailsDialog.vue
index 2ce0cd5..cc258a6 100644
--- a/src/views/sales/salesDetails/AddSalesDetailsDialog.vue
+++ b/src/views/sales/salesDetails/AddSalesDetailsDialog.vue
@@ -22,11 +22,20 @@
           <div class="basic-info-view">
             <el-row>
               <el-col :span="12">
-                <el-form-item label="瀹㈡埛鍚嶇О" prop="clientId">
+                <el-form-item label="瀹㈡埛鍚嶇О" prop="client_name">
                   <div class="custom-name">
-                    <el-input v-model="editConfig.infomation.clientId"></el-input>
-                    <div class="common-select-btn"><i class="el-icon-circle-plus-outline" title="閫夋嫨"></i></div>
-                    <div class="common-select-btn"><i class="el-icon-edit" title="缂栬緫"></i></div>
+                    <el-autocomplete
+                      v-model="editConfig.infomation.client_name"
+                      :fetch-suggestions="querySearchAsync"
+                      value-key="name"
+                      @select="handleSelectClient"
+                    ></el-autocomplete>
+                    <div class="common-select-btn" @click="selClientClick">
+                      <i class="el-icon-circle-plus-outline" title="閫夋嫨"></i>
+                    </div>
+                    <div class="common-select-btn" @click="clearupClient">
+                      <i class="el-icon-edit-outline" title="娓呴櫎"></i>
+                    </div>
                   </div>
                 </el-form-item>
               </el-col>
@@ -82,7 +91,7 @@
                   </el-date-picker>
                 </el-form-item>
               </el-col>
-              <el-col :span="12">
+              <!-- <el-col :span="12">
                 <el-form-item label="寰俊璁㈠崟鐘舵��" prop="wechatOrderStatus">
                   <div class="common-select">
                     <el-select
@@ -104,7 +113,7 @@
                     </div>
                   </div>
                 </el-form-item>
-              </el-col>
+              </el-col> -->
             </el-row>
           </div>
           <!-- 鏀惰揣淇℃伅 -->
@@ -128,6 +137,21 @@
                     :autosize="{ minRows: 2 }"
                     v-model="editConfig.infomation.address"
                   ></el-input>
+                </el-form-item>
+              </el-col>
+              <el-col :span="12">
+                <el-form-item label="鐗╂祦鍏徃" prop="logisticCompany">
+                  <el-input v-model="editConfig.infomation.logisticCompany"></el-input>
+                </el-form-item>
+              </el-col>
+              <el-col :span="12">
+                <el-form-item label="鐗╂祦鍗曞彿" prop="logisticNumber">
+                  <el-input v-model="editConfig.infomation.logisticNumber"></el-input>
+                </el-form-item>
+              </el-col>
+              <el-col :span="12">
+                <el-form-item label="鐗╂祦璐圭敤" prop="logisticCost">
+                  <el-input v-model="editConfig.infomation.logisticCost"></el-input>
                 </el-form-item>
               </el-col>
             </el-row>
@@ -257,6 +281,12 @@
         <el-button type="primary" size="small" @click="saveClick('form')">淇濆瓨</el-button>
         <el-button size="small" @click="editConfig.visible = false">鍙栨秷</el-button>
       </div>
+      <!-- 閫夋嫨瀹㈡埛 -->
+      <SelectClientDialog
+        v-if="editSelectClientConfig.editVisible"
+        :edit-common-config="editSelectClientConfig"
+        @selClient="selClient"
+      />
     </el-dialog>
   </div>
 </template>
@@ -265,6 +295,7 @@
 import CommonFormTableView from "@/components/makepager/CommonFormTableView"
 import { getAllData } from "@/api/client/client"
 import { getAddSalesDetails, getUpdateSalesDetails } from "@/api/sales/salesDetails"
+import SelectClientDialog from "@/views/other/commonDialog/SelectClientDialog"
 export default {
   name: "AddSalesDetailsDialog",
   props: {
@@ -279,19 +310,24 @@
       }
     }
   },
-  components: { CommonFormTableView },
-  computed: {},
+  components: { CommonFormTableView, SelectClientDialog },
+  computed: {
+    clientList() {
+      return this.$store.state.getClientName.clientList
+    }
+  },
   data() {
     return {
       dialogWidth: "80%",
       editConfig: this.editCommonConfig,
       rules: {
-        clientId: [{ required: true, message: "璇疯緭鍏�", trigger: "blur" }],
+        client_name: [{ required: true, message: "璇疯緭鍏�", trigger: "blur" }],
         number: [{ required: true, message: "璇疯緭鍏�", trigger: "blur" }],
         signTime: [{ required: true, message: "璇烽�夋嫨", trigger: "change" }],
         memberId: [{ required: true, message: "璇烽�夋嫨璐熻矗浜�", trigger: "change" }]
         // approvalOpinion: [{ required: true, message: "璇疯緭鍏�", trigger: "blur" }]
       },
+      clientId: this.editCommonConfig.infomation.clientId,
       memberOptions: [],
       selSourceOrderOptions: [],
       wechatOrderStatusOptions: [], // 寰俊璁㈠崟鐘舵��
@@ -307,10 +343,16 @@
         total: true,
         sumProp: ["other1", "other7"],
         mergeNumber: 2
+      },
+      editSelectClientConfig: {
+        editVisible: false,
+        title: "",
+        infomation: {}
       }
     }
   },
   created() {
+    this.$store.dispatch("geClient")
     this.setTableForm()
     this.getCommonData()
   },
@@ -377,7 +419,7 @@
         salesDetails: {
           address: data.address || "",
           addressee: data.addressee || "",
-          clientId: parseInt(data.clientId) || 0,
+          clientId: parseInt(this.clientId),
           conditions: data.conditions || "",
           deliveryDate: data.deliveryDate || "",
           memberId: data.memberId || 0,
@@ -398,7 +440,10 @@
           saleChanceId: data.saleChanceId || 0,
           saleType: data.saleType || 0,
           signTime: data.signTime || "",
-          wechatOrderStatus: data.wechatOrderStatus || 0
+          wechatOrderStatus: data.wechatOrderStatus || 0,
+          logisticCompany: data.logisticCompany || "",
+          logisticCost: parseInt(data.logisticCost) || 0,
+          logisticNumber: data.logisticNumber || ""
         }
       }
       return params
@@ -406,6 +451,33 @@
 
     handleClose() {
       this.editConfig.visible = false
+    },
+    // 閫夋嫨瀹㈡埛鐩稿叧鏂规硶
+    querySearchAsync(queryString, cb) {
+      var restaurants = this.clientList
+      var results = queryString ? restaurants.filter(this.createStateFilter(queryString)) : restaurants
+      cb(results)
+    },
+    createStateFilter(queryString) {
+      return (state) => {
+        return state.name.toLowerCase().indexOf(queryString.toLowerCase()) === 0
+      }
+    },
+    handleSelectClient(item) {
+      this.clientId = item.id
+    },
+    selClientClick() {
+      this.editSelectClientConfig.editVisible = true
+    },
+    selClient(row) {
+      console.log(row)
+      this.editConfig.infomation.client_name = row.name
+      this.clientId = row.id
+    },
+    // 娓呴櫎宸查�夋嫨鐢ㄦ埛
+    clearupClient() {
+      this.editConfig.infomation.client_name = ""
+      this.editConfig.infomation.client_id = 0
     },
     // 娣诲姞闄勪欢
     addAnnexClick() {},
@@ -447,13 +519,7 @@
     .basic-info-view {
       margin-top: 10px;
       padding-right: 40px;
-      .custom-name {
-        display: flex;
-        .common-select-btn {
-          margin-left: 5px;
-          font-size: 18px;
-        }
-      }
+      .custom-name,
       .common-select {
         display: flex;
         .common-select-sel {

--
Gitblit v1.8.0