living-detail.vue 11.3 KB
Newer Older
宋雄's avatar
宋雄 committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
<template>
  <div class="page-content">
    <a-spin :spinning="confirmLoading">
      <h4 style="padding:20px 0 0 30px;line-height:30px;font-weight:600;">缴费详情</h4>
      <j-form-container :disabled="true">
        <a-form-model ref="form" :model="model" slot="detail">
          <a-row>
            <a-col :span="12">
              <a-form-model-item label="收费类型" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="chargeTypeName">
                <a-input v-model="model.chargeTypeName" placeholder="请输入"></a-input>
              </a-form-model-item>
            </a-col>
            <a-col :span="12">
              <a-form-model-item label="收费项目" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="chargeItem">
                <a-input v-model="model.chargeItem" placeholder="请输入"></a-input>
              </a-form-model-item>
            </a-col>
            <a-col :span="12">
              <a-form-model-item label="房屋" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="roomAllName">
                <a-input v-model="model.roomAllName" placeholder="请输入"></a-input>
              </a-form-model-item>
            </a-col>
            <a-col :span="12">
              <a-form-model-item label="业主" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="ownerName">
                <a-input v-model="model.ownerName" placeholder="请输入"></a-input>
              </a-form-model-item>
            </a-col>
            <a-col :span="12">
              <a-form-model-item label="与业主关系" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="relationShip">
                <!-- <a-input v-model="model.relationShip" placeholder="请输入"></a-input> -->
                <a-select v-model="model.relationShip" placeholder="请选择与业主关系">
何忠建's avatar
何忠建 committed
32 33
                  <a-select-option v-for="item in relationShipList" :key="item.value"
                    :value="item.value">{{item.label}}</a-select-option>
宋雄's avatar
宋雄 committed
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50
                </a-select>
              </a-form-model-item>
            </a-col>
            <a-col :span="12">
              <a-form-model-item label="住户" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="residentName">
                <a-input v-model="model.residentName" placeholder="请输入"></a-input>
              </a-form-model-item>
            </a-col>

            <a-col :span="12">
              <a-form-model-item label="收费标准" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="chargeTypeCodeName">
                <a-input v-model="model.chargeTypeCodeName" placeholder="请输入"></a-input>
              </a-form-model-item>
            </a-col>
            <a-col :span="12">
              <a-form-model-item label="收费周期" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="chargeCycle">
                <a-select style="width: 100%" v-model="model.chargeCycle" placeholder="请选择付费周期">
何忠建's avatar
何忠建 committed
51 52
                  <a-select-option v-for="item in dictOptions" :key="item.value"
                    :value="item.value">{{item.label}}</a-select-option>
宋雄's avatar
宋雄 committed
53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75
                </a-select>
              </a-form-model-item>
            </a-col>
            <template v-if="model.designFormulas === 2">
              <a-col :span="12">
                <a-form-model-item label="房屋面积" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="floorSpace">
                  <a-input v-model="model.floorSpace" placeholder="请输入房屋面积" style="width:100%"></a-input>
                </a-form-model-item>
              </a-col>
              <a-col :span="12">
                <a-form-model-item label="单价" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="unitPrice">
                  <a-input v-model="model.unitPrice" placeholder="请输入单价" style="width:100%"></a-input>
                </a-form-model-item>
              </a-col>
            </template>
            <template v-if="model.designFormulas === 3">
              <a-col :span="12">
                <a-form-model-item label="上期度数" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="lastDegrees">
                  <a-input v-model="model.lastDegrees" placeholder="请输入上期度数" style="width:100%"></a-input>
                </a-form-model-item>
              </a-col>
              <a-col :span="12">
                <a-form-model-item label="本期度数" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="currentDegrees">
何忠建's avatar
何忠建 committed
76 77
                  <a-input-number v-model="model.currentDegrees" placeholder="请输入本期度数"
                    style="width:100%"></a-input-number>
