From 960d295793f1d164e3e8e22f8d7744b7923ae24b Mon Sep 17 00:00:00 2001
From: yangfeng <wanwan926_4@163.com>
Date: 星期一, 17 七月 2023 18:29:17 +0800
Subject: [PATCH] 销售线索列表、新建、编辑接口联调

---
 src/views/custom/salesLead/AddSalesLeadDialog.vue |  180 +++++++++++++++++++++++++++++++++++++++++------------------
 1 files changed, 125 insertions(+), 55 deletions(-)

diff --git a/src/views/custom/salesLead/AddSalesLeadDialog.vue b/src/views/custom/salesLead/AddSalesLeadDialog.vue
index 000c2dd..e0e9680 100644
--- a/src/views/custom/salesLead/AddSalesLeadDialog.vue
+++ b/src/views/custom/salesLead/AddSalesLeadDialog.vue
@@ -21,32 +21,32 @@
           <div class="basic-info-view">
             <el-row>
               <el-col :span="12">
-                <el-form-item label="瀹㈡埛鍚嶇О" prop="customName">
-                  <el-input v-model="editConfig.infomation.customName"></el-input>
+                <el-form-item label="瀹㈡埛鍚嶇О" prop="name">
+                  <el-input v-model="editConfig.infomation.name"></el-input>
                 </el-form-item>
               </el-col>
               <el-col :span="12">
-                <el-form-item label="閿�鍞嚎绱㈢紪鍙�" prop="saleLeadNumber">
-                  <el-input v-model="editConfig.infomation.saleLeadNumber"></el-input>
+                <el-form-item label="閿�鍞嚎绱㈢紪鍙�" prop="number">
+                  <el-input v-model="editConfig.infomation.number"></el-input>
                 </el-form-item>
               </el-col>
             </el-row>
             <el-row>
               <el-col :span="12">
-                <el-form-item label="鑱旂郴浜哄鍚�" prop="contactName">
-                  <el-input v-model="editConfig.infomation.contactName"></el-input>
+                <el-form-item label="鑱旂郴浜哄鍚�" prop="contact_name">
+                  <el-input v-model="editConfig.infomation.contact_name"></el-input>
                 </el-form-item>
               </el-col>
               <el-col :span="12">
-                <el-form-item label="鑱旂郴浜鸿亴鍔�" prop="contactDuties">
-                  <el-input v-model="editConfig.infomation.contactDuties"></el-input>
+                <el-form-item label="鑱旂郴浜鸿亴鍔�" prop="contact_position">
+                  <el-input v-model="editConfig.infomation.contact_position"></el-input>
                 </el-form-item>
               </el-col>
             </el-row>
             <el-row>
               <el-col :span="12">
-                <el-form-item label="鎵嬫満鍙风爜" prop="phoneNumber">
-                  <el-input v-model="editConfig.infomation.phoneNumber"></el-input>
+                <el-form-item label="鎵嬫満鍙风爜" prop="contact_phone">
+                  <el-input v-model="editConfig.infomation.contact_phone"></el-input>
                 </el-form-item>
               </el-col>
               <el-col :span="12">
@@ -57,17 +57,31 @@
             </el-row>
             <el-row>
               <el-col :span="12">
-                <el-form-item label="鍟嗘満鏉ユ簮" prop="businessSource">
-                  <CommonSelectView
-                    :common-value="editConfig.infomation.businessSource"
-                    :common-options="businessSourceOptions"
-                    @editDropdownBox="editDropdownBox"
-                  />
+                <el-form-item label="鍟嗘満鏉ユ簮" prop="sales_sources_id">
+                  <div class="common-select">
+                    <el-select
+                      v-model="editConfig.infomation.sales_sources_id"
+                      placeholder="璇烽�夋嫨"
+                      class="common-select-sel"
+                      size="mini"
+                    >
+                      <el-option
+                        v-for="item in businessSourceOptions"
+                        :key="item.id"
+                        :label="item.name"
+                        :value="item.id"
+                      >
+                      </el-option>
+                    </el-select>
+                    <div class="common-select-btn" @click="editDropdownBox">
+                      <i class="el-icon-setting"></i>
+                    </div>
+                  </div>
                 </el-form-item>
               </el-col>
               <el-col :span="12">
