|
|
|
@ -2,14 +2,14 @@ |
|
|
|
|
<view> |
|
|
|
|
<view class="input-box"> |
|
|
|
|
<view class="icon search"></view> |
|
|
|
|
<input placeholder="搜索卡券" v-model="couponName" placeholder-style="color:#c0c0c0;" @input="toSearch()" /> |
|
|
|
|
<input placeholder="搜索商品" v-model="couponName" placeholder-style="color:#c0c0c0;" @input="toSearch()" /> |
|
|
|
|
</view> |
|
|
|
|
|
|
|
|
|
<view class="swiper"> |
|
|
|
|
<view class="swiper-box"> |
|
|
|
|
<swiper circular="true" autoplay="true" @change="swiperChange"> |
|
|
|
|
<swiper-item v-for="swiper in swiperList" :key="swiper.id"> |
|
|
|
|
<image :src="imageUrl+swiper.imgData" ></image> |
|
|
|
|
<image :src="imageUrl+swiper.imgData"></image> |
|
|
|
|
</swiper-item> |
|
|
|
|
</swiper> |
|
|
|
|
<view class="indicator"> |
|
|
|
@ -30,18 +30,17 @@ |
|
|
|
|
|
|
|
|
|
<view class="info mart10"> |
|
|
|
|
<view class="price" v-if="typeId == 2"> |
|
|
|
|
<image style="width: 15px;height: 15px;vertical-align: sub;" |
|
|
|
|
src="../../../static/img/jfx.png"> |
|
|
|
|
<image style="width: 15px;height: 15px;vertical-align: sub;" src="../../../static/img/jfx.png"> |
|
|
|
|
</image> {{ row.discountPrice*100}} |
|
|
|
|
</view> |
|
|
|
|
<view class="price" v-if="typeId == 1"> |
|
|
|
|
<view class="price" v-if="typeId == 1 || typeId == 3"> |
|
|
|
|
¥ {{ row.discountPrice*100}} |
|
|
|
|
</view> |
|
|
|
|
<!-- v-if="product.discountPrice !== product.salesPrice" --> |
|
|
|
|
<view class="slogan" v-if="row.discountPrice !== row.salesPrice"> |
|
|
|
|
<image v-if="typeId == 2" style="width: 15px;height: 15px;vertical-align: sub;" |
|
|
|
|
<image v-if="typeId == 2" style="width: 15px;height: 15px;vertical-align: sub;" |
|
|
|
|
src="../../../static/img/jfh.png"> |
|
|
|
|
</image> <text v-if="typeId == 1">¥</text>{{ row.salesPrice*100}} |
|
|
|
|
</image> <text v-if="typeId == 1 || typeId == 3">¥</text>{{ row.salesPrice*100}} |
|
|
|
|
</view> |
|
|
|
|
</view> |
|
|
|
|
</view> |
|
|
|
@ -53,7 +52,8 @@ |
|
|
|
|
<script> |
|
|
|
|
import { |
|
|
|
|
getCouponList, |
|
|
|
|
getCmsContent |
|
|
|
|
getCmsContent, |
|
|
|
|
getBrandCouponList |
|
|
|
|
} from '../../../Utils/Api.js'; |
|
|
|
|
let app = getApp(); |
|
|
|
|
export default { |
|
|
|
@ -61,7 +61,7 @@ |
|
|
|
|
return { |
|
|
|
|
goodsList: [], |
|
|
|
|
imagewxUrl: app.globalData.imageWxImg, |
|
|
|
|
imgadres:'noorder.png', |
|
|
|
|
imgadres: 'noorder.png', |
|
|
|
|
imageUrl: app.globalData.imgUrl, |
|
|
|
|
// 轮播图片 |
|
|
|
|
swiperList: [{ |
|
|
|
@ -80,38 +80,55 @@ |
|
|
|
|
pageSize: 10, |
|
|
|
|
isNoMoreData: false, |
|
|
|
|
typeId: '', |
|
|
|
|
couponName: '' |
|
|
|
|
couponName: '', |
|
|
|
|
brandid : '', |
|
|
|
|
goodtyid: '' |
|
|
|
|
}; |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
onLoad: function(option) { //option为object类型,会序列化上个页面传递的参数 |
|
|
|
|
this.typeId = option.id; |
|
|
|
|
this.brandid = option.brandId; |
|
|
|
|
this.goodtyid = option.goodsId; |
|
|
|
|
if (option.id == 1) { |
|
|
|
|
uni.setNavigationBarTitle({ |
|
|
|
|
title: '商品列表' |
|
|
|
|
}); |
|
|
|
|
this.getCouponListArea(); |
|
|
|
|
this.getCmsContent('CMS_WX_APPLETS_GOODS_LIST'); |
|
|
|
|
} |
|
|
|
|
if (option.id == 2) { |
|
|
|
|
uni.setNavigationBarTitle({ |
|
|
|
|
title: '积分列表' |
|
|
|
|
}); |
|
|
|
|
this.getCouponListArea(); |
|
|
|
|
this.getCmsContent('CMS_WX_APPLETS_GOODS_LIST'); |
|
|
|
|
} |
|
|
|
|
if (option.id == 3) { |
|
|
|
|
uni.setNavigationBarTitle({ |
|
|
|
|
title: '优选商品' |
|
|
|
|
}); |
|
|
|
|
this.getCmsContent('CMS_PRE_LIST'); |
|
|
|
|
this.getBrandCouponList(); |
|
|
|
|
} |
|
|
|
|
this.getCouponListArea(); |
|
|
|
|
this.getCmsContent(); |
|
|
|
|
}, |
|
|
|
|
onPageScroll(e) { |
|
|
|
|
|
|
|
|
|
}, |
|
|
|
|
//上拉加载,需要自己在page.json文件中配置"onReachBottomDistance" |
|
|
|
|
onReachBottom() { |
|
|
|
|
this.getCouponListArea(); |
|
|
|
|
if(this.typeId == 3){ |
|
|
|
|
this.getBrandCouponList(); |
|
|
|
|
}else{ |
|
|
|
|
this.getCouponListArea(); |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
methods: { |
|
|
|
|
//获取弹出或者弹窗 |
|
|
|
|
getCmsContent() { |
|
|
|
|
getCmsContent(item) { |
|
|
|
|
let params = { |
|
|
|
|
regionId: app.globalData.cityId, |
|
|
|
|
categoryCode: 'CMS_WX_APPLETS_GOODS_LIST' |
|
|
|
|
categoryCode: item |
|
|
|
|
} |
|
|
|
|
getCmsContent(params).then(res => { |
|
|
|
|
if (res.return_code == '000000') { |
|
|
|
@ -154,12 +171,48 @@ |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
}, |
|
|
|
|
//优选商品列表 |
|
|
|
|
getBrandCouponList() { |
|
|
|
|
uni.showLoading({ |
|
|
|
|
title: '加载中...' |
|
|
|
|
}) |
|
|
|
|
if (this.isNoMoreData) { |
|
|
|
|
uni.hideLoading() |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
let pagenum = this.pageNum; |
|
|
|
|
let params = { |
|
|
|
|
regionId: app.globalData.cityId, |
|
|
|
|
pageNum: pagenum, |
|
|
|
|
pageSize: this.pageSize, |
|
|
|
|
brandId: this.brandid, |
|
|
|
|
goodsTypeId: this.goodtyid, |
|
|
|
|
couponName: this.couponName |
|
|
|
|
} |
|
|
|
|
getBrandCouponList(params).then(res => { |
|
|
|
|
uni.hideLoading(); |
|
|
|
|
if (res.return_code == '000000') { |
|
|
|
|
this.isNoMoreData = res.return_data.list.length == this.pageSize ? false : true; |
|
|
|
|
this.goodsList = this.goodsList.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.goodsList = []; |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
}, |
|
|
|
|
toSearch() { |
|
|
|
|
this.pageNum = 1; |
|
|
|
|
this.pageSize = 10; |
|
|
|
|
this.isNoMoreData = false; |
|
|
|
|
this.goodsList = []; |
|
|
|
|
this.getCouponListArea(); |
|
|
|
|
if(this.typeId == 3){ |
|
|
|
|
this.getBrandCouponList(); |
|
|
|
|
}else{ |
|
|
|
|
this.getCouponListArea(); |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
//商品跳转 |
|
|
|
|
toGoods(e) { |
|
|
|
@ -268,12 +321,12 @@ |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
.goodsxg { |
|
|
|
|
margin-top: 5px; |
|
|
|
|
border: 1px solid #eb5823; |
|
|
|
|
border-radius: 5px; |
|
|
|
|
color: #eb5823; |
|
|
|
|
width: 55px; |
|
|
|
|
padding: 3px; |
|
|
|
|
margin-top: 5px; |
|
|
|
|
border: 1px solid #eb5823; |
|
|
|
|
border-radius: 5px; |
|
|
|
|
color: #eb5823; |
|
|
|
|
width: 55px; |
|
|
|
|
padding: 3px; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
.info { |
|
|
|
|