Blame view

src/components/fee/prestoreAccount.vue 8.39 KB
6ec243d6   wuxw   v1.9 点击提交后,成功提示没有...
1
  <template>
24d3590f   wuxw   房屋收费页面开发完成
2
3
4
5
6
    <el-dialog
      :title="$t('prestoreAccount.title')"
      :visible.sync="dialogVisible"
      width="50%"
    >
911b5549   wuxw   修改平凉客户 反馈的bug 修复
7
8
      <el-form :model="prestoreAccountInfo" :rules="rules" ref="form" label-width="120px">
        <el-form-item :label="$t('prestoreAccount.accountType')" prop="acctType" required>
24d3590f   wuxw   房屋收费页面开发完成
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
          <el-select
            v-model="prestoreAccountInfo.acctType"
            style="width: 100%"
          >
            <el-option
              :label="$t('prestoreAccount.selectAccountType')"
              value=""
              disabled
            ></el-option>
            <el-option
              v-for="(type,index) in prestoreAccountInfo.acctTypes"
              :key="index"
              :label="type.name"
              :value="type.statusCd"
            ></el-option>
          </el-select>
        </el-form-item>
  
911b5549   wuxw   修改平凉客户 反馈的bug 修复
27
        <el-form-item :label="$t('prestoreAccount.ownerPhone')" prop="tel" required>
24d3590f   wuxw   房屋收费页面开发完成
28
29
30
31
32
33
34
          <el-input
            v-model="prestoreAccountInfo.tel"
            :placeholder="$t('prestoreAccount.ownerPhonePlaceholder')"
            @blur="_changeTel"
          ></el-input>
        </el-form-item>
  
911b5549   wuxw   修改平凉客户 反馈的bug 修复
35
        <el-form-item :label="$t('prestoreAccount.ownerName')" prop="ownerId" required>
24d3590f   wuxw   房屋收费页面开发完成
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
          <el-select
            v-model="prestoreAccountInfo.ownerId"
            style="width: 100%"
            @change="_loadOwnerRooms"
          >
            <el-option
              :label="$t('prestoreAccount.selectOwner')"
              value=""
              disabled
            ></el-option>
            <el-option
              v-for="(owner,index) in prestoreAccountInfo.owners"
              :key="index"
              :label="owner.name"
              :value="owner.ownerId"
            ></el-option>
          </el-select>
        </el-form-item>
  
        <el-form-item
          v-if="prestoreAccountInfo.acctType == '2004' || prestoreAccountInfo.acctType == '2005'"
          :label="$t('prestoreAccount.deductionRoom')"
911b5549   wuxw   修改平凉客户 反馈的bug 修复
58
          prop="roomId"
24d3590f   wuxw   房屋收费页面开发完成
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
          required
        >
          <el-select v-model="prestoreAccountInfo.roomId" style="width: 100%">
            <el-option
              :label="$t('prestoreAccount.selectRoom')"
              value=""
              disabled
            ></el-option>
            <el-option
              v-for="(room,index) in prestoreAccountInfo.rooms"
              :key="index"
              :label="room.roomName"
              :value="room.roomId"
            ></el-option>
          </el-select>
        </el-form-item>
  
911b5549   wuxw   修改平凉客户 反馈的bug 修复
76
        <el-form-item :label="$t('prestoreAccount.prestoreAmount')" prop="amount" required>
24d3590f   wuxw   房屋收费页面开发完成
77
78
79
80
81
82
          <el-input
            v-model="prestoreAccountInfo.amount"
            :placeholder="$t('prestoreAccount.prestoreAmountPlaceholder')"
          ></el-input>
        </el-form-item>
  
911b5549   wuxw   修改平凉客户 反馈的bug 修复
83
        <el-form-item :label="$t('prestoreAccount.paymentMethod')" prop="primeRate" required>
24d3590f   wuxw   房屋收费页面开发完成
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
          <el-select v-model="prestoreAccountInfo.primeRate" style="width: 100%">
            <el-option
              :label="$t('prestoreAccount.selectPaymentMethod')"
              value=""
              disabled
            ></el-option>
            <el-option
              v-for="(item,index) in prestoreAccountInfo.primeRates"
              v-if="item.statusCd != '5' && item.statusCd != '6'"
              :key="index"
              :label="item.name"
              :value="item.statusCd"
            ></el-option>
          </el-select>
        </el-form-item>
  
911b5549   wuxw   修改平凉客户 反馈的bug 修复
100
        <el-form-item :label="$t('prestoreAccount.remark')" prop="remark">
