Blame view

src/components/fee/tempImportRoomFee.vue 7.14 KB
6ec243d6   wuxw   v1.9 点击提交后,成功提示没有...
1
  <template>
814833f5   wuxw   优化费用缴费代码
2
3
4
    <el-dialog :title="$t('tempImportRoomFee.title')" :visible.sync="dialogVisible" width="40%"
      @close="clearTempImportRoomFeeInfo">
      <el-form :model="form" label-width="120px" class="text-left">
24d3590f   wuxw   房屋收费页面开发完成
5
        <el-form-item :label="$t('tempImportRoomFee.feeType')">
814833f5   wuxw   优化费用缴费代码
6
7
8
9
          <el-select v-model="form.feeTypeCd" @change="changeFeeTypeCd"
            :placeholder="$t('tempImportRoomFee.selectFeeType')">
            <el-option v-for="(item, index) in feeTypeCds" :key="index" :label="item.name"
              :value="item.statusCd"></el-option>
24d3590f   wuxw   房屋收费页面开发完成
10
11
          </el-select>
        </el-form-item>
814833f5   wuxw   优化费用缴费代码
12
  
24d3590f   wuxw   房屋收费页面开发完成
13
        <el-form-item :label="$t('tempImportRoomFee.feeObj')">
814833f5   wuxw   优化费用缴费代码
14
          <el-input v-model="form.objName" disabled :placeholder="$t('tempImportRoomFee.inputFeeObj')"></el-input>
24d3590f   wuxw   房屋收费页面开发完成
15
16
17
        </el-form-item>
  
        <el-form-item :label="$t('tempImportRoomFee.feeName')" v-if="form.feeNameFlag === 'S'">
814833f5   wuxw   优化费用缴费代码
18
19
20
          <el-select v-model="form.configId" :placeholder="$t('tempImportRoomFee.selectFeeItem')">
            <el-option v-for="(item, index) in feeConfigs" :key="index" :label="item.feeName"
              :value="item.configId"></el-option>
24d3590f   wuxw   房屋收费页面开发完成
21
          </el-select>
814833f5   wuxw   优化费用缴费代码
22
          <span>{{ $t('tempImportRoomFee.feeItemDesc') }}</span>
24d3590f   wuxw   房屋收费页面开发完成
23
24
25
26
        </el-form-item>
  
        <el-form-item :label="$t('tempImportRoomFee.feeName')" v-else>
          <el-col :span="18">
814833f5   wuxw   优化费用缴费代码
27
            <el-input v-model="form.feeName" :placeholder="$t('tempImportRoomFee.inputFeeName')"></el-input>
24d3590f   wuxw   房屋收费页面开发完成
28
29
          </el-col>
          <el-col :span="6">
814833f5   wuxw   优化费用缴费代码
30
            <el-button @click="toggleFeeNameFlag">{{ $t('tempImportRoomFee.select') }}</el-button>
24d3590f   wuxw   房屋收费页面开发完成
31
32
33
34
          </el-col>
        </el-form-item>
  
        <el-form-item :label="$t('tempImportRoomFee.amount')">
814833f5   wuxw   优化费用缴费代码
35
          <el-input v-model="form.amount" :placeholder="$t('tempImportRoomFee.inputAmount')"></el-input>
24d3590f   wuxw   房屋收费页面开发完成
36
37
38
        </el-form-item>
  
        <el-form-item :label="$t('tempImportRoomFee.startTime')">
b25b036d   wuxw   v1.9 优化日期
39
          <el-date-picker v-model="form.startTime" type="datetime" :placeholder="$t('tempImportRoomFee.selectStartTime')" value-format="yyyy-MM-dd HH:mm:ss"></el-date-picker>
24d3590f   wuxw   房屋收费页面开发完成
40
41
42
        </el-form-item>
  
        <el-form-item :label="$t('tempImportRoomFee.endTime')">
b25b036d   wuxw   v1.9 优化日期
43
          <el-date-picker v-model="form.endTime" type="datetime" :placeholder="$t('tempImportRoomFee.selectEndTime')" value-format="yyyy-MM-dd HH:mm:ss"></el-date-picker>
24d3590f   wuxw   房屋收费页面开发完成
44
45
46
47
        </el-form-item>
      </el-form>
  
      <div slot="footer" class="dialog-footer">
814833f5   wuxw   优化费用缴费代码
48
49
        <el-button @click="dialogVisible = false">{{ $t('tempImportRoomFee.cancel') }}</el-button>
        <el-button type="primary" @click="saveTempImportFeeInfo">{{ $t('tempImportRoomFee.submit') }}</el-button>
