living-detail.vue 10.9 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
<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="relationShip">
                <!-- <a-input v-model="model.relationShip" placeholder="请输入"></a-input> -->
                <a-select v-model="model.relationShip" placeholder="请选择与业主关系">
何忠建's avatar
何忠建 committed
27 28
                  <a-select-option v-for="item in relationShipList" :key="item.value"
                    :value="item.value">{{item.label}}</a-select-option>
宋雄's avatar
宋雄 committed
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45
                </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
46 47
                  <a-select-option v-for="item in dictOptions" :key="item.value"
                    :value="item.value">{{item.label}}</a-select-option>
宋雄's avatar
宋雄 committed
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70
                </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
71 72
                  <a-input-number v-model="model.currentDegrees" placeholder="请输入本期度数"
                    style="width:100%"></a-input-number>
宋雄's avatar
宋雄 committed
73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91
                </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
92 93 94 95
              <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
96 97 98 99 100 101 102 103 104 105 106 107
              </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
108
        <a-table ref="table" size="middle" :scroll="{ x: true }" bordered rowKey="id" :columns="columns"
何忠建's avatar
何忠建 committed
109
          :dataSource="dataSource" :pagination="pagination" :loading="loading" class="j-table-force-nowrap">
宋雄's avatar
宋雄 committed
110 111 112 113 114 115 116 117 118 119 120 121 122 123
          <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
124 125
import { queryDetailByIdApi, ajaxGetDictItems, getDictItemsFromCache, getHistoryListdApi } from '@/api/api'
import { RELATION_SHIP } from '@/assets/static.js'
宋雄's avatar
宋雄 committed
126

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

何忠建's avatar
何忠建 committed
202 203 204 205 206 207 208 209 210 211 212 213
        ownerId: '',
        buildingId: '',
        buildingName: '',
        unitId: '',
        unitName: '',
        roomId: '',
        roomName: '',
        floorSpace: '',
        ownerPhone: '',
        residentName: '',
        residentPhone: '',
        relationShip: '',
宋雄's avatar
宋雄 committed
214

何忠建's avatar
何忠建 committed
215 216 217
        lastDegrees: '',
        currentDegrees: '',
        useAmount: '',
宋雄's avatar
宋雄 committed
218
        totalAmount: '',
何忠建's avatar
何忠建 committed
219
        meterReadingTime: '',
宋雄's avatar
宋雄 committed
220
      },
何忠建's avatar
何忠建 committed
221 222 223
      labelCol: {
        xs: { span: 24 },
        sm: { span: 4 },
宋雄's avatar
宋雄 committed
224
      },
何忠建's avatar
何忠建 committed
225 226 227
      wrapperCol: {
        xs: { span: 24 },
        sm: { span: 20 },
宋雄's avatar
宋雄 committed
228
      },
何忠建's avatar
何忠建 committed
229 230 231 232 233 234 235 236 237
      totalAmount: '',
      confirmLoading: false,
      columns: columns,
      dataSource: [],
      pagination: {
        total: 0,
        current: 1,
        pageSize: 10,
        showSizeChanger: true,
宋雄's avatar
宋雄 committed
238
      },
何忠建's avatar
何忠建 committed
239
      loading: false,
宋雄's avatar
宋雄 committed
240
    }
何忠建's avatar
何忠建 committed
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 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290
  },
  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
291 292 293
      this.closeCurrent()
      // this.$store.dispatch('tags/delView', this.$route.path)
      // this.$router.go(-1)
何忠建's avatar
何忠建 committed
294 295 296
    },
  },
}
宋雄's avatar
宋雄 committed
297 298 299 300 301 302 303 304 305
</script>

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