import { View } from '@tarojs/components'
import Taro, { useDidShow, usePullDownRefresh, useRouter } from '@tarojs/taro'
import React, { ReactNode, memo, useCallback, useEffect, useMemo, useRef, useState } from 'react'
import classnames from 'classnames'
import styles from './index.module.scss'
import { alert } from '@/common/common'
import { formatDateTime, formatPriceDiv, formatWeightDiv } from '@/common/format'
import IconFont from '@/components/iconfont/iconfont'

interface Props {
  title: string
  des: string | number
  isPhone?: boolean
  isBorder?: boolean
}
const Form = (props: Props) => {
  const {
    isPhone = false,
    isBorder = true,
  } = props

  const handPhone = () => {
    Taro.makePhoneCall({
      phoneNumber: props.des as string,
    })
  }

  return (
    <View className={classnames(isBorder ? styles.mainItem : styles.mainItem_active)}>
      <View className={styles.mainItem_left}>{props.title}</View>
      <View className={classnames(isPhone ? styles.mainItem_active_right : styles.mainItem_right)}>{props.des}</View>
      {
        isPhone && <View className={styles.call} onClick={() => handPhone()}>拨打</View>
      }
    </View>
  )
}
export default memo(Form)