-                <el-form-item label="璐熻矗浜�" prop="owner">
-                  <el-select v-model="editConfig.infomation.owner" placeholder="璇烽�夋嫨" size="mini">
+                <el-form-item label="璐熻矗浜�" prop="member_id">
+                  <el-select v-model="editConfig.infomation.member_id" placeholder="璇烽�夋嫨" size="mini">
                     <el-option v-for="item in ownerOptions" :key="item.value" :label="item.label" :value="item.value">
                     </el-option>
                   </el-select>
@@ -77,8 +91,8 @@
           </div>
           <!-- 鍦板潃淇℃伅 -->
           <div v-if="isUnflod" class="basic-info-title">鍦板潃淇℃伅</div>
-          <div v-if="isUnflod" class="address-view">
-            <el-row>
+          <div v-if="isUnflod" class="basic-info-view">
+            <!-- <el-row>
               <el-col :span="24">
                 <el-form-item label="瀹氫綅" prop="position">
                   <el-input v-model="editConfig.infomation.position"></el-input>
@@ -91,7 +105,7 @@
                   <div style="height: 100px"></div>
                 </el-form-item>
               </el-col>
-            </el-row>
+            </el-row> -->
             <el-row>
               <el-col :span="12">
                 <el-form-item label="鍥藉" prop="country">
@@ -134,12 +148,12 @@
           <div v-if="isUnflod" class="basic-info-view">
             <el-row>
               <el-col :span="24">
-                <el-form-item label="鍦板潃" prop="address">
+                <el-form-item label="澶囨敞" prop="desc">
                   <el-input
                     type="textarea"
                     :autosize="{ minRows: 2, maxRows: 4 }"
                     placeholder="璇疯緭鍏ュ唴瀹�"
-                    v-model="editConfig.infomation.address"
+                    v-model="editConfig.infomation.desc"
                   ></el-input>
                 </el-form-item>
               </el-col>
@@ -166,7 +180,7 @@
 <script>
 import CommonSelectView from "@/components/makepager/CommonSelectView"
 import EditDropdownDialog from "@/views/other/commonDialog/EditDropdownDialog"
-import { getSalesSourcesList } from "@/api/custom/salesLead"
+import { getSalesSourcesList, getAddSalesLeads, getUpdateSalesLeads } from "@/api/custom/salesLead"
 
 export default {
   name: "AddSalesLeadDialog",
@@ -178,21 +192,21 @@
           visible: false,
           title: "鏂板缓",
           infomation: {
-            customName: "",
-            saleLeadNumber: "LEA50",
-            contactName: "",
-            contactDuties: "",
-            phoneNumber: "",
+            name: "",
+            number: "LEA50",
+            contact_name: "",
+            contact_position: "",
+            contact_phone: "",
             businessStatus: "",
-            businessSource: "1",
-            owner: "",
-            position: "",
-            map: "",
-            country: "1",
-            province: "1",
-            city: "1",
-            region: "1",
-            address: ""
+            sales_sources_id: "",
+            member_id: "",
+            country: "",
+            province: "",
+            city: "",
+            region: "",
+            address: "",
+            desc: "",
+            id: ""
           }
         }
       }
