//首页用
export const formatPrice = (price, type = 1) => {
    if (type == 1) {
        return parseInt(price)
    } else if (type == 2) {
        const findDot = Number(price).toFixed(2).toString().indexOf('.')
        if (findDot > -1) {
            return  Number(price).toFixed(2).toString().slice(findDot)
        } else {
            return '.00'
        }
    }
}

export const formatInt = (price) => {
    if (price < 10000) {
        return parseInt(price)
    } else if (price >= 10000){
        const s = parseInt(price).toString().slice(0, -4);
        const e = parseInt(price).toString().slice(-4, -3)
        return s + '.' + e
    } else {
        return 0
    }
}
export const formatDecimal = (price=0) => {
    if (price < 9999) {
        const findDot = Number(price).toFixed(2).toString().indexOf('.')
        if (findDot > -1) {
            return Number(price).toFixed(2).toString().slice(findDot)
        } else {
            return '00'
        }
    } else {
        return 'w'
    }
}