import { Button, View } from '@tarojs/components'
import Taro from '@tarojs/taro'
import { memo } from 'react'
import classnames from 'classnames'
import styles from './index.module.scss'

interface prosObj {
  isDisabled: boolean
  handSure?: () => void
  clientId?: Number
  clientName?: string
}
const BottomCustomer = (props: prosObj) => {
  const {
    isDisabled = true,
    handSure,
    clientName = '',
  } = props
  const navTo = () => {
    Taro.navigateTo({
      url: `/pages/customerPage/index?clientId=${props?.clientId}`,
    })
  }

  return (
    <View className={styles.bottomBox}>
      <View className={styles.leftBottom} onClick={() => { navTo() }}>
        <View className={styles.nowFont}>当前客户：</View>
        <View className={styles.selctFont}>{clientName === '' ? '请选择客户 >' : `${clientName} >`}</View>
      </View>
      <Button className={classnames(isDisabled ? styles.activeButton : styles.button)} disabled={isDisabled} onClick={() => { handSure?.() }}> 加入购物车</Button >
    </View >
  )
}
export default memo(BottomCustomer)
