ソースを参照

汽保客户详情

caojunjie 1 年間 前
コミット
c1f4b35756
3 ファイル変更113 行追加31 行削除
  1. 26 1
      src/api/basicData/client.js
  2. 68 17
      src/views/client/detailsPage.vue
  3. 19 13
      src/views/client/js/optionList.js

+ 26 - 1
src/api/basicData/client.js

@@ -54,6 +54,31 @@ export const submit = (data) => {
     data: data
   })
 }
+// 汽保大保存数据
+export const submitWeb = (data) => {
+  return request({
+    url: '/api/blade-client/partsCorps/submitWeb',
+    method: 'POST',
+    data: data
+  })
+}
+// 配件客户联系人管理保存
+export const submitAttn = (data) => {
+  return request({
+    url: '/api/blade-client/partsCorps/submitAttn',
+    method: 'POST',
+    data: data
+  })
+}
+// 配件客户地址管理保存
+export const submitAddr = (data) => {
+  return request({
+    url: '/api/blade-client/partsCorps/submitAddr',
+    method: 'POST',
+    data: data
+  })
+}
+
 export const remove = (data) => {
   return request({
     url: '/api/blade-client/corpsdesc/update',
@@ -88,4 +113,4 @@ export const itemDel = (data) => {
       ids:data
     }
   })
-}
+}

+ 68 - 17
src/views/client/detailsPage.vue

@@ -32,6 +32,18 @@
             <el-button type="primary" icon="el-icon-plus" size="mini" @click.stop="addRow"
               :disabled="detailData.status == 1" circle></el-button>
           </template>
+            <template slot-scope="{row}" slot="defaultAddres">
+                <el-switch
+                    v-model="row.defaultAddres"
+                    active-value="1"
+                    inactive-value="0"
+                    :disabled="!row.$cellEdit"
+                    active-color="#13ce66"
+                    inactive-color="#ff4949"
+                    @click="defaultAddresfun"
+                >
+                </el-switch>
+            </template>
           <template slot="menu" slot-scope="{ row, index }">
             <el-button size="small" type="text" @click="rowCell(row, index)">{{
                 row.$cellEdit ? "保存" : "修改"
@@ -87,8 +99,8 @@
             @row-save="rowSave"
             @row-update="rowUpdate"
             @row-del="rowDelTwo">
-          <template slot-scope="{ type, size, row }" slot="menu">
-            <el-button icon="el-icon-check" :size="size" :type="type" @click="creatingUsers(row)">创建用户</el-button>
+          <template slot-scope="{ type, size, row, index }" slot="menu">
+            <el-button icon="el-icon-check" :size="size" :type="type" @click="creatingUsers(contactsData[index])">创建用户</el-button>
           </template>
         </avue-crud>
       </trade-card>
@@ -123,7 +135,15 @@
 
 <script>
 import { option2, option3 } from "./js/optionList";
-import { getDetails, addCorpType, getCorpType, submit, customerList, itemDel } from "@/api/basicData/client";
+import {
+    getDetails,
+    addCorpType,
+    getCorpType,
+    submitWeb,
+    customerList,
+    itemDel,
+    submitAttn, submitAddr
+} from "@/api/basicData/client";
 import corpType from '@/components/corpType/index'
 import customerContact from "@/views/basicData/customerInformation/configuration/customerContact.json";
 import {corpsattn, creatingUsers} from "@/api/basicData/customerInformation";
@@ -252,11 +272,11 @@ export default {
               value: "dictKey"
             },
           },
-          {
-            label: "期初欠款",
-            prop: "arrears",
-            span: 8,
-          },
+            {
+                label: "联系人",
+                prop: "attn",
+                span: 8,
+            },
           {
             label: "电话",
             prop: "tel",
@@ -267,11 +287,11 @@ export default {
             prop: "telephone",
             span: 8,
           },
-          {
-            label: "传真",
-            prop: "fax",
-            span: 8,
-          },
+            {
+                label: "期初欠款",
+                prop: "arrears",
+                span: 8,
+            },
           {
             label: "邮箱",
             prop: "mailbox",
@@ -475,7 +495,22 @@ export default {
     },
     rowCell(row, index) {
       if (row.$cellEdit == true) {
+          let i = 0
+          for(let item of this.data) {
+              if (item.defaultAddres == 1) {
+                  i++
+                  if (i > 1) {
+                      this.$message.warning('默认地址只能有一个');
+                      return
+                  }
+              }
+          }
         this.$set(row, "$cellEdit", false);
+        // 保存编辑接口
+          this.data[index].pid = this.form.id
+          submitAddr(this.data[index]).then(res=>{
+              this.data[index] = res.data.data
+          })
       } else {
         this.$set(row, "$cellEdit", true);
       }
@@ -574,13 +609,13 @@ export default {
             });
           }
           this.loadingBtn = true;
-          submit({
+            submitWeb({
             ...this.form,
             code: this.form.cname,
             corpType: "KH",
-            corpsAddrList: this.data,
+            // corpsAddrList: this.data,
             corpsFiles: this.corpsFiles,
-            corpsAttnList:this.contactsData,
+            // corpsAttnList:this.contactsData,
             billType:1
           }).then(res => {
               this.$message.success("保存成功");
@@ -642,14 +677,30 @@ export default {
     },
     //新增客户联系人保存触发
     rowSave(row, done, loading) {
-      console.log(row, done, loading);
       this.contactsData.push(row);
+        this.submitAttnfun(row)
       done();
     },
     //修改客户联系人触发
     rowUpdate(row, index, done, loading) {
+        this.submitAttnfun(row,index)
       done(row);
     },
+      // 保存客户联系接口
+      submitAttnfun(row,index){
+          if (index) {
+              this.contactsData[index].pid = this.form.id
+              this.contactsData[index] = {...row,...this.contactsData[index]}
+              submitAttn(this.contactsData[index]).then(res=>{
+                  this.$set(this.contactsData,index,res.data.data)
+              })
+          }else {
+              row.pid = this.form.id
+              submitAttn(row).then(res=>{
+                  this.contactsData[this.contactsData.length-1] = res.data.data
+              })
+          }
+      },
     //删除客户联系人触发
     rowDelTwo(row, index, donerowDel) {
       this.$confirm("确定将选择数据删除?", {

+ 19 - 13
src/views/client/js/optionList.js

@@ -146,6 +146,12 @@ export const option2 = {
   index: true,
   indexSlot: true,
   column: [
+    // defaultAddres 0否 1是
+    {
+      label: "是否是默认地址",
+      prop: "defaultAddres",
+      span: 24,
+    },
     {
       label: "简称",
       allowCreate: true,
@@ -170,6 +176,19 @@ export const option2 = {
       cell: true
     },
     {
+      label: "联系人",
+      prop: "attn",
+      width:200,
+      overHidden: true,
+      cell: true
+    },{
+      label: "电话",
+      prop: "tel",
+      width:200,
+      overHidden: true,
+      cell: true
+    },
+    {
       label: "地址",
       prop: "addr",
       dicData:[],
@@ -185,19 +204,6 @@ export const option2 = {
       span: 24,
     },
     {
-      label: "联系人",
-      prop: "attn",
-      width:200,
-      overHidden: true,
-      cell: true
-    },{
-      label: "电话",
-      prop: "tel",
-      width:200,
-      overHidden: true,
-      cell: true
-    },
-    {
       label: "详细地址",
       prop: "detailedAddress",
       cell: true,