shop_uniapp/pages/new_goods/index.vue

75 lines
1.7 KiB
Vue

<template>
<view class="hot-list">
<mescroll-body ref="mescrollRef" @init="mescrollInit" @down="downCallback" @up="upCallback">
<view class="main">
<router-link to="/pages/goods_search/goods_search">
<u-search wrap-bg-color="transparent" bg-color="#fff" :disabled="true" :height="62">
</u-search>
</router-link>
<goods-list :list="goodsList" type="double" :price-type="price_type"></goods-list>
</view>
</mescroll-body>
<tabbar></tabbar>
</view>
</template>
<script>
import {
getNewGoods
} from '@/api/store';
import MescrollMixin from "@/components/mescroll-uni/mescroll-mixins";
export default {
mixins: [MescrollMixin],
data() {
return {
upOption: {
empty: {
icon: `${this.$aliOSS}uniapp/goods_null.png`,
tip: "暂无商品~"
}
},
hotList: [],
goodsList: [],
type: '',
price_type: 0
};
},
methods: {
upCallback(page) {
let pageNum = page.num;
let pageSize = page.size;
const params = {
page_no: pageNum,
page_size: pageSize,
p_id: this.$store.getters.hasPid,
set: this.$store.getters.hasSetId
}
params.type = 'all'
getNewGoods(params).then(res => {
if (res.code == 1) {
this.price_type = 0;
let curPageData = res.data.lists;
let curPageLen = curPageData.length;
let hasNext = !!res.data.more;
if (page.num == 1) {
this.goodsList = [];
}
this.goodsList = this.goodsList.concat(curPageData);
this.mescroll.endSuccess(curPageLen, hasNext);
}
}).catch(err => {
this.mescroll.endErr()
})
},
}
};
</script>
<style lang="scss">
.list-title {
margin: 27rpx 0 30rpx;
}
</style>