Pārlūkot izejas kodu

信用额度,接口

chen 3 gadi atpakaļ
vecāks
revīzija
d8cc0f4c05

+ 51 - 0
src/api/finance/credit_list.js

@@ -0,0 +1,51 @@
+import request from '@/utils/request'
+
+// 信用额度列表-新增
+export function getCreditListAdd(params) {
+    return request({
+      url: '/credit/add',
+      method: 'post',
+      params
+    })
+  }
+// 信用额度列表
+export function getCreditList(params) {
+    return request({
+      url: '/credit/list',
+      method: 'get',
+      params
+    })
+  }
+// 设置信用额度
+export function getCreditListEdit(params) {
+    return request({
+      url: '/credit/record/add',
+      method: 'post',
+      params
+    })
+  }
+// 信用额度列表-导出
+export function getCreditListExport(params) {
+    return request({
+      url: '/credit/exportData',
+      method: 'get',
+      params
+    })
+  }
+//信用额度记录-导出
+export function getCreditExport(params) {
+    return request({
+      url: '/credit/record/export',
+      method: 'get',
+      params
+    })
+  }
+// 信用额度记录
+export function getCredit(params) {
+    return request({
+      url: '/credit/record/list',
+      method: 'get',
+      params
+    })
+  }
+

+ 116 - 21
src/views/finance/components/credit_list-detail.vue

@@ -16,22 +16,38 @@
       >
         <el-row :gutter="20">
           <el-col :xs="24" :sm="12" :lg="6">
-            <el-form-item label="日期" prop="">
+            <el-form-item label="开始时间" prop="startTime">
               <el-date-picker
-                v-model="value1"
-                type="daterange"
-                range-separator="至"
-                start-placeholder="开始日期"
-                end-placeholder="结束日期"
+                class="selectStyle"
+                v-model="searchForm.startTime"
+                type="datetime"
+                placeholder="选择日期时间"
+                default-time="00:00:00"
+                value-format="yyyy-MM-dd HH:mm:ss"
+              >
+              </el-date-picker>
+            </el-form-item>
+          </el-col>
+          <el-col :xs="24" :sm="12" :lg="6">
+            <el-form-item label="结束时间" prop="endTime">
+              <el-date-picker
+                class="selectStyle"
+                v-model="searchForm.endTime"
+                type="datetime"
+                placeholder="选择日期时间"
+                default-time="00:00:00"
+                value-format="yyyy-MM-dd HH:mm:ss"
               >
               </el-date-picker>
             </el-form-item>
           </el-col>
 
-          <el-col :xs="24" :sm="24" :lg="18">
+          <el-col :xs="24" :sm="24" :lg="12">
             <el-form-item label="" class="fr">
-              <el-button size="small">清空</el-button>
-              <el-button size="small" type="primary">搜索</el-button>
+              <el-button size="small" @click="clearFn">清空</el-button>
+              <el-button size="small" type="primary" @click="searchFn"
+                >搜索</el-button
+              >
             </el-form-item>
           </el-col>
         </el-row>
@@ -40,7 +56,9 @@
     <!-- 按钮 -->
     <div class="btn-group clearfix">
       <div class="fr">
-        <el-button type="primary" size="small">导出</el-button>
+        <el-button type="primary" size="small" @click="exportList"
+          >导出</el-button
+        >
       </div>
     </div>
     <!-- 列表 -->
@@ -58,55 +76,70 @@
           <el-table-column
             label="序号"
             align="center"
-            min-width="100"
+            width="100"
+            type="index"
             show-overflow-tooltip
           ></el-table-column>
           <el-table-column
             align="center"
             label="经销商编码"
-            prop=""
+            prop="customerNumber"
             min-width="160"
             show-overflow-tooltip
           ></el-table-column>
           <el-table-column
             align="center"
             label="经销商名称"
-            prop=""
+            prop="customerName"
             min-width="160"
             show-overflow-tooltip
           ></el-table-column>
           <el-table-column
             align="center"
             label="关联钱包"
-            prop=""
+            prop="customerWalletName"
+            min-width="160"
+            show-overflow-tooltip
+          ></el-table-column>
+          <el-table-column
+            align="center"
+            label="变更金额"
+            prop="amount"
+            min-width="160"
+            show-overflow-tooltip
+          ></el-table-column>
+          <el-table-column
+            align="center"
+            label="使用金额"
+            prop="useAmount"
             min-width="160"
             show-overflow-tooltip
           ></el-table-column>
           <el-table-column
             align="center"
