|
|
|
@ -2,7 +2,7 @@ |
|
|
|
|
<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"> |
|
|
|
@ -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;" |
|
|
|
|
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 { |
|
|
|
@ -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(); |
|
|
|
|
this.getCmsContent('CMS_WX_APPLETS_GOODS_LIST'); |
|
|
|
|
} |
|
|
|
|
if (option.id == 3) { |
|
|
|
|
uni.setNavigationBarTitle({ |
|
|
|
|
title: '优选商品' |
|
|
|
|
}); |
|
|
|
|
this.getCmsContent('CMS_PRE_LIST'); |
|
|
|
|
this.getBrandCouponList(); |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
onPageScroll(e) { |
|
|
|
|
|
|
|
|
|
}, |
|
|
|
|
//上拉加载,需要自己在page.json文件中配置"onReachBottomDistance" |
|
|
|
|
onReachBottom() { |
|
|
|
|
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 = []; |
|
|
|
|
if(this.typeId == 3){ |
|
|
|
|
this.getBrandCouponList(); |
|
|
|
|
}else{ |
|
|
|
|
this.getCouponListArea(); |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
//商品跳转 |
|
|
|
|
toGoods(e) { |
|
|
|
|