Blame view

src/components/scm/withholdGold.vue 4.63 KB
6ec243d6   wuxw   v1.9 点击提交后,成功提示没有...
1
  <template>
ab44ac83   wuxw   v1.9 测试优惠相关功能 修复部...
2
3
    <el-dialog :title="$t('withholdGold.applyWithdraw')" :visible.sync="visible" width="50%" :before-close="handleClose">
      <el-form ref="form" :model="form" :rules="rules" label-width="120px" label-position="right">
6ed9faf1   wuxw   开发完成优惠下的积分功能
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
        <el-row>
          <el-col :span="12">
            <el-form-item :label="$t('withholdGold.goldAmount')" prop="amount">
              <el-input v-model="form.amount" disabled />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item :label="$t('withholdGold.withdrawAmount')" prop="applyAmount">
              <el-input v-model="form.applyAmount" />
            </el-form-item>
          </el-col>
        </el-row>
  
        <el-row>
          <el-col :span="12">
            <el-form-item :label="$t('withholdGold.applicant')" prop="applyUserName">
              <el-input v-model="form.applyUserName" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item :label="$t('withholdGold.applicantPhone')" prop="applyUserTel">
              <el-input v-model="form.applyUserTel" />
            </el-form-item>
          </el-col>
        </el-row>
  
        <el-row>
          <el-col :span="12">
            <el-form-item :label="$t('withholdGold.bankAccount')" prop="bankNum">
              <el-input v-model="form.bankNum" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item :label="$t('withholdGold.accountName')" prop="bankNumName">
              <el-input v-model="form.bankNumName" />
            </el-form-item>
          </el-col>
        </el-row>
  
        <el-row>
          <el-col :span="12">
            <el-form-item :label="$t('withholdGold.bankName')" prop="bankName">
              <el-input v-model="form.bankName" type="textarea" :rows="2" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item :label="$t('withholdGold.applicationNote')" prop="remark">
              <el-input v-model="form.remark" type="textarea" :rows="2" />
            </el-form-item>
          </el-col>
        </el-row>
      </el-form>
  
      <span slot="footer" class="dialog-footer">
        <el-button @click="handleClose">{{ $t('common.cancel') }}</el-button>
ab44ac83   wuxw   v1.9 测试优惠相关功能 修复部...
59
        <el-button type="primary" @click="submitForm" :loading="loading">
6ed9faf1   wuxw   开发完成优惠下的积分功能
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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
          {{ $t('common.submit') }}
        </el-button>
      </span>
    </el-dialog>
  </template>
  
  <script>
  import { applyGoldWithHold } from '@/api/scm/goldApi'
  import { getCommunityId } from '@/api/community/communityApi'
  
  export default {
    name: 'WithholdGold',
    data() {
      return {
        visible: false,
        loading: false,
        form: {
          goldId: '',
          goldName: '',
          communityId: '',
          amount: '',
          applyAmount: '',
          applyUserName: '',
          applyUserTel: '',
          remark: '',
          bankNum: '',
          bankNumName: '',
          bankName: ''
        },
        rules: {
          applyAmount: [
            { required: true, message: this.$t('withholdGold.required'), trigger: 'blur' }
          ],
          applyUserName: [
            { required: true, message: this.$t('withholdGold.required'), trigger: 'blur' }
          ],
          applyUserTel: [
            { required: true, message: this.$t('withholdGold.required'), trigger: 'blur' }
          ],
          bankNum: [
            { required: true, message: this.$t('withholdGold.required'), trigger: 'blur' }
          ],
          bankNumName: [
            { required: true, message: this.$t('withholdGold.required'), trigger: 'blur' }
          ],
          bankName: [
            { required: true, message: this.$t('withholdGold.required'), trigger: 'blur' }
          ]
        }
      }
    },
    methods: {
      open(data) {
        this.form = {
          ...this.form,
          goldId: data.goldId,
          amount: data.amount,
          communityId: data.communityId || getCommunityId()
        }
        this.visible = true
        this.$nextTick(() => {
          this.$refs.form && this.$refs.form.clearValidate()
        })
      },
      handleClose() {
        this.visible = false
      },
      submitForm() {
        this.$refs.form.validate(async valid => {
          if (!valid) return
  
          try {
            this.loading = true
ab44ac83   wuxw   v1.9 测试优惠相关功能 修复部...
133
134
135
136
137
            const { code, msg } = await applyGoldWithHold(this.form)
            if(code != 0){
              this.$message.error(msg)
              return
            }
6ed9faf1   wuxw   开发完成优惠下的积分功能
138
            this.$emit('success')
6ec243d6   wuxw   v1.9 点击提交后,成功提示没有...
139
            this.$message.success(this.$t('common.operationSuccess'))
6ed9faf1   wuxw   开发完成优惠下的积分功能
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
            this.visible = false
          } catch (error) {
            console.error('Submit failed:', error)
            this.$message.error(this.$t('withholdGold.submitFailed'))
          } finally {
            this.loading = false
          }
        })
      }
    }
  }
  </script>
  
  <style scoped>
  .el-textarea {
    width: 100%;
  }
  </style>