فهرست منبع

修复bug:客户线索

baijunde 7 ماه پیش
والد
کامیت
d4b9f5b5ea
1فایلهای تغییر یافته به همراه129 افزوده شده و 106 حذف شده
  1. 129 106
      src/views/customerManage/customerLeadsList.vue

+ 129 - 106
src/views/customerManage/customerLeadsList.vue

@@ -9,7 +9,11 @@
       label-width="80px"
     >
       <el-form-item label="用户id">
-        <el-input v-model="query.userId" placeholder="请输入用户id" type="number"></el-input>
+        <el-input
+          v-model="query.userId"
+          placeholder="请输入用户id"
+          type="number"
+        ></el-input>
       </el-form-item>
       <el-form-item label="用户姓名">
         <el-input
@@ -18,7 +22,11 @@
         ></el-input>
       </el-form-item>
       <el-form-item label="手机号">
-        <el-input v-model="query.phone" placeholder="请输入手机号" type="number"></el-input>
+        <el-input
+          v-model="query.phone"
+          placeholder="请输入手机号"
+          type="number"
+        ></el-input>
       </el-form-item>
       <el-form-item label="用户来源">
         <el-select
@@ -61,84 +69,30 @@
         </el-select>
       </el-form-item>
       <el-form-item label=" ">
-        <el-button type="primary" @click="getList">查询</el-button>
-        <el-button @click="resetQuery">清空</el-button>
+        <el-button type="primary" @click="findPage">查询</el-button>
+        <el-button @click="resetQuery">重置</el-button>
       </el-form-item>
     </el-form>
     <div class="g-card">
-      <el-table ref="table" row-key="id" :data="list" v-loading="loading"  v-disable-resize="false">
-        <el-table-column
-          label="用户id"
-          align="center"
-          prop="userId"
-        ></el-table-column>
-        <el-table-column label="用户姓名" align="center" prop="userName">
-        </el-table-column>
-        <el-table-column label="性别" align="center" prop="gender">
-          <template #default="{ row }">
-            {{ row.gender == 1 ? "男" : "女" }}
-          </template>
-        </el-table-column>
-        <el-table-column
-          label="生日"
-          align="center"
-          prop="birthDate"
-        ></el-table-column>
-        <el-table-column
-          label="手机号"
-          align="center"
-          prop="phone"
-        ></el-table-column>
-        <el-table-column label="用户来源" align="center" prop="userSource">
-          <template #default="{ row }">
-            {{ row.userSource == 1 ? "晋掌柜 " : "掌柜生活" }}
-          </template>
-        </el-table-column>
-        <el-table-column label="用户状态" align="center" prop="userStatus">
-          <template #default="{ row }">
-            {{ row.userStatus == 1 ? "正式用户 " : "临时用户" }}
-          </template>
-        </el-table-column>
-        <el-table-column label="用户类型" align="center" prop="userType">
-          <template #default="{ row }">
-            {{ row.userType == 1 ? "普通用户 " : "会员用户" }}
-          </template>
-        </el-table-column>
-        <el-table-column
-          label="触发时间"
-          align="center"
-          prop="triggerTime"
-        ></el-table-column>
-        <el-table-column
-          label="处理状态"
-          align="center"
-          prop="processingStatus"
-        >
-          <template #default="{ row }">
-            {{ row.processingStatus == 1 ? "已处理 " : "未处理" }}
-          </template>
-        </el-table-column>
-        <el-table-column label="客户意向" align="center" prop="customerIntent">
-          <template #default="{ row }">
-            {{ row.customerIntent == 1 ? "初步了解 " : row.customerIntent == 2 ? "确认投保" :''}}
-          </template>
-        </el-table-column>
-        <el-table-column label="操作" align="center" width="200" fixed="right">
-          <template #default="{ row }">
-            <el-button
-              type="text"
-              @click="examine(row)"
-              >查看</el-button
-            >
-            <el-button
-              type="text"
-              @click="manage(row)"
-              v-if="row.customerIntent!=2"
-              >处理</el-button
-            >
-          </template>
-        </el-table-column>
-      </el-table>
+      <templateTable
+        ref="table"
+        :operationWidth="200"
+        :showOperation="true"
+        :showBatchDelete="false"
+        :data="Result"
+        :columns="Columns"
+        @findPage="findPage"
+      >
+        <template slot="buttonSlot" slot-scope="{ row }">
+          <el-button type="text" @click="examine(row)">查看</el-button>
+          <el-button
+            type="text"
+            v-if="row.customerIntent!=2"
+            @click="manage(row)"
+            >处理</el-button
+          >
+        </template>
+      </templateTable>
     </div>
 
     <el-dialog
@@ -156,7 +110,6 @@
         >
           <el-form-item label="客户意向" prop="customerIntent">
             <el-radio-group v-model="form.customerIntent" @change="setChange">
