Jelajahi Sumber

客户分ABC类、置顶

Long 4 hari lalu
induk
melakukan
cea6de1036

+ 2 - 1
src/api/crm/customerLevel.js

@@ -38,9 +38,10 @@ export const del = (data) => {
   });
 };
 
-export const customerLevelOption = () => {
+export const customerLevelOption = (query) => {
   return request({
     url: "/crm/customerLevel/getCustomerLevelOption",
     method: "get",
+    params: query,
   });
 };

+ 9 - 1
src/views/crm/components/customerDetails.vue

@@ -43,7 +43,7 @@
             </el-descriptions-item>
             <el-descriptions-item label="客户类型" >
                 <span v-if="item!=null">
-                    <el-tag  v-for="(dict, index) in typeOptions"    v-if="item.customerType==dict.dictValue">{{dict.dictLabel}}</el-tag>
+                    <el-tag v-for="dict in customerLevelOptions"  v-if="item.customerLevel === dict.dictValue">{{dict.dictLabel}}</el-tag>
                 </span>
             </el-descriptions-item>
             <el-descriptions-item label="客户状态" >
@@ -141,6 +141,7 @@
     import customerStoreOrderList from '../components/customerStoreOrderList.vue';
     import customerContacts from './customerContacts.vue';
     import { getCustomer,getCustomer1,getCustomer2 } from "@/api/crm/customer";
+    import {customerLevelOption} from "@/api/crm/customerLevel";
     export default {
         name: "customer",
         components: { customerContacts,customerVisitList,customerLogsList,customerVoiceLogsList,customerStoreOrderList,customerSmsLogsList },
@@ -155,6 +156,7 @@
                 sexOptions:[],
                 item:null,
                 company:null,
+              customerLevelOptions: [],
 
             };
         },
@@ -176,11 +178,17 @@
                 this.customerExts = response.data;
 
             });
+          this.getCustomerLevelOptions()
 
         },
         mounted(){
         },
         methods: {
+          getCustomerLevelOptions() {
+            customerLevelOption().then(response => {
+              this.customerLevelOptions = response.data;
+            })
+          },
             handleMobile(){
                 const customerId = this.item.customerId;
                 getCustomer2(customerId).then(response =>{

+ 53 - 32
src/views/crm/customer/index.vue

@@ -60,17 +60,17 @@
               />
         </el-select>
       </el-form-item>
-      <el-form-item label="客户类型" prop="customerType">
-        <el-select multiple v-model="ctsTypeArr" placeholder="请选择客户类型" clearable size="small">
+      <el-form-item label="客户类型" prop="customerLevel">
+        <el-select v-model="queryParams.customerLevel" placeholder="请选择客户类型" clearable size="small">
            <el-option
-                v-for="item in typeOptions"
+                v-for="item in customerLevelOptions"
                 :key="'type'+item.dictValue"
                 :label="item.dictLabel"
                 :value="item.dictValue"
               />
         </el-select>
       </el-form-item>
-      
+
       <el-form-item label="创建时间" prop="createTime">
         <el-date-picker clearable size="small" style="width: 205.4px"
           v-model="dateRange"
@@ -186,9 +186,9 @@
         </template>
       </el-table-column>
 
-      <el-table-column  label="客户类型" align="center" prop="customerType">
+      <el-table-column  label="客户类型" align="center">
         <template slot-scope="scope">
-            <el-tag prop="customerType" v-for="(item, index) in typeOptions" :key="'customerType'+index"   v-if="scope.row.customerType==item.dictValue">{{item.dictLabel}}</el-tag>
+          <el-tag v-for="item in customerLevelOptions"  v-if="scope.row.customerLevel === item.dictValue">{{item.dictLabel}}</el-tag>
         </template>
       </el-table-column>
 
@@ -228,6 +228,13 @@
             @click="handleDelete(scope.row)"
             v-hasPermi="['crm:customer:remove']"
           >删除</el-button>
+          <el-button
+            size="mini"
+            type="text"
+            icon="el-icon-mouse"
+            @click="handleSwitchToTop(scope.row)"
+            v-hasPermi="['crm:customer:switchToTop']"
+          >{{ scope.row.isTop === 1 ? '取消置顶' : '置顶' }}</el-button>
         </template>
       </el-table-column>
     </el-table>
@@ -280,10 +287,10 @@
                 />
           </el-select>
         </el-form-item>
-        <el-form-item label="客户类型" prop="customerType">
-          <el-select v-model="form.customerType" placeholder="请选择客户类型" clearable size="small">
+        <el-form-item label="客户类型">
+          <el-select v-model="form.customerLevel" placeholder="请选择客户类型" clearable size="small">
             <el-option
-                  v-for="item in typeOptions"
+                  v-for="item in customerLevelOpenOptions"
                   :key="item.dictValue"
                   :label="item.dictLabel"
                   :value="item.dictValue"
@@ -346,7 +353,15 @@
 </template>
 
 <script>
-import { listCustomer,getCustomer,addCustomer,updateCustomer,delCustomer,exportCustomer  } from "@/api/crm/customer";
+import {
+  listCustomer,
+  getCustomer,
+  addCustomer,
+  updateCustomer,
+  delCustomer,
+  exportCustomer,
+  switchToTop
+} from "@/api/crm/customer";
 import { getCompanyList } from "@/api/company/company";
 import customerDetails from '../components/customerDetails.vue';
 import editCustomerSource from '../components/editCustomerSource.vue';
@@ -356,6 +371,7 @@ import { throwStatement } from "@babel/types";
 import { treeselect } from "@/api/company/companyDept";
 import Treeselect from "@riophae/vue-treeselect";
 import "@riophae/vue-treeselect/dist/vue-treeselect.css";
+import {customerLevelOption} from "@/api/crm/customerLevel";
 
 export default {
    watch: {
@@ -441,7 +457,8 @@ export default {
         companyId: null,
         isLine: null,
         source: null,
-        tags: null
+        tags: null,
+        customerLevel: null,
       },
       // 表单参数
       form: {},
@@ -459,7 +476,9 @@ export default {
         source: [
           { required: true, message: "客户来源不能为空", trigger: "blur" }
         ],
-      }
+      },
+      customerLevelOptions: [],
+      customerLevelOpenOptions: [],
     };
   },
   created() {
@@ -483,8 +502,14 @@ export default {
     });
     this.getCitys();
     this.getList();
+    this.getCustomerLevelOptions()
   },
   methods: {
+     getCustomerLevelOptions() {
+       customerLevelOption().then(response => {
+         this.customerLevelOptions = response.data;
+       })
+     },
     handleEditSource(){
       this.source.open=true;
       var that=this;
@@ -534,25 +559,6 @@ export default {
           this.citys=res.data;
         })
     },
-    handleClose(tag) {
-        this.tags.splice(this.tags.indexOf(tag), 1);
-        this.form.tags=this.tags.toString();
-    },
-    showInput() {
-      this.inputVisible = true;
-      this.$nextTick(_ => {
-        this.$refs.saveTagInput.$refs.input.focus();
-      });
-    },
-    handleInputConfirm() {
-      let inputValue = this.inputValue;
-      if (inputValue) {
-        this.tags.push(inputValue);
-      }
-      this.inputVisible = false;
-      this.inputValue = '';
-      this.form.tags=this.tags.toString();
-    },
     handleShow(row){
       var that=this;
       that.show.open=true;
@@ -631,7 +637,8 @@ export default {
         companyId: null,
         isLine: null,
         source: null,
-        tags: null
+        tags: null,
+        customerLevel: null,
       };
       this.tags=[];
       this.cityIds=[];
@@ -689,6 +696,11 @@ export default {
               that.cityIds.push(id)
           });
         }
+
+        customerLevelOption({status: 0}).then(response => {
+          this.customerLevelOpenOptions = response.data;
+        })
+
         this.open = true;
         this.title = "修改客户";
       });