-            label="变更额度"
-            prop=""
+            label="开始日期"
+            prop="startTime"
             min-width="160"
             show-overflow-tooltip
           ></el-table-column>
           <el-table-column
             align="center"
-            label="总信用额度"
-            prop=""
+            label="结束日期"
+            prop="endTime"
             min-width="160"
             show-overflow-tooltip
           ></el-table-column>
           <el-table-column
             align="center"
             label="变更时间"
-            prop=""
+            prop="updateTime"
             min-width="160"
             show-overflow-tooltip
           ></el-table-column>
           <el-table-column
             align="center"
             label="变更人"
-            prop=""
+            prop="updateBy"
             min-width="160"
             show-overflow-tooltip
           ></el-table-column>
@@ -115,6 +148,8 @@
       <!-- 分页 -->
       <div class="fr">
         <el-pagination
+          @size-change="handleSizeChange"
+          @current-change="handleCurrentChange"
           :current-page="currentPage"
           :page-sizes="[10, 20, 30, 50]"
           :page-size="10"
@@ -128,18 +163,78 @@
 </template>
 
 <script>
+import { getCredit } from "@/api/finance/credit_list";
+import { downloadFiles } from "@/utils/util";
 export default {
+  props: {
+    recordsList: {
+      type: Object,
+      required: true,
+    },
+  },
   data() {
     return {
       currentPage: 1, // 当前页码
       pageSize: 10, // 每页数量
       listTotal: 0, // 列表总数
       dataList: [], // 列表数据
-      searchForm: {}, //搜索表单
+      searchForm: {
+        startTime: "",
+        endTime: "",
+      }, //搜索表单
       listLoading: false, // 列表加载loading
     };
   },
+  created() {
+    this.getDataList({
+      customerWalletCreditId: this.recordsList.id,
+
+      pageNum: this.currentPage,
+      pageSize: this.pageSize,
+    });
+  },
   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 });
+    },
+    //导出
+    exportList() {
+      let screenData = {
+        customerWalletCreditId: this.recordsList.id,
+        startTime: this.searchForm.startTime,
+        endTime: this.searchForm.endTime,
+      };
+      downloadFiles("/credit/record/export", screenData);
+    },
+    //清除
+    clearFn() {
+      this.$refs.searchForm.resetFields();
+    },
+    //搜索
+    searchFn() {
+      console.log(this.searchForm);
+      this.getDataList({
+        ...this.searchForm,
+        customerWalletCreditId: this.recordsList.id,
+        pageNum: this.currentPage,
+        pageSize: this.pageSize,
+      });
+    },
+    //获取信用额度变更记录数据
+    async getDataList(data) {
+      const res = await getCredit(data);
+      console.log(res);
+      this.dataList = res.data.records;
+      this.listTotal = res.data.total;
+    },
     goBack() {
       this.$parent.showRecord = true;
     },

+ 275 - 44
src/views/finance/credit_list.vue

@@ -12,30 +12,44 @@
         >
           <el-row :gutter="20">
             <el-col :xs="24" :sm="12" :lg="6">
-              <el-form-item label="经销商编码" prop="">
-                <el-input placeholder="请输入"></el-input>
+              <el-form-item label="经销商编码" prop="customerNumber">
+                <el-input
+                  v-model="searchForm.customerNumber"
+                  placeholder="请输入"
+                ></el-input>
               </el-form-item>
             </el-col>
             <el-col :xs="24" :sm="12" :lg="6">
-              <el-form-item label="经销商名称" prop="">
-                <el-input placeholder="请输入"></el-input>
+              <el-form-item label="经销商名称" prop="customerName">
+                <el-input
+                  v-model="searchForm.customerName"
+                  placeholder="请输入"
+                ></el-input>
               </el-form-item>
             </el-col>
             <el-col :xs="24" :sm="12" :lg="6">
-              <el-form-item label="关联钱包" prop="">
-                <el-input placeholder="请输入"></el-input>
+              <el-form-item label="关联钱包" prop="walletName">
+                <el-input
+                  v-model="searchForm.walletName"
+                  placeholder="请输入"
+                ></el-input>
               </el-form-item>
             </el-col>
             <el-col :xs="24" :sm="12" :lg="6">
