diff --git a/pages/index/index.vue b/pages/index/index.vue index 4ce5936..9eec998 100644 --- a/pages/index/index.vue +++ b/pages/index/index.vue @@ -16,7 +16,7 @@ :current="currentTime" @refresh="handleSeckillRefresh" /> - + @@ -27,11 +27,15 @@ import { ApiGetCurrentTime, ApiGetSeckillGoods, } from "@/plugins/api/seckill"; -import { ApiGetRecommendedGoodsList } from "@/plugins/api/goods"; +import { + ApiGetRecommendedGoodsList, + ApiGetGoodsList, +} from "@/plugins/api/goods"; import Banner from "./module/Banner.vue"; import Seckil from "./module/Seckill.vue"; import Pick from "./module/Pick.vue"; -const PICK_COUNT_MIN = 3; // 甄选推荐最小商品数 +const SECKILL_COUNT = 20; // 秒杀商品数 +const NEW_COUNT = 5; // 新品上架商品数 export default { components: { Banner, Seckil, Pick }, @@ -43,7 +47,7 @@ export default { if (seckillData.activityTimeVO) { const { result } = await ApiGetSeckillGoods({ pageIndex: 1, - length: 20, + length: SECKILL_COUNT, activityTimeId: seckillData.activityTimeVO.id, }); if (result) { @@ -53,17 +57,25 @@ export default { // 获取服务器当前时间 const { result: currentTime } = await ApiGetCurrentTime(); - const { result: pickData } = await ApiGetRecommendedGoodsList(); + // 获取甄选商品 + const { result: recommendData } = await ApiGetRecommendedGoodsList(); + + // 获取新品上架商品 + let newData = []; + const { result: newDataResult } = await ApiGetGoodsList({ + pageIndex: 1, + length: NEW_COUNT, + }); + if (newDataResult) { + newData = newDataResult.records || []; + } + return { currentTime, - seckillData: seckillData || { activityTimeVO: null }, + newData, sekillGoodsList, - pickData: pickData || [], - }; - }, - data() { - return { - PICK_COUNT_MIN, + seckillData: seckillData || { activityTimeVO: null }, + recommendData: recommendData || [], }; }, methods: { diff --git a/pages/index/module/Pick.vue b/pages/index/module/Pick.vue index d8a8454..3ffd689 100644 --- a/pages/index/module/Pick.vue +++ b/pages/index/module/Pick.vue @@ -1,52 +1,71 @@