Commit 9506014c by 高淑倩

add: 积分兑换优惠券

parent 796ba9a3
...@@ -2,7 +2,6 @@ ...@@ -2,7 +2,6 @@
"pages": [ "pages": [
"pages/mySpend/mySpend", "pages/mySpend/mySpend",
"pages/welcome/welcome", "pages/welcome/welcome",
"pages/memberOfOwn/memberOfOwn", "pages/memberOfOwn/memberOfOwn",
"pages/userCenter/userCenter", "pages/userCenter/userCenter",
"pages/memberRules/memberRules", "pages/memberRules/memberRules",
......
// component/noMore.js
Page({
/**
* 页面的初始数据
*/
data: {
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
}
})
\ No newline at end of file
{
"component": true,
"usingComponents": {}
}
\ No newline at end of file
<!--component/noMore.wxml-->
<view class="detail-list-bottom">-已经到底啦-</view>
/* component/noMore.wxss */
.detail-list-bottom {
text-align: center;
font-size: 21rpx;
color: #bfbfbf;
margin-top: 45rpx;
}
\ No newline at end of file
...@@ -9,77 +9,69 @@ wxService.page({ ...@@ -9,77 +9,69 @@ wxService.page({
* 页面的初始数据 * 页面的初始数据
*/ */
data: { data: {
params: { pageNo: 1,
pageNo: '1', pageSize: 10,
pageSize: '10' query: '',
}, totalPages: 0,
totalPages: '' integralCouponList: [], // 积分兑换优惠券列表
noMore: false
}, },
/** /**
* 生命周期函数--监听页面加载 * 生命周期函数--监听页面加载
*/ */
onLoad: function (options) { onLoad: function (options) {},
},
/** /**
* 生命周期函数--监听页面显示 * 生命周期函数--监听页面显示
*/ */
onShow: function () { onShow: function () {
this.initIntegralCouponList() this.initIntegralCouponList(this.data.pageNo, this.data.pageSize)
}, },
//获取消费列表 // 积分兑换优惠券列表
initIntegralCouponList(type) { initIntegralCouponList(pageNo,pageSize) {
wx.showLoading({ wx.showLoading({
title: '加载中' title: '加载中'
}) })
wxService.get(`/coupon/pointsRedemptionCouponSetting/findPage?pageNo=${this.data.params.pageNo}&pageSize=${this.data.params.pageSize}`).then(res => { wxService.get(`/coupon/pointsRedemptionCouponSetting/findPage?pageNo=${pageNo}&pageSize=${pageSize}&query=${this.data.query}`).then(res => {
let integralCouponList = []; const {result,data} = res.data
integralCouponList = this.data.params.pageNo == 1 ? res.data.data : this.data.integralCouponList.concat(res.data.data); if(result == 0){
wx.hideLoading()
this.setData({ this.setData({
integralCouponList, integralCouponList: this.data.pageNo == 1? [...data.content]: [...this.data.integralCouponList,...data.content],
totalPages: res.data.data.totalPages, totalPages: data.totalPages
}) })
wx.hideLoading(); }
if (type && type.pullDown) wx.stopPullDownRefresh();
}).finally(() => { }).finally(() => {
wx.hideLoading(); wx.hideLoading();
this.setData({
integralCouponList: ''
})
}) })
}, },
// 点击跳转至会员规则页
handleGoMemberRulesRules() {
wxService.router(`/pages/memberRules/memberRules`)
},
goCouponDetail(e) {
const {id} = e.currentTarget.dataset
wxService.router(`/pages/integralMallDetail/integralMallDetail?id=${id}`)
},
/** /**
* 页面相关事件处理函数--监听用户下拉动作 * 页面相关事件处理函数--监听用户下拉动作
*/ */
onPullDownRefresh: function () { onPullDownRefresh: function () {},
this.setData({
params: {
pageNo: 1,
pageSize: 10,
},
})
this.initIntegralCouponList({
pullDown: true
});
},
/** /**
* 页面上拉触底事件的处理函数 * 页面上拉触底事件的处理函数
*/ */
bindDownLoad: function () { onReachBottom: function () {
if (this.data.params.pageNo < this.data.totalPages) { if (this.data.pageNo < this.data.totalPages) {
this.setData({ this.setData({
params: { pageNo: this.data.pageNo + 1,
pageNo: this.data.params.pageNo + 1, pageSize: 10,
pageSize: 10 noMore: true
},
loadDataDone: true
}) })
this.initIntegralCouponList() this.initIntegralCouponList(this.data.pageNo, this.data.pageSize)
} }
}, },
}) })
\ No newline at end of file
{ {
"enablePullDownRefresh":true,
"navigationBarTitleText": "积分商城", "navigationBarTitleText": "积分商城",
"usingComponents": {} "usingComponents": {
"no-more": "/component/noMore/noMore"
}
} }
\ No newline at end of file
<!--pages/userCenter.wxml--> <!--pages/userCenter.wxml-->
<view class='page-integral-mall'> <view class='page-integral-mall' style="padding-bottom: 40rpx">
<navigator hover-class='none' url='/pages/memberRules/memberRules'> <view class='integral-vip-rules'>会员规则</view></navigator> <view class='integral-vip-rules' wx:if="{{integralCouponList.length}}" bindtap="handleGoMemberRulesRules">会员规则</view>
<scroll-view scroll-y bindscrolltolower="bindDownLoad"> <view class='coupon-wrap' wx:if="{{integralCouponList.length}}">
<view class='coupon-wrap'> <view class='coupon-list' wx:for="{{integralCouponList}}" wx:for-item="item" wx:for-index="k" wx:key="{{k}}">
<view class='coupon-list'>
<navigator hover-class='none' url='/pages/couponDetail/couponDetail'>
<image class='coupon-bg' src='/assets/imgs/coupon-bg.png'></image> <image class='coupon-bg' src='/assets/imgs/coupon-bg.png'></image>
<view class='coupon-img'> <view class='coupon-img'>
<image src='/assets/imgs/qr-code.png'></image> <image src='/assets/imgs/qr-code.png'></image>
</view> </view>
<view class='coupon-info'> <view class='coupon-info'>
<view class='coupon-name fs-28'>卡劵名称</view> <view class='coupon-name fs-28'>{{item.couponName}}</view>
<view class='coupon-time fs-24'>时间</view> <view class='coupon-time fs-24'>{{item.startTime}}</view>
<view class='coupon-desc fs-24'>查看详情</view> <view class='coupon-desc fs-24' data-id="{{item.id}}" bindtap="goCouponDetail">查看详情</view>
</view> </view>
<view class='coupon-code fs-24'>立即兑换</view> <view class='coupon-code fs-24'>立即兑换</view>
</navigator>
</view>
<view class='coupon-list'>
<image class='coupon-bg' src='/assets/imgs/coupon-bg.png'></image>
<view class='coupon-img'>
<image src='/assets/imgs/qr-code.png'></image>
</view>
<view class='coupon-info'>
<view class='coupon-name fs-28'>卡劵名称</view>
<view class='coupon-time fs-24'>时间</view>
<view class='coupon-desc fs-24'>查看详情</view>
</view>
<view class='coupon-code fs-24'>出示劵码</view>
</view> </view>
</view> </view>
</scroll-view> <view class='empty-wrap' wx:if="{{!integralCouponList.length}}">
<view class='empty-wrap'>
<view class='empty-info'> <view class='empty-info'>
<image class='empty-img' src='/assets/imgs/empty-coupon.png'></image> <image class='empty-img' src='/assets/imgs/empty-coupon.png'></image>
<view class='empty-text'>没有任何卡劵</view> <view class='empty-text'>没有任何卡劵</view>
</view> </view>
</view> </view>
<no-more wx:if="{{noMore}}"/>
</view> </view>
...@@ -18,11 +18,7 @@ wxService.page({ ...@@ -18,11 +18,7 @@ wxService.page({
pointsTotal: 2, pointsTotal: 2,
status: '交易成功', status: '交易成功',
themeArr: { count: '数量', name: '商品名称', price: '价格' }, themeArr: { count: '数量', name: '商品名称', price: '价格' },
itemArr: [ itemArr: [],
{ count: 1, name: '牛奶', price: 112 },
{ count: 2, name: '榛果', price: 5222 },
{ count: 2, name: '薯片', price: 124 },
],
orderDetail: {} orderDetail: {}
}, },
......
{ {
"navigationBarTitleText": "积分流水", "navigationBarTitleText": "积分流水",
"usingComponents": {} "usingComponents": {
"no-more": "/component/noMore/noMore"
}
} }
\ No newline at end of file
...@@ -24,8 +24,7 @@ ...@@ -24,8 +24,7 @@
<view class="detail-num" wx:if="{{item.operation}}">+ {{item.changeValue}}</view> <view class="detail-num" wx:if="{{item.operation}}">+ {{item.changeValue}}</view>
<view class="detail-num minus" wx:if="{{!item.operation}}">- {{item.changeValue}}</view> <view class="detail-num minus" wx:if="{{!item.operation}}">- {{item.changeValue}}</view>
</view> </view>
<no-more />
<view class="detail-list-bottom">-已经到底啦-</view>
</view> </view>
</view> </view>
</view> </view>
...@@ -33,6 +33,7 @@ ...@@ -33,6 +33,7 @@
border-radius: 50rpx; border-radius: 50rpx;
vertical-align:top; vertical-align:top;
margin-top: 25rpx; margin-top: 25rpx;
margin-bottom: 40rpx;
} }
.num-current { .num-current {
font-size: 36rpx; font-size: 36rpx;
...@@ -78,15 +79,6 @@ ...@@ -78,15 +79,6 @@
padding: 0 60rpx 0 30rpx; padding: 0 60rpx 0 30rpx;
margin-bottom: 20rpx; margin-bottom: 20rpx;
} }
.detail-list-bottom {
text-align: center;
font-size: 21rpx;
color: #bfbfbf;
margin-top: 45rpx;
/* position: absolute; */
/* bottom: 28rpx; */
/* left: 45%; */
}
.detail-list-no { .detail-list-no {
font-size: 24rpx; font-size: 24rpx;
color: #333; color: #333;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment