
import Taro from '@tarojs/taro'
import { Image } from '@tarojs/components'
import './index.scss'

export default function StatCustomerListItem (props) {

  const { data = {}, showStatus = false } = props

  return (
    <view className='components StatCustomerListItem flex-h'>
      <view className='Icon' onClick={() => { Taro.navigateTo({ url: `/pages/mine/customerDetail/index?id=${data.customerId}&name=${data.name}&sex=${data.sex}&phone=${data.phone}&avatarurl=${data.avatarurl}&status=${data.status}` }) }}>
        <Image mode='scaleToFill' src={data.avatarurl || data.picture}></Image>
      </view>
      <view className='flex-item' onClick={() => { Taro.navigateTo({ url: `/pages/mine/customerDetail/index?id=${data.customerId}&name=${data.name}&sex=${data.sex}&phone=${data.phone}&avatarurl=${data.avatarurl}&status=${data.status}` }) }}>
        <view>
          <text>{data.name}</text>
          <text className={data.sex === 1 ? 'iconfont icon-nanxing' : 'iconfont icon-nvxing'}></text>
        </view>
        <text>{data.phone}</text>
      </view>
      <text className='iconfont icon-liaotian'></text>
      <text className='iconfont icon-dianhua active' onClick={() => { Taro.makePhoneCall({ phoneNumber: data.phone }) }}></text>
      {
        showStatus &&
        <text className='Status'>{data.status === 0 ? '' : data.status === 1 ? '报备' : data.status === 2 ? '到访' : data.status === 3 ? '认筹' : '签约'}</text>
      }
    </view>
  )
}
