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

export default (props) => {
  const { detail, order, job, onClick } = props
  const handleDetail = () => {
    Taro.navigateTo({ url: '/pages/orderDetail/index' });
  }
  const handleClick = () => {
    Taro.navigateTo({ url: '/pages/orderDetail/index' });
  }
  return (
    <View className='card'>
      <View className='jianbian'>
        <View className='text'>待作业</View>
      </View>
      <View className='cardHead'>
        {
          job && <MyCell header='需求时间' job action='详情>>' handleAction={handleClick}>2022-06-02</MyCell>
        }
        {
          !job && <>
            <MyCell header='需求时间'>2022-06-02</MyCell>
            <Text className='price'><Text style={{ fontSize: '44rpx' }}>600</Text>元</Text>
          </>
        }
      </View>
      <View className='line' />
      <MyCell header='农机名称'>收割机001</MyCell>
      <MyCell header='下单人'>张三</MyCell>
      {
        detail && <MyCell header='手机号'>13613949434</MyCell>
      }
      <MyCell header='订单时间'>2022-03-08</MyCell>
      {
        detail && <MyCell header='服务地址'>河南省南阳市邓州市孟楼镇</MyCell>
      }
      <MyCell header='作业时间'>上午06:00--晚上21:00</MyCell>
      {
        job && <MyButton value='开始作业' onClick={onClick} />
      }
      {
        order && <View className='line' />
      }
      {
        order && <View className='footer' onClick={handleDetail}>详情{">"}{">"}</View>
      }
    </View>
  )
}