Blame view

src/components/fee/EditCommunityPayment.vue 6.49 KB
6ec243d6   wuxw   v1.9 点击提交后,成功提示没有...
1
  <template>
1f3f7892   wuxw   开发完成admin 系统小区公众号
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
    <el-dialog :title="$t('editCommunityPayment.title')" :visible.sync="visible" width="800px" @closed="resetForm">
      <el-form ref="form" :model="form" label-width="120px" :rules="rules">
        <el-form-item :label="$t('communityPayment.paymentName')" prop="paymentName">
          <el-input v-model="form.paymentName" :placeholder="$t('addCommunityPayment.namePlaceholder')" />
        </el-form-item>
  
        <el-form-item :label="$t('communityPayment.paymentVendor')">
          <el-select v-model="form.paymentType" disabled style="width: 100%">
            <el-option v-for="item in paymentTypes" :key="item.paymentType" :label="item.name" :value="item.paymentType" />
          </el-select>
        </el-form-item>
  
        <el-form-item v-for="(key, index) in paymentKeys" :key="index" :label="key.name">
          <el-input v-model="key.columnValue" type="textarea" :rows="2" :placeholder="key.remark" />
        </el-form-item>
  
        <el-form-item v-if="form.paymentType === 'WECHAT'" :label="$t('communityPayment.merchantCert')">
cd705b0a   wuxw   v1.9 优化群里反馈 admin...
19
          <upload-file ref="uploader"  @notify="handleUploadSuccess" />
1f3f7892   wuxw   开发完成admin 系统小区公众号
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
        </el-form-item>
  
        <el-form-item :label="$t('communityPayment.paymentScope')">
          <el-select v-model="form.payType" disabled style="width: 100%">
            <el-option :label="$t('communityPayment.communityFee')" value="1001" />
            <el-option :label="$t('communityPayment.tempParkingFee')" value="2002" />
            <el-option :label="$t('communityPayment.specificFee')" value="3003" />
          </el-select>
        </el-form-item>
  
        <el-form-item v-if="form.payType === '3003'" :label="$t('communityPayment.selectFeeItem')">
          <el-checkbox-group v-model="form.configIds">
            <el-checkbox v-for="fee in feeConfigs" :key="fee.configId" :label="fee.configId">
              {{ fee.feeName }}
            </el-checkbox>
          </el-checkbox-group>
        </el-form-item>
  
        <el-form-item :label="$t('communityPayment.status')" prop="state">
          <el-select v-model="form.state" :placeholder="$t('editCommunityPayment.statusPlaceholder')" style="width: 100%">
            <el-option :label="$t('communityPayment.enabled')" value="Y" />
            <el-option :label="$t('communityPayment.disabled')" value="N" />
          </el-select>
        </el-form-item>
  
        <el-form-item :label="$t('communityPayment.instruction')">
          <el-input v-model="form.remark" type="textarea" :rows="3"
            :placeholder="$t('addCommunityPayment.remarkPlaceholder')" />
        </el-form-item>
      </el-form>
  
      <div slot="footer">
        <el-button @click="visible = false">{{ $t('communityPayment.cancel') }}</el-button>
        <el-button type="primary" @click="submitForm">{{ $t('communityPayment.save') }}</el-button>
      </div>
    </el-dialog>
  </template>
  
  <script>
  import { updateAdminPaymentPool, listPaymentKey, listPaymentAdapt, queryAdminFeeConfigs } from '@/api/fee/communityPaymentApi'
cd705b0a   wuxw   v1.9 优化群里反馈 admin...
60
  import uploadFile from '@/components/upload/uploadFile'
