You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
high-mini/subPages/preferred-goods/preferred-goods.vue

121 lines
2.7 KiB

<template>
<view>
<image class="width94 mart20" mode="widthFix" :src="imagewxUrl+imgadres"></image>
<!-- 分割线 -->
<view class="title-split">
<view></view>
<text>商品分类</text>
<view></view>
</view>
<view v-if="listgoods == '' " class="mart60 fotct font14 fcor666">
<image mode="widthFix" style="width: 70vw;" :src="imagewxUrl+imgadres1"></image>
</view>
<!-- 分类-->
<view class="width94">
<view class="width50 flleft fotct mart5" v-for="(item,index) in listgoods" :key="item" @click="jumpbrand(item)">
<image :src="imageUrl+item.img" class="preimg"></image>
</view>
</view>
</view>
</template>
<script>
import {
getListGoodsType
} from '../../Utils/Api.js';
let app = getApp();
export default {
data() {
return {
imageUrl: app.globalData.imgUrl,
imagewxUrl: app.globalData.imageWxImg,
imgadres: 'preimg.png',
imgadres1: 'noorder.png',
listgoods: [],
pageNum: 1,
pageSize: 10,
isNoMoreData: false,
}
},
onLoad() {
this.getListGoodsType();
},
onReachBottom() {
this.getListGoodsType();
},
methods: {
//查询分类
getListGoodsType() {
uni.showLoading({
title: '加载中...'
})
if (this.isNoMoreData) {
uni.hideLoading()
return false;
}
let pagenum = this.pageNum;
let params = {
pageNum: pagenum,
pageSize: this.pageSize,
userService:'优选商品'
}
getListGoodsType(params).then(res => {
uni.hideLoading();
if (res.return_code == '000000') {
this.isNoMoreData = res.return_data.list.length == this.pageSize ? false : true;
this.listgoods = this.listgoods.concat(res.return_data.list);
if (res.return_data.total == (this.pageNum * this.pageSize)) {
this.isNoMoreData = true;
}
this.pageNum = res.return_data.list.length == this.pageSize ? ++pagenum : pagenum;
} else {
this.listgoods = [];
}
})
},
// 跳转品牌
jumpbrand(item) {
uni.navigateTo({
url: '../brand-classification/brand-classification?id='+item.id
})
}
}
}
</script>
<style lang="scss">
.title-split {
margin: 30rpx 0 28rpx 0;
display: flex;
align-items: center;
justify-content: center;
text {
color: #161616;
font-weight: 500;
font-size: 30rpx;
padding: 0 24rpx;
}
view {
width: 140rpx;
height: 4rpx;
border-radius: 3rpx;
&:first-of-type {
background: linear-gradient(90deg, rgba(98, 98, 98, 0) 0%, #333333 100%);
}
&:last-of-type {
background: linear-gradient(90deg, #333333 0%, rgba(98, 98, 98, 0) 100%);
}
}
}
.preimg {
width: 120px;
height: 80px;
}
</style>