宋雄's avatar
宋雄 committed
78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96
                </a-form-model-item>
              </a-col>
              <a-col :span="12">
                <a-form-model-item label="用量" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="useAmount">
                  <a-input v-model="model.useAmount" placeholder="请输入用量" style="width:100%"></a-input>
                </a-form-model-item>
              </a-col>
              <a-col :span="12">
                <a-form-model-item label="单价" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="unitPrice">
                  <a-input v-model="model.unitPrice" placeholder="请输入单价" style="width:100%"></a-input>
                </a-form-model-item>
              </a-col>
            </template>
            <a-col :span="12">
              <a-form-model-item label="金额" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="totalAmount">
                <a-input v-model="model.totalAmount" placeholder="请输入金额" style="width:100%"></a-input>
              </a-form-model-item>
            </a-col>
            <a-col :span="24">
何忠建's avatar
何忠建 committed
97 98 99 100
              <a-form-model-item label="抄表时间" :labelCol="{ xs: { span: 24 }, sm: { span: 2 } }" :wrapperCol="wrapperCol"
                prop="meterReadingTime">
                <j-date placeholder="请选择抄表时间" v-model="model.meterReadingTime" :showTime="true"
                  dateFormat="YYYY-MM-DD HH:mm:ss" style="width: 50%;" />
宋雄's avatar
宋雄 committed
101 102 103 104 105 106 107 108 109 110 111 112
              </a-form-model-item>
            </a-col>
          </a-row>
        </a-form-model>
      </j-form-container>

      <a-divider />
      <div style="display:flex;justify-content: space-between;align-items: center;">
        <h4 style="padding:0 0 0 30px;line-height:30px;font-weight:600;">历史记录</h4>
        <p style="padding-right:50px;color:#EC808D">总缴费金额: {{totalAmount}}</p>
      </div>
      <div>
何忠建's avatar
何忠建 committed
113 114
        <a-table ref="table" size="middle" :scroll="{ x: 1500, y: 300 }" bordered rowKey="id" :columns="columns"
          :dataSource="dataSource" :pagination="pagination" :loading="loading" class="j-table-force-nowrap">
宋雄's avatar
宋雄 committed
115 116 117 118 119 120 121 122 123 124 125 126 127 128
          <span slot="roomId" slot-scope="text, record">
            <span>{{record.buildingName}}{{record.unitName}}{{record.roomName}}</span>
          </span>
        </a-table>
      </div>
    </a-spin>

    <div style="text-align:center">
      <a-button @click="onReturn">返回</a-button>
    </div>
  </div>
</template>

<script>
何忠建's avatar
何忠建 committed
129 130
import { queryDetailByIdApi, ajaxGetDictItems, getDictItemsFromCache, getHistoryListdApi } from '@/api/api'
import { RELATION_SHIP } from '@/assets/static.js'
宋雄's avatar
宋雄 committed
131

