Blame view

src/components/account/cancelAccountDetail.vue 2.75 KB
6ec243d6   wuxw   v1.9 点击提交后,成功提示没有...
1
  <template>
1c380d6d   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
    <el-dialog
      :title="$t('cancelAccountDetail.title')"
      :visible.sync="visible"
      width="600px"
      :close-on-click-modal="false">
      <el-form 
        ref="form" 
        :model="formData" 
        label-position="left"
        label-width="120px">
        <el-form-item 
          :label="$t('cancelAccountDetail.accountName')" 
          prop="acctName">
          <el-input 
            v-model="formData.acctName" 
            disabled
            :placeholder="$t('cancelAccountDetail.required')"/>
        </el-form-item>
        
        <el-form-item 
          :label="$t('cancelAccountDetail.cancelAmount')" 
          prop="amount">
          <el-input 
            v-model="formData.amount" 
            disabled
            :placeholder="$t('cancelAccountDetail.required')"/>
        </el-form-item>
        
        <el-form-item 
          :label="$t('cancelAccountDetail.cancelReason')" 
          prop="remark"
          :rules="[{ required: true, message: $t('cancelAccountDetail.required') }]">
          <el-input
            type="textarea"
            v-model="formData.remark"
            :rows="4"
            :placeholder="$t('cancelAccountDetail.required')"/>
        </el-form-item>
      </el-form>
      
      <div slot="footer" class="dialog-footer">
        <el-button @click="visible = false">
          {{ $t('cancelAccountDetail.cancel') }}
        </el-button>
        <el-button 
          type="primary" 
          @click="handleSubmit"
          :loading="submitting">
          {{ $t('cancelAccountDetail.submit') }}
        </el-button>
      </div>
    </el-dialog>
  </template>
  
  <script>
  import { cancelAccountDetail } from '@/api/account/accountDetailManageApi'
  
  export default {
    name: 'CancelAccountDetail',
    data() {
      return {
        visible: false,
        submitting: false,
        formData: {
          detailId: '',
          acctName: '',
          amount: '',
          remark: ''
        }
      }
    },
    methods: {
      open(row) {
        this.formData = {
          detailId: row.detailId,
          acctName: row.acctName,
          amount: row.amount,
          remark: ''
        }
        this.visible = true
        this.$nextTick(() => {
          if (this.$refs.form) {
            this.$refs.form.clearValidate()
          }
        })
      },
      async handleSubmit() {
        try {
          const valid = await this.$refs.form.validate()
          if (!valid) return
          
          this.submitting = true
          await cancelAccountDetail({
            detailId: this.formData.detailId,
            remark: this.formData.remark
          })
          
          this.$message.success(this.$t('common.operationSuccess'))
          this.$emit('success')
          this.visible = false
        } catch (error) {
          this.$message.error(error.message || this.$t('common.operationFailed'))
        } finally {
          this.submitting = false
        }
      }
    }
  }
  </script>