import { Text, View } from '@tarojs/components'
import { memo } from 'react'
import styles from './index.module.scss'
import NormalButton from '@/components/normalButton'
import { formatMillionYuan, toDecimal2 } from '@/common/format'

interface PropsType {
  amount?: number
  onSettleAccount?: Function
}
const BottomSettleBar = (props: PropsType) => {
  const { onSettleAccount, amount = 0 } = props

  const handleSettle = () => {
    onSettleAccount && onSettleAccount()
  }

  return (
    <View className={styles.bottomBar}>
      <View className={styles.bottomLeft}>
        <Text className={styles.moneyText}>预估金额：</Text>
        <Text className={styles.moneyNumber}>
          <Text className={styles.unit}>¥</Text>
          <Text className={styles.money}>{Number(Number(amount)
            .toFixed(2))
            .toLocaleString()}</Text>

        </Text>
      </View>
      <View className={styles.bottomRight}>
        <NormalButton type="primary" round size="normal" onClick={handleSettle} customStyles={{ padding: '0 80rpx' }}>
          <Text style={{ fontSize: '32rpx' }}>结算</Text>
        </NormalButton>
      </View>
    </View>
  )
}

export default BottomSettleBar
