<!-- <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="false" :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+')'">
|
|
</view>
|
|
<view class="over_y">
|
|
<view class="item_goods" v-for="(item,index) in list" :key="index">
|
|
<goods-item :goods="item" thereTo='ZeroMoneyBuy'></goods-item>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</template> -->
|
|
|
|
<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='ZeroMoneyBuy'></goods-item>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</template>
|
|
|
|
<script>
|
|
import config from "@/utils/js/config.js"
|
|
export default {
|
|
data() {
|
|
return {
|
|
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)
|
|
},
|
|
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 => {
|
|
|
|
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
|
|
}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);
|
|
|
|
}
|
|
</style>
|
|
|
|
<!--
|
|
<template>
|
|
<view class="pages">
|
|
<view class="search"><u-search v-model="keyword" placeholder="请输入要搜索的商品" height="70" :show-action="false" @search="search" /></view>
|
|
<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='ZeroMoneyBuy'></goods-item>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</template>
|
|
|
|
<script>
|
|
import config from "@/utils/js/config.js"
|
|
export default {
|
|
data() {
|
|
return {
|
|
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();
|
|
},
|
|
methods: {
|
|
search () {
|
|
this.pageNo = 1
|
|
this.pageSize = 9999
|
|
this.getGoodsList()
|
|
},
|
|
getGoodsList() {
|
|
uni.showLoading();
|
|
const params = {
|
|
pageNo: this.pageNo,
|
|
pageSize: this.pageSize,
|
|
bottonId:this.id,
|
|
title: this.keyword
|
|
}
|
|
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]
|
|
})
|
|
// this.list = this.list.concat(result.records);
|
|
this.list = !this.keyword ? this.list.concat(result.records) : result.records
|
|
}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);
|
|
|
|
}
|
|
</style>
|
|
-->
|