|
@@ -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;
|
|
|
},
|
|
|
},
|