Commit 94d16c26431dc80644a80880d815d02f1c64b45e

Authored by wuxw
1 parent f2cd6b17

优化批量创建费用

src/api/fee/roomCreatePayFeeApi.js 0 → 100644
  1 +import request from '@/utils/request'
  2 +
  3 +// 获取费用配置列表
  4 +export function listFeeConfigs(params) {
  5 + return new Promise((resolve, reject) => {
  6 + request({
  7 + url: '/feeConfig.listFeeConfigs',
  8 + method: 'get',
  9 + params
  10 + }).then(response => {
  11 + const res = response.data
  12 + resolve(res)
  13 + }).catch(error => {
  14 + reject(error)
  15 + })
  16 + })
  17 +}
  18 +
  19 +// 查询楼栋列表
  20 +export function queryFloors(params) {
  21 + return new Promise((resolve, reject) => {
  22 + request({
  23 + url: '/floor.queryFloors',
  24 + method: 'get',
  25 + params
  26 + }).then(response => {
  27 + const res = response.data
  28 + resolve(res)
  29 + }).catch(error => {
  30 + reject(error)
  31 + })
  32 + })
  33 +}
  34 +
  35 +// 查询房屋列表
  36 +export function queryRooms(params) {
  37 + return new Promise((resolve, reject) => {
  38 + request({
  39 + url: '/room.queryRooms',
  40 + method: 'get',
  41 + params
  42 + }).then(response => {
  43 + const res = response.data
  44 + resolve(res)
  45 + }).catch(error => {
  46 + reject(error)
  47 + })
  48 + })
  49 +}
  50 +
  51 +// 保存房屋创建费用
  52 +export function saveRoomCreatePayFee(data) {
  53 + return new Promise((resolve, reject) => {
  54 + request({
  55 + url: '/fee.roomCreatePayFee',
  56 + method: 'post',
  57 + data
  58 + }).then(response => {
  59 + const res = response.data
  60 + resolve(res)
  61 + }).catch(error => {
  62 + reject(error)
  63 + })
  64 + })
  65 +}
0 \ No newline at end of file 66 \ No newline at end of file
src/i18n/feeI18n.js
@@ -33,6 +33,7 @@ import { messages as createFeeByComboMessages } from '../views/fee/createFeeByCo @@ -33,6 +33,7 @@ import { messages as createFeeByComboMessages } from '../views/fee/createFeeByCo
33 import { messages as owePayFeeOrderMessages } from '../views/fee/owePayFeeOrderLang' 33 import { messages as owePayFeeOrderMessages } from '../views/fee/owePayFeeOrderLang'
34 import { messages as printOweFeeMessages } from '../views/fee/printOweFeeLang' 34 import { messages as printOweFeeMessages } from '../views/fee/printOweFeeLang'
35 import { messages as feeDetailMessages } from '../views/fee/feeDetailLang' 35 import { messages as feeDetailMessages } from '../views/fee/feeDetailLang'
  36 +import { messages as roomCreatePayFeeMessages } from '../views/fee/roomCreatePayFeeLang'
