Blame view

src/components/fee/roomCreateFeeAdd.vue 8.54 KB
6ec243d6   wuxw   v1.9 点击提交后,成功提示没有...
1
  <template>
814833f5   wuxw   优化费用缴费代码
2
    <el-dialog :title="$t('roomCreateFeeAdd.title')" :visible.sync="visible" width="40%" :before-close="handleClose">
24d3590f   wuxw   房屋收费页面开发完成
3
4
      <el-form ref="form" :model="formData" label-width="120px">
        <el-form-item :label="$t('roomCreateFeeAdd.location')">
814833f5   wuxw   优化费用缴费代码
5
6
          <el-input v-model="formData.locationTypeCdName" disabled
            :placeholder="$t('roomCreateFeeAdd.locationPlaceholder')"></el-input>
24d3590f   wuxw   房屋收费页面开发完成
7
        </el-form-item>
814833f5   wuxw   优化费用缴费代码
8
  
24d3590f   wuxw   房屋收费页面开发完成
9
        <el-form-item :label="$t('roomCreateFeeAdd.feeType')" prop="feeTypeCd">
814833f5   wuxw   优化费用缴费代码
10
11
          <el-select v-model="formData.feeTypeCd" @change="handleFeeTypeChange"
            :placeholder="$t('roomCreateFeeAdd.feeTypePlaceholder')" style="width: 100%">
24d3590f   wuxw   房屋收费页面开发完成
12
            <template v-for="item in feeTypeOptions">
814833f5   wuxw   优化费用缴费代码
13
14
              <el-option v-if="item.statusCd != '888800010017'" :key="item.statusCd" :label="item.name"
                :value="item.statusCd"></el-option>
24d3590f   wuxw   房屋收费页面开发完成
15
16
17
18
            </template>
          </el-select>
        </el-form-item>
  
814833f5   wuxw   优化费用缴费代码
19
20
21
22
23
        <el-form-item v-if="formData.feeTypeCd" :label="$t('roomCreateFeeAdd.feeItem')" prop="configId">
          <el-select v-model="formData.configId" @change="handleConfigChange"
            :placeholder="$t('roomCreateFeeAdd.feeItemPlaceholder')" style="width: 100%">
            <el-option v-for="item in feeConfigOptions" :key="item.configId" :label="item.feeName"
              :value="item.configId"></el-option>
24d3590f   wuxw   房屋收费页面开发完成
24
25
26
          </el-select>
        </el-form-item>
  
814833f5   wuxw   优化费用缴费代码
27
28
        <el-form-item v-if="formData.computingFormula == '4004'" :label="$t('roomCreateFeeAdd.amount')" prop="amount">
          <el-input v-model="formData.amount" :placeholder="$t('roomCreateFeeAdd.amountPlaceholder')"></el-input>
24d3590f   wuxw   房屋收费页面开发完成
29
30
31
        </el-form-item>
  
        <el-form-item :label="$t('roomCreateFeeAdd.startTime')" prop="startTime">
814833f5   wuxw   优化费用缴费代码
32
33
34
          <el-date-picker v-model="formData.startTime" type="date"
            :placeholder="$t('roomCreateFeeAdd.startTimePlaceholder')" value-format="yyyy-MM-dd"
            @change="validateStartTime"></el-date-picker>
24d3590f   wuxw   房屋收费页面开发完成
35
36
37
        </el-form-item>
  
        <el-form-item :label="$t('roomCreateFeeAdd.endTime')" prop="endTime">
814833f5   wuxw   优化费用缴费代码
38
39
          <el-date-picker v-model="formData.endTime" type="date" :placeholder="$t('roomCreateFeeAdd.endTimePlaceholder')"
            value-format="yyyy-MM-dd" @change="validateEndTime"></el-date-picker>
24d3590f   wuxw   房屋收费页面开发完成
40
41
        </el-form-item>
  
814833f5   wuxw   优化费用缴费代码
42
43
44
        <el-form-item v-show="formData.computingFormula == '1102'" :label="$t('roomCreateFeeAdd.rateCycle')"
          prop="rateCycle">
          <el-input v-model="formData.rateCycle" :placeholder="$t('roomCreateFeeAdd.rateCyclePlaceholder')"></el-input>
24d3590f   wuxw   房屋收费页面开发完成
45
46
        </el-form-item>
  
814833f5   wuxw   优化费用缴费代码
47
48
        <el-form-item v-show="formData.computingFormula == '1102'" :label="$t('roomCreateFeeAdd.rate')" prop="rate">
          <el-input v-model="formData.rate" :placeholder="$t('roomCreateFeeAdd.ratePlaceholder')"></el-input>
24d3590f   wuxw   房屋收费页面开发完成
49
50
        </el-form-item>
  
