import Taro from "@tarojs/taro"
import { View, Text } from '@tarojs/components'
import Jianbian from "@/components/Jianbian"
import MyCell from "../MyCell"
import MyButton from "../MyButton"
import './style.less'

export default (props) => {
  const { detail, order, job, value, onClick,goDetail } = props
  
  return (
    <View className='card'>
      <Jianbian status='1' />
      <View className='cardHead'>
        {
          job && <MyCell header='需求时间' job action='详情>>' handleAction={goDetail}>2022-06-02</MyCell>
        }
        {
          !job && <MyCell header='需求时间'>2022-06-02</MyCell>
        }
      </View>
      <View className='line' />
      <MyCell header='农机名称'>{value?.machineryName||'收割机001'}</MyCell>
      <MyCell header='下单人'>{value?.personName}</MyCell>
      <MyCell header='手机号'>{value?.phone}</MyCell>
      <MyCell header='订单时间'>{value?.createDate.substr(0,10)||'2022-03-08'}</MyCell>
      {
        detail && <MyCell header='服务地址'>{value?.address||'河南省南阳市邓州市孟楼镇'}</MyCell>
      }
      <MyCell header='作业时间'>上午06:00--晚上21:00</MyCell>
      <MyCell header='订单费用'>{(value?.charges&&value.charges/100)||600}元</MyCell>
      {
        job && <MyButton value='开始作业' onClick={onClick} />
      }
      {
        order && <View className='line' />
      }
      {
        order && <View className='footer' onClick={goDetail}>详情{">"}{">"}</View>
      }
    </View>
  )
}