import { getMallGoods, geHsbyListingGoods } from '@/services/bus/goods';
import { goToMallDeatil, goToHotDeatil } from '@/views/mall/goods/setup/router';

export function goToGoodsDetial(goodsId: number) {
    // 商城商品
    const mall = getMallGoods();
    const mallItem = mall.find((item) => item.goodsid === goodsId);
    // 竞价商品
    const host = geHsbyListingGoods();
    const hostItem = host.value.find((item) => item.goodsid === goodsId);
    if (mallItem) {
        goToMallDeatil(mallItem);
    } else if (hostItem) {
        goToHotDeatil(hostItem);
    } else {
        console.warn(`未找到对应goodsId：${goodsId}商品`);
    }
}