@@ -731,6 +743,15 @@ export default {
           this.msgSuccess("删除成功");
         }).catch(function() {});
     },
+    handleSwitchToTop(row) {
+      switchToTop(row.customerId).then(response => {
+        const {code} = response
+        if (code === 200) {
+          this.msgSuccess(row.isTop === 0 ? "已置顶" : "已取消置顶");
+          this.getList();
+        }
+      })
+    },
     /** 导出按钮操作 */
     handleExport() {
       //const queryParams = this.queryParams;

+ 1 - 30
src/views/crm/customer/line.vue

@@ -156,14 +156,9 @@
             <el-tag prop="source" v-for="(item, index) in sourceOptions"   v-if="scope.row.source==item.dictValue">{{item.dictLabel}}</el-tag>
         </template>
       </el-table-column>
-      <el-table-column label="客户等级" align="center">
-        <template slot-scope="scope">
-            <el-tag v-for="item in customerLevelOptions"   v-if="scope.row.customerLevel === item.dictValue">{{item.dictLabel}}</el-tag>
-        </template>
-      </el-table-column>
       <el-table-column label="流量来源" align="center" prop="trafficSource" />
       <el-table-column label="备注" align="center" prop="remark" />
-      <el-table-column label="操作" width="200" align="center" class-name="small-padding fixed-width">
+      <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
         <template slot-scope="scope">
           <el-button
             size="mini"
@@ -186,13 +181,6 @@
             @click="handleDelete(scope.row)"
             v-hasPermi="['crm:customer:removeLine']"
           >删除</el-button>
-          <el-button
-            size="mini"
-            type="text"
-            icon="el-icon-mouse"
-            @click="handleSwitchToTop(scope.row)"
-            v-hasPermi="['crm:customer:switchToTop']"
-          >{{scope.row.isTop === 1 ? '取消置顶' : '置顶'}}</el-button>
         </template>
       </el-table-column>
     </el-table>
@@ -243,16 +231,6 @@
                 />
           </el-select>
         </el-form-item>
-        <el-form-item label="客户级别">
-          <el-select v-model="form.customerLevel" placeholder="请选择客户级别" clearable size="small">
-            <el-option
-              v-for="item in customerLevelOptions"
-              :key="item.dictValue"
-              :label="item.dictLabel"
-              :value="item.dictValue"
-            />
-          </el-select>
-        </el-form-item>
         <el-form-item label="标签" prop="tags">
           <el-tag
             :key="tag"
@@ -504,7 +482,6 @@ export default {
           { required: true, message: "客户来源不能为空", trigger: "blur" }
         ],
       },
-      customerLevelOptions: []
     };
   },
   created() {
@@ -525,7 +502,6 @@ export default {
 
     this.getCitys();
     this.getList();
-    this.getCustomerLevelOption()
   },
   methods: {
     handleEditSource(){
@@ -833,11 +809,6 @@ export default {
      submitFileForm() {
       this.$refs.upload.submit();
     },
-    getCustomerLevelOption() {
-      customerLevelOption().then(response => {
-        this.customerLevelOptions = response.data;
-      })
-    },
   }
 };
 </script>