Преглед изворни кода

资金管理列表添加合计行,钱包余额修改bug

chen пре 3 година
родитељ
комит
d7de0c3aed

+ 16 - 6
src/views/finance/account_list.vue

@@ -125,6 +125,8 @@
             fit
             highlight-current-row
             stripe
+            show-summary
+            :summary-method="$getSummaries"
           >
             <el-table-column
               align="center"
@@ -167,13 +169,13 @@
               min-width="160"
               show-overflow-tooltip
             ></el-table-column>
-            <el-table-column
+            <!-- <el-table-column
               align="center"
               label="部门"
               prop=""
               min-width="160"
               show-overflow-tooltip
-            ></el-table-column>
+            ></el-table-column> -->
             <el-table-column
               align="center"
               label="现金钱包类型"
@@ -203,19 +205,23 @@
               show-overflow-tooltip
             ></el-table-column>
             <el-table-column
-              align="center"
+              align="right"
               label="收付款金额"
               prop="amount"
               min-width="160"
               show-overflow-tooltip
-            ></el-table-column>
-            <el-table-column
+            >
+              <template slot-scope="scope">
+                {{ scope.row.amount | numToFixed }}
+              </template>
+            </el-table-column>
+            <!-- <el-table-column
               align="center"
               label="发货金额"
               prop=""
               min-width="160"
               show-overflow-tooltip
-            ></el-table-column>
+            ></el-table-column> -->
             <el-table-column
               align="center"
               label="备注"