24d3590f   wuxw   房屋收费页面开发完成
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
133
134
135
136
137
138
139
          <el-input
            type="textarea"
            :rows="3"
            v-model="prestoreAccountInfo.remark"
            :placeholder="$t('prestoreAccount.remarkPlaceholder')"
          ></el-input>
        </el-form-item>
      </el-form>
  
      <span slot="footer" class="dialog-footer">
        <el-button @click="dialogVisible = false">{{ $t('prestoreAccount.cancel') }}</el-button>
        <el-button type="primary" @click="savePrestoreAccountInfo">{{ $t('prestoreAccount.save') }}</el-button>
      </span>
    </el-dialog>
  </template>
  
  <script>
  import { ownerPrestoreAccount, queryOwners, queryRoomsByOwner } from '@/api/fee/prestoreAccountApi'
  import { getDict } from '@/api/community/communityApi'
  import { getCommunityId } from '@/api/community/communityApi'
  
  export default {
    name: 'PrestoreAccount',
    data() {
      return {
        dialogVisible: false,
        prestoreAccountInfo: {
          tel: '',
          ownerId: '',
          owners: [],
          amount: '',
          remark: '',
          acctTypes: [],
          acctType: '2003',
          primeRate: '',
          primeRates: [],
          rooms: [],
          roomId: '',
        },
911b5549   wuxw   修改平凉客户 反馈的bug 修复
140
141
142
143
144
145
146
147
148
149
        communityId: '',
        rules: {
          acctType: [{ required: true, message: this.$t('prestoreAccount.selectAccountType'), trigger: 'change' }],
          tel: [{ required: true, message: this.$t('prestoreAccount.ownerPhonePlaceholder'), trigger: 'blur' }],
          ownerId: [{ required: true, message: this.$t('prestoreAccount.selectOwner'), trigger: 'change' }],
          roomId: [{ required: true, message: this.$t('prestoreAccount.selectRoom'), trigger: 'change' }],
          amount: [{ required: true, message: this.$t('prestoreAccount.prestoreAmountPlaceholder'), trigger: 'blur' }],
          primeRate: [{ required: true, message: this.$t('prestoreAccount.selectPaymentMethod'), trigger: 'change' }],
          remark: [{ max: 200, message: this.$t('prestoreAccount.validateRemark'), trigger: 'blur' }]
        }
24d3590f   wuxw   房屋收费页面开发完成
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
      }
    },
    created() {
      this.communityId = getCommunityId()
      this._initPrimeRates()
    },
    methods: {
      open(params) {
        this.dialogVisible = true
        this._initAcctTypes()
        
        if (params) {
          this.prestoreAccountInfo.tel = params.tel || ''
          this.prestoreAccountInfo.ownerId = params.ownerId || ''
          this.prestoreAccountInfo.acctType = params.acctType || '2003'
          this.prestoreAccountInfo.roomId = params.roomId || ''
          
          if (params.tel) {
            this._changeTel()
            this._loadOwnerRooms()
          }
        }
      },
      _initPrimeRates() {
        getDict('pay_fee_detail', 'prime_rate').then(data => {
          this.prestoreAccountInfo.primeRates = data
        })
      },
      _initAcctTypes() {
        getDict('account', 'acct_type').then(data => {
          this.prestoreAccountInfo.acctTypes = data
        })
      },
      prestoreAccountValidate() {
911b5549   wuxw   修改平凉客户 反馈的bug 修复
184
185
186
187
188
        return new Promise((resolve) => {
          this.$refs.form.validate((valid) => {
            resolve(valid)
          })
        })
24d3590f   wuxw   房屋收费页面开发完成
189
190
      },
      savePrestoreAccountInfo() {
911b5549   wuxw   修改平凉客户 反馈的bug 修复
191
192
193
194
195
196
        this.prestoreAccountValidate().then(valid => {
          if (valid) {
            const params = {
              ...this.prestoreAccountInfo,
              communityId: this.communityId
            }
24d3590f   wuxw   房屋收费页面开发完成
197
  
911b5549   wuxw   修改平凉客户 反馈的bug 修复
198
199
            ownerPrestoreAccount(params).then(response => {
              if (response.code === 0) {
6ec243d6   wuxw   v1.9 点击提交后,成功提示没有...
200
                this.$message.success(this.$t('common.operationSuccess'))
911b5549   wuxw   修改平凉客户 反馈的bug 修复
201
202
203
204
205
206
207
208
209
210
                this.dialogVisible = false
                this.clearPrestoreAccountInfo()
                this.$emit('save-success')
              } else {
                this.$message.error(response.msg)
              }
            }).catch(error => {
              console.error('请求失败:', error)
              this.$message.error(this.$t('prestoreAccount.saveFailed'))
            })
24d3590f   wuxw   房屋收费页面开发完成
211
          }
24d3590f   wuxw   房屋收费页面开发完成
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
        })
      },
      clearPrestoreAccountInfo() {
        const primeRates = this.prestoreAccountInfo.primeRates
        this.prestoreAccountInfo = {
          tel: '',
          ownerId: '',
          owners: [],
          amount: '',
          remark: '',
          acctTypes: [],
          acctType: '2003',
          primeRate: '',
          primeRates: primeRates,
          rooms: [],
          roomId: '',
        }
911b5549   wuxw   修改平凉客户 反馈的bug 修复
229
230
        // 重置表单验证状态
        this.$refs.form && this.$refs.form.resetFields()
24d3590f   wuxw   房屋收费页面开发完成
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
      },
      _changeTel() {
        if (!this.prestoreAccountInfo.tel) return
  
        const params = {
          communityId: this.communityId,
          row: 50,
          page: 1,
          link: this.prestoreAccountInfo.tel,
          ownerTypeCd: '1001'
        }
  
        queryOwners(params).then(response => {
          this.prestoreAccountInfo.owners = response.data
        }).catch(error => {
          console.error('请求失败:', error)
          this.prestoreAccountInfo.owners = []
        })
      },
      _loadOwnerRooms() {
        if (!this.prestoreAccountInfo.ownerId) return
  
        const params = {
          communityId: this.communityId,
          row: 50,
          page: 1,
          ownerId: this.prestoreAccountInfo.ownerId,
        }
  
        queryRoomsByOwner(params).then(response => {
          this.prestoreAccountInfo.rooms = response.rooms
        }).catch(error => {
          console.error('请求失败:', error)
          this.prestoreAccountInfo.rooms = []
        })
      }
    }
  }
  </script>