clearing.vue 1.91 KB
<template>
  <layout-body>
    <layout-list>
      <Table border :columns="tableCols" :data="tableData"></Table>
      <Page
        :total="pageData.total"
        :current="pageData.pageNo"
        :page-size="20"
        show-total
        @on-change="pageChange"
      ></Page>
    </layout-list>
  </layout-body>
</template>

<script>
import list from './store/list';
import FranchiseService from 'services/finance/franchise-service';
import _ from 'lodash';

export default {
  data() {
    return list.call(this);
  },
  created() {
    this.franchiseService = new FranchiseService();
    this.search();
  },
  methods: {
    filterValues() {
      const params = {
        type: 1,
        beginTime: this.startTime,
        endTime: this.endTime,
        pageSize: this.pageData.pageSize,
        pageNo: this.pageData.pageNo,
        manageMode: 2,
      };

      return _.pickBy(params, val => val);
    },
    search() {
      this.franchiseService.balanceList(this.filterValues()).then(ret => {
        this.tableData = _.get(ret, 'data.records', []);
        this.pageData.total = _.get(ret, 'data.totalCount', 0);
        this.pageData.pageNo = _.get(ret, 'data.pageNo', 1);
      });
    },
    reset() {
      this.pageData.pageNo = 1;
      this.pageData.total = 0;

      this.search();
    },
    pageChange(val) {
      this.pageData.pageNo = val;
      this.search();
    },
    onClickInfo(params) {
      this.$router.push({
        name: 'finance.franchise-clearing.detail',
        params: {},
        query: {
          balanceId: params.row.id,
          brandId: params.row.brandId,
          status: {
            未结算: 1,
            已结算: 2,
          }[params.row.statusDesc],
          productSku: params.row.productSku,
          orderCode: params.row.orderCode,
          type: params.row.type,
          agreementIsAbnormal: params.row.agreementIsAbnormal,
        },
      });
    },
  },
};
</script>