@@ -347,6 +353,10 @@ export default {
     //获取列表
     async getDataList(data) {
       let res = await getFinanceStandingBookList(data);
+      res.data.records.forEach((item) => {
+        item.sums1 = [];
+        item.sums2 = ["amount"];
+      });
       this.dataList = res.data.records;
       this.listTotal = res.data.total;
     },

+ 16 - 4
src/views/finance/change_list.vue

@@ -78,6 +78,8 @@
             fit
             highlight-current-row
             stripe
+            show-summary
+            :summary-method="$getSummaries"
           >
             <el-table-column
               label="序号"
@@ -141,12 +143,16 @@
               show-overflow-tooltip
             ></el-table-column>
             <el-table-column
-              align="center"
+              align="right"
               label="返利金额"
               prop="amount"
               min-width="160"
               show-overflow-tooltip
-            ></el-table-column>
+            >
+              <template slot-scope="scope">
+                {{ scope.row.amount | numToFixed }}
+              </template>
+            </el-table-column>
             <el-table-column
               align="center"
               label="接收方经销商编号"
@@ -379,7 +385,9 @@ export default {
   methods: {
     //切换radio
     changeRadioGroupFn(v) {
-      console.log(v);
+      // console.log(v);
+      this.currentPage = 1;
+      this.pageSize = 10;
       this.getDataList({
         pageSize: this.pageSize,
         pageNum: this.currentPage,
@@ -415,7 +423,11 @@ export default {
     //获取列表数据
     async getDataList(data) {
       const res = await getChangeList(data);
-      console.log(res);
+      // console.log(res);
+      res.data.records.forEach((item) => {
+        item.sums1 = [];
+        item.sums2 = ["amount"];
+      });
       this.dataList = res.data.records;
       this.listTotal = res.data.total;
     },

+ 17 - 7
src/views/finance/components/account_list-detail.vue

@@ -112,6 +112,8 @@
           fit
           highlight-current-row
           stripe
+          show-summary
+          :summary-method="$getSummaries"
         >
           <el-table-column
             align="center"
@@ -154,13 +156,13 @@
             min-width="160"
             show-overflow-tooltip
           ></el-table-column>
-          <el-table-column
+          <!-- <el-table-column
             align="center"
             label="部门"
             prop=""
             min-width="160"
             show-overflow-tooltip
-          ></el-table-column>
+          ></el-table-column> -->
           <el-table-column
             align="center"
             label="现金钱包类型"
@@ -190,19 +192,23 @@
             show-overflow-tooltip
           ></el-table-column>
           <el-table-column
-            align="center"
+            align="right"
             label="收付款金额"
             prop="amount"
             min-width="160"
             show-overflow-tooltip
-          ></el-table-column>
-          <el-table-column
+          >
+            <template slot-scope="scope">
+              {{ scope.row.amount | numToFixed }}
+            </template>
+          </el-table-column>
+          <!-- <el-table-column
             align="center"
             label="发货金额"
             prop=""
             min-width="160"
             show-overflow-tooltip
-          ></el-table-column>
+          ></el-table-column> -->
           <el-table-column
             align="center"
             label="备注"
@@ -219,7 +225,7 @@
           @current-change="handleCurrentChange"
           :current-page="currentPage"
           :page-sizes="[10, 20, 30, 50]"
-          :page-size="10"
+          :page-size="pageSize"
           layout="total, sizes, prev, pager, next, jumper"
           :total="listTotal"
         >
@@ -312,6 +318,10 @@ export default {
     //获取列表
     async getDataList(data) {
       let res = await getFinanceStandingBookList(data);
+      res.data.records.forEach((item) => {
+        item.sums1 = [];
+        item.sums2 = ["amount"];
+      });
       this.dataList = res.data.records;
       this.listTotal = res.data.total;
     },

+ 34 - 3
src/views/finance/credit_list.vue

@@ -62,6 +62,8 @@
             fit
             highlight-current-row
             stripe
+            show-summary
+            :summary-method="getSummaries"
           >
             <el-table-column
               label="序号"
@@ -85,14 +87,17 @@
               show-overflow-tooltip
             ></el-table-column>
             <el-table-column
-              align="center"
+              align="right"
               label="总信用额度"
               prop="amount"
               min-width="160"
               show-overflow-tooltip
             >
               <template slot-scope="scope">
-                {{ scope.row.usedCreditAmount + scope.row.freeCreditAmount }}
+                {{
+                  (scope.row.usedCreditAmount + scope.row.freeCreditAmount)
+                    | numToFixed
+                }}
               </template>
             </el-table-column>
             <el-table-column
@@ -263,6 +268,32 @@ export default {
     this.getCustomerData({ pageSize: -1, pageNum: 1 });
   },
   methods: {
+    //列表合计
+    getSummaries(param) {
+      const { columns, data } = param;
+      const sums = [];
+      columns.forEach((column, index) => {
+        if (index === 0) {
+          sums[index] = "合计";
+        }
+        if (index === 3) {
+          let map1 = data.map((v) => {
+            return v.usedCreditAmount + v.freeCreditAmount;
+          });
+          sums[index] = map1
+            .reduce((prev, curr) => {
+              const value = Number(curr);
+              if (!isNaN(value)) {
+                return prev + curr;
+              } else {
+                return prev;
+              }
+            }, 0)
+            .toFixed(2);
+        }
+      });
+      return sums;
+    },
     //获取经销商列表
     async getCustomerData(data) {
       const res = await getCustomerList(data);
@@ -304,7 +335,7 @@ export default {
     //列表数据
     async getDataList(data) {
       const res = await getWalletCustomerList(data);
-      console.log(res);
+      // console.log(res);
       this.dataList = res.data.records;
       this.listTotal = res.data.total;
     },

+ 18 - 4
src/views/finance/finance_sum.vue

@@ -51,6 +51,8 @@
           fit
           highlight-current-row
           stripe
+          show-summary
+          :summary-method="$getSummaries"
         >
           <el-table-column
             align="center"
@@ -74,19 +76,27 @@
             show-overflow-tooltip
           ></el-table-column>
           <el-table-column
-            align="center"
+            align="right"
             label="可用信用额度"
             prop="freezeCreditAmount"
             min-width="160"
             show-overflow-tooltip
-          ></el-table-column>
+          >
+            <template slot-scope="scope">
+              {{ scope.row.freezeCreditAmount | numToFixed }}
+            </template>
+          </el-table-column>
           <el-table-column
-            align="center"
+            align="right"
             label="已用信用额度"
             prop="usedCreditAmount"
             min-width="160"
             show-overflow-tooltip
-          ></el-table-column>
+          >
+            <template slot-scope="scope">
+              {{ scope.row.usedCreditAmount | numToFixed }}
+            </template>
+          </el-table-column>
           <el-table-column
             align="center"
             label="更新时间"
@@ -151,6 +161,10 @@ export default {
     //获取列表数据
     async getDataList(data) {
       const res = await getFinanceTotal(data);
+      res.data.forEach((item) => {
+        item.sums1 = [];
+        item.sums2 = ["freezeCreditAmount", "usedCreditAmount"];
+      });
       this.dataList = res.data;
     },
   },

+ 46 - 2
src/views/finance/rebate_form.vue

@@ -117,6 +117,8 @@
           :row-class-name="rouClassNameFn"
           @row-click="onRowClick"
           @selection-change="selectionChange"
+          show-summary
+          :summary-method="getSummaries"
         >
           <el-table-column
             align="center"
@@ -183,7 +185,7 @@
             </template>
           </el-table-column>
           <el-table-column
-            align="center"
+            align="left"
             label="返利总金额"
             prop="amount"
             min-width="160"
@@ -194,7 +196,7 @@
             </template>
           </el-table-column>
           <el-table-column
-            align="center"
+            align="left"
             label="暂扣返利"
             prop="withholdAmount"
             min-width="160"
@@ -390,6 +392,48 @@ export default {
     this.searchForm.createBy = this.name;
   },
   methods: {
+    //合计
+    getSummaries(param) {
+      const { columns, data } = param;
+      const sums = [];
+      columns.forEach((column, index) => {
+        if (index === 0) {
+          sums[index] = "合计";
+        }
+        if (index === 4) {
+          let map2 = data.map((v) => {
+            return v.amount;
+          });
+          sums[index] = map2
+            .reduce((prev, curr) => {
+              const value = Number(curr);
+              if (!isNaN(value)) {
+                return prev + curr;
+              } else {
+                return prev;
+              }
+            }, 0)
+            .toFixed(2);
+        }
+        if (index === 5) {
+          let map2 = data.map((v) => {
+            return v.withholdAmount;
+          });
+          sums[index] = map2
+            .reduce((prev, curr) => {
+              const value = Number(curr);
+              if (!isNaN(value)) {
+                return prev + curr;
+              } else {
+                return prev;
+              }
+            }, 0)
+            .toFixed(2);
+        }
+      });
+
+      return sums;
+    },
     //删除
     delSeletFn() {
       console.log(this.dataList);

+ 1 - 0
src/views/finance/rebate_list.vue

@@ -656,6 +656,7 @@ export default {
     //切换radio获取数据
     changeRadioFn(v) {
       // console.log(111);
+
       this.currentPage = 1;
       this.getDataList({
         ...this.searchForm,

+ 13 - 3
src/views/finance/receipt_list.vue

@@ -115,6 +115,8 @@
             fit
             highlight-current-row
             stripe
+            show-summary
+            :summary-method="$getSummaries"
           >
             <el-table-column
               align="center"
@@ -177,12 +179,16 @@
               show-overflow-tooltip
             ></el-table-column>
             <el-table-column
-              align="center"
+              align="right"
               label="表头·实收金额"
               prop="amount"
               min-width="160"
               show-overflow-tooltip
-            ></el-table-column>
+            >
+              <template slot-scope="scope">
+                {{ scope.row.amount | numToFixed }}
+              </template>
+            </el-table-column>
             <el-table-column
               align="center"
               label="收款金额"
@@ -372,7 +378,11 @@ export default {
     },
     async getDataList(data) {
       const res = await getK3ReceiptList(data);
-      console.log(res);
+      // console.log(res);
+      res.data.records.forEach((item) => {
+        item.sums1 = [];
+        item.sums2 = ["amount"];
+      });
       this.dataList = res.data.records;
       this.listTotal = res.data.total;
     },

+ 0 - 2
src/views/finance/standbook_list.vue

@@ -822,9 +822,7 @@ export default {
     //货款台账列表合计
     getSummaries(param) {
       const { columns, data } = param;
-
       const sums = [];
-
       columns.forEach((column, index) => {
         if (index === 0) {
           sums[index] = "合计";

+ 105 - 31
src/views/finance/wallet.vue

@@ -1,11 +1,11 @@
 <template>
   <div class="app-container">
-    <div class="sty" v-show="this.$route.query.id">
+    <div class="sty" v-show="show">
       <el-page-header @back="goBack"> </el-page-header>
     </div>
     <br />
     <!-- 筛选条件 -->
-    <div v-if="!isShow">
+    <div v-if="show2">
       <el-form
         ref="searchForm"
         :model="searchForm"
@@ -70,6 +70,8 @@
           fit
           highlight-current-row
           stripe
+          show-summary
+          :summary-method="$getSummaries"
         >
           <el-table-column
             align="center"
@@ -86,26 +88,38 @@
             show-overflow-tooltip
           ></el-table-column>
           <el-table-column
-            align="center"
+            align="right"
             label="余额"
             prop="amount"
             min-width="160"
             show-overflow-tooltip
-          ></el-table-column>
+          >
+            <template slot-scope="scope">
+              {{ scope.row.amount | numToFixed }}
+            </template>
+          </el-table-column>
           <el-table-column
-            align="center"
+            align="right"
             label="可用信用额度"
             prop="freeCreditAmount"
             min-width="160"
             show-overflow-tooltip
-          ></el-table-column>
+          >
+            <template slot-scope="scope">
+              {{ scope.row.freeCreditAmount | numToFixed }}
+            </template>
+          </el-table-column>
           <el-table-column
-            align="center"
+            align="right"
             label="已用信用额度"
             prop="usedCreditAmount"
             min-width="160"
             show-overflow-tooltip
-          ></el-table-column>
+          >
+            <template slot-scope="scope">
+              {{ scope.row.usedCreditAmount | numToFixed }}
+            </template>
+          </el-table-column>
           <el-table-column
             align="center"
             label="更新时间"
@@ -129,6 +143,8 @@
           fit
           highlight-current-row
           stripe
+          show-summary
+          :summary-method="$getSummaries"
         >
           <el-table-column
             align="center"
@@ -145,13 +161,16 @@
             show-overflow-tooltip
           ></el-table-column>
           <el-table-column
-            align="center"
+            align="right"
             label="钱包余额"
             prop="amount"
             min-width="160"
             show-overflow-tooltip
-          ></el-table-column>
-
+          >
+            <template slot-scope="scope">
+              {{ scope.row.amount | numToFixed }}
+            </template>
+          </el-table-column>
           <el-table-column
             align="center"
             label="更新时间"
@@ -221,6 +240,8 @@ export default {
   data() {
     return {
       isShow: JSON.parse(localStorage.getItem("supply_user")).isCustomer,
+      show: false,
+      show2: true,
       searchForm: {
         customerId: null,
       },
@@ -252,32 +273,77 @@ export default {
       },
     };
   },
-  created() {
-    // console.log(this.$route.query.id, 11, this.customerId);
-    if (this.$route.query.id) {
-      this.getDataWallet({
-        customerId: this.$route.query.id,
-        type: "COMMONLY",
-      });
-      this.getDataRebate({
-        customerId: this.$route.query.id,
-        type: "REBATE",
-      });
-    } else {
-      if (this.isShow) {
-        this.getDataWallet({
-          customerId: this.customerId,
+  beforeRouteEnter(to, from, next) {
+    // console.log(11112222);
+    // console.log(to, from, next, 898);
+    next((vm) => {
+      // 这个时候组件还没有创建,所以要通过vm来访问
+      if (
+        from.path == "/finance/details/balance_sum" &&
+        to.path == "/finance/details/wallet" &&
+        vm.$route.query.id
+      ) {
+        //只有是从A进到B页面才执行
+        // 将要执行的逻辑
+        vm.show = true;
+        vm.show2 = false;
+        vm.getDataWallet({
+          customerId: vm.$route.query.id,
           type: "COMMONLY",
         });
-        this.getDataRebate({
-          customerId: this.customerId,
+        vm.getDataRebate({
+          customerId: vm.$route.query.id,
           type: "REBATE",
         });
       } else {
-        this.$message("请选择经销商");
-        this.getCustomerDataList();
+        if (vm.isShow) {
+          vm.show2 = false;
+          vm.getDataWallet({
+            customerId: vm.customerId,
+            type: "COMMONLY",
+          });
+          vm.getDataRebate({
+            customerId: vm.customerId,
+            type: "REBATE",
+          });
+        } else {
+          vm.show = false;
+          vm.show2 = true;
+          vm.walletList = [];
+          vm.rebateList = [];
+          vm.$message("请选择经销商");
+          vm.getCustomerDataList();
+        }
       }
-    }
+    });
+  },
+
+  created() {
+    // console.log(this.$route.query.id, 11, this.customerId);
+    // if (this.$route.query.id) {
+    //   this.getDataWallet({
+    //     customerId: this.$route.query.id,
+    //     type: "COMMONLY",
+    //   });
+    //   this.getDataRebate({
+    //     customerId: this.$route.query.id,
+    //     type: "REBATE",
+    //   });
+    // } else {
+    //   if (this.isShow) {
+    //     this.getDataWallet({
+    //       customerId: this.customerId,
+    //       type: "COMMONLY",
+    //     });
+    //     this.getDataRebate({
+    //       customerId: this.customerId,
+    //       type: "REBATE",
+    //     });
+    //   } else {
+    //     this.$message("请选择经销商");
+    //     this.getCustomerDataList();
+    //   }
+    // }
   },
   computed: {
     ...mapGetters(["customerId"]),
@@ -352,10 +418,18 @@ export default {
     //
     async getDataRebate(data) {
       let res = await getWalletCustomerList(data);
+      res.data.forEach((item) => {
+        item.sums1 = [];
+        item.sums2 = ["amount"];
+      });
       this.rebateList = res.data;
     },
     async getDataWallet(data) {
       let res = await getWalletCustomerList(data);
+      res.data.forEach((item) => {
+        item.sums1 = [];
+        item.sums2 = ["amount", "freeCreditAmount", "usedCreditAmount"];
+      });
       this.walletList = res.data;
     },
   },