Blame view

src/components/fee/viewFeeData.vue 2.79 KB
b25b036d   wuxw   v1.9 优化日期
1
  <template>
1a0bdbe0   wuxw   优化缴费页面
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
109
110
111
112
113
    <el-dialog
      :title="title"
      :visible.sync="dialogVisible"
      width="50%"
      @close="handleClose"
    >
      <el-table
        :data="tableData"
        border
        style="width: 100%"
      >
        <el-table-column
          prop="label"
          :label="$t('viewFeeData.label')"
          width="180"
        />
        <el-table-column
          prop="value"
          :label="$t('viewFeeData.value')"
        />
      </el-table>
    </el-dialog>
  </template>
  
  <script>
  import { getCommunityId } from '@/api/community/communityApi'
  import { dateFormat } from '@/utils/dateUtil'
  
  export default {
    name: 'ViewFeeData',
    data() {
      return {
        dialogVisible: false,
        title: '',
        tableData: [],
        feeId: ''
      }
    },
    methods: {
      open(params) {
        this.feeId = params.feeId
        this.loadViewFeeData()
        this.dialogVisible = true
      },
      close() {
        this.dialogVisible = false
      },
      async loadViewFeeData() {
        try {
          const communityId = await getCommunityId()
          const params = {
            page: 1,
            row: 1,
            communityId,
            feeId: this.feeId
          }
  
          const response = await this.$http.get('/fee.listFee', { params })
          const fee = response.data.fees[0]
  
          this.title = `${fee.feeName} ${this.$t('viewFeeData.details')}`
  
          const data = {
            [this.$t('viewFeeData.feeId')]: fee.feeId,
            [this.$t('viewFeeData.feeFlag')]: fee.feeFlagName,
            [this.$t('viewFeeData.feeType')]: fee.feeTypeCdName,
            [this.$t('viewFeeData.payerObj')]: fee.payerObjName,
            [this.$t('viewFeeData.feeName')]: fee.feeName,
            [this.$t('viewFeeData.state')]: fee.stateName,
            [this.$t('viewFeeData.createTime')]: fee.startTime,
            [this.$t('viewFeeData.billingStartTime')]: this.getViewFeeDataEndTime(fee),
            [this.$t('viewFeeData.billingEndTime')]: this.getViewFeeDataDeadlineTime(fee),
            [this.$t('viewFeeData.batch')]: fee.batchId
          }
  
          if (fee.feeAttrs) {
            fee.feeAttrs.forEach(attr => {
              data[attr.specCdName] = attr.value
            })
          }
  
          this.tableData = Object.keys(data).map(key => ({
            label: key,
            value: data[key]
          }))
        } catch (error) {
          console.error('加载费用数据失败:', error)
        }
      },
      getViewFeeDataDeadlineTime(fee) {
        if (fee.amountOwed == 0 && fee.endTime == fee.deadlineTime) {
          return "-"
        }
        if (fee.state == '2009001') {
          return "-"
        }
        return dateFormat(fee.deadlineTime)
      },
      getViewFeeDataEndTime(fee) {
        if (fee.state == '2009001') {
          return "-"
        }
        return dateFormat(fee.endTime)
      },
      handleClose() {
        this.tableData = []
        this.title = ''
        this.feeId = ''
      }
    }
  }
  </script>