-              
               <el-radio :label="'1'">初步了解 </el-radio>
               <el-radio :label="'2'">确认投保</el-radio>
             </el-radio-group>
@@ -182,7 +135,11 @@
 <script>
 import Sortable from "sortablejs";
 import { getList, addCustomer } from "@/api/customer/customerLeads.js";
+import templateTable from "@/components/templateTable.vue";
 export default {
+  components: {
+    templateTable,
+  },
   name: "define-customer-attr",
   data() {
     return {
@@ -233,9 +190,93 @@ export default {
           },
         ],
       },
+      
+      Result: {
+        rows: [],
+        total: 100,
+        pageNum: 1,
+        pageSize: 10,
+      },
+      Columns: [
+        { prop: "userId", label: "用户ID", minWidth: 180 },
+        { prop: "userName", label: "用户姓名", minWidth: 160 },
+        {
+          prop: "gender",
+          label: "性别",
+          minWidth: 120,
+          formatter: (row) => {
+            return row.gender == 1 ? "男" : row.gender == 0 ? "女" : "";
+          },
+        },
+        { prop: "birthDate", label: "生日", minWidth: 160 }, 
+        { prop: "phone", label: "手机号", minWidth: 160 },
+        {
+          prop: "userSource", 
+          label: "用户来源",
+          minWidth: 160,
+          formatter: (row) => {
+            return row.userSource == 1 ? "晋掌柜" : "掌柜生活";
+          },
+        },
+        {
+          prop: "userStatus", 
+          label: "用户状态",
+          minWidth: 160,
+          formatter: (row) => {
+            return row.userStatus == 1 ? "正式用户" : "临时用户";
+          },
+        },
+        {
+          prop: "userType",
+          label: "用户类型",
+          minWidth: 160,
+          formatter: (row) => {
+            return row.userType == 1 ? "普通用户" : "会员用户";
+          },
+        },
+        { prop: "triggerTime", label: "触发时间", minWidth: 160 }, 
+        {
+          prop: "processingStatus", 
+          label: "处理状态",
+          minWidth: 160,
+          formatter: (row) => {
+            return row.processingStatus == 1 ? "已处理" : "未处理";
+          },
+        },
+        {
+          prop: "customerIntent", 
+          label: "客户意向",
+          minWidth: 160,
+          formatter: (row) => {
+            const intent = row.customerIntent;
+            if (intent == 1) return "初步了解";
+            if (intent == 2) return "确认投保";
+            return "";
+          },
+        },
+      ],
     };
   },
   methods: {
+    //列表查询
+    findPage() {
+      let that = this;
+      getList({
+          ...this.query,
+          pageNum: this.Result.pageNum,
+          pageSize: this.Result.pageSize,
+        })
+        .then((res) => {
+          if (res.code == 200) {
+            that.Result = {
+              rows: res.rows,
+              total: res.total,
+              pageSize: res.pageSize,
+              pageNum: res.pageNum,
+            };
+          }
+        });
+    },
     updateSort() {
       this.list.forEach((item, index) => {
         item.labelSort = this.list.length - index;
@@ -268,8 +309,11 @@ export default {
     //查看线索详情
     examine(data) {
       console.log(data);
-      //customerLeadsDetails  
-      this.$router.push({ path:'customerLeadsDetails', query: { userId: data.userId } })
+      //customerLeadsDetails
+      this.$router.push({
+        path: "customerLeadsDetails",
+        query: { userId: data.userId },
+      });
     },
     setChange(type) {
       if (type !== 3) {
@@ -287,9 +331,9 @@ export default {
               this.getList(1);
               this.$refs["form"].resetFields();
               this.form = {
-                userId: "", 
-                customerIntent: "", 
-                keyInfoDescription: "", 
+                userId: "",
+                customerIntent: "",
+                keyInfoDescription: "",
               };
             })
             .catch((error) => {
@@ -331,9 +375,6 @@ export default {
       this.newInput = "";
     },
     resetQuery() {
-      // this.query.labelName = ''
-      // this.query.type = null
-      // this.query.visualTagIds = ''
       (this.query = {
         userId: "",
         userName: "",
@@ -343,7 +384,7 @@ export default {
         processingStatus: "",
       }),
         (this.queryTag = []);
-      this.getList();
+      this.findPage();
     },
     submitSelectTag(data) {
       this.tagList = data;
@@ -353,25 +394,7 @@ export default {
         })
         .join(",");
     },
-    getList(type) {
-      this.loading = true;
-      getList(this.query).then((res) => {
-        this.loading = false;
-
-        this.list = res.rows;
-        console.log(this.list);
-        if (type == "init") {
-          this.dragSort();
-        }
-        if (type == "delete") {
-          this.updateSort();
-        }
-      });
-    },
-  },
-  mounted() {
-    this.getList("init");
-  },
+  }
 };
 </script>
 <style lang="scss" scoped>