import { Text, View } from "@tarojs/components"
import { useCallback, useEffect, useMemo } from "react"
import {formatKbPrice} from '@/common/common'
import styles  from './index.module.scss'
type Param = {
    style?: Object,
    number?: number
}
export default ({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}>
            <Text className={styles.order_price_text}>预估金额</Text>
            <View className={styles.order_price_num} style={style}>
                {priceDom()}
            </View>
        </View>
    )
}