Blame view

src/components/fee/payFeeCoupon.vue 2.3 KB
1a0bdbe0   wuxw   优化缴费页面
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
  <template>
    <el-dialog
      :title="$t('payFeeCoupon.title')"
      :visible.sync="dialogVisible"
      width="70%"
      @close="handleClose"
    >
      <el-card v-if="feeCoupons.length > 0">
        <div slot="header" class="clearfix">
          <span>{{ $t('payFeeCoupon.couponInfo') }}</span>
        </div>
  
        <el-table
          :data="feeCoupons"
          border
          style="width: 100%"
        >
          <el-table-column
            prop="ruleName"
            align="center"
            :label="$t('payFeeCoupon.ruleName')"
          />
          <el-table-column
            prop="couponName"
            align="center"
            :label="$t('payFeeCoupon.couponName')"
          />
          <el-table-column
            prop="quantity"
            align="center"
            :label="$t('payFeeCoupon.quantity')"
          >
            <template slot-scope="scope">
              {{ scope.row.quantity }}{{ $t('payFeeCoupon.unit') }}
            </template>
          </el-table-column>
          <el-table-column
            prop="toTypeName"
            align="center"
            :label="$t('payFeeCoupon.purpose')"
          />
        </el-table>
      </el-card>
    </el-dialog>
  </template>
  
  <script>
  import { getCommunityId } from '@/api/community/communityApi'
  
  export default {
    name: 'PayFeeCoupon',
    data() {
      return {
        dialogVisible: false,
        feeCoupons: [],
        feeId: '',
        communityId: '',
        cycles: 1,
        endTime: ''
      }
    },
    methods: {
      open(params) {
        this.feeId = params.feeId
        this.cycles = params.cycles || 1
        this.endTime = params.endTime || ''
        this.listFeeCoupons()
        this.dialogVisible = true
      },
      close() {
        this.dialogVisible = false
      },
      async listFeeCoupons() {
        try {
          this.communityId = await getCommunityId()
          const params = {
            page: 1,
            row: 20,
            feeId: this.feeId,
            communityId: this.communityId,
            cycles: this.cycles,
            endTime: this.endTime
          }
  
          const response = await this.$http.get('/coupon.computePayFeeCoupon', { params })
          this.feeCoupons = response.data.data || []
        } catch (error) {
          console.error('查询优惠券信息失败:', error)
        }
      },
      handleClose() {
        this.feeCoupons = []
      }
    }
  }
  </script>
  
  <style scoped>
  .el-table {
    margin-top: 20px;
  }
  </style>