Jelajahi Sumber

1.新增企业客户管理-来单列表

GouGengquan 1 hari lalu
induk
melakukan
901e372ce3
2 mengubah file dengan 212 tambahan dan 11 penghapusan
  1. 4 0
      src/api/modules/customerCompany.js
  2. 208 11
      src/views/customer/customerCompany.vue

+ 4 - 0
src/api/modules/customerCompany.js

@@ -25,4 +25,8 @@ export default {
   getCustomerCompanyPage(params) {
     return request.get(`customerCompany/getCustomerCompanyPage`, { params: params })
   },
+  // 分页查询企业客户来单列表
+  getCustomerCompanyOrderPage(params) {
+    return request.get(`customerCompany/getCustomerCompanyOrderPage`, { params: params })
+  },
 }

+ 208 - 11
src/views/customer/customerCompany.vue

@@ -62,7 +62,8 @@
         </el-table-column>
         <el-table-column label="来单量" align="center" prop="orderVolume">
           <template slot-scope="{row}">
-            <span>{{ row.orderVolume }}</span>
+            <el-link v-if="row.orderVolume > 0" @click="openOrderDialog(row.companyId)">{{ row.orderVolume }}</el-link>
+            <span v-else>{{ row.orderVolume }}</span>
           </template>
         </el-table-column>
         <el-table-column label="评估收入" align="center" prop="estimatedRevenue">
@@ -77,12 +78,12 @@
         </el-table-column>
         <el-table-column label="操作" align="center" width="100" fixed="right">
           <template slot-scope="{row}">
-            <el-button type="text">修改</el-button>
+            <el-button type="text" @click="getDetail(row.companyId)">修改</el-button>
           </template>
         </el-table-column>
       </parentTable>
     </y-page-list-layout>
-    <el-dialog title="新增客户" :visible.sync="dialogCompanyFormVisible" width="50%" @close="clearCompanyForm">
+    <el-dialog title="新增客户" :visible.sync="companyFormDialogVisible" width="50%" @close="clearCompanyForm">
       <el-form :model="companyForm" :rules="companyFormRules" ref="companyForm">
         <el-row>
           <el-col>
@@ -95,8 +96,8 @@
           <el-col>
             <el-form-item label="终端客户:" prop="terminal" label-width="140px" class="postInfo-container-item">
               <el-select v-model="companyForm.terminal" style="width: 100%;" clearable>
-                <el-option label="是" value="true"></el-option>
-                <el-option label="否" value="false"></el-option>
+                <el-option label="是" :value="true"></el-option>
+                <el-option label="否" :value="false"></el-option>
               </el-select>
             </el-form-item>
           </el-col>
@@ -145,9 +146,79 @@
       </el-form>
       <div slot="footer" class="dialog-footer">
         <el-button @click="clearCompanyForm()">取 消</el-button>
-        <el-button type="primary" @click="addCustomer()">确 定</el-button>
+        <el-button v-if="!companyForm.id" type="primary" @click="addCustomer()">新 增</el-button>
+        <el-button v-if="companyForm.id" type="primary" @click="editCustomer()">修 改</el-button>
       </div>
     </el-dialog>
