Blame view

src/components/fee/refundDepositFee.vue 1.63 KB
24d3590f   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
  <template>
    <el-dialog
      :title="$t('refundDepositFee.title')"
      :visible.sync="visible"
      width="500px"
      :before-close="handleClose"
    >
      <div class="dialog-content">
        <p>{{ $t('refundDepositFee.confirmText') }}</p>
      </div>
      <span slot="footer" class="dialog-footer">
        <el-button @click="handleClose">{{ $t('common.cancel') }}</el-button>
        <el-button type="primary" @click="refundDepositFee">{{ $t('common.confirm') }}</el-button>
      </span>
    </el-dialog>
  </template>
  
  <script>
  import { getCommunityId } from '@/api/community/communityApi'
  import { refundFeeDeposit } from '@/api/fee/batchPayFeeOrderApi'
  
  export default {
    name: 'RefundDepositFee',
    data() {
      return {
        visible: false,
        refundDepositFeeInfo: {}
      }
    },
    methods: {
      open(fee) {
        this.refundDepositFeeInfo = { ...fee }
        this.visible = true
      },
  
      handleClose() {
        this.visible = false
      },
  
      async refundDepositFee() {
        try {
          const params = {
            ...this.refundDepositFeeInfo,
            communityId: getCommunityId()
          }
  
          const res = await refundFeeDeposit(params)
          if (res.code === 0) {
            this.$message.success('退押金成功')
            this.visible = false
            this.$emit('success')
            this.$emit('refresh')
          } else {
            this.$message.error(res.msg)
          }
        } catch (error) {
          console.error('请求失败:', error)
          this.$message.error('退押金失败')
        }
      }
    }
  }
  </script>
  
  <style lang="scss" scoped>
  .dialog-content {
    padding: 20px;
    text-align: center;
    font-size: 16px;
    line-height: 1.6;
  }
  </style>