import { Text, View } from '@tarojs/components'
import { memo, useCallback, useEffect, useMemo } from 'react'
import classnames from 'classnames'
import styles from './index.module.scss'
import { formatKbPrice } from '@/common/common'

interface Param {
  style?: Object
  number?: number
}
export default memo(({ style, number = 0 }: Param) => {
  const priceDom = useCallback(() => {
    const res = number.toFixed(2).split('.')
    const int_num = `${parseInt(res[0])}`
    const decimals_num = res[1]
    return (
      <>
        <Text>¥</Text>
        <Text>{Number(int_num).toLocaleString()}</Text>
        <Text>.{decimals_num}</Text>
      </>
    )
  }, [number])
  return (
    <>
      <View className={styles.order_price}>
        <View className={classnames(styles.order_price_text, styles.emphasis)}>
          <Text>应付金额</Text>
          <View className={styles.iconfont_msg}>
            <Text className={classnames(styles.miconfont, 'iconfont icon-a-tuikuanshouhou')}></Text>
            {/* <View className={classnames(styles.message)}>123123123121212312312312312</View> */}
          </View>
        </View>
        <View className={classnames(styles.order_price_num, styles.emphasis_num)} style={style}>
          {priceDom()}
        </View>

      </View>
    </>
  )
})
