refundDepositFee.vue 1.63 KB
<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>