36 37
37 export const messages = { 38 export const messages = {
38 en: { 39 en: {
@@ -71,6 +72,7 @@ export const messages = { @@ -71,6 +72,7 @@ export const messages = {
71 ...owePayFeeOrderMessages.en, 72 ...owePayFeeOrderMessages.en,
72 ...printOweFeeMessages.en, 73 ...printOweFeeMessages.en,
73 ...feeDetailMessages.en, 74 ...feeDetailMessages.en,
  75 + ...roomCreatePayFeeMessages.en,
74 }, 76 },
75 zh: { 77 zh: {
76 ...contractCreateFeeMessages.zh, 78 ...contractCreateFeeMessages.zh,
@@ -108,5 +110,6 @@ export const messages = { @@ -108,5 +110,6 @@ export const messages = {
108 ...owePayFeeOrderMessages.zh, 110 ...owePayFeeOrderMessages.zh,
109 ...printOweFeeMessages.zh, 111 ...printOweFeeMessages.zh,
110 ...feeDetailMessages.zh, 112 ...feeDetailMessages.zh,
  113 + ...roomCreatePayFeeMessages.zh,
111 } 114 }
112 } 115 }
113 \ No newline at end of file 116 \ No newline at end of file
src/router/feeRouter.js
@@ -159,5 +159,10 @@ export default [ @@ -159,5 +159,10 @@ export default [
159 name: '/views/fee/feeDetail', 159 name: '/views/fee/feeDetail',
160 component: () => import('@/views/fee/feeDetail.vue') 160 component: () => import('@/views/fee/feeDetail.vue')
161 }, 161 },
  162 + {
  163 + path: '/pages/fee/roomCreatePayFee',
  164 + name: '/pages/fee/roomCreatePayFee',
  165 + component: () => import('@/views/fee/roomCreatePayFeeList.vue')
  166 + }
162 167
163 ] 168 ]
164 \ No newline at end of file 169 \ No newline at end of file
src/views/fee/roomCreatePayFeeLang.js 0 → 100644
  1 +export const messages = {
  2 + en: {
  3 + roomCreatePayFee: {
  4 + title: 'Room Create Fee',
  5 + feeType: 'Fee Type',
  6 + feeItem: 'Fee Item',
  7 + startTime: 'Start Time',
  8 + endTime: 'End Time',
  9 + amount: 'Amount',
  10 + rateCycle: 'Rate Cycle',
  11 + rate: 'Rate',
  12 + rateStartTime: 'Rate Start Time',
  13 + building: 'Building',
  14 + roomState: 'Room State',
  15 + room: 'Room',
  16 + selectFeeType: 'Please select fee type',
  17 + selectFeeItem: 'Please select fee item',
  18 + selectStartTime: 'Please select start time',
  19 + selectEndTime: 'Please select end time',
  20 + inputAmount: 'Please input amount',
  21 + inputRateCycle: 'Please input rate cycle (month)',
  22 + inputRate: 'Please input rate',
  23 + selectRateStartTime: 'Please select rate start time',
  24 + selectBuilding: 'Please select building',
  25 + selectAll: 'Select All',
  26 + noRoom: 'No Room',
  27 + validateError: 'Validation failed',
  28 + noRoomSelected: 'No room selected',
  29 + occupied: 'Occupied',
  30 + delivered: 'Delivered',
  31 + decorated: 'Decorated',
  32 + vacant: 'Vacant',
  33 + rented: 'Rented',
  34 + sold: 'Sold'
  35 + }
  36 + },
  37 + zh: {
  38 + roomCreatePayFee: {
  39 + title: '房屋创建费用',
  40 + feeType: '费用类型',
  41 + feeItem: '收费项目',
  42 + startTime: '计费起始时间',
  43 + endTime: '计费结束时间',
  44 + amount: '收费金额',
  45 + rateCycle: '递增周期',
  46 + rate: '计费递增率',
  47 + rateStartTime: '递增开始时间',
  48 + building: '楼栋',
  49 + roomState: '房屋状态',
  50 + room: '房屋',
  51 + selectFeeType: '请选择费用类型',
  52 + selectFeeItem: '请选择收费项目',
  53 + selectStartTime: '请选择计费起始时间',
  54 + selectEndTime: '请选择计费结束时间',
  55 + inputAmount: '请输入收费金额',
  56 + inputRateCycle: '请输入递增周期(月份)',
  57 + inputRate: '请输入递增率',
  58 + selectRateStartTime: '请选择递增开始时间',
  59 + selectBuilding: '请选择楼栋',
  60 + selectAll: '全选',
  61 + noRoom: '没有房屋',
  62 + validateError: '验证失败',
  63 + noRoomSelected: '未包含房屋',
  64 + occupied: '已入住',
  65 + delivered: '已交房',
  66 + decorated: '已装修',
  67 + vacant: '未入住',
  68 + rented: '已出租',
  69 + sold: '已出售'
  70 + }
  71 + }
  72 +}
0 \ No newline at end of file 73 \ No newline at end of file
src/views/fee/roomCreatePayFeeList.vue 0 → 100644
  1 +<template>
  2 + <div class="room-create-pay-fee-container">
  3 + <el-card class="box-card">
  4 + <div slot="header" class="flex justify-between">
  5 + <span>{{ $t('roomCreatePayFee.title') }}</span>
  6 + </div>
  7 +
  8 + <el-row :gutter="20">
  9 + <el-col :span="24">
  10 + <el-form ref="form" :model="roomCreatePayFeeInfo" label-width="120px">
  11 + <el-row :gutter="20">
  12 + <el-col :span="12">
  13 + <el-form-item :label="$t('roomCreatePayFee.feeType')">
  14 + <el-select v-model="roomCreatePayFeeInfo.feeTypeCd" @change="changeFeeTypeCd" style="width:100%"
  15 + :placeholder="$t('roomCreatePayFee.selectFeeType')">
  16 + <template v-for="(item, index) in roomCreatePayFeeInfo.feeTypeCds">
  17 + <el-option :key="index" :label="item.name" :value="item.statusCd"
  18 + v-if="item.statusCd != '888800010017'">
  19 + </el-option>
  20 + </template>
  21 + </el-select>
  22 + </el-form-item>
  23 + </el-col>
  24 + <el-col :span="12">
  25 + <el-form-item :label="$t('roomCreatePayFee.feeItem')">
  26 + <el-select v-model="roomCreatePayFeeInfo.configId" @change="roomCreatePayFeeIfOnceFee"
  27 + style="width:100%" :placeholder="$t('roomCreatePayFee.selectFeeItem')">
  28 + <template v-for="(item, index) in roomCreatePayFeeInfo.feeConfigs">
  29 + <el-option :key="index" :label="item.feeName" :value="item.configId">
  30 + </el-option>
  31 + </template>
  32 + </el-select>
  33 + </el-form-item>
  34 + </el-col>
  35 + </el-row>
  36 +
  37 + <el-row :gutter="20">
  38 + <el-col :span="12">
  39 + <el-form-item :label="$t('roomCreatePayFee.startTime')">
  40 + <el-date-picker v-model="roomCreatePayFeeInfo.startTime" type="date" style="width:100%"
  41 + :placeholder="$t('roomCreatePayFee.selectStartTime')">
  42 + </el-date-picker>
  43 + </el-form-item>
  44 + </el-col>
  45 + <el-col :span="12">
  46 + <el-form-item :label="$t('roomCreatePayFee.endTime')">
  47 + <el-date-picker v-model="roomCreatePayFeeInfo.endTime" type="date" style="width:100%"
  48 + :placeholder="$t('roomCreatePayFee.selectEndTime')">
  49 + </el-date-picker>
  50 + </el-form-item>
  51 + </el-col>
  52 + </el-row>
  53 +
  54 + <el-row :gutter="20" v-if="roomCreatePayFeeInfo.computingFormula == '4004'">
  55 + <el-col :span="12">
  56 + <el-form-item :label="$t('roomCreatePayFee.amount')">
  57 + <el-input v-model="roomCreatePayFeeInfo.amount" :placeholder="$t('roomCreatePayFee.inputAmount')">
  58 + </el-input>
  59 + </el-form-item>
  60 + </el-col>
  61 + </el-row>
  62 +
  63 + <el-row :gutter="20" v-if="roomCreatePayFeeInfo.computingFormula == '1102'">
  64 + <el-col :span="12">
  65 + <el-form-item :label="$t('roomCreatePayFee.rateCycle')">
  66 + <el-input v-model="roomCreatePayFeeInfo.rateCycle"
  67 + :placeholder="$t('roomCreatePayFee.inputRateCycle')">
  68 + </el-input>
  69 + </el-form-item>
  70 + </el-col>
  71 + <el-col :span="12">
  72 + <el-form-item :label="$t('roomCreatePayFee.rate')">
  73 + <el-input v-model="roomCreatePayFeeInfo.rate" :placeholder="$t('roomCreatePayFee.inputRate')">
  74 + </el-input>
  75 + </el-form-item>
  76 + </el-col>
  77 + </el-row>
  78 +
  79 + <el-row :gutter="20" v-show="roomCreatePayFeeInfo.computingFormula == '1102'">
  80 + <el-col :span="12">
  81 + <el-form-item :label="$t('roomCreatePayFee.rateStartTime')">
  82 + <el-date-picker v-model="roomCreatePayFeeInfo.rateStartTime" type="date" style="width:100%"
  83 + :placeholder="$t('roomCreatePayFee.selectRateStartTime')">
  84 + </el-date-picker>
  85 + </el-form-item>
  86 + </el-col>
  87 + </el-row>
  88 +
  89 + <el-row :gutter="20">
  90 + <el-col :span="12">
  91 + <el-form-item :label="$t('roomCreatePayFee.building')">
  92 + <el-select v-model="roomCreatePayFeeInfo.floorId" @change="loadFloorRooms" style="width:100%"
  93 + :placeholder="$t('roomCreatePayFee.selectBuilding')">
  94 + <el-option v-for="(item, index) in roomCreatePayFeeInfo.floors" :key="index" :label="item.floorNum"
  95 + :value="item.floorId">
  96 + </el-option>
  97 + </el-select>
  98 + </el-form-item>
  99 + </el-col>
  100 + <el-col :span="12">
  101 + <el-form-item :label="$t('roomCreatePayFee.roomState')">
  102 + <el-checkbox-group v-model="roomCreatePayFeeInfo.roomState" @change="changeRoomState">
  103 + <el-checkbox label="2001">{{ $t('roomCreatePayFee.occupied') }}</el-checkbox>
  104 + <el-checkbox label="2003">{{ $t('roomCreatePayFee.delivered') }}</el-checkbox>
  105 + <el-checkbox label="2005">{{ $t('roomCreatePayFee.decorated') }}</el-checkbox>
  106 + <el-checkbox label="2004">{{ $t('roomCreatePayFee.vacant') }}</el-checkbox>
  107 + <el-checkbox label="2006">{{ $t('roomCreatePayFee.rented') }}</el-checkbox>
  108 + <el-checkbox label="2007">{{ $t('roomCreatePayFee.sold') }}</el-checkbox>
  109 + </el-checkbox-group>
  110 + </el-form-item>
  111 + </el-col>
  112 + </el-row>
  113 +
  114 + <el-row :gutter="20">
  115 + <el-col :span="24" class="text-left">
  116 + <el-form-item :label="$t('roomCreatePayFee.room')">
  117 + <div v-show="roomCreatePayFeeInfo.rooms && roomCreatePayFeeInfo.rooms.length > 0">
  118 + <el-checkbox v-model="checkAllRooms" @change="checkAll">{{ $t('roomCreatePayFee.selectAll')
  119 + }}</el-checkbox>
  120 + <br />
  121 + <el-checkbox-group v-model="roomCreatePayFeeInfo.roomIds">
  122 + <el-checkbox v-for="(item, index) in roomCreatePayFeeInfo.rooms" :key="index"
  123 + :label="item.roomId">
  124 + <span v-if="item.unitNum != '0'">{{ item.roomName }}</span>
  125 + <span v-else>{{ item.floorNum }}-{{ item.roomNum }}</span>
  126 + ({{ item.stateName }})
  127 + </el-checkbox>
  128 + </el-checkbox-group>
  129 + </div>
  130 + <div v-show="!roomCreatePayFeeInfo.rooms || roomCreatePayFeeInfo.rooms.length < 1">
  131 + <span>{{ $t('roomCreatePayFee.noRoom') }}</span>
  132 + </div>
  133 + </el-form-item>
  134 + </el-col>
  135 + </el-row>
  136 +
  137 + <el-row :gutter="20">
  138 + <el-col :span="24" class="text-right">
  139 + <el-button type="warning" @click="goBack">{{ $t('common.back') }}</el-button>
  140 + <el-button type="primary" @click="saveRoomCreatePayFee">{{ $t('common.submit') }}</el-button>
  141 + </el-col>
  142 + </el-row>
  143 + </el-form>
  144 + </el-col>
  145 + </el-row>
  146 + </el-card>
  147 + </div>
  148 +</template>
  149 +
  150 +<script>
  151 +import { getCommunityId, getDict } from '@/api/community/communityApi'
  152 +import {
  153 + listFeeConfigs,
  154 + queryFloors,
  155 + queryRooms,
  156 + saveRoomCreatePayFee
  157 +} from '@/api/fee/roomCreatePayFeeApi'
  158 +
  159 +export default {
  160 + name: 'RoomCreatePayFeeList',
  161 + data() {
  162 + return {
  163 + roomCreatePayFeeInfo: {
  164 + feeTypeCds: [],
  165 + feeConfigs: [],
  166 + remark: '',
  167 + floorId: '',
  168 + communityId: '',
  169 + feeTypeCd: '',
  170 + configId: '',
  171 + roomIds: [],
  172 + rooms: [],
  173 + hasTime: 'OFF',
  174 + startTime: '',
  175 + endTime: '2050-01-01',
  176 + feeFlag: '',
  177 + computingFormula: '',
  178 + amount: '',
  179 + rateCycle: '',
  180 + rate: '',
  181 + rateStartTime: '',
  182 + roomState: ['2001', '2003', '2005', '2004', '2006', '2007'],
  183 + floors: []
  184 + },
  185 + checkAllRooms: false
  186 + }
  187 + },
  188 + created() {
  189 + this.initData()
  190 + },
  191 + methods: {
  192 + async initData() {
  193 + this.roomCreatePayFeeInfo.communityId = getCommunityId()
  194 + await this.loadFeeTypeCds()
  195 + await this.loadFloors()
  196 + },
  197 + async loadFeeTypeCds() {
  198 + try {
  199 + const data = await getDict('pay_fee_config', 'fee_type_cd')
  200 + this.roomCreatePayFeeInfo.feeTypeCds = data.filter(item =>
  201 + item.statusCd !== "888800010015" && item.statusCd !== "888800010016"
  202 + )
  203 + } catch (error) {
  204 + console.error('Failed to load fee types:', error)
  205 + }
  206 + },
  207 + async loadFloors() {
  208 + try {
  209 + const params = {
  210 + page: 1,
  211 + row: 100,
  212 + communityId: this.roomCreatePayFeeInfo.communityId
  213 + }
  214 + const { apiFloorDataVoList } = await queryFloors(params)
  215 + this.roomCreatePayFeeInfo.floors = apiFloorDataVoList
  216 + } catch (error) {
  217 + console.error('Failed to load floors:', error)
  218 + }
  219 + },
  220 + async changeFeeTypeCd(feeTypeCd) {
  221 + if (feeTypeCd === '888800010006' || feeTypeCd === '888800010014') {
  222 + this.roomCreatePayFeeInfo.startTime = new Date()
  223 + this.roomCreatePayFeeInfo.endTime = this.addMonthDate(new Date(), 1)
  224 + }
  225 + this.roomCreatePayFeeInfo.configId = ''
  226 +
  227 + try {
  228 + const params = {
  229 + page: 1,
  230 + row: 500,
  231 + communityId: this.roomCreatePayFeeInfo.communityId,
  232 + feeTypeCd: feeTypeCd,
  233 + isDefault: 'F',
  234 + valid: '1'
  235 + }
  236 + const { feeConfigs } = await listFeeConfigs(params)
  237 + this.roomCreatePayFeeInfo.feeConfigs = feeConfigs
  238 + } catch (error) {
  239 + console.error('Failed to load fee configs:', error)
  240 + }
  241 + },
  242 + async loadFloorRooms() {
  243 + this.roomCreatePayFeeInfo.rooms = []
  244 + this.roomCreatePayFeeInfo.roomIds = []
  245 +
  246 + if (!this.roomCreatePayFeeInfo.floorId) return
  247 +
  248 + try {
  249 + const params = {
  250 + page: 1,
  251 + row: 500,
  252 + communityId: this.roomCreatePayFeeInfo.communityId,
  253 + floorId: this.roomCreatePayFeeInfo.floorId,
  254 + roomState: this.roomCreatePayFeeInfo.roomState.join(',')
  255 + }
  256 + const { rooms } = await queryRooms(params)
  257 + this.roomCreatePayFeeInfo.rooms = rooms
  258 + if (rooms && rooms.length > 0) {
  259 + this.roomCreatePayFeeInfo.roomIds = rooms.map(room => room.roomId)
  260 + }
  261 + } catch (error) {
  262 + console.error('Failed to load rooms:', error)
  263 + }
  264 + },
  265 + changeRoomState() {
  266 + setTimeout(() => {
  267 + this.loadFloorRooms()
  268 + }, 1000)
  269 + },
  270 + roomCreatePayFeeIfOnceFee(configId) {
  271 + if (this.roomCreatePayFeeInfo.feeTypeCd !== '888800010006' &&
  272 + this.roomCreatePayFeeInfo.feeTypeCd !== '888800010014' &&
  273 + this.roomCreatePayFeeInfo.feeFlag === '1003006') {
  274 + this.roomCreatePayFeeInfo.endTime = ''
  275 + }
  276 +
  277 + const config = this.roomCreatePayFeeInfo.feeConfigs.find(item => item.configId === configId)
  278 + if (config) {
  279 + this.roomCreatePayFeeInfo.feeFlag = config.feeFlag
  280 + this.roomCreatePayFeeInfo.computingFormula = config.computingFormula
  281 + }
  282 + },
  283 + checkAll(checked) {
  284 + if (checked) {
  285 + this.roomCreatePayFeeInfo.roomIds = this.roomCreatePayFeeInfo.rooms.map(room => room.roomId)
  286 + } else {
  287 + this.roomCreatePayFeeInfo.roomIds = []
  288 + }
  289 + },
  290 + async saveRoomCreatePayFee() {
  291 + if (!this.validate()) {
  292 + this.$message.error(this.$t('roomCreatePayFee.validateError'))
  293 + return
  294 + }
  295 +
  296 + if (!this.roomCreatePayFeeInfo.roomIds || this.roomCreatePayFeeInfo.roomIds.length < 1) {
  297 + this.$message.error(this.$t('roomCreatePayFee.noRoomSelected'))
  298 + return
  299 + }
  300 +
  301 + try {
  302 + await saveRoomCreatePayFee(this.roomCreatePayFeeInfo)
  303 + this.$message.success(this.$t('common.saveSuccess'))
  304 + this.goBack()
  305 + } catch (error) {
  306 + this.$message.error(error.message || this.$t('common.saveFailed'))
  307 + }
  308 + },
  309 + validate() {
  310 + if (!this.roomCreatePayFeeInfo.configId) {
  311 + return false
  312 + }
  313 + return true
  314 + },
  315 + goBack() {
  316 + this.$router.go(-1)
  317 + },
  318 + addMonthDate(date, months) {
  319 + const newDate = new Date(date)
  320 + newDate.setMonth(newDate.getMonth() + months)
  321 + return newDate
  322 + }
  323 + }
  324 +}
  325 +</script>
  326 +
  327 +<style lang="scss" scoped>
  328 +.room-create-pay-fee-container {
  329 + padding: 20px;
  330 +
  331 + .box-card {
  332 + margin-bottom: 20px;
  333 + }
  334 +
  335 + .text-right {
  336 + text-align: right;
  337 + }
  338 +
  339 + .el-checkbox-group {
  340 + margin-top: 10px;
  341 +
  342 + .el-checkbox {
  343 + margin-right: 15px;
  344 + margin-bottom: 10px;
  345 + }
  346 + }
  347 +}
  348 +</style>
0 \ No newline at end of file 349 \ No newline at end of file