+    <el-dialog title="来单列表" :visible.sync="orderDialogVisible" width="70%">
+      <y-page-list-layout :get-page-list="getOrderPage" :page-list="orderData" :page-para="orderListQuery">
+        <template slot="left">
+          <el-input style="width: 200px;float: left;" class="filter-item" v-model="orderListQuery.projectName" placeholder="订单名称" clearable></el-input>
+          <el-input style="width: 200px;float: left;margin-left: 10px;" class="filter-item" v-model="orderListQuery.orderId" placeholder="订单号" clearable></el-input>
+          <el-select v-model="orderListQuery.businessType" placeholder="业务类型" style=" width: 180px;margin-left: 10px;float: left;" clearable>
+            <el-option label="资产业务" value="ASSET_BUSINESS"></el-option>
+            <el-option label="大中型业务" value="MAJOR_BUSINESS"></el-option>
+            <el-option label="个贷业务" value="PERSONAL_BUSINESS"></el-option>
+          </el-select>
+          <el-date-picker
+            style="margin-right: 20px;float: left;margin-left: 10px;"
+            v-model="selectDateOrder"
+            type="daterange"
+            :picker-options="pickerOptions"
+            format="yyyy 年 MM 月 dd 日"
+            value-format="yyyy-MM-dd"
+            range-separator="至"
+            start-placeholder="开始日期"
+            end-placeholder="结束日期"
+            align="right"
+          ></el-date-picker>
+          <el-button class="filter-item" style="margin-left: 10px;float: left;" type="primary" @click="searchListOrder()" round>搜索</el-button>
+          <el-button class="filter-item" style="float: left;" round type="success" @click="resetParamsOrder()">重置</el-button>
+        </template>
+        <parentTable ref="table" :data="orderData.records" slot="table" style="width: 100%;" :isBoard="800" class="tableFull" v-loading="orderListLoading">
+          <el-table-column label="订单号" align="center">
+            <template slot-scope="{row}">
+              <span>{{ row.orderId }}</span>
+            </template>
+          </el-table-column>
+          <el-table-column label="订单名称" align="center" show-overflow-tooltip>
+            <template slot-scope="{row}">
+              <span>{{ row.projectName }}</span>
+            </template>
+          </el-table-column>
+          <el-table-column label="业务类型" align="center">
+            <template slot-scope="{row}">
+              <span>{{ row.businessType === 'ASSET_BUSINESS' ? '资产业务' : row.businessType === 'PERSONAL_BUSINESS' ? '个贷业务' : row.businessType === 'MAJOR_BUSINESS' ? '大中型业务' : '-' }}</span>
+            </template>
+          </el-table-column>
+          <el-table-column label="客户名称" align="center">
+            <template slot-scope="{row}">
+              <span>{{ row.customerName }}</span>
+            </template>
+          </el-table-column>
+          <el-table-column label="业务来源" align="center">
+            <template slot-scope="{row}">
+              <span>{{ row.customerSubName }}</span>
+            </template>
+          </el-table-column>
+          <el-table-column label="客户经理" align="center">
+            <template slot-scope="{row}">
+              <span>{{ row.clientManager }}</span>
+            </template>
+          </el-table-column>
+          <el-table-column label="客户联系人" align="center">
+            <template slot-scope="{row}">
+              <span>{{ row.linkmanName }}</span>
+            </template>
+          </el-table-column>
+          <el-table-column label="下单时间" align="center">
+            <template slot-scope="{row}">
+              <span>{{ row.created }}</span>
+            </template>
+          </el-table-column>
+        </parentTable>
+      </y-page-list-layout>
+    </el-dialog>
   </div>
 </template>
 
@@ -210,6 +281,7 @@ export default {
       ],
       pageData: { records: [] },
       listLoading: false,
