// 物业收费标准列表
<template>
  <div class="routerWapper">
    <div class="portalDetailTitle" v-if="$route.name=='feeStandard'">
			<span class="title">物业收费标准列表</span>
			<div class="detailOperations">
				<a-button @click="backPage"> 返回 </a-button>
			</div>
		</div>
    <div v-if="$route.name=='feeStandard'" class="layoutMargin layoutPadding">
        <!-- <p class="gayLine noline" ></p> -->
        <!-- table -->
        <div class="portalTableOperates">
          <a-table class="portalTable" size="small" :columns="columns" :data-source="tableData" bordered :pagination='false'>
            <span slot="changedCosts" slot-scope="text, record">
              {{changeMeaning('changedCosts', record.changedCosts)}}
            </span>

            <span slot="chargingModel" slot-scope="text, record">
              {{changeMeaning('chargingModel', record.chargingModel)}}
            </span>

            <span slot="buildingType" slot-scope="text, record">
              {{changeMeaning('buildingType', record.buildingType)}}
            </span>

            <span slot="haveElv" slot-scope="text, record">
              {{changeMeaning('haveElv', record.haveElv)}}
            </span>

            <span slot="houseUse" slot-scope="text, record">
              {{changeMeaning('houseUse', record.houseUse)}}
            </span>

            <span slot="area" slot-scope="text, record">
              {{!!text? text + `（㎡）` : '无数据'}}
            </span>

            <span slot="charges" slot-scope="text, record">
              {{!!text? text + `（元/月·㎡）` : '无数据'}}
            </span>
          </a-table>
        </div>
    </div>
    <RouterWapper v-else />
  </div>
</template>

<script>

export default {
  name: 'feeStandard',
  data() {
    return {
      columns: [ // 表格展示的列
        {
          title: '建筑类型',
          dataIndex: 'buildingType',
          key: 'buildingType',
          scopedSlots: {
            customRender: 'buildingType'
          }
        },
        {
          title: '收费模式',
          dataIndex: 'chargingModel',
          key: 'chargingModel',
          scopedSlots: {
            customRender: 'chargingModel'
          }
        },
        {
          title: '是否较前一份物业服务合同调整过物业服务费',
          dataIndex: 'changedCosts',
          key: 'changedCosts',
          scopedSlots: {
            customRender: 'changedCosts'
          }
        },
        {
          title: '有无电梯',
          dataIndex: 'haveElv',
          key: 'haveElv',
          scopedSlots: {
            customRender: 'haveElv'
          }
        },
        {
          title: '房屋用途',
          dataIndex: 'houseUse',
          key: 'houseUse',
          scopedSlots: {
            customRender: 'houseUse'
          }
        },
        {
          title: '可收费面积',
          dataIndex: 'area',
          key: 'area',
          scopedSlots: {
            customRender: 'area'
          }
        },
        {
          title: '物业费收费标准',
          dataIndex: 'charges',
          key: 'charges',
          scopedSlots: {
            customRender: 'charges'
          }
        },
        {
          title: '可收费户数/车位数（个）',
          dataIndex: 'number',
          key: 'number',
        },
      ],
      tableData: [],
    }
  },
  mounted() {
    this.getList()
  },
  methods: {
    getList() {
      this.$ajax.get({
        url: this.$api.GET_FEE_STANDARD_LIST + '?sectId=' + this.$route.query.id,
      }).then(res => {
        if (res.code == 200) {
          //先获取全部的自定义字段列表 
          this.tableData = this.$com.confirm(res, 'data.content', [])
          // console.log(this.extList)
        }
      })
    },
    backPage(){ // 返回按钮
      this.$router.back()
    },
    changeMeaning(type, num) {
      console.log(type, num)
      if(type == 'changedCosts') {
        switch (num) {
        case '1':
          return '是'
          break

        case '0':
          return '否'
          break
        
        default:
          break
        }
      } else if(type == 'chargingModel') {
        switch (num) {
        case '1':
          return '按户（车位）收费（元/月·户（车位））'
          break

        case '2':
          return '按面积收费（元/月·㎡）'
          break
        
        default:
          break
        }

      } else if(type == 'buildingType') {

        switch (num) {
        case '1':
          return '高层'
          break

        case '2':
          return '多层'
          break

        case '3':
          return '小高层'
          break

        case '4':
          return '联体别墅'
          break

        case '5':
          return '单体别墅'
          break
        
        default:
          break
        }
        
      } else if(type == 'haveElv') {
        switch (num) {
        case true:
          return '有'
          break

        case false:
          return '无'
          break
        
        default:
          break
        }

      } else if(type == 'houseUse') {
        switch (num) {
        case '1':
          return '一般住宅'
          break

        case '2':
          return '公建配套'
          break

        case '3':
          return '物业用房'
          break

        case '4':
          return '单体别墅'
          break

        case '5':
          return '商业用房'
          break

        case '6':
          return '车库'
          break

        case '7':
          return '其它'
          break

        case '8':
          return '机动车位'
          break
        
        default:
          break
        }
      }
    }
  },
}
</script>

<style scoped>

</style>

