<template>
  <div class="app-container">
    <search-form
      :list-loading="listLoading"
      @change="searchHandle"
    />
    <table-list
      :list-loading="listLoading"
      :data="tableData2"
      :columns="listConfig"
      :current-page="currentPage"
      :page-size="pageSize"
      :total-records="totalRecords"
      @currentChange="pageHandle"
      @sizeChange="sizeChange"
    >
      <!-- :insertSlotArr="[4]" -->
      <!-- <div slot="OI5">
        <el-table-column
          width="70"
          label="查看房子图片"
          align="center"
        >
          <template slot-scope="scope">
          </template>
        </el-table-column>
      </div> -->
    </table-list>
  </div>
</template>
<script>
import { arrToObj } from '@/utils'
import SearchForm from './components/searchForm/Cust'
import baseTable from '_m/baseTable.js'
export default {
  name: 'index',
  components: {
    SearchForm,
  },
  provide() {
    return {
      parentData: this
    }
  },
  mixins: [baseTable],
  data() {
    return {
      apiStr: 'user.admuserhouselist',
      searchForm: null,
      isDtlShow: false,
      curObj: {}
    }
  },
  computed: {
    tableData2() {
      const arr = [...this.tableData]
      arr.map(item => {
        const curImg = (item.images || '').split(',')
        item.img1 = curImg[0] || ''
        item.img2 = curImg[1] || ''
        item.img3 = curImg[2] || ''
        item.img4 = curImg[3] || ''
        item.img5 = curImg[4] || ''
        item.img6 = curImg[5] || ''
        item.img7 = curImg[6] || ''
        item.img8 = curImg[7] || ''
        item.img9 = curImg[8] || ''
        if (item.verify_state === '1') item.deal1 = true
      })
      return arr
    }
  },
  created() {},
  mounted() {
    this.listConfig = {
      rows: [
        { label: '已审核', prop: 'verify_state', type: 'tag', tags: arrToObj(this.$dictData.sys_yesno) }, 
        { label: '房产证', prop: 'house_cert', type: 'img' },
        { label: '联系方式', prop: 'phone' },
        { label: '预期价格', prop: 'price' },
        { label: '房东备注', prop: 'remark', fullShow: true, minWidth: '200', align: 'left' },
        { label: '图1', prop: 'img1', type: 'img' },
        { label: '图2', prop: 'img2', type: 'img' },
        { label: '图3', prop: 'img3', type: 'img' },
        { label: '图4', prop: 'img4', type: 'img' },
        { label: '图5', prop: 'img5', type: 'img' },
        { label: '图6', prop: 'img6', type: 'img' },
        { label: '图7', prop: 'img7', type: 'img' },
        { label: '图8', prop: 'img8', type: 'img' },
        { label: '图9', prop: 'img9', type: 'img' },
        { label: '更新人', prop: 'update_by' },
        { label: '更新时间', prop: 'update_at' },
        { label: '创建时间', prop: 'create_at' },
        { label: '操作', width: 120, type: 'handle2', operations:
          [
            { label: '标记已审核', func: this.dealHandle, btnType: 'primary', hide: 'deal1' },
            // { label: '删除', func: this.delHandle, btnType: 'danger' },
          ]
        }
      ]
    }
  },
  methods: {
    dealHandle (row) {
      this.$msg(`您确定要标记成已审核吗`, 'confirm', () => {
        this.$api.user.admuserhouseverify({
          id: row.id,
          is_dispose: 1,
        }).then(data => {
          this.$msgs(`已处理！`)
          this.fetchData()
        })
      }, null, true)
    },
    delHandle(row) {
      this.$msg(`您确定要删除该文章吗？`, 'confirm', () => {
        this.$api.user.admfeedbackdel({
          id: row.id,
        }).then(data => {
          this.$msgs(`已删除！`)
          this.fetchData()
        })
      }, null, true)
    },
  }
}
</script>
<style lang="scss" scoped>
</style>

