bill.vue 5.08 KB
<template>
  <d2-container>
    <el-card shadow="never">
      <el-form :inline="true" :model="formInline" class="demo-form-inline" size="small">
        <el-form-item label="商户对账状态">
          <el-select v-model="formInline.status" placeholder="请选择">
            <el-option value="" label="全部">全部</el-option>
            <el-option value="1" label="未对账">未对账</el-option>
            <el-option value="2" label="待审核">待审核</el-option>
            <el-option value="3" label="待修正">待修正</el-option>
            <el-option value="4" label="已完成">已完成</el-option>
            <el-option value="5" label="已导出">已导出</el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="商户名称">
          <el-input v-model="formInline.merchantName" placeholder="请输入商户名称" />
        </el-form-item>
        <el-form-item label="对账日期">
          <el-date-picker
            v-model="registerDate"
            type="daterange"
            range-separator="至"
            start-placeholder="开始日期"
            end-placeholder="结束日期"
            value-format="yyyy-MM-dd"
          />
        </el-form-item>
        <el-form-item>
          <el-button type="primary" icon="el-icon-search" :loading="tableLoading" @click="getList()">搜索</el-button>
        </el-form-item>
      </el-form>
    </el-card>

    <!-- 表格区域 开始 -->
    <div class="table_box">
      <el-table v-loading="tableLoading" :data="tableData" stripe style="width: 100%" size="small" border>
        <el-table-column type="index" :index="index => {return index+1}" label="序号" width="80" />
        <el-table-column prop="merchantName" label="对账商户名称" />
        <el-table-column prop="salesTime" label="对账日期">
          <template slot-scope="scope">{{ DATEFORMATE(scope.row.salesTime, 'YYYY-MM-DD HH:mm:ss') }}</template>
        </el-table-column>
        <el-table-column prop="totalPrice" label="对账总额">
          <template slot-scope="scope">¥{{ (scope.row.totalPrice || 0).toFixed(2) }}</template>
        </el-table-column>
        <el-table-column prop="status" label="商户对账状态">
          <template slot-scope="scope">{{ STATUS[scope.row.status] }}</template>
        </el-table-column>
        <el-table-column prop="exportStatu" label="导出状态">
          <template slot-scope="scope">{{ scope.row.status == 5?'已导出':'' }}</template>
        </el-table-column>
        <el-table-column prop="statRetnNum" label="操作" align="center" width="80">
          <template slot-scope="scope">
            <el-link type="primary" :underline="false">详情</el-link>
          </template>
        </el-table-column>
      </el-table>
      <div class="pagination_list">
        <el-pagination
          background
          layout="sizes, total,prev, pager, next, jumper"
          :total="pageTotal"
          :page-size="pageSize"
          :page-sizes="pageSizes"
          @current-change="getList"
          @size-change="changePageSize"
        />
      </div>
    </div>
    <!-- 表格区域 end -->

  </d2-container>
</template>

<script>
import {
  GETALLSALESMANA
} from '@/http/interface'
export default {
  data() {
    return {
      formInline: {},
      tableData: [],
      dialogVisible: false,
      tableLoading: false,
      pageTotal: 0,
      userInfo: {},
      currentPage: 1,
      pageSizes: [10, 20, 30, 40],
      pageSize: 10,
      registerDate: [],
      tdWidth: 170,
      DATEFORMATE: (str, type) => {
        return this.$Util.dateFormate(str, type)
      },
      STATUS: {
        1: '未对账',
        2: '待审核',
        3: '待修正',
        4: '已完成',
        5: '已导出'
      }
    }
  },
  created() {

  },

  mounted: function() {
    this.getList()
  },
  methods: {

    /**
       * 查询列表
       */
    getList: function(current) {
      const _this = this
      const oParams = _this.getParams()
      console.log(current)
      oParams.pageNum = current || _this.currentPage
      _this.tableLoading = true
      GETALLSALESMANA(oParams).then(res => {
        console.log(res)
        _this.tableLoading = false
        if (res.returnCode == 0) {
          const {
            data
          } = res
          const {
            total,
            list
          } = data
          _this.tableData = list || []
          _this.pageTotal = total
        }
      })
    },

    /**
       * 获取查询参数
       */
    getParams: function() {
      const n = this.formInline
      const m = this.registerDate
      const oParams = {}
      if (m && m.length > 0) {
        n.startDate = m[0]
        n.endDate = m[1]
      } else {
        delete n.startDate
        delete n.endDate
      }
      oParams.condition = n
      oParams.pageSize = this.pageSize
      return oParams
    },

    /**
       * 每页展示
       */
    changePageSize: function(e) {
      this.pageSize = e
      this.getList()
    }

  }

}
</script>

<style lang="scss" scoped>
  .table_box {
    margin: 20px 0;
  }
  .line{
    text-align:center !important;
  }
</style>