|
|
@ -31,12 +31,6 @@
|
|
|
|
:key="item.id"
|
|
|
|
:key="item.id"
|
|
|
|
></UiGoodsItem>
|
|
|
|
></UiGoodsItem>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<UiPagination
|
|
|
|
|
|
|
|
:current-page="currentPage"
|
|
|
|
|
|
|
|
:page-size="query.length"
|
|
|
|
|
|
|
|
:total="total"
|
|
|
|
|
|
|
|
@current-change="handleCurrentChange"
|
|
|
|
|
|
|
|
/>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
@ -45,8 +39,8 @@
|
|
|
|
</template>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
|
|
<script>
|
|
|
|
<script>
|
|
|
|
|
|
|
|
import _ from "lodash";
|
|
|
|
import UiGoodsItem from "@/components/UiGoodsItem.vue";
|
|
|
|
import UiGoodsItem from "@/components/UiGoodsItem.vue";
|
|
|
|
import UiPagination from "@/components/UiPagination.vue";
|
|
|
|
|
|
|
|
import {
|
|
|
|
import {
|
|
|
|
ApiGetHomeSeckill,
|
|
|
|
ApiGetHomeSeckill,
|
|
|
|
ApiGetCurrentTime,
|
|
|
|
ApiGetCurrentTime,
|
|
|
@ -62,9 +56,10 @@ import Pick from "./module/Pick.vue";
|
|
|
|
import TabbarFixed from "./module/TabbarFixed.vue";
|
|
|
|
import TabbarFixed from "./module/TabbarFixed.vue";
|
|
|
|
const SECKILL_COUNT = 20; // 秒杀商品数
|
|
|
|
const SECKILL_COUNT = 20; // 秒杀商品数
|
|
|
|
const NEW_COUNT = 5; // 新品上架商品数
|
|
|
|
const NEW_COUNT = 5; // 新品上架商品数
|
|
|
|
|
|
|
|
const FOOTER_BAR_HEIGHT = 200; // 公共底部高度
|
|
|
|
|
|
|
|
|
|
|
|
export default {
|
|
|
|
export default {
|
|
|
|
components: { Banner, Seckil, Pick, UiGoodsItem, UiPagination, TabbarFixed },
|
|
|
|
components: { Banner, Seckil, Pick, UiGoodsItem, TabbarFixed },
|
|
|
|
async asyncData({ store }) {
|
|
|
|
async asyncData({ store }) {
|
|
|
|
// 获取秒杀数据
|
|
|
|
// 获取秒杀数据
|
|
|
|
let seckillData = { activityTimeVO: null };
|
|
|
|
let seckillData = { activityTimeVO: null };
|
|
|
@ -120,6 +115,7 @@ export default {
|
|
|
|
loading: false,
|
|
|
|
loading: false,
|
|
|
|
currentPage: 0,
|
|
|
|
currentPage: 0,
|
|
|
|
scrollTop: 0,
|
|
|
|
scrollTop: 0,
|
|
|
|
|
|
|
|
ticking: false,
|
|
|
|
};
|
|
|
|
};
|
|
|
|
},
|
|
|
|
},
|
|
|
|
created() {
|
|
|
|
created() {
|
|
|
@ -133,9 +129,21 @@ export default {
|
|
|
|
window.removeEventListener("scroll", this.scrollEventMethod);
|
|
|
|
window.removeEventListener("scroll", this.scrollEventMethod);
|
|
|
|
},
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
methods: {
|
|
|
|
scrollEventMethod() {
|
|
|
|
scrollEventMethod: _.debounce(function () {
|
|
|
|
this.scrollTop = window.scrollY;
|
|
|
|
this.scrollTop = window.scrollY;
|
|
|
|
},
|
|
|
|
const contentHeight = document.body.scrollHeight; // 内容高度
|
|
|
|
|
|
|
|
const clientHeight = document.body.clientHeight; // 屏幕高度
|
|
|
|
|
|
|
|
if (
|
|
|
|
|
|
|
|
window.scrollY + clientHeight >= contentHeight - FOOTER_BAR_HEIGHT &&
|
|
|
|
|
|
|
|
this.total &&
|
|
|
|
|
|
|
|
this.selectProducts.length < this.total
|
|
|
|
|
|
|
|
) {
|
|
|
|
|
|
|
|
this.query.pageIndex += 1;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// “为你精选”上拉加载
|
|
|
|
|
|
|
|
this.getSelectProducts();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}, 200),
|
|
|
|
|
|
|
|
|
|
|
|
// 刷新秒杀活动状态
|
|
|
|
// 刷新秒杀活动状态
|
|
|
|
async handleSeckillRefresh() {
|
|
|
|
async handleSeckillRefresh() {
|
|
|
@ -153,13 +161,9 @@ export default {
|
|
|
|
if (result) {
|
|
|
|
if (result) {
|
|
|
|
const { total, records } = result;
|
|
|
|
const { total, records } = result;
|
|
|
|
this.total = total;
|
|
|
|
this.total = total;
|
|
|
|
this.selectProducts = records;
|
|
|
|
this.selectProducts = this.selectProducts.concat(records);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
|
handleCurrentChange(page) {
|
|
|
|
|
|
|
|
this.query.pageIndex = page;
|
|
|
|
|
|
|
|
this.getSelectProducts();
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
},
|
|
|
|
},
|
|
|
|
};
|
|
|
|
};
|
|
|
|
</script>
|
|
|
|
</script>
|
|
|
|