Selaa lähdekoodia

信用额度页面更改完成

chen 3 vuotta sitten
vanhempi
commit
efc93c0382

+ 10 - 1
src/api/finance/credit_list.js

@@ -41,7 +41,7 @@ export function getCreditExport(params) {
     })
   }
 // 信用额度记录
-export function getCredit(params) {
+export function getCreditRecordList(params) {
     return request({
       url: '/credit/record/list',
       method: 'get',
@@ -49,3 +49,12 @@ export function getCredit(params) {
     })
   }
 
+// 经销商钱包列表
+export function getWalletCustomerList(params) {
+    return request({
+      url: '/wallet/customer/list',
+      method: 'get',
+      params
+    })
+  }
+

+ 10 - 12
src/views/finance/components/credit_list-detail.vue

@@ -163,12 +163,12 @@
 </template>
 
 <script>
-import { getCredit } from "@/api/finance/credit_list";
+import { getCreditRecordList } from "@/api/finance/credit_list";
 import { downloadFiles } from "@/utils/util";
 export default {
   props: {
-    recordsList: {
-      type: Object,
+    recordsListId: {
+      type: String,
       required: true,
     },
   },
@@ -187,10 +187,9 @@ export default {
   },
   created() {
     this.getDataList({
-      customerWalletCreditId: this.recordsList.id,
-
-      pageNum: this.currentPage,
+      customerWalletId: this.recordsListId,
       pageSize: this.pageSize,
+      pageNum: this.currentPage,
     });
   },
   methods: {
@@ -208,7 +207,7 @@ export default {
     //导出
     exportList() {
       let screenData = {
-        customerWalletCreditId: this.recordsList.id,
+        customerWalletCreditId: this.recordsListId,
         startTime: this.searchForm.startTime,
         endTime: this.searchForm.endTime,
       };
@@ -222,16 +221,15 @@ export default {
     searchFn() {
       console.log(this.searchForm);
       this.getDataList({
-        ...this.searchForm,
-        customerWalletCreditId: this.recordsList.id,
-        pageNum: this.currentPage,
+        customerWalletId: this.recordsListId,
         pageSize: this.pageSize,
+        pageNum: this.currentPage,
+        ...this.searchForm,
       });
     },
     //获取信用额度变更记录数据
     async getDataList(data) {
-      const res = await getCredit(data);
-      console.log(res);
+      const res = await getCreditRecordList(data);
       this.dataList = res.data.records;
       this.listTotal = res.data.total;
     },

+ 24 - 134
src/views/finance/credit_list.vue

@@ -57,11 +57,6 @@
       </div>
       <!-- 按钮 -->
       <div class="btn-group clearfix">
-        <div class="fl">
-          <el-button type="primary" size="small" @click="showAddFn"
-            >新建</el-button
-          >
-        </div>
         <div class="fr">
           <el-button type="primary" size="small" @click="exportList"
             >导出</el-button
@@ -108,11 +103,15 @@
               prop="amount"
               min-width="160"
               show-overflow-tooltip
-            ></el-table-column>
+            >
+              <template slot-scope="scope">
+                {{ scope.row.usedCreditAmount + scope.row.freeCreditAmount }}
+              </template>
+            </el-table-column>
             <el-table-column
               align="center"
               label="关联钱包"
-              prop="customerWalletName"
+              prop="name"
               min-width="160"
               show-overflow-tooltip
             ></el-table-column>
@@ -132,7 +131,7 @@
                 <el-button
                   type="text"
                   class="textColor"
-                  @click="recordFn(scope.row)"
+                  @click="recordFn(scope.row.customerWalletId)"
                   >记录</el-button
                 >
               </template>
@@ -154,10 +153,10 @@
         </div>
       </div>
     </div>
-    <CreditListDetail :recordsList="recordsList" v-else />
+    <CreditListDetail :recordsListId="recordsListId" v-else />
     <!-- 新增弹窗 -->
     <el-dialog
-      title="新增"
+      title="经销商信用额度管理"
       :visible.sync="dialogForm"
       width="30%"
       :show-close="false"
@@ -169,44 +168,10 @@
         :model="addForm"
         label-width="120px"
       >
-        <el-form-item label="经销商名称" prop="customerId" label-width="120px">
-          <el-select
-            v-model="addForm.customerId"
-            class="selectStyle"
-            placeholder="请选择"
-            filterable
-            @change="customerChangeFn"
-          >
-            <el-option
-              v-for="v in customerList"
-              :key="v.id"
-              :label="v.name"
-              :value="v.id"
-            >
-            </el-option>
-          </el-select>
-        </el-form-item>
-
         <el-form-item label="信用变更额度" prop="amount">
           <el-input v-model.number="addForm.amount"></el-input>
         </el-form-item>
 
-        <el-form-item label="关联钱包" prop="customerWalletId">
-          <el-select
-            v-model="addForm.customerWalletId"
-            class="selectStyle"
-            placeholder="请选择"
-            filterable
-          >
-            <el-option
-              v-for="v in customerWalletList"
-              :key="v.customerWalletId"
-              :label="v.mainName"
-              :value="v.customerWalletId"
-            >
-            </el-option>
-          </el-select>
-        </el-form-item>
         <el-form-item label="开始时间" prop="startTime">
           <el-date-picker
             class="selectStyle"
@@ -239,12 +204,9 @@
 </template>
 
 <script>
-import { getWalletCustomerList } from "@/api/finance/change_apply";
-import { getDealerList } from "@/api/basic_data/dealer";
 import {
-  getCreditListAdd,
-  getCreditList,
   getCreditListEdit,
+  getWalletCustomerList,
 } from "@/api/finance/credit_list";
 import CreditListDetail from "./components/credit_list-detail";
 import { downloadFiles } from "@/utils/util";
@@ -271,13 +233,10 @@ export default {
         startTime: "",
         endTime: "",
         amount: null,
-        customerId: "",
-        customerWalletId: "",
       },
-      customerList: [], //经销商列表数据
-      customerWalletList: [], //经销商钱包列表
-      recordsList: {}, //记录数据
-      customerWalletCreditId: null, //设置额度ID
+      data: null,
+      recordsListId: {}, //记录
+
       rules: {
         startTime: [
           { required: true, message: "请选择开始时间", trigger: "blur" },
@@ -303,34 +262,15 @@ export default {
     };
   },
   created() {
-    this.getDataList({ pageSize: this.pageSize, pageNum: this.currentPage });
-    this.getDealerData({ pageSize: -1, pageNum: 1 });
+    this.getDataList({ type: "COMMONLY" });
   },
   methods: {
-    // 更改每页数量
-    handleSizeChange(val) {
-      this.pageSize = val;
-      this.currentPage = 1;
-      this.getDataList({ pageNum: 1, pageSize: this.pageSize });
-    },
-    // 更改当前页
-    handleCurrentChange(val) {
-      this.currentPage = val;
-      this.getDataList({ pageNum: val, pageSize: 10 });
-    },
     //设置额度
     editFn(value) {
-      this.customerWalletCreditId = value.id;
-
-      this.addForm = {
-        startTime: "",
-        endTime: "",
-        amount: value.amount,
+      this.data = {
         customerId: value.customerId,
         customerWalletId: value.customerWalletId,
       };
-      this.getWalletData({ type: "COMMONLY", customerId: value.customerId });
-
       this.dialogForm = true;
     },
     //导出
@@ -348,13 +288,7 @@ export default {
       this.$refs.searchForm.resetFields();
     },
     //搜索
-    searchFn() {
-      this.getDataList({
-        ...this.searchForm,
-        pageSize: this.pageSize,
-        pageNum: this.currentPage,
-      });
-    },
+    searchFn() {},
     // 更改每页数量
     handleSizeChange(val) {
       this.pageSize = val;
@@ -368,72 +302,28 @@ export default {
     },
     //列表数据
     async getDataList(data) {
-      const res = await getCreditList(data);
-      console.log(res);
-      this.dataList = res.data.records;
-      this.listTotal = res.data.total;
-    },
-    //下拉框数据
-    customerChangeFn(value) {
-      this.getWalletData({ type: "COMMONLY", customerId: value });
-    },
-    //获取经销商钱包列表
-    async getWalletData(data) {
       const res = await getWalletCustomerList(data);
-
-      this.customerWalletList = res.data;
+      console.log(res);
+      this.dataList = res.data;
     },
-    //获取经销商列表
-    async getDealerData(data) {
-      const res = await getDealerList(data);
 
-      this.customerList = res.data.records;
-    },
-    //新建
-    showAddFn() {
-      this.dialogForm = true;
-    },
     //确定
     async addDataFn() {
       await this.$refs.addForm.validate();
-
-      if (this.customerWalletCreditId) {
-        await getCreditListEdit({
-          ...this.addForm,
-          customerWalletCreditId: this.customerWalletCreditId,
-        });
-        this.$message.success("设置成功");
-      } else {
-        await getCreditListAdd({ ...this.addForm });
-        this.$message.success("新增成功");
-      }
-      this.getDataList({ pageSize: this.pageSize, pageNum: this.currentPage });
-      this.addForm = {
-        startTime: "",
-        endTime: "",
-        amount: null,
-        customerId: "",
-        customerWalletId: "",
-      };
-      this.customerWalletCreditId = null;
+      await getCreditListEdit({ ...this.addForm, ...this.data });
+      this.getDataList({ type: "COMMONLY" });
+      this.$message.success("设置成功");
       this.dialogForm = false;
     },
     //取消
     async cancelFn() {
-      // this.addForm = {
-      //   startTime: "",
-      //   endTime: "",
-      //   amount: null,
-      //   customerId: "",
-      //   customerWalletId: "",
-      // };
       await this.$refs.addForm.resetFields();
-      this.customerWalletCreditId = null;
       this.dialogForm = false;
     },
     //记录
-    recordFn(v) {
-      this.recordsList = v;
+    recordFn(id) {
+      console.log(id);
+      this.recordsListId = id;
       this.showRecord = false;
     },
   },