814833f5   wuxw   优化费用缴费代码
51
52
53
54
        <el-form-item v-show="formData.computingFormula == '1102'" :label="$t('roomCreateFeeAdd.rateStartTime')"
          prop="rateStartTime">
          <el-date-picker v-model="formData.rateStartTime" type="date"
            :placeholder="$t('roomCreateFeeAdd.rateStartTimePlaceholder')" value-format="yyyy-MM-dd"></el-date-picker>
24d3590f   wuxw   房屋收费页面开发完成
55
56
57
58
59
60
61
62
63
64
65
66
67
        </el-form-item>
      </el-form>
  
      <span slot="footer" class="dialog-footer">
        <el-button @click="handleClose">{{ $t('common.cancel') }}</el-button>
        <el-button type="primary" @click="handleSubmit">{{ $t('common.submit') }}</el-button>
      </span>
    </el-dialog>
  </template>
  
  <script>
  import { saveRoomCreateFee, listFeeConfigs } from '@/api/fee/roomCreateFeeAddApi'
  import { getDict, getCommunityId } from '@/api/community/communityApi'
ab1ebb3c   wuxw   缴费支持 押金 优惠券 优惠折扣 ...
68
  import { dateFormat,addMonth } from '@/utils/dateUtil'
24d3590f   wuxw   房屋收费页面开发完成
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
  
  export default {
    name: 'RoomCreateFeeAdd',
    data() {
      return {
        visible: false,
        formData: {
          feeTypeCds: [],
          feeConfigs: [],
          locationTypeCd: '',
          locationObjId: '',
          feeTypeCd: '',
          configId: '',
          locationTypeCdName: '',
          startTime: '',
          endTime: '2050-01-01',
          computingFormula: '',
          amount: '',
          rateCycle: '',
          rate: '',
          rateStartTime: '',
          feeFlag: ''
        },
        feeTypeOptions: [],
        feeConfigOptions: [],
        rules: {
          locationObjId: [
            { required: true, message: this.$t('roomCreateFeeAdd.validate.locationRequired'), trigger: 'blur' }
          ],
          feeTypeCd: [
            { required: true, message: this.$t('roomCreateFeeAdd.validate.feeTypeRequired'), trigger: 'change' }
          ],
          configId: [
            { required: true, message: this.$t('roomCreateFeeAdd.validate.feeItemRequired'), trigger: 'change' }
          ],
          startTime: [
            { required: true, message: this.$t('roomCreateFeeAdd.validate.startTimeRequired'), trigger: 'blur' }
          ]
        }
      }
    },
    methods: {
      open(room) {
        this.resetForm()
        this.formData.locationObjId = room.roomId
        this.formData.locationTypeCdName = `${room.floorNum}-${room.unitNum}-${room.roomNum}(${room.ownerName})`
814833f5   wuxw   优化费用缴费代码
115
  
24d3590f   wuxw   房屋收费页面开发完成
116
117
118
        if (room.roomName) {
          this.formData.locationTypeCdName = room.roomName
        }
814833f5   wuxw   优化费用缴费代码
119
  
24d3590f   wuxw   房屋收费页面开发完成
120
121
122
123
        this.formData.roomType = room.roomType
        if (room.roomType === '2020602') {
          this.formData.locationTypeCdName = `${room.floorNum}-${room.roomNum}(${room.ownerName})`
        }
814833f5   wuxw   优化费用缴费代码
124
  
24d3590f   wuxw   房屋收费页面开发完成
125
126
127
        this.loadFeeTypes()
        this.visible = true
      },
814833f5   wuxw   优化费用缴费代码
128
  
24d3590f   wuxw   房屋收费页面开发完成
129
130
      loadFeeTypes() {
        getDict('pay_fee_config', 'fee_type_cd').then(data => {
814833f5   wuxw   优化费用缴费代码
131
          this.feeTypeOptions = data.filter(item =>
24d3590f   wuxw   房屋收费页面开发完成
132
133
134
135
            item.statusCd !== '888800010015' && item.statusCd !== '888800010016'
          )
        })
      },
814833f5   wuxw   优化费用缴费代码
136
  
24d3590f   wuxw   房屋收费页面开发完成
137
138
      handleFeeTypeChange(value) {
        if (value === '888800010006' || value === '888800010014') {
ab1ebb3c   wuxw   缴费支持 押金 优惠券 优惠折扣 ...
139
140
          this.formData.startTime = dateFormat(new Date())
          this.formData.endTime = dateFormat(addMonth(new Date(),1))
24d3590f   wuxw   房屋收费页面开发完成
141
        }
814833f5   wuxw   优化费用缴费代码
142
  
24d3590f   wuxw   房屋收费页面开发完成
143
144
145
        this.formData.configId = ''
        this.loadFeeConfigs(value)
      },
814833f5   wuxw   优化费用缴费代码
146
  
24d3590f   wuxw   房屋收费页面开发完成
147
148
149
150
151
152
153
154
155
      loadFeeConfigs(feeTypeCd) {
        listFeeConfigs({
          page: 1,
          row: 500,
          communityId: getCommunityId(),
          feeTypeCd,
          isDefault: 'F',
          state: 'Y'
        }).then(response => {
814833f5   wuxw   优化费用缴费代码
156
          this.feeConfigOptions = response.feeConfigs
24d3590f   wuxw   房屋收费页面开发完成
157
158
        })
      },
814833f5   wuxw   优化费用缴费代码
159
  
24d3590f   wuxw   房屋收费页面开发完成
160
      handleConfigChange(configId) {
814833f5   wuxw   优化费用缴费代码
161
162
163
        if (this.formData.feeTypeCd !== '888800010006' &&
          this.formData.feeTypeCd !== '888800010014' &&
          this.formData.feeFlag === '1003006') {
24d3590f   wuxw   房屋收费页面开发完成
164
165
          this.formData.endTime = ''
        }
814833f5   wuxw   优化费用缴费代码
166
  
24d3590f   wuxw   房屋收费页面开发完成
167
168
169
170
171
172
        const config = this.feeConfigOptions.find(item => item.configId === configId)
        if (config) {
          this.formData.feeFlag = config.feeFlag
          this.formData.computingFormula = config.computingFormula
        }
      },
814833f5   wuxw   优化费用缴费代码
173
  
24d3590f   wuxw   房屋收费页面开发完成
174
175
176
177
178
179
180
181
182
183
      validateStartTime(value) {
        if (!this.formData.feeFlag && !this.formData.feeTypeCd) {
          const start = new Date(value)
          const end = new Date(this.formData.endTime)
          if (start >= end) {
            this.$message.error(this.$t('roomCreateFeeAdd.validate.startBeforeEnd'))
            this.formData.startTime = ''
          }
        }
      },
814833f5   wuxw   优化费用缴费代码
184
  
24d3590f   wuxw   房屋收费页面开发完成
185
186
187
188
189
190
191
192
      validateEndTime(value) {
        const start = new Date(this.formData.startTime)
        const end = new Date(value)
        if (start >= end) {
          this.$message.error(this.$t('roomCreateFeeAdd.validate.endAfterStart'))
          this.formData.endTime = ''
        }
      },
814833f5   wuxw   优化费用缴费代码
193
  
24d3590f   wuxw   房屋收费页面开发完成
194
195
196
      handleSubmit() {
        this.$refs.form.validate(valid => {
          if (!valid) return
814833f5   wuxw   优化费用缴费代码
197
  
24d3590f   wuxw   房屋收费页面开发完成
198
199
200
201
202
203
          if (this.formData.feeTypeCd !== '888800010006' && this.formData.feeFlag !== '1003006') {
            if (!this.formData.endTime) {
              this.$message.error(this.$t('roomCreateFeeAdd.validate.endTimeRequired'))
              return
            }
          }
814833f5   wuxw   优化费用缴费代码
204
  
24d3590f   wuxw   房屋收费页面开发完成
205
206
207
208
          const params = {
            ...this.formData,
            communityId: getCommunityId()
          }
814833f5   wuxw   优化费用缴费代码
209
  
24d3590f   wuxw   房屋收费页面开发完成
210
          saveRoomCreateFee(params).then(() => {
6ec243d6   wuxw   v1.9 点击提交后,成功提示没有...
211
            this.$message.success(this.$t('common.operationSuccess'))
24d3590f   wuxw   房屋收费页面开发完成
212
213
214
215
216
217
218
            this.$emit('success')
            this.handleClose()
          }).catch(error => {
            this.$message.error(error.message)
          })
        })
      },
814833f5   wuxw   优化费用缴费代码
219
  
24d3590f   wuxw   房屋收费页面开发完成
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
      resetForm() {
        if (this.$refs.form) {
          this.$refs.form.resetFields()
        }
        this.formData = {
          feeTypeCds: [],
          feeConfigs: [],
          locationTypeCd: '',
          locationObjId: '',
          feeTypeCd: '',
          configId: '',
          locationTypeCdName: '',
          startTime: '',
          endTime: '2050-01-01',
          computingFormula: '',
          amount: '',
          rateCycle: '',
          rate: '',
          rateStartTime: '',
          feeFlag: ''
        }
      },
814833f5   wuxw   优化费用缴费代码
242
  
24d3590f   wuxw   房屋收费页面开发完成
243
244
245
246
247
248
      handleClose() {
        this.visible = false
        this.resetForm()
      }
    }
  }
814833f5   wuxw   优化费用缴费代码
249
250
251
252
253
254
255
256
257
258
259
260
261
  </script>
  <style scoped>
  .el-form-item{
    width: 90%;
    text-align: left;
  }
  .el-select{
    width: 100%;
  }
  .el-date-editor{  
    width: 100%;
  }
  </style>