何忠建's avatar
何忠建 committed
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 190 191 192 193 194 195 196 197 198 199
const columns = [
  {
    title: '收费类型',
    dataIndex: 'chargeTypeName',
    key: 'chargeTypeName',
    width: 120,
    align: 'center',
  },
  {
    title: '收费项目',
    dataIndex: 'chargeItem',
    key: 'chargeItem',
    width: 120,
    align: 'center',
  },
  {
    title: '房屋编号',
    dataIndex: 'roomId',
    scopedSlots: { customRender: 'roomId' },
    key: 'roomId',
    width: 140,
    align: 'center',
  },
  {
    title: '用量',
    dataIndex: 'useAmount',
    key: 'useAmount',
    width: 120,
    align: 'center',
  },
  {
    title: '金额(元)',
    dataIndex: 'totalAmount',
    key: 'totalAmount',
    width: 120,
    align: 'center',
  },
  {
    title: '缴费单号',
    dataIndex: 'paymentNum',
    key: 'paymentNum',
    width: 120,
    align: 'center',
  },
  {
    title: '缴费日期',
    dataIndex: 'paymentTime',
    key: 'paymentTime',
    width: 120,
    align: 'center',
  },
  {
    title: '创建日期',
    dataIndex: 'createTime',
    key: 'createTime',
    width: 120,
    align: 'center',
  },
]
export default {
  name: 'PropertyChargruleForm',
  inject: ['closeCurrent'],
  props: {
    //表单禁用
    disabled: {
      type: Boolean,
      default: false,
      required: false,
宋雄's avatar
宋雄 committed
200
    },
何忠建's avatar
何忠建 committed
201 202 203 204 205 206 207 208 209 210 211 212 213
  },
  data() {
    return {
      relationShipList: RELATION_SHIP,
      dictOptions: [],
      model: {
        chargeCycle: '',
        chargeItem: '',
        chargingStandardId: '',
        chargeTypeCode: '',
        chargeTypeId: '',
        chargeTypeName: '',
        unitPrice: '',
宋雄's avatar
宋雄 committed
214

何忠建's avatar
何忠建 committed
215 216 217 218 219 220 221 222 223 224 225 226 227
        ownerId: '',
        buildingId: '',
        buildingName: '',
        unitId: '',
        unitName: '',
        roomId: '',
        roomName: '',
        floorSpace: '',
        ownerName: '',
        ownerPhone: '',
        residentName: '',
        residentPhone: '',
        relationShip: '',
宋雄's avatar
宋雄 committed
228

何忠建's avatar
何忠建 committed
229 230 231
        lastDegrees: '',
        currentDegrees: '',
        useAmount: '',
宋雄's avatar
宋雄 committed
232
        totalAmount: '',
何忠建's avatar
何忠建 committed
233
        meterReadingTime: '',
宋雄's avatar
宋雄 committed
234
      },
何忠建's avatar
何忠建 committed
235 236 237
      labelCol: {
        xs: { span: 24 },
        sm: { span: 4 },
宋雄's avatar
宋雄 committed
238
      },
何忠建's avatar
何忠建 committed
239 240 241
      wrapperCol: {
        xs: { span: 24 },
        sm: { span: 20 },
宋雄's avatar
宋雄 committed
242
      },
何忠建's avatar
何忠建 committed
243 244 245 246 247 248 249 250 251
      totalAmount: '',
      confirmLoading: false,
      columns: columns,
      dataSource: [],
      pagination: {
        total: 0,
        current: 1,
        pageSize: 10,
        showSizeChanger: true,
宋雄's avatar
宋雄 committed
252
      },
何忠建's avatar
何忠建 committed
253
      loading: false,
宋雄's avatar
宋雄 committed
254
    }
何忠建's avatar
何忠建 committed
255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304
  },
  computed: {
    formDisabled() {
      return this.disabled
    },
  },
  created() {
    //备份model原始值
    this.getDetail()
    this.initDictData()
  },
  methods: {
    async getDetail() {
      this.confirmLoading = true
      let { result } = await queryDetailByIdApi({ id: this.$route.query.id })
      result['chargeTypeCodeName'] = `${result.chargeTypeCode}-${result.chargeTypeName}`
      result['roomAllName'] = `${result.buildingName}${result.unitName}${result.roomName}`
      this.model = { ...result }
      this.confirmLoading = false
      this.getHistoryList(this.model.ownerId)
    },
    initDictData() {
      //优先从缓存中读取字典配置
      if (getDictItemsFromCache('chargingCycle')) {
        this.dictOptions = getDictItemsFromCache('chargingCycle')
        return
      }
      // //根据字典Code, 初始化字典数组
      ajaxGetDictItems('chargingCycle', null).then((res) => {
        if (res.success) {
          this.dictOptions = res.result
        }
      })
    },
    async getHistoryList(ownerId) {
      this.loading = true
      let { result } = await getHistoryListdApi({ ownerId })
      this.totalAmount = result.totalAmount
      let data = result.pageList
      this.pagination.total = data.total
      this.pagination.current = data.current
      this.pagination.pageSize = data.size
      this.dataSource = data.records
      this.loading = false
    },
    onReturn() {
      // if(this.model.lastDegrees || this.model.lastDegrees == 0) {
      //   this.model.useAmount = (value - Number(this.model.lastDegrees)).toFixed(2)
      //   this.model.totalAmount = (Number(this.model.useAmount) * this.amount).toFixed(2)
      // }
宋雄's avatar
宋雄 committed
305 306 307
      this.closeCurrent()
      // this.$store.dispatch('tags/delView', this.$route.path)
      // this.$router.go(-1)
何忠建's avatar
何忠建 committed
308 309 310
    },
  },
}
宋雄's avatar
宋雄 committed
311 312 313 314 315 316 317 318 319
</script>

<style scoped lang="less">
.page-content {
  min-height: 430px;
  background-color: #fff;
  padding: 0 15px 50px 5px;
}
</style>