<template>
  <view class="uni-app">
    <view class="status-bar" />
    <view class="main-container">
      <wk-nav-bar :title="title" />

      <view class="list-view">
        <wk-scroll-view
          :status="listStatus"
          class="list-scroll"
          @refresh="getList({}, true)"
          @loadmore="getList()">
          <customer-item
            v-for="(item, index) in listData"
            :key="index"
            :item-data="item" />
        </wk-scroll-view>
      </view>
    </view>
  </view>
</template>

<script>
  import {ForgetList, ForgetCustomerList} from 'API/crm/work'
  import CustomerItem from '../customer/components/customerItem.vue'
  import mainListMixins from '@/mixins/mainList.js'

  export default {
    name: 'ForgetCustomer',
    components: {
      CustomerItem
    },
    mixins: [mainListMixins],
    data() {
      return {
        title: '',
        day: null,
        queryData: {},

        dayMap: {
          7: '超过7天未联系的客户',
          15: '超过15天未联系的客户',
          30: '超过30天未联系的客户',
          90: '超过3个月未联系的客户',
          180: '超过6个月未联系的客户',
          0: '逾期未联系的客户'
        }
      }
    },
    computed: {
      GetListFn() {
        if (!this.queryData || !this.queryData.hasOwnProperty('day')) return null
        if (this.queryData.day == 0) return ForgetCustomerList
        return ForgetList
      }
    },
    onLoad(options) {
      this.queryData = options
      this.title = this.dayMap[this.queryData.day]
      this.getList()
    },
    methods: {
      getParams() {
        const params = {
        ...this.queryData
        }
        if (params.day == 0) {
          delete params.day
        }
        return params
      }
    }
  }
</script>

<style scoped lang="scss">
.list-view {
  flex: 1;
  overflow: hidden;
  margin-top: 20rpx;
  .list-scroll {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
  }
}
</style>
