瀏覽代碼

财务汇总接口完成

chen 3 年之前
父節點
當前提交
142e2cd0cc
共有 2 個文件被更改,包括 72 次插入10 次删除
  1. 18 0
      src/api/finance/finance_sum.js
  2. 54 10
      src/views/finance/finance_sum.vue

+ 18 - 0
src/api/finance/finance_sum.js

@@ -0,0 +1,18 @@
+import request from '@/utils/request'
+
+// 财务汇总
+export function getFinanceTotal(params) {
+    return request({
+      url: '/finance/total',
+      method: 'get',
+      params
+    })
+  }
+// 产品品类列表
+export function getProductCategoryList(params) {
+    return request({
+      url: '/product-category/list',
+      method: 'get',
+      params
+    })
+  }

+ 54 - 10
src/views/finance/finance_sum.vue

@@ -11,17 +11,30 @@
       >
         <el-row :gutter="20">
           <el-col :xs="24" :sm="12" :lg="6">
-            <el-form-item label="选择品类" prop="">
-              <el-select class="selectStyle" placeholder="请选择">
-                <el-option> </el-option>
+            <el-form-item label="选择品类" prop="mainId">
+              <el-select
+                v-model="searchForm.mainId"
+                class="selectStyle"
+                placeholder="请选择"
+                filterable
+              >
+                <el-option
+                  v-for="v in categoryList"
+                  :key="v.productCategoryNumber"
+                  :label="v.productCategoryName"
+                  :value="v.productCategoryNumber"
+                >
+                </el-option>
               </el-select>
             </el-form-item>
           </el-col>
 
           <el-col :xs="24" :sm="12" :lg="18">
             <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>
@@ -42,28 +55,28 @@
           <el-table-column
             align="center"
             label="品类"
-            prop=""
+            prop="mainName"
             min-width="160"
             show-overflow-tooltip
           ></el-table-column>
           <el-table-column
             align="center"
             label="钱包名称"
-            prop=""
+            prop="name"
             min-width="160"
             show-overflow-tooltip
           ></el-table-column>
           <el-table-column
             align="center"
             label="余额"
-            prop=""
+            prop="totalAmount"
             min-width="160"
             show-overflow-tooltip
           ></el-table-column>
           <el-table-column
             align="center"
             label="更新时间"
-            prop=""
+            prop="theTime"
             min-width="160"
             show-overflow-tooltip
           ></el-table-column>
@@ -85,6 +98,10 @@
 </template>
 
 <script>
+import {
+  getFinanceTotal,
+  getProductCategoryList,
+} from "@/api/finance/finance_sum";
 export default {
   data() {
     return {
@@ -92,10 +109,37 @@ export default {
       pageSize: 10, // 每页数量
       listTotal: 0, // 列表总数
       dataList: [], // 列表数据
-      searchForm: {}, //搜索表单
+      searchForm: {
+        mainId: "",
+      }, //搜索表单
       listLoading: false, // 列表加载loading
+      categoryList: [], //品类数据
     };
   },
+  created() {
+    this.getCategoryList();
+    this.getDataList();
+  },
+  methods: {
+    //清空
+    async clearFn() {
+      await this.$refs.searchForm.resetFields();
+    },
+    //搜索
+    searchFn() {
+      this.getDataList({ mainId: this.searchForm.mainId });
+    },
+    //获取品类数据
+    async getCategoryList() {
+      const res = await getProductCategoryList();
+      this.categoryList = res.data;
+    },
+    //获取列表数据
+    async getDataList(data) {
+      const res = await getFinanceTotal(data);
+      this.dataList = res.data;
+    },
+  },
 };
 </script>