135 lines
3.2 KiB
Vue
135 lines
3.2 KiB
Vue
<template>
|
|
<view class="pad-b150">
|
|
<status-nav :ifReturn="false" navBarTitle="套件" :marginBottom="20"></status-nav>
|
|
<!-- 套件列表 -->
|
|
<pull-list :list="kitList" :isKit="true" @toDetail="toDetail"></pull-list>
|
|
<!-- 暂无更多内容 -->
|
|
<view class="more-txt" v-if="totalAll == total">暂无更多内容</view>
|
|
<!-- 购物车btn -->
|
|
<enter-cart></enter-cart>
|
|
<!-- 底部tab -->
|
|
<foot-tab current="2"></foot-tab>
|
|
</view>
|
|
</template>
|
|
|
|
<script>
|
|
import statusNav from '@/components/status-navs/status-nav';
|
|
import enterCart from '@/components/enter-cart/enter-cart.vue';
|
|
import pullList from '@/components/pull-list/pull-list.vue';
|
|
// 底部组件
|
|
import footTab from '@/components/foot-tab/foot-tab.vue';
|
|
import {userInfoEv,getCartNum} from '@/jsFile/public-api.js';
|
|
export default {
|
|
components:{
|
|
statusNav,
|
|
enterCart,
|
|
pullList,
|
|
footTab
|
|
},
|
|
data() {
|
|
return {
|
|
scrollHeight:uni.getSystemInfoSync().windowHeight - uni.getSystemInfoSync().statusBarHeight - 50,
|
|
newWidth:uni.getSystemInfoSync().windowWidth,
|
|
kitList:[], //套件列表
|
|
page:1, //页数
|
|
size:10, //数量
|
|
total:0, //总数
|
|
totalAll:-1, //计算总数
|
|
category_id:0, //分类id
|
|
sort:'new', //排序
|
|
cacheBusinessId:-1, //商户id
|
|
isLoading:false,
|
|
}
|
|
},
|
|
onLoad(op) {
|
|
if(op.business_id){
|
|
this.cacheBusinessId = op.business_id;
|
|
}
|
|
},
|
|
onShow() {
|
|
if(this.cacheBusinessId !== -1){
|
|
this.$requst.post('/api/index/change-business',{business_id:this.cacheBusinessId}).then(res=>{
|
|
if(res.code == 0){
|
|
this.kitList = [];
|
|
this.getKitEv();
|
|
userInfoEv();
|
|
}
|
|
})
|
|
}else{
|
|
this.kitList = [];
|
|
this.getKitEv();
|
|
userInfoEv();
|
|
}
|
|
getCartNum();
|
|
},
|
|
onReachBottom(e) {
|
|
if(this.kitList.length<this.total){
|
|
this.page++;
|
|
//查询套件列表
|
|
this.getKitEv();
|
|
}
|
|
},
|
|
// 分享到微信
|
|
onShareAppMessage() {
|
|
let path = uni.getStorageSync('page-path-options')+'?business_id='+uni.getStorageSync('business_id');
|
|
return {
|
|
path:path
|
|
}
|
|
},
|
|
// 分享到朋友圈
|
|
onShareTimeline(res){
|
|
let path = uni.getStorageSync('page-path-options')+'?business_id='+uni.getStorageSync('business_id');
|
|
return {
|
|
path:path
|
|
}
|
|
},
|
|
methods: {
|
|
// 查询套件列表
|
|
getKitEv(){
|
|
uni.showLoading({
|
|
title: '加载中'
|
|
});
|
|
this.isLoading =false;
|
|
let params = {
|
|
page:this.page,
|
|
size:this.size,
|
|
category_id:this.category_id,
|
|
sort:this.sort
|
|
}
|
|
this.$requst.post('/api/spu/series',params).then(res=>{
|
|
if(res.code==0) {
|
|
this.total = res.data.total;
|
|
let newArr = [];
|
|
res.data.list.forEach(item=>{
|
|
let obj = {
|
|
id:item.id,
|
|
src:item.cover,
|
|
title:item.name,
|
|
subtitle:item.subtitle,
|
|
series:item.series
|
|
}
|
|
newArr.push(obj);
|
|
})
|
|
this.kitList = this.kitList.concat(newArr);
|
|
if(this.kitList.length == this.total){
|
|
this.totalAll = this.total;
|
|
}
|
|
}
|
|
uni.hideLoading();
|
|
this.isLoading =true;
|
|
})
|
|
},
|
|
// 跳转详情页
|
|
toDetail(id) {
|
|
uni.navigateTo({
|
|
url:`/pages/tabbar/kit/detail?id=${id.id}`
|
|
})
|
|
},
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style>
|
|
|
|
</style>
|