import { navbarButtonGroup } from '../config/config.js'

// 导航按钮类型
export function generateNavbarButtonText(productData) {
    const { priceType } = productData
    const navbarButton = navbarButtonGroup[priceType]
    // 拼团券后价购买
    if (priceType === 'groupWithCoupon') {
        navbarButton.left[1] = `￥${productData.normalCouponPrice.toFixed(2)}`
        navbarButton.right[1] = `￥${productData.couponPrice.toFixed(2)}`
    }
    // 拼团价购买
    else if (priceType === 'group') {
        navbarButton.left[1] = `￥${productData.normalPrice.toFixed(2)}`
        navbarButton.right[1] = `￥${productData.price.toFixed(2)}`
    }
    // 活动价券后价购买（限时特价|普通活动）
    else if (priceType === 'activityWithCoupon') {
        navbarButton.right[1] = `￥${productData.couponPrice.toFixed(2)}`
    }
    // 普通价券后价购买
    else if (priceType === 'normalWithCoupon') {
        navbarButton.right[1] = `￥${productData.couponPrice.toFixed(2)}`
    } else {
        navbarButton.right[1] = ''
    }
    return navbarButton
}
