jiangping
2025-03-18 1b0cf0db5c82ea8308d2f338973a91555787c34d
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
<template>
  <TableLayout>
    <!-- 搜索表单 -->
    <el-form ref="searchForm" slot="search-form" :model="searchForm" label-width="100px" inline>
      
      <el-form-item label="创建时间" prop="name">
        <el-date-picker
          v-model="value1"
          type="daterange"
          
          range-separator="至"
          start-placeholder="开始日期"
          end-placeholder="结束日期"
          format="yyyy-MM-dd" value-format="yyyy-MM-dd HH:mm:ss"
          @change="selectDate"
        ></el-date-picker>
      </el-form-item>
      
      <section>
        <el-button type="primary" @click="search">搜索</el-button>
        <el-button @click="reset">重置</el-button>
      </section>
    </el-form>
    <!-- 表格和分页 -->
    <template v-slot:table-wrap>
      <el-table
        v-loading="isWorking.search"
        :data="tableData.list"
        stripe
        border
      >
        <el-table-column prop="name" label="业务类型" min-width="100px" align="center"></el-table-column>
        <el-table-column label="微信" min-width="200px" align="center">
          <el-table-column
            prop="payNum"
            label="交易笔数"
            min-width="100px"
            align="center"
          ></el-table-column>
          <el-table-column
            prop="payMoney"
            label="交易金额"
            min-width="100px"
            align="center"
          ></el-table-column>
        </el-table-column>
      </el-table>
      
    </template>
    <!-- 新建/修改 -->
  </TableLayout>
</template>
 
<script>
import BaseTable from '@/components/base/BaseTable'
import TableLayout from '@/layouts/TableLayout'
import { fetchList } from '@/api/business/onlinePayStatistics'
import { formatDateTime } from '@/utils/util'
export default {
  name: 'PricingParam',
  extends: BaseTable,
  components: { TableLayout  },
  data () {
    return {
      value1: [new Date(), new Date()],
      // 搜索
      searchForm: {
        endDate: '',
        startDate: ''
      }
    }
  },
  created () {
    this.searchForm.startDate = formatDateTime(new Date(), 'yyyy-MM-dd') + ' 00:00:00'
    this.search()
  },
  methods: {
    reset() {
      this.searchForm.startDate = ''
      this.searchForm.endDate = ''
      this.value1 = []
      this.$refs.searchForm.resetFields()
      this.search()
    },
    
    search() {
      fetchList(this.searchForm)
        .then(res => {
          this.tableData.list = [
            { name: '支付押金', payNum: res.payNum, payMoney: res.payMoney },
            { name: '退款', payNum: res.refundNum, payMoney: res.refundMoney },
            { name: '未结算', payNum: res.unClosedNum, payMoney: res.unClosedMoney },
            { name: '结算收入', payNum: res.closedNum, payMoney: res.closedMoney },
          ]
        })
    },
    selectDate(v) {
      this.searchForm.startDate = ''
      this.searchForm.endDate = ''
      if (v) {
        this.searchForm.startDate = v[0]
        this.searchForm.endDate = v[1]
      }
      this.search()
    }
  },
}
</script>