@@ -209,20 +223,20 @@
       dialogWidth: "80%",
       editConfig: this.editSalesLeadConfig,
       rules: {
-        customName: [{ required: true, message: "璇疯緭鍏ュ鎴峰悕绉�", trigger: "blur" }],
-        saleLeadNumber: [{ required: true, message: "璇疯緭鍏ラ攢鍞嚎绱㈢紪鍙�", trigger: "blur" }],
+        name: [{ required: true, message: "璇疯緭鍏ュ鎴峰悕绉�", trigger: "blur" }],
+        number: [{ required: true, message: "璇疯緭鍏ラ攢鍞嚎绱㈢紪鍙�", trigger: "blur" }],
         businessStatus: [{ required: true, message: "璇疯緭鍏ュ晢鏈虹姸鎬�", trigger: "blur" }],
-        businessSource: [{ required: true, message: "璇烽�夋嫨鍟嗘満鏉ユ簮", trigger: "change" }]
+        sales_sources_id: [{ required: true, message: "璇烽�夋嫨鍟嗘満鏉ユ簮", trigger: "change" }]
       },
       businessSourceOptions: [
-        { value: "1", label: "鍚庡彴娉ㄥ唽" },
-        { value: "2", label: "浠g悊鍟嗗鎴�" },
-        { value: "3", label: "鐢佃瘽闄岀敓鎷滆" },
-        { value: "4", label: "鐩存帴璁块棶" },
-        { value: "5", label: "椤圭洰鍚堜綔" },
-        { value: "6", label: "涓汉鑷壘" },
-        { value: "7", label: "浜屾閿�鍞�" },
-        { value: "8", label: "鍏徃鐢佃瘽" }
+        { id: "1", name: "鍚庡彴娉ㄥ唽" },
+        { id: "2", name: "浠g悊鍟嗗鎴�" },
+        { id: "3", name: "鐢佃瘽闄岀敓鎷滆" },
+        { id: "4", name: "鐩存帴璁块棶" },
+        { id: "5", name: "椤圭洰鍚堜綔" },
+        { id: "6", name: "涓汉鑷壘" },
+        { id: "7", name: "浜屾閿�鍞�" },
+        { id: "8", name: "鍏徃鐢佃瘽" }
       ],
       ownerOptions: [
         { value: "1", label: "BOSS" },
@@ -269,7 +283,7 @@
       getSalesSourcesList()
         .then((res) => {
           console.log(res)
-          // this.businessSourceOptions = res.data.tableList
+          this.businessSourceOptions = res.data.list
         })
         .catch((err) => {
           console.log(err)
@@ -282,7 +296,56 @@
     saveClick(formName) {
       this.$refs[formName].validate((valid) => {
         if (valid) {
-          alert("submit")
+          console.log(this.editConfig.infomation)
+          let params = {
+            city_id: 0,
+            contact_name: this.editConfig.infomation.contact_name || "",
+            contact_phone: this.editConfig.infomation.contact_phone || "",
+            contact_position: this.editConfig.infomation.contact_position || "",
+            country_id: 0,
+            id: this.editConfig.title === "鏂板缓" ? 0 : this.editConfig.infomation.id,
+            desc: this.editConfig.infomation.desc || "",
+            member_id: parseInt(this.editConfig.infomation.member_id) || 0,
+            name: this.editConfig.infomation.name || "",
+            number: this.editConfig.infomation.number || "",
+            province_id: 0,
+            region_id: 0,
+            sales_sources_id: this.editConfig.infomation.sales_sources_id || 0
+          }
+          console.log(params)
+          if (this.editConfig.title === "鏂板缓") {
+            getAddSalesLeads(params)
+              .then((res) => {
+                console.log(res)
+                this.editConfig.visible = false
+                if (res.code === 200) {
+                  this.$message({
+                    message: "娣诲姞鎴愬姛",
+                    type: "success"
+                  })
+                  this.$parent.getData()
+                }
+              })
+              .catch((err) => {
+                console.log(err)
+              })
+          } else {
+            getUpdateSalesLeads(params)
+              .then((res) => {
+                console.log(res)
+                this.editConfig.visible = false
+                if (res.code === 200) {
+                  this.$message({
+                    message: "缂栬緫鎴愬姛",
+                    type: "success"
+                  })
+                  this.$parent.getData()
+                }
+              })
+              .catch((err) => {
+                console.log(err)
+              })
+          }
         } else {
           console.log("error submit")
           return false
@@ -325,10 +388,17 @@
     .basic-info-view {
       margin-top: 10px;
       padding-right: 40px;
-    }
-    .address-view {
-      margin-top: 10px;
-      padding-right: 40px;
+      .common-select {
+        display: flex;
+        .common-select-sel {
+          width: 270px;
+        }
+        .common-select-btn {
+          margin-left: 5px;
+          font-size: 16px;
+          cursor: pointer;
+        }
+      }
     }
   }
   .unflod-collapse {

--
Gitblit v1.8.0