+      orderListLoading: false,
       listQuery: {
         page: 1,
         size: 20,
@@ -219,7 +291,7 @@ export default {
       allUsers: [],
       // 上级企业
       parentCompany: [],
-      dialogCompanyFormVisible: false,
+      companyFormDialogVisible: false,
       // 企业客户表单
       companyForm: {
         id: null,
@@ -238,6 +310,51 @@ export default {
         companyType: [{ required: true, message: '请选择企业/单位类型', trigger: 'change' }],
         clientManagerId: [{ required: true, message: '请选择维护人', trigger: 'change' }],
       },
+      orderDialogVisible: false,
+      selectDateOrder: '',
+      // 查询订单
+      orderListQuery: {
+        page: 1,
+        size: 10,
+        current: 1,
+        projectName: null,
+        orderId: null,
+        businessType: null,
+        createdStartTime: null,
+        createdEndTime: null
+      },
+      orderData: { records: [] },
+      pickerOptions: {
+        shortcuts: [
+          {
+            text: '最近一周',
+            onClick(picker) {
+              const end = new Date();
+              const start = new Date();
+              start.setTime(start.getTime() - 3600 * 1000 * 24 * 7);
+              picker.$emit('pick', [start, end]);
+            },
+          },
+          {
+            text: '最近一个月',
+            onClick(picker) {
+              const end = new Date();
+              const start = new Date();
+              start.setTime(start.getTime() - 3600 * 1000 * 24 * 30);
+              picker.$emit('pick', [start, end]);
+            },
+          },
+          {
+            text: '最近三个月',
+            onClick(picker) {
+              const end = new Date();
+              const start = new Date();
+              start.setTime(start.getTime() - 3600 * 1000 * 24 * 90);
+              picker.$emit('pick', [start, end]);
+            },
+          },
+        ],
+      },
     };
   },
   created() {
@@ -296,15 +413,35 @@ export default {
     exportPage() {
       this.$utils.exportUtil('/customerCompany/getCustomerCompanyPage/export', this.listQuery, '导出');
     },
-    // 打开新增客户弹窗
+    // 打开新增/修改客户弹窗
     openCompanyFormDialog() {
-      this.dialogCompanyFormVisible = true;
+      this.companyFormDialogVisible = true;
       this.getParentCompany();
     },
-    // 关闭新增客户弹窗
+    // 获取客户详情
+    getDetail(id) {
+      this.$api.customerCompany.detail(id).then((res) => {
+        if (res.code === 200 && res.data) {
+          this.companyForm = res.data;
+          this.openCompanyFormDialog();
+        }
+      });
+    },
+    // 关闭新增/修改客户弹窗
     clearCompanyForm() {
+      this.companyForm = {
+        id: null,
+        name: null,
+        terminal: null,
+        parentId: null,
+        companyType: null,
+        address: null,
+        phone: null,
+        clientManagerId: null,
+        level: null,
+      };
       this.$refs.companyForm.resetFields();
-      this.dialogCompanyFormVisible = false;
+      this.companyFormDialogVisible = false;
     },
     // 新增客户
     addCustomer() {
@@ -325,6 +462,66 @@ export default {
         }
       });
     },
+    // 修改客户
+    editCustomer() {
+      this.$refs.companyForm.validate((valid) => {
+        if (valid) {
+          // 如果有上级企业,level为1
+          if (this.companyForm.parentId) {
+            this.companyForm.level = 1;
+          } else {
+            this.companyForm.level = 0;
+          }
+          this.$api.customerCompany.edit(this.companyForm).then((res) => {
+            if (res.code === 200) {
+              this.clearCompanyForm();
+              this.resetParams();
+            }
+          });
+        }
+      });
+    },
+    // 打开来单列表弹窗
+    openOrderDialog(id) {
+      this.orderDialogVisible = true;
+      this.orderListQuery.subCustomerId = id;
+      this.getOrderPage();
+    },
+    // 条件搜索来单
+    searchListOrder() {
+      // 重置分页
+      this.orderListQuery.page = 1;
+      this.orderListQuery.size = 10;
+      this.orderListQuery.current = 1;
+      this.getOrderPage();
+    },
+    // 重置来单列表搜索条件
+    resetParamsOrder() {
+      this.orderListQuery.page = 1;
+      this.orderListQuery.size = 10;
+      this.orderListQuery.current = 1;
+      this.orderListQuery.projectName = null;
+      this.orderListQuery.orderId = null;
+      this.orderListQuery.businessType = null;
+      this.orderListQuery.createdStartTime = null;
+      this.orderListQuery.createdEndTime = null;
+      this.selectDateOrder = '';
+      this.getOrderPage();
+    },
+    // 获取客户来单列表
+    getOrderPage() {
+      this.orderListLoading = true;
+      if (this.selectDateOrder) {
+        this.orderListQuery.createdStartTime = this.selectDateOrder[0] + ' 00:00:00';
+        this.orderListQuery.createdEndTime = this.selectDateOrder[1] + ' 23:59:59';
+      }
+      this.$api.customerCompany.getCustomerCompanyOrderPage(this.orderListQuery).then((res) => {
+        if (res.code === 200) {
+          this.orderData = res.data;
+        }
+        this.orderListLoading = false;
+      });
+    },
   },
 };
 </script>