耀实惠小程序
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.
 
 
 

285 lines
5.9 KiB

<template>
<view class="pages">
<u-sticky>
<view>
<view class="search"><u-search v-model="keyword" placeholder="请输入要搜索的商品" height="70" :show-action="false" @search="search" /></view>
<!-- 分区 -->
<u-tabs :list="nav_list" :is-scroll="true" :current="status" @change="getGoodsListInfo" bar-width="80" active-color="#01AEEA" font-size="34"></u-tabs>
</view>
</u-sticky>
<view class="top_bg_text" :style="'background-image: url('+pageImage+')'">
<!-- <text class="title_max">{{title}}</text>
<text class="title_min">{{title_alt}}</text> -->
</view>
<view class="over_y">
<view class="item_goods" v-for="(item,index) in list" :key="index">
<goods-item :goods="item" thereTo='integralStore'></goods-item>
</view>
</view>
<view class="mask" v-show="show" @click.stop="show=false">
<view class="warp">
<view class="rect" @tap.stop>
<image :src="http_img + 'Bell.png'" mode=""></image>
<text class="info">金卡、钻石卡会员尊享!</text>
<text class="alt">您现在还不是以上会员,不能参与此活动。</text>
<button @click="toHome" class="tohome_btn">好的</button>
</view>
</view>
</view>
</view>
</template>
<script>
import config from "@/utils/js/config.js"
export default {
data() {
return {
show: false,
status: '0',
butClass:'1',
nav_list: [
{
name: "全部"
},
],
payNum:0, // 0 非处方 1处方
http_img: config.img_url,
pageImage: '',
title: "兑购金商城",
title_alt: "小兑购金也有大用处!",
list: [],
pageNo: 1,
pageSize: 10,
total: null,
isLock: true,
id: '',
keyword: ''
}
},
onPullDownRefresh() {
this.pageNo= 1;
this.total = null;
this.list = [];
this.getGoodsList();
},
onReachBottom() {
if(this.isLock) {
if(this.total !== null && this.pageNo * this.pageSize >= this.total){
this.isLock = false;
this.$Toast('没有更多数据了哦!');
setTimeout(()=>{
this.isLock = true;
},3000)
return
}
this.pageNo+=1;
this.getGoodsList();
}
},
onLoad(options) {
this.id = options.id;
this.pageImage = options.pageImage
this.getGoodsList();
this.getButClass();
},
methods: {
getButClass(){
this.$api('getButClassList', {}).then(res => {
this.nav_list = this.nav_list.concat(res.result)
}).catch(err => {
this.$Toast(err.message)
})
},
search () {
this.pageNo = 1
this.getGoodsList()
},
getGoodsListInfo(e){
this.status = e;
this.butClass = this.nav_list[e].id;
this.list = [];
this.pageNo = 1;
this.total = null;
this.isLock = true;
this.payNum = e;
this.getGoodsList()
console.log("获取新数据",e)
},
toHome() {
console.log(this.show);
return
uni.switchTab({
url: "/pages/home/home"
})
},
getGoodsList() {
uni.showLoading();
const params = {
pageNo: this.pageNo,
pageSize: this.pageSize,
bottonId:this.id,
title: this.keyword,
payNum:this.payNum,
butClass:this.butClass
}
this.$api('getGoodsList',params).then(res => {
let { code, result, message} = res;
uni.hideLoading();
if(code == 200){
if(this.total == null) {
this.total = result.total;
}
result.records.forEach(item => {
// const picArray= item.pic.split(',')
// item.pic= picArray[0]
if(item.pic!==null){
const picArray=item.pic.split(',')
item.pic= picArray[0]
}else{
item.pic= []
}
})
// this.list = this.list.concat(result.records);
this.list = !this.keyword ? this.list.concat(result.records) : result.records
console.log(this.list)
}else{
this.$Toast(message);
}
}).catch( err => {
uni.hideLoading();
this.$Toast(err.message);
})
},
}
}
</script>
<style lang="scss" scoped>
.search {
// position: fixed;
width: 100%;
top: 0;
left: 0;
padding: 28rpx;
background: #fff;
z-index: 1;
}
.top_bg_text{
width: 100%;
height: 184rpx;
margin-top: 30rpx;
background-size: 100% 184rpx;
display: flex;
flex-direction: column;
align-items: center;
.title_max{
margin-top: 20rpx;
font-size: 54rpx;
font-weight: bold;
color: #73B8DE;
}
.title_min{
margin-top: 10rpx;
font-size: 28rpx;
color: #73B8DE;
}
}
.pages {
background-color: #F5F5F5;
// padding-top: 120rpx;
.top_img {
margin-top: 30rpx;
margin-bottom: 50rpx;
height: 184rpx;
}
}
.over_y {
overflow-y: auto;
}
.item_goods {
margin: 0 auto;
width: 713rpx;
margin-top: 38rpx;
margin-bottom: 30rpx;
background-color: #FFF;
border-radius: 34rpx;
box-shadow: 0 3px 6px 0 rgba(0, 0, 0, 0.16);
display: flex;
flex-direction: column;
}
// 遮罩层 内容
.mask{
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
z-index: 100;
background-color: rgba(0, 0, 0, .5);
}
.warp {
position: absolute;
top: 0;
left: 0;
display: flex;
align-items: center;
justify-content: center;
height: 100%;
width: 750rpx !important;
.rect {
width: 605rpx !important;
height: 614rpx;
border-radius: 16rpx;
background-color: #fff;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
image {
margin-top: 50rpx;
width: 241rpx;
height: 232rpx;
}
.info {
font-size: 33rpx;
font-weight: bold;
color: #01AEEA;
margin-top: 54rpx;
}
.alt {
font-size: 28rpx;
color: #707070;
margin-top: 21rpx;
}
.tohome_btn {
width: 440rpx;
height: 94rpx;
margin-top: 44rpx;
margin-bottom: 37rpx;
border-radius: 46rpx;
border: 3rpx solid #01AEEA;
background-color: #fff;
line-height: 94rpx;
text-align: center;
font-size: 30rpx;
font-weight: bold;
color: #01AEEA;
}
}
}
</style>