24d3590f   wuxw   房屋收费页面开发完成
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
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
      </div>
    </el-dialog>
  </template>
  
  <script>
  import { importTempData } from '@/api/fee/tempImportRoomFeeApi'
  import { getDict } from '@/api/community/communityApi'
  import { getCommunityId } from '@/api/community/communityApi'
  import { listFeeConfigs } from '@/api/fee/feeConfigManageApi'
  export default {
    name: 'TempImportRoomFee',
    data() {
      return {
        dialogVisible: false,
        form: {
          communityId: '',
          feeTypeCd: '',
          objType: '',
          feeTypeCds: [],
          configId: '',
          objName: '',
          objId: '',
          amount: '',
          startTime: this.formatDate(new Date()),
          endTime: this.addMonth(new Date(), 1),
          feeConfigs: [],
          feeNameFlag: 'S'
        },
        feeTypeCds: [],
        feeConfigs: [],
        communityId: ''
      }
    },
    created() {
      this.communityId = getCommunityId()
      this.loadDictData()
    },
    methods: {
      open(room) {
        this.clearTempImportRoomFeeInfo()
        this.form.objId = room.roomId
        this.form.objName = room.roomName
        this.form.objType = room.objType
        this.dialogVisible = true
      },
      async loadDictData() {
        try {
          const data = await getDict('pay_fee_config', 'fee_type_cd')
          this.feeTypeCds = data
          this.form.feeTypeCds = data
        } catch (error) {
          console.error('获取字典数据失败:', error)
        }
      },
      async changeFeeTypeCd(feeTypeCd) {
        try {
          const res = await listFeeConfigs({
            page: 1,
            row: 500,
            communityId: this.communityId,
            feeTypeCd: feeTypeCd,
            isDefault: 'F',
            computingFormula: '4004',
            valid: '1'
          })
          this.feeConfigs = res.feeConfigs
        } catch (error) {
          console.error('获取费用配置失败:', error)
        }
      },
      toggleFeeNameFlag() {
        this.form.feeNameFlag = this.form.feeNameFlag === 'S' ? 'I' : 'S'
      },
      validateForm() {
        if (!this.form.feeTypeCd) {
          this.$message.warning(this.$t('tempImportRoomFee.feeTypeRequired'))
          return false
        }
        if (!this.form.configId && this.form.feeNameFlag === 'S') {
          this.$message.warning(this.$t('tempImportRoomFee.feeNameRequired'))
          return false
        }
        if (!this.form.objId) {
          this.$message.warning(this.$t('tempImportRoomFee.feeObjRequired'))
          return false
        }
        if (!this.form.startTime) {
          this.$message.warning(this.$t('tempImportRoomFee.startTimeRequired'))
          return false
        }
        if (!this.form.endTime) {
          this.$message.warning(this.$t('tempImportRoomFee.endTimeRequired'))
          return false
        }
        if (new Date(this.form.startTime) >= new Date(this.form.endTime)) {
          this.$message.warning(this.$t('tempImportRoomFee.endTimeMustAfterStart'))
          return false
        }
        if (!this.form.amount) {
          this.$message.warning(this.$t('tempImportRoomFee.amountRequired'))
          return false
        }
        return true
      },
      async saveTempImportFeeInfo() {
        if (!this.validateForm()) return
814833f5   wuxw   优化费用缴费代码
156
  
24d3590f   wuxw   房屋收费页面开发完成
157
158
159
160
161
        try {
          const res = await importTempData({
            ...this.form,
            communityId: this.communityId
          })
b8952de5   wuxw   v1.9 业主重置密码不显示问题
162
          if (res.code == 0) {
24d3590f   wuxw   房屋收费页面开发完成
163
            this.dialogVisible = false
b8952de5   wuxw   v1.9 业主重置密码不显示问题
164
            this.$emit('success')
6ec243d6   wuxw   v1.9 点击提交后,成功提示没有...
165
            this.$message.success(this.$t('common.operationSuccess'))
24d3590f   wuxw   房屋收费页面开发完成
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
          } else {
            this.$message.error(res.msg)
          }
        } catch (error) {
          console.error('请求失败:', error)
          this.$message.error(this.$t('tempImportRoomFee.createFailed'))
        }
      },
      clearTempImportRoomFeeInfo() {
        this.form = {
          communityId: this.communityId,
          feeTypeCd: '',
          feeTypeCds: this.feeTypeCds,
          configId: '',
          objName: '',
          objId: '',
          amount: '',
          startTime: this.formatDate(new Date()),
          endTime: this.addMonth(new Date(), 1),
          feeNameFlag: 'S',
          feeConfigs: []
        }
      },
      formatDate(date) {
        const year = date.getFullYear()
        const month = String(date.getMonth() + 1).padStart(2, '0')
        const day = String(date.getDate()).padStart(2, '0')
        const hours = String(date.getHours()).padStart(2, '0')
        const minutes = String(date.getMinutes()).padStart(2, '0')
        const seconds = String(date.getSeconds()).padStart(2, '0')
        return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`
      },
      addMonth(date, months) {
        const newDate = new Date(date)
        newDate.setMonth(newDate.getMonth() + months)
        return this.formatDate(newDate)
      }
    }
  }
814833f5   wuxw   优化费用缴费代码
205
206
207
208
209
210
211
212
213
  </script>
  <style scoped>
  .el-form-item{
    width: 90%;
  }
  .el-date-editor{  
    width: 100%;
  }
  </style>