1f3f7892   wuxw   开发完成admin 系统小区公众号
61
62
63
  
  export default {
    name: 'EditCommunityPayment',
cd705b0a   wuxw   v1.9 优化群里反馈 admin...
64
    components: { uploadFile },
1f3f7892   wuxw   开发完成admin 系统小区公众号
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
    data() {
      return {
        visible: false,
        form: {
          ppId: '',
          communityId: '',
          paymentName: '',
          paymentType: '',
          certPath: '',
          state: '',
          remark: '',
          payType: '',
          configIds: []
        },
        paymentTypes: [],
        paymentKeys: [],
        feeConfigs: [],
        rules: {
          paymentName: [
            { required: true, message: this.$t('communityPayment.requiredField'), trigger: 'blur' },
            { max: 64, message: this.$t('communityPayment.maxLength64'), trigger: 'blur' }
          ],
          state: [
            { required: true, message: this.$t('communityPayment.requiredField'), trigger: 'change' }
          ]
        }
      }
    },
    created() {
      this.loadPaymentTypes()
    },
    methods: {
      open(row) {
        this.form = { ...row }
        this.visible = true
        this.$nextTick(() => {
          this.$refs.form && this.$refs.form.clearValidate()
          this.loadPaymentKeys()
          this.loadFeeConfigs()
          if (row.certPath && this.$refs.uploader) {
cd705b0a   wuxw   v1.9 优化群里反馈 admin...
105
106
107
            this.$refs.uploader.fileName = row.certPath
            this.$refs.uploader.realFileName = row.certPath
            this.$refs.uploader.progress = 100
1f3f7892   wuxw   开发完成admin 系统小区公众号
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
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
          }
        })
      },
      resetForm() {
        this.form = {
          ppId: '',
          communityId: '',
          paymentName: '',
          paymentType: '',
          certPath: '',
          state: '',
          remark: '',
          payType: '',
          configIds: []
        }
        this.paymentKeys = []
        if (this.$refs.uploader) {
          this.$refs.uploader.clearFile()
        }
      },
      async loadPaymentTypes() {
        try {
          const res = await listPaymentAdapt({ page: 1, row: 100 })
          this.paymentTypes = res.data || []
        } catch (error) {
          console.error('Failed to load payment types:', error)
        }
      },
      async loadPaymentKeys() {
        if (!this.form.paymentType) return
  
        try {
          const res = await listPaymentKey({
            paymentType: this.form.paymentType,
            page: 1,
            row: 100
          })
          this.paymentKeys = res.data || []
  
          // Load existing values
          if (this.form.values) {
            this.paymentKeys.forEach(key => {
              const value = this.form.values.find(v => v.columnKey === key.columnKey)
              if (value) {
                key.columnValue = value.columnValue
              }
            })
          }
        } catch (error) {
          console.error('Failed to load payment keys:', error)
          this.paymentKeys = []
        }
      },
      async loadFeeConfigs() {
        if (!this.form.communityId) return
  
        try {
          const res = await queryAdminFeeConfigs({
            communityId: this.form.communityId,
            isDefault: 'F',
            page: 1,
            row: 100
          })
          this.feeConfigs = res.feeConfigs || []
        } catch (error) {
          console.error('Failed to load fee configs:', error)
          this.feeConfigs = []
        }
      },
      handleUploadSuccess(file) {
        this.form.certPath = file.realFileName
      },
      submitForm() {
        this.$refs.form.validate(async valid => {
          if (!valid) return
  
          try {
            const payload = {
              ...this.form,
              paymentKeys: this.paymentKeys
            }
            await updateAdminPaymentPool(payload)
07e12785   wuxw   v1.9 admin账户中部分页面...
190
            this.$message.success(this.$t('common.operationSuccess'))
1f3f7892   wuxw   开发完成admin 系统小区公众号
191
192
193
            this.visible = false
            this.$emit('success')
          } catch (error) {
07e12785   wuxw   v1.9 admin账户中部分页面...
194
            this.$message.error(error || this.$t('common.updateFailed'))
1f3f7892   wuxw   开发完成admin 系统小区公众号
195
196
197
198
199
200
          }
        })
      }
    }
  }
  </script>