import { Text, View } from "@tarojs/components"
import { memo, useCallback, useEffect, useMemo } from "react"
import {formatKbPrice} from '@/common/common'
import classnames from "classnames";
import styles  from './index.module.scss'
type Param = {
    style?: Object,
    number?: number
}
export default memo(({style, number = 0}:Param) => {
    const priceDom = useCallback(() => {
        let res = number.toFixed(2).split('.')
        let int_num  = parseInt(res[0]) + ''
        let 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={styles.order_price_text}>
                    <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={styles.order_price_num} style={style}>
                    {priceDom()}
                </View>
            </View>
            <View className={styles.order_price}>
                <View className={styles.order_price_text}>
                    <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={styles.order_price_num} style={style}>
                    {priceDom()}
                </View>
            </View>
            <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>
        </>
    )
})