-              <el-form-item label="总信用额度" prop="">
-                <el-input placeholder="请输入"></el-input>
+              <el-form-item label="总信用额度" prop="amount">
+                <el-input
+                  v-model="searchForm.amount"
+                  placeholder="请输入"
+                ></el-input>
               </el-form-item>
             </el-col>
 
             <el-col :xs="24" :sm="24" :lg="24">
               <el-form-item label="" class="fr">
-                <el-button size="small">清空</el-button>
-                <el-button size="small" type="primary">搜索</el-button>
+                <el-button size="small" @click="clearFn">清空</el-button>
+                <el-button size="small" type="primary" @click="searchFn"
+                  >搜索</el-button
+                >
               </el-form-item>
             </el-col>
           </el-row>
@@ -47,12 +61,11 @@
           <el-button type="primary" size="small" @click="showAddFn"
             >新建</el-button
           >
-          <el-button type="primary" size="small" @click="recordFn"
-            >详情</el-button
-          >
         </div>
         <div class="fr">
-          <el-button type="primary" size="small">导出</el-button>
+          <el-button type="primary" size="small" @click="exportList"
+            >导出</el-button
+          >
           <el-button type="primary" size="small">打印</el-button>
         </div>
       </div>
@@ -71,41 +84,35 @@
             <el-table-column
               label="序号"
               align="center"
-              min-width="100"
+              type="index"
+              width="100"
               show-overflow-tooltip
             ></el-table-column>
             <el-table-column
               align="center"
               label="经销商编码"
-              prop=""
+              prop="customerNumber"
               min-width="160"
               show-overflow-tooltip
             ></el-table-column>
             <el-table-column
               align="center"
               label="经销商名称"
-              prop=""
-              min-width="160"
-              show-overflow-tooltip
-            ></el-table-column>
-            <el-table-column
-              align="center"
-              label="当前信用额度"
-              prop=""
+              prop="customerName"
               min-width="160"
               show-overflow-tooltip
             ></el-table-column>
             <el-table-column
               align="center"
-              label="上次额度"
-              prop=""
+              label="总信用额度"
+              prop="amount"
               min-width="160"
               show-overflow-tooltip
             ></el-table-column>
             <el-table-column
               align="center"
               label="关联钱包"
-              prop=""
+              prop="customerWalletName"
               min-width="160"
               show-overflow-tooltip
             ></el-table-column>
@@ -115,11 +122,17 @@
               min-width="160"
               show-overflow-tooltip
             >
-              <template slot-scope="">
-                <el-button type="text" class="textColor" slot="reference"
+              <template slot-scope="scope">
+                <el-button
+                  type="text"
+                  class="textColor"
+                  @click="editFn(scope.row)"
                   >设置额度</el-button
                 >
-                <el-button type="text" class="textColor" slot="reference"
+                <el-button
+                  type="text"
+                  class="textColor"
+                  @click="recordFn(scope.row)"
                   >记录</el-button
                 >
               </template>
@@ -129,6 +142,8 @@
         <!-- 分页 -->
         <div class="fr">
           <el-pagination
+            @size-change="handleSizeChange"
+            @current-change="handleCurrentChange"
             :current-page="currentPage"
             :page-sizes="[10, 20, 30, 50]"
             :page-size="10"
@@ -139,31 +154,81 @@
         </div>
       </div>
     </div>
-    <CreditListDetail v-else />
+    <CreditListDetail :recordsList="recordsList" v-else />
     <!-- 新增弹窗 -->
     <el-dialog
-      title="提货人档案"
+      title="新增"
       :visible.sync="dialogForm"
       width="30%"
       :show-close="false"
       :close-on-click-modal="false"
     >
-      <el-form label-width="120px">
+      <el-form
+        ref="addForm"
+        :rules="rules"
+        :model="addForm"
+        label-width="120px"
+      >
         <el-form-item label="经销商名称" prop="customerId" label-width="120px">
-          <el-select class="selectStyle" placeholder="请选择">
-            <el-option> </el-option>
+          <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="">
-          <el-input></el-input>
+        <el-form-item label="信用变更额度" prop="amount">
+          <el-input v-model.number="addForm.amount"></el-input>
         </el-form-item>
 
-        <el-form-item label="关联钱包" prop="customerId">
-          <el-select class="selectStyle" placeholder="请选择">
-            <el-option> </el-option>
+        <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"
+            v-model="addForm.startTime"
+            type="datetime"
+            placeholder="选择日期时间"
+            default-time="00:00:00"
+            value-format="yyyy-MM-dd HH:mm:ss"
+          >
+          </el-date-picker>
+        </el-form-item>
+        <el-form-item label="结束时间" prop="endTime">
+          <el-date-picker
+            class="selectStyle"
+            v-model="addForm.endTime"
+            type="datetime"
+            placeholder="选择日期时间"
+            default-time="00:00:00"
+            value-format="yyyy-MM-dd HH:mm:ss"
+          >
+          </el-date-picker>
+        </el-form-item>
       </el-form>
       <div slot="footer" class="dialog-footer">
         <el-button @click="cancelFn">取 消</el-button>
@@ -174,7 +239,15 @@
 </template>
 
 <script>
+import { getWalletCustomerList } from "@/api/finance/change_apply";
+import { getDealerList } from "@/api/basic_data/dealer";
+import {
+  getCreditListAdd,
+  getCreditList,
+  getCreditListEdit,
+} from "@/api/finance/credit_list";
 import CreditListDetail from "./components/credit_list-detail";
+import { downloadFiles } from "@/utils/util";
 export default {
   components: {
     CreditListDetail,
@@ -185,24 +258,182 @@ export default {
       pageSize: 10, // 每页数量
       listTotal: 0, // 列表总数
       dataList: [], // 列表数据
-      searchForm: {}, //搜索表单
+      searchForm: {
+        customerNumber: "",
+        customerName: "",
+        amount: "",
+        walletName: "",
+      }, //搜索表单
       listLoading: false, // 列表加载loading
       showRecord: true,
       dialogForm: false, //弹窗表单
+      addForm: {
+        startTime: "",
+        endTime: "",
+        amount: null,
+        customerId: "",
+        customerWalletId: "",
+      },
+      customerList: [], //经销商列表数据
+      customerWalletList: [], //经销商钱包列表
+      recordsList: {}, //记录数据
+      customerWalletCreditId: null, //设置额度ID
+      rules: {
+        startTime: [
+          { required: true, message: "请选择开始时间", trigger: "blur" },
+        ],
+        endTime: [
+          { required: true, message: "请选择结束时间", trigger: "blur" },
+        ],
+        amount: [
+          {
+            required: true,
+            message: "请输入数字",
+            type: "number",
+            trigger: "blur",
+          },
+        ],
+        customerId: [
+          { required: true, message: "请选择经销商", trigger: "blur" },
+        ],
+        customerWalletId: [
+          { required: true, message: "请选择钱包", trigger: "blur" },
+        ],
+      },
     };
   },
+  created() {
+    this.getDataList({ pageSize: this.pageSize, pageNum: this.currentPage });
+    this.getDealerData({ pageSize: -1, pageNum: 1 });
+  },
   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,
+        customerId: value.customerId,
+        customerWalletId: value.customerWalletId,
+      };
+      this.getWalletData({ type: "COMMONLY", customerId: value.customerId });
+
+      this.dialogForm = true;
+    },
+    //导出
+    exportList() {
+      let screenData = {
+        amount: this.searchForm.amount,
+        customerNumber: this.searchForm.customerNumber,
+        customerName: this.searchForm.customerName,
+        walletName: this.searchForm.walletName,
+      };
+      downloadFiles("/credit/exportData", screenData);
+    },
+    //清空
+    clearFn() {
+      this.$refs.searchForm.resetFields();
+    },
+    //搜索
+    searchFn() {
+      this.getDataList({
+        ...this.searchForm,
+        pageSize: this.pageSize,
+        pageNum: this.currentPage,
+      });
+    },
+    // 更改每页数量
+    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 });
+    },
+    //列表数据
+    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;
+    },
+    //获取经销商列表
+    async getDealerData(data) {
+      const res = await getDealerList(data);
+
+      this.customerList = res.data.records;
+    },
     //新建
     showAddFn() {
       this.dialogForm = true;
     },
     //确定
-    addDataFn() {},
+    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;
+      this.dialogForm = false;
+    },
     //取消
-    cancelFn() {
+    async cancelFn() {
+      // this.addForm = {
+      //   startTime: "",
+      //   endTime: "",
+      //   amount: null,
+      //   customerId: "",
+      //   customerWalletId: "",
+      // };
+      await this.$refs.addForm.resetFields();
+      this.customerWalletCreditId = null;
       this.dialogForm = false;
     },
-    recordFn() {
+    //记录
+    recordFn(v) {
+      this.recordsList = v;
       this.showRecord = false;
     },
   },