Commit e674dbbc8643eddde484bfe4d76c055926084e05

Authored by 前端研发-钱巧玲
1 parent 8ed9ba58

我的礼包和礼包列表分页实现

pages/giftpack/buygiftpack/giftpackbuy.js
  1 +var i = require("../../../utils/util.js");
1 var e = getApp(), 2 var e = getApp(),
2 a = e.globalData.setting, 3 a = e.globalData.setting,
3 os = a, 4 os = a,
@@ -12,14 +13,18 @@ Page({ @@ -12,14 +13,18 @@ Page({
12 wareCard: [], 13 wareCard: [],
13 page: 0, 14 page: 0,
14 pageSize: 10, 15 pageSize: 10,
15 - isEmpty: true, 16 + isEmpty: false,
16 loadingType: 0, //定义加载方式 0---contentdown 1---contentrefresh 2---contentnomore 17 loadingType: 0, //定义加载方式 0---contentdown 1---contentrefresh 2---contentnomore
17 contentText: { 18 contentText: {
18 contentdown: '加载更多', 19 contentdown: '加载更多',
19 contentrefresh: '加载中...', 20 contentrefresh: '加载中...',
20 contentnomore: '已加载全部' 21 contentnomore: '已加载全部'
21 }, 22 },
22 - is_read:0,//礼包列表是否全部加载完毕 23 + ismore: 0, //数据是否全部加载完成
  24 + is_read: 0, //是否查询过我的礼包接口
  25 + curpage: 1, //当前分页数
  26 + pageSize: 3, //页大小
  27 + total: 0, //总数量
23 }, 28 },
24 onLoad: function(options) { 29 onLoad: function(options) {
25 var th = this; 30 var th = this;
@@ -27,10 +32,7 @@ Page({ @@ -27,10 +32,7 @@ Page({
27 my_confirm.open_cancel(0); 32 my_confirm.open_cancel(0);
28 th.setData({ 33 th.setData({
29 getStorageID: a.stoid, 34 getStorageID: a.stoid,
30 - getUserID: d.user_id,  
31 - pages: 1,  
32 - pageSize: 10,  
33 - loadingType: 0 35 + getUserID: d.user_id
34 }) 36 })
35 th.getList(); 37 th.getList();
36 }, 38 },
@@ -47,7 +49,7 @@ Page({ @@ -47,7 +49,7 @@ Page({
47 GetBuyPrice: function(e) { 49 GetBuyPrice: function(e) {
48 var that = this.data; 50 var that = this.data;
49 var th = this; 51 var th = this;
50 - var id = e.currentTarget.dataset.id;//活动id 52 + var id = e.currentTarget.dataset.id; //活动id
51 var my_confirm = th.selectComponent("#my_confirm"); //组件的id 53 var my_confirm = th.selectComponent("#my_confirm"); //组件的id
52 my_confirm.open( 54 my_confirm.open(
53 "是否确定购买该礼包", 55 "是否确定购买该礼包",
@@ -76,20 +78,20 @@ Page({ @@ -76,20 +78,20 @@ Page({
76 header: { 78 header: {
77 'content-type': 'application/json' 79 'content-type': 'application/json'
78 }, // 设置请求的 header 80 }, // 设置请求的 header
79 - success: function (res) { 81 + success: function(res) {
80 if (res.data.code == 0) { 82 if (res.data.code == 0) {
81 - res=res.data.data; 83 + res = res.data.data;
82 wx.requestPayment({ 84 wx.requestPayment({
83 timeStamp: String(res.timeStamp), 85 timeStamp: String(res.timeStamp),
84 nonceStr: res.nonceStr, 86 nonceStr: res.nonceStr,
85 package: res.packageValue, 87 package: res.packageValue,
86 signType: res.signType, 88 signType: res.signType,
87 paySign: res.paySign, 89 paySign: res.paySign,
88 - success: function (n) {  
89 - 90 + success: function(n) {
  91 +
90 }, 92 },
91 - fail: function (n) {  
92 - 93 + fail: function(n) {
  94 +
93 } 95 }
94 }); 96 });
95 } else { 97 } else {
@@ -108,7 +110,7 @@ Page({ @@ -108,7 +110,7 @@ Page({
108 GetBuyIntegral: function(e) { 110 GetBuyIntegral: function(e) {
109 var that = this.data; 111 var that = this.data;
110 var th = this; 112 var th = this;
111 - var id = e.currentTarget.dataset.id;//活动id 113 + var id = e.currentTarget.dataset.id; //活动id
112 var my_confirm = th.selectComponent("#my_confirm"); //组件的id 114 var my_confirm = th.selectComponent("#my_confirm"); //组件的id
113 my_confirm.open( 115 my_confirm.open(
114 "是否确定兑换该礼包", 116 "是否确定兑换该礼包",
@@ -136,7 +138,7 @@ Page({ @@ -136,7 +138,7 @@ Page({
136 header: { 138 header: {
137 'content-type': 'application/json' 139 'content-type': 'application/json'
138 }, // 设置请求的 header 140 }, // 设置请求的 header
139 - success: function (res) { 141 + success: function(res) {
140 if (res.data.code == 0) { 142 if (res.data.code == 0) {
141 getApp().my_warnning("兑换成功!", 1, th); 143 getApp().my_warnning("兑换成功!", 1, th);
142 } else { 144 } else {
@@ -147,59 +149,35 @@ Page({ @@ -147,59 +149,35 @@ Page({
147 149
148 }) 150 })
149 151
150 -  
151 }, 152 },
152 getList: function(e) { 153 getList: function(e) {
153 - var _this = this; //上拉加载  
154 - var that = this.data;  
155 - if (that.loadingType != 0) {  
156 - return false;  
157 - }  
158 - // that.loadingType = 1;  
159 - _this.setData({  
160 - loadingType: 1  
161 - }) 154 + var th = this;
162 getApp().request.get('/api/weshop/marketing/giftbag/page', { 155 getApp().request.get('/api/weshop/marketing/giftbag/page', {
163 data: { 156 data: {
164 - "storeId": that.getStorageID, //商家ID  
165 - "userId": that.getUserID, //用户ID  
166 - "page": that.pages,  
167 - "pageSize": that.pageSize 157 + storeId: th.data.getStorageID, //商家ID
  158 + userId: th.data.getUserID, //用户ID
  159 + page: th.data.pages,
  160 + pageSize: th.data.pageSize
168 }, 161 },
169 success: function success(res) { 162 success: function success(res) {
  163 + wx.hideLoading();
170 if (res.data.code == 0) { 164 if (res.data.code == 0) {
171 - if (res.data.data.total > 0) {  
172 - _this.setData({  
173 - isEmpty: false  
174 - })  
175 - } else {  
176 - _this.setData({  
177 - isEmpty: true  
178 - })  
179 - }  
180 - if (res.data.data.pageData.length == 0) {  
181 - _this.setData({  
182 - loadingType: 2  
183 - })  
184 - } else {  
185 - var wareCard = that.wareCard;  
186 - var is_read = 0;  
187 - if (wareCard.length < res.data.data.total) {  
188 - for (var i = 0; i < res.data.data.pageData.length; i++) {  
189 - wareCard.push(res.data.data.pageData[i]);  
190 - }  
191 - }else{  
192 - is_read:1  
193 - }  
194 - _this.setData({  
195 - wareCard: wareCard,  
196 - is_read: is_read,  
197 - loadingType: 0  
198 - })  
199 -  
200 - } 165 + th.data.curpage++;
  166 + var arr1 = th.data.wareCard;
  167 + var arr2 = res.data.data.pageData;
  168 + var arr3 = [...arr1, ...arr2];
  169 + var ismore = 0;
  170 + if (arr3.length == res.data.data.total) ismore = 1
  171 + th.setData({
  172 + wareCard: arr3,
  173 + total: res.data.data.total,
  174 + ismore: ismore,
  175 + is_read: 1
  176 + }), wx.stopPullDownRefresh(); //停止下拉刷新
201 } else { 177 } else {
202 - getApp().my_warnning(res.data.msg, 0, _this); 178 + th.setData({
  179 + is_read: 1
  180 + })
203 } 181 }
204 } 182 }
205 }) 183 })
@@ -215,11 +193,22 @@ Page({ @@ -215,11 +193,22 @@ Page({
215 }); 193 });
216 }, 194 },
217 //不销毁界面跳转 195 //不销毁界面跳转
218 - navigateTo:function(e){ 196 + navigateTo: function(e) {
219 var th = this; 197 var th = this;
220 var url = e.currentTarget.dataset.url; 198 var url = e.currentTarget.dataset.url;
221 wx.navigateTo({ 199 wx.navigateTo({
222 url: url, 200 url: url,
223 }) 201 })
224 - } 202 + },
  203 + //下拉事件
  204 + onReachBottom: function() {
  205 + var th = this;
  206 + if (th.data.total <= th.data.pageSize) return;
  207 + if (th.data.ismore) return;
  208 + wx.showLoading({
  209 + title: '加载中...',
  210 + })
  211 + th.getList();
  212 + },
  213 +
225 }) 214 })
226 \ No newline at end of file 215 \ No newline at end of file
pages/giftpack/buygiftpack/giftpackbuy.json
1 { 1 {
2 "navigationBarTitleText": "礼包列表", 2 "navigationBarTitleText": "礼包列表",
3 "navigationStyle": "custom", 3 "navigationStyle": "custom",
  4 + "enablePullDownRefresh": false,
4 "usingComponents": { 5 "usingComponents": {
5 "warn": "/components/long_warn/long_warn", 6 "warn": "/components/long_warn/long_warn",
6 "my_confirm": "/components/my_confirm/my_confirm" 7 "my_confirm": "/components/my_confirm/my_confirm"
pages/giftpack/buygiftpack/giftpackbuy.wxml
@@ -21,7 +21,7 @@ @@ -21,7 +21,7 @@
21 <view class="content_ware_title"> 21 <view class="content_ware_title">
22 <text bindtap="__e">{{items.giftTitle}}</text> 22 <text bindtap="__e">{{items.giftTitle}}</text>
23 </view> 23 </view>
24 - <view class="content_ware_type"> 24 + <view class="content_ware_type flex">
25 <block wx:if="{{items.payMoney>0}}"> 25 <block wx:if="{{items.payMoney>0}}">
26 <text>{{"¥"+items.payMoney}}</text> 26 <text>{{"¥"+items.payMoney}}</text>
27 </block> 27 </block>
@@ -34,19 +34,20 @@ @@ -34,19 +34,20 @@
34 <view>积分</view> 34 <view>积分</view>
35 </view> 35 </view>
36 </block> 36 </block>
37 - </view>  
38 - <view class="content_ware_price">  
39 - <text class="ellipsis-1">{{"原价:¥"+items.giftPosPrice}}</text>  
40 - </view>  
41 - <view class="content_ware_time">  
42 - <text class="ellipsis-1">{{"活动时间:"+items.endTime}}</text>  
43 - </view>  
44 </view> 37 </view>
45 - </view>  
46 - <view class="content_box_button">  
47 - <view class="box_button_remark">  
48 - <text>{{"已售:"+items.giftQty+"件"}}</text> 38 + <view class="content_ware_price">
  39 + <text class="ellipsis-1">{{"原价:¥"+items.giftPosPrice}}</text>
  40 + </view>
  41 + <view class="content_ware_time">
  42 + <text class="ellipsis-1">{{"活动时间:"+items.endTime}}</text>
49 </view> 43 </view>
  44 + </view>
  45 + </view>
  46 + <view class="content_box_button">
  47 + <view class="box_button_remark">
  48 + <text>{{"已售:"+items.giftQty+"件"}}</text>
  49 + </view>
  50 + <view class="flex-vertical">
50 <block wx:if="{{items.payMoney>0}}"> 51 <block wx:if="{{items.payMoney>0}}">
51 <view class="box_button_buy" bindtap="GetBuyPrice" data-id="{{items.lbId}}"> 52 <view class="box_button_buy" bindtap="GetBuyPrice" data-id="{{items.lbId}}">
52 <button>立即购买</button> 53 <button>立即购买</button>
@@ -59,8 +60,9 @@ @@ -59,8 +60,9 @@
59 </block> 60 </block>
60 </view> 61 </view>
61 </view> 62 </view>
  63 + </view>
62 </block> 64 </block>
63 - <block wx:if="{{isEmpty==true && wareCard.length<2}}"> 65 + <block wx:if="{{is_read && wareCard.length<1}}">
64 <view class="foot_empty"> 66 <view class="foot_empty">
65 <view> 67 <view>
66 <image src="{{iurl+'/miniapp/images/giftbag/gift07.png'}}" lazy-load="true"></image> 68 <image src="{{iurl+'/miniapp/images/giftbag/gift07.png'}}" lazy-load="true"></image>
@@ -73,10 +75,13 @@ @@ -73,10 +75,13 @@
73 </view> 75 </view>
74 </view> 76 </view>
75 </block> 77 </block>
76 - <view wx:if="{{is_read}}" class="foot_box">  
77 - <text>———— 到底了 ————</text>  
78 - </view> 78 + <!-- 加载完毕并且数据大于=页大小 -->
  79 + <view class="After_all flex-center" wx:if="{{ismore && wareCard.length>=3}}">
  80 + <view class="Line"></view>
  81 + <view class="end fs26">到底了</view>
  82 + <view class="Line"></view>
79 </view> 83 </view>
80 - <!-- 引入提示组件 -->  
81 - <warn id="warn"></warn>  
82 - <my_confirm id="my_confirm"></my_confirm>  
83 \ No newline at end of file 84 \ No newline at end of file
  85 +</view>
  86 +<!-- 引入提示组件 -->
  87 +<warn id="warn"></warn>
  88 +<my_confirm id="my_confirm"></my_confirm>
84 \ No newline at end of file 89 \ No newline at end of file
pages/giftpack/buygiftpack/giftpackbuy.wxss
@@ -29,6 +29,7 @@ page { @@ -29,6 +29,7 @@ page {
29 margin: 0rpx 20rpx 0rpx 20rpx; 29 margin: 0rpx 20rpx 0rpx 20rpx;
30 -webkit-align-content: center; 30 -webkit-align-content: center;
31 align-content: center; 31 align-content: center;
  32 + margin-bottom: 10rpx;
32 } 33 }
33 34
34 .top_title_box { 35 .top_title_box {
@@ -60,8 +61,9 @@ page { @@ -60,8 +61,9 @@ page {
60 61
61 .content_box { 62 .content_box {
62 background-color: #fff; 63 background-color: #fff;
63 - margin: 10rpx 20rpx 0rpx 20rpx; 64 + margin: 0rpx 20rpx;
64 border-radius: 10rpx; 65 border-radius: 10rpx;
  66 + margin-bottom: 10rpx;
65 } 67 }
66 68
67 .content_box_ware { 69 .content_box_ware {
@@ -149,7 +151,7 @@ page { @@ -149,7 +151,7 @@ page {
149 } 151 }
150 152
151 .box_button_remark { 153 .box_button_remark {
152 - margin-left: 5rpx; 154 +
153 } 155 }
154 156
155 .box_button_remark text { 157 .box_button_remark text {
@@ -162,24 +164,20 @@ page { @@ -162,24 +164,20 @@ page {
162 width: 160rpx; 164 width: 160rpx;
163 height: 50rpx; 165 height: 50rpx;
164 font-size: 20rpx; 166 font-size: 20rpx;
165 - background: #d41c34;  
166 - color: #fff; 167 + background: #fff;
  168 + color: #000;
167 line-height: 50rpx; 169 line-height: 50rpx;
168 } 170 }
169 171
170 -.box_button_dui {  
171 - text-align: right;  
172 - margin: 22rpx 25rpx 0rpx 0rpx;  
173 -}  
174 -  
175 .box_button_dui button { 172 .box_button_dui button {
176 display: inline-block; 173 display: inline-block;
177 width: 160rpx; 174 width: 160rpx;
178 height: 50rpx; 175 height: 50rpx;
179 font-size: 20rpx; 176 font-size: 20rpx;
180 - background: #fff;  
181 - color: #000; 177 + background: #d41c34;
  178 + color: #fff;
182 line-height: 50rpx; 179 line-height: 50rpx;
  180 + margin-left: 20rpx;
183 } 181 }
184 182
185 .foot_box { 183 .foot_box {
@@ -229,3 +227,17 @@ page { @@ -229,3 +227,17 @@ page {
229 font-size: 28rpx; 227 font-size: 28rpx;
230 color: #fff; 228 color: #fff;
231 } 229 }
  230 +.After_all {
  231 + height: 80rpx;
  232 + margin-bottom: 10rpx;
  233 + color: rgb(255, 255, 255);
  234 +}
  235 +
  236 +.After_all .Line {
  237 + border-top: 3rpx solid rgb(255, 255, 255);
  238 + width: 130rpx;
  239 +}
  240 +
  241 +.After_all .end {
  242 + margin: 0rpx 15rpx;
  243 +}
232 \ No newline at end of file 244 \ No newline at end of file
pages/giftpack/giftpacklist/giftpacklist.js
@@ -33,20 +33,26 @@ Page({ @@ -33,20 +33,26 @@ Page({
33 getGiftID: options.lbId, 33 getGiftID: options.lbId,
34 orderSn: options.orderSn 34 orderSn: options.orderSn
35 }) 35 })
36 - },  
37 - onShow: function() {  
38 - var th = this;  
39 - if (th.data.isBuy == 0) { 36 + if (options.isBuy == 0) {
40 th.GetMyGiftList(); 37 th.GetMyGiftList();
41 } else { 38 } else {
42 th.GetBuyGiftList(); 39 th.GetBuyGiftList();
43 } 40 }
44 -  
45 - // this.giftRemark = this.giftRemark.replace(/<p><img/gi, "<p class='img'><img");  
46 th.setData({ 41 th.setData({
47 giftRemark: th.data.giftRemark.replace(/<p><img/gi, "<p class='img'><img") 42 giftRemark: th.data.giftRemark.replace(/<p><img/gi, "<p class='img'><img")
48 }) 43 })
49 }, 44 },
  45 + onShow: function() {
  46 + // var th = this;
  47 + // if (th.data.isBuy == 0) {
  48 + // th.GetMyGiftList();
  49 + // } else {
  50 + // th.GetBuyGiftList();
  51 + // }
  52 + // th.setData({
  53 + // giftRemark: th.data.giftRemark.replace(/<p><img/gi, "<p class='img'><img")
  54 + // })
  55 + },
50 GetBuyPrice: function (e) { 56 GetBuyPrice: function (e) {
51 var that = this.data; 57 var that = this.data;
52 var th = this; 58 var th = this;
pages/giftpack/giftpacklist/giftpacklist.wxml
@@ -63,7 +63,7 @@ @@ -63,7 +63,7 @@
63 <text class="data-v-3a5b7e36"></text> 63 <text class="data-v-3a5b7e36"></text>
64 </view> 64 </view>
65 <view class="box_ware_item_qty data-v-3a5b7e36"> 65 <view class="box_ware_item_qty data-v-3a5b7e36">
66 - <text class="data-v-3a5b7e36">{{"数量:"+item.num}}</text> 66 + <text class="data-v-3a5b7e36 ellipsis-1">{{"数量:"+item.num}}</text>
67 </view> 67 </view>
68 <view class="box_ware_code data-v-3a5b7e36"> 68 <view class="box_ware_code data-v-3a5b7e36">
69 <block wx:if="{{isBuy==0&item.lbType==1}}"> 69 <block wx:if="{{isBuy==0&item.lbType==1}}">
@@ -71,7 +71,7 @@ @@ -71,7 +71,7 @@
71 </block> 71 </block>
72 <block wx:if="{{isBuy==0&item.lbType==2}}"> 72 <block wx:if="{{isBuy==0&item.lbType==2}}">
73 <image src="{{iurl+'/miniapp/images/giftbag/gift06.png'}}" bindtap="__e" class="data-v-3a5b7e36" lazy-load="true"></image> 73 <image src="{{iurl+'/miniapp/images/giftbag/gift06.png'}}" bindtap="__e" class="data-v-3a5b7e36" lazy-load="true"></image>
74 - </block> 74 + </block>
75 <block wx:if="{{isBuy==0&item.lbType==3}}"> 75 <block wx:if="{{isBuy==0&item.lbType==3}}">
76 <image src="{{iurl+'/miniapp/images/giftbag/gift06.png'}}" bindtap="__e" class="data-v-3a5b7e36" lazy-load="true"></image> 76 <image src="{{iurl+'/miniapp/images/giftbag/gift06.png'}}" bindtap="__e" class="data-v-3a5b7e36" lazy-load="true"></image>
77 </block> 77 </block>
pages/giftpack/mygiftpack/mygiftpack.js
  1 +var i = require("../../../utils/util.js")
1 var e = getApp(), 2 var e = getApp(),
2 a = e.globalData.setting, 3 a = e.globalData.setting,
3 os = a, 4 os = a,
@@ -6,20 +7,24 @@ var e = getApp(), @@ -6,20 +7,24 @@ var e = getApp(),
6 Page({ 7 Page({
7 data: { 8 data: {
8 iurl: a.imghost, //图片前缀网址 9 iurl: a.imghost, //图片前缀网址
9 - getDate: new Date().getTime(), 10 + getDate: "",
10 getStorageID: '', 11 getStorageID: '',
11 getUserID: '', 12 getUserID: '',
12 wareCard: [], 13 wareCard: [],
13 pages: 0, 14 pages: 0,
14 pageSize: 10, 15 pageSize: 10,
15 - isEmpty: true, 16 + isEmpty: false,
16 loadingType: 0, //定义加载方式 0---contentdown 1---contentrefresh 2---contentnomore 17 loadingType: 0, //定义加载方式 0---contentdown 1---contentrefresh 2---contentnomore
17 contentText: { 18 contentText: {
18 contentdown: '加载更多', 19 contentdown: '加载更多',
19 contentrefresh: '加载中...', 20 contentrefresh: '加载中...',
20 contentnomore: '已加载全部' 21 contentnomore: '已加载全部'
21 }, 22 },
22 - is_resad:0,//数据是否全部加载完成 23 + ismore:0,//数据是否全部加载完成
  24 + is_read:0,//是否查询过我的礼包接口
  25 + curpage: 1, //当前分页数
  26 + pageSize: 3, //页大小
  27 + total: 0, //总数量
23 }, 28 },
24 29
25 onLoad: function(options) { 30 onLoad: function(options) {
@@ -30,8 +35,9 @@ Page({ @@ -30,8 +35,9 @@ Page({
30 getStorageID: a.stoid, 35 getStorageID: a.stoid,
31 getUserID: d.user_id, 36 getUserID: d.user_id,
32 pages: 1, 37 pages: 1,
33 - pageSize: 10,  
34 - loadingType: 0 38 + pageSize: 3,
  39 + loadingType: 0,
  40 + getDate: i.formatTime(new Date().getTime())
35 }) 41 })
36 th.getList(); 42 th.getList();
37 }, 43 },
@@ -65,93 +71,91 @@ Page({ @@ -65,93 +71,91 @@ Page({
65 71
66 // }, 72 // },
67 getList: function() { 73 getList: function() {
68 - var _this = this; //上拉加载  
69 - var that = this.data;  
70 - if (that.loadingType != 0) {  
71 - return false;  
72 - }  
73 - // that.loadingType = 1;  
74 - _this.setData({  
75 - loadingType: 1  
76 - }) 74 + var th = this;
  75 + // if (th.data.loadingType) {
  76 + // return false;
  77 + // }
  78 + // // that.loadingType = 1;
  79 + // th.setData({
  80 + // loadingType: 1
  81 + // })
77 getApp().request.get('/api/weshop/marketing/my/giftbag/page', { 82 getApp().request.get('/api/weshop/marketing/my/giftbag/page', {
78 data: { 83 data: {
79 // "storeId": this.getStorageID, //商家ID 84 // "storeId": this.getStorageID, //商家ID
80 // "userId": this.getUserID, //用户ID 85 // "userId": this.getUserID, //用户ID
81 // "page": this.pages, 86 // "page": this.pages,
82 // "pageSize": this.pageSize 87 // "pageSize": this.pageSize
83 - "storeId": that.getStorageID, //商家ID  
84 - "userId": that.getUserID, //用户ID  
85 - "page": that.pages,  
86 - "pageSize": that.pageSize 88 + storeId: th.data.getStorageID, //商家ID
  89 + userId: th.data.getUserID, //用户ID
  90 + page: th.data.curpage,
  91 + pageSize: th.data.pageSize
87 }, 92 },
88 success: function success(res) { 93 success: function success(res) {
  94 + wx.hideLoading();
89 if (res.data.code == 0) { 95 if (res.data.code == 0) {
90 - console.log(res.data.data);  
91 - if (res.data.data.total > 0) {  
92 - // _this.isEmpty = false;  
93 - _this.setData({  
94 - isEmpty: false  
95 - })  
96 - } else {  
97 - // _this.isEmpty = true;  
98 - _this.setData({  
99 - isEmpty: true  
100 - })  
101 - }  
102 - if (res.data.data.pageData.length == 0) {  
103 - // _this.loadingType = 2;  
104 - _this.setData({  
105 - loadingType: 2  
106 - })  
107 - } else {  
108 - var wareCard = that.wareCard;  
109 - var is_resad = 0;  
110 - // if (_this.wareCard.length < res.data.data.pageData.length) {  
111 - if (wareCard.length < res.data.data.total) {  
112 - for (var i = 0; i < res.data.data.pageData.length; i++) {  
113 - wareCard.push(res.data.data.pageData[i]);  
114 - }  
115 - }else{  
116 - is_resad=1  
117 - }  
118 - _this.setData({  
119 - wareCard: wareCard,  
120 - is_resad: is_resad  
121 - })  
122 -  
123 - // _this.loadingType = 0;  
124 - _this.setData({  
125 - loadingType: 0  
126 - })  
127 - } 96 + th.data.curpage++;
  97 + var arr1 = th.data.wareCard;
  98 + var arr2 = res.data.data.pageData;
  99 + var arr3 = [...arr1, ...arr2];
  100 + var ismore = 0;
  101 + if (arr3.length == res.data.data.total) ismore = 1
  102 + th.setData({
  103 + wareCard: arr3,
  104 + total: res.data.data.total,
  105 + ismore: ismore,
  106 + is_read:1
  107 + }), wx.stopPullDownRefresh(); //停止下拉刷新
128 } else { 108 } else {
129 - 109 + th.setData({
  110 + is_read: 1
  111 + })
130 } 112 }
  113 + // if (res.data.code == 0) {
  114 + // if (res.data.data.total > 0) {
  115 + // // _this.isEmpty = false;
  116 + // _this.setData({
  117 + // isEmpty: false
  118 + // })
  119 + // } else {
  120 + // // _this.isEmpty = true;
  121 + // _this.setData({
  122 + // isEmpty: true
  123 + // })
  124 + // }
  125 + // if (res.data.data.pageData.length == 0) {
  126 + // // _this.loadingType = 2;
  127 + // _this.setData({
  128 + // loadingType: 2
  129 + // })
  130 + // } else {
  131 + // var wareCard = that.wareCard;
  132 + // var is_resad = 0;
  133 + // // if (_this.wareCard.length < res.data.data.pageData.length) {
  134 + // if (wareCard.length < res.data.data.total) {
  135 + // for (var i = 0; i < res.data.data.pageData.length; i++) {
  136 + // wareCard.push(res.data.data.pageData[i]);
  137 + // }
  138 + // }else{
  139 + // is_resad=1
  140 + // }
  141 + // _this.setData({
  142 + // wareCard: wareCard,
  143 + // is_resad: is_resad
  144 + // })
  145 +
  146 + // // _this.loadingType = 0;
  147 + // _this.setData({
  148 + // loadingType: 0
  149 + // })
  150 + // }
  151 + // } else {
  152 +
  153 + // }
131 } 154 }
  155 +
132 }); 156 });
133 157
134 }, 158 },
135 - TimeToDate: function(num) { //时间戳数据处理 是按秒来转换  
136 - var date = new Date(num * 1000);  
137 - //时间戳为10位需*1000,时间戳为13位的话不需乘1000  
138 - var y = date.getFullYear();  
139 - var MM = date.getMonth() + 1;  
140 - MM = MM < 10 ? '0' + MM : MM; //月补0  
141 - var d = date.getDate();  
142 - d = d < 10 ? '0' + d : d; //天补0  
143 - var h = date.getHours();  
144 - h = h < 10 ? '0' + h : h; //小时补0  
145 - var m = date.getMinutes();  
146 - m = m < 10 ? '0' + m : m; //分钟补0  
147 - var s = date.getSeconds();  
148 - s = s < 10 ? '0' + s : s; //秒补0  
149 - return y + '-' + MM + '-' + d + ' ' + h + ':' + m + ':' + s;  
150 - },  
151 - DateToTime: function DateToTime(TimeNum) { //时间转换成时间戳  
152 - var Time = new Date(TimeNum);  
153 - return Time.getTime() / 1000;  
154 - },  
155 //销毁界面跳转 159 //销毁界面跳转
156 redirectTo: function (e) { 160 redirectTo: function (e) {
157 var th = this; 161 var th = this;
@@ -168,6 +172,16 @@ Page({ @@ -168,6 +172,16 @@ Page({
168 wx.navigateTo({ 172 wx.navigateTo({
169 url: url, 173 url: url,
170 }) 174 })
171 - } 175 + },
  176 + //下拉事件
  177 + onReachBottom: function () {
  178 + var th = this;
  179 + if (th.data.total <= th.data.pageSize) return;
  180 + if (th.data.ismore) return;
  181 + wx.showLoading({
  182 + title: '加载中...',
  183 + })
  184 + th.getList();
  185 + },
172 186
173 }); 187 });
174 \ No newline at end of file 188 \ No newline at end of file
pages/giftpack/mygiftpack/mygiftpack.wxml
1 <view class="top_img"> 1 <view class="top_img">
2 <view class="top_img"> 2 <view class="top_img">
3 <!-- <image src="{{$GetInfo.imgHttp+'/miniapp/images/giftbag/gift00.jpg'}}"></image> --> 3 <!-- <image src="{{$GetInfo.imgHttp+'/miniapp/images/giftbag/gift00.jpg'}}"></image> -->
4 - <image src="{{iurl+'/miniapp/images/giftbag/gift00.jpg'}}"></image> 4 + <image src="{{iurl+'/miniapp/images/giftbag/gift00.jpg'}}" lazy-load="true"></image>
5 </view> 5 </view>
6 <view class="top_title"> 6 <view class="top_title">
7 <view class="top_title_box"> 7 <view class="top_title_box">
@@ -20,7 +20,7 @@ @@ -20,7 +20,7 @@
20 <image src="{{iurl+item.lbUrl}}" lazy-load="true"></image> 20 <image src="{{iurl+item.lbUrl}}" lazy-load="true"></image>
21 <block wx:if="{{item.actType!=0}}"> 21 <block wx:if="{{item.actType!=0}}">
22 <view class="{{[item.actType==1?'content_box_img_title content_box_img_ground1':item.actType==2?'content_box_img_title content_box_img_ground2':item.actType==4?'content_box_img_title content_box_img_ground3':'content_box_img_title content_box_img_ground4']}}"> 22 <view class="{{[item.actType==1?'content_box_img_title content_box_img_ground1':item.actType==2?'content_box_img_title content_box_img_ground2':item.actType==4?'content_box_img_title content_box_img_ground3':'content_box_img_title content_box_img_ground4']}}">
23 - <image src="{{iurl+'/miniapp/images/giftbag/gift01.png'}}"></image> 23 + <image src="{{iurl+'/miniapp/images/giftbag/gift01.png'}}" lazy-load="true"></image>
24 <!-- <block wx:if="{{item.$orig.actType==1}}"> --> 24 <!-- <block wx:if="{{item.$orig.actType==1}}"> -->
25 <block wx:if="{{item.actType==1}}"> 25 <block wx:if="{{item.actType==1}}">
26 <text>新人有礼</text> 26 <text>新人有礼</text>
@@ -71,10 +71,9 @@ @@ -71,10 +71,9 @@
71 <text>{{"原价:¥"+item.giftPosPrice}}</text> 71 <text>{{"原价:¥"+item.giftPosPrice}}</text>
72 </view> 72 </view>
73 <view class="content_ware_time"> 73 <view class="content_ware_time">
74 - <!-- <block wx:if="{{getDate>item.endTime}}"> -->  
75 - <!-- <text>{{"兑换截至日期:"+item.endTime}}</text> -->  
76 - <text>{{"兑换截至日期:"+getDate}}</text>  
77 - <!-- </block> --> 74 + <block wx:if="{{getDate>item.endTime}}">
  75 + <text>{{"兑换截至日期:"+item.endTime}}</text>
  76 + </block>
78 <block wx:if="{{getDate<item.starTime}}"> 77 <block wx:if="{{getDate<item.starTime}}">
79 <text>{{"距兑换开始时间: "+item.starTime}}</text> 78 <text>{{"距兑换开始时间: "+item.starTime}}</text>
80 </block> 79 </block>
@@ -86,7 +85,7 @@ @@ -86,7 +85,7 @@
86 </view> 85 </view>
87 </view> 86 </view>
88 </block> 87 </block>
89 - <block wx:if="{{isEmpty==true}}"> 88 + <block wx:if="{{is_read && wareCard.length<1}}">
90 <view class="foot_empty"> 89 <view class="foot_empty">
91 <view> 90 <view>
92 <image src="{{iurl+'/miniapp/images/giftbag/gift07.png'}}" lazy-load="true"></image> 91 <image src="{{iurl+'/miniapp/images/giftbag/gift07.png'}}" lazy-load="true"></image>
@@ -99,10 +98,16 @@ @@ -99,10 +98,16 @@
99 </view> 98 </view>
100 </view> 99 </view>
101 </block> 100 </block>
102 - <block wx:if="{{is_resad}}">  
103 - <view class="foot_box"> 101 + <block wx:if="{{ismore}}">
  102 + <!-- <view class="foot_box">
104 <text>———— 到底了 ————</text> 103 <text>———— 到底了 ————</text>
105 - </view> 104 + </view> -->
  105 + <!-- 加载完毕并且数据大于=页大小 -->
  106 + <view class="After_all flex-center" wx:if="{{ismore && wareCard.length>=3}}">
  107 + <view class="Line"></view>
  108 + <view class="end fs26">到底了</view>
  109 + <view class="Line"></view>
  110 + </view>
106 </block> 111 </block>
107 </view> 112 </view>
108 <!-- 引入提示组件 --> 113 <!-- 引入提示组件 -->
pages/giftpack/mygiftpack/mygiftpack.wxss
1 -  
2 -  
3 /*引用样式路径*/ 1 /*引用样式路径*/
4 @charset "UTF-8"; 2 @charset "UTF-8";
  3 +
5 /* Author XGQ 4 /* Author XGQ
6 * 2019-11-12 5 * 2019-11-12
7 */ 6 */
  7 +
8 .top_img { 8 .top_img {
9 - -webkit-align-content: center;  
10 - align-content: center; 9 + -webkit-align-content: center;
  10 + align-content: center;
11 } 11 }
  12 +
12 .top_img image { 13 .top_img image {
13 - width: 100%;  
14 - height: 660rpx; 14 + width: 100%;
  15 + height: 660rpx;
15 } 16 }
  17 +
16 .top_title { 18 .top_title {
17 - display: -webkit-box;  
18 - display: -webkit-flex;  
19 - display: flex;  
20 - background-color: #FFFFFF;  
21 - height: 85rpx;  
22 - border-radius: 10rpx 10rpx 0rpx 0rpx;  
23 - margin: 0rpx 20rpx 0rpx 20rpx;  
24 - -webkit-align-content: center;  
25 - align-content: center; 19 + display: -webkit-box;
  20 + display: -webkit-flex;
  21 + display: flex;
  22 + background-color: #fff;
  23 + height: 85rpx;
  24 + border-radius: 10rpx 10rpx 0rpx 0rpx;
  25 + margin: 0rpx 20rpx 0rpx 20rpx;
  26 + -webkit-align-content: center;
  27 + align-content: center;
  28 + margin-bottom: 10rpx;
26 } 29 }
  30 +
27 .top_title_box { 31 .top_title_box {
28 - width: 49%;  
29 - -webkit-align-content: center;  
30 - align-content: center;  
31 - text-align: center;  
32 - padding: 15rpx; 32 + width: 49%;
  33 + -webkit-align-content: center;
  34 + align-content: center;
  35 + text-align: center;
  36 + padding: 15rpx;
33 } 37 }
  38 +
34 .top_title_box_S { 39 .top_title_box_S {
35 - width: 1%;  
36 - -webkit-align-content: center;  
37 - align-content: center;  
38 - text-align: center;  
39 - margin: 20rpx 0rpx 20rpx 0rpx;  
40 - border-left: #000000 solid 3rpx; 40 + width: 1%;
  41 + -webkit-align-content: center;
  42 + align-content: center;
  43 + text-align: center;
  44 + margin: 20rpx 0rpx 20rpx 0rpx;
  45 + border-left: #000 solid 3rpx;
41 } 46 }
  47 +
42 .top_title_redtext { 48 .top_title_redtext {
43 - font-size: 30rpx;  
44 - color: #d61b30; 49 + font-size: 30rpx;
  50 + color: #d61b30;
45 } 51 }
  52 +
46 .top_title_blacktext { 53 .top_title_blacktext {
47 - font-size: 30rpx;  
48 - color: #000000; 54 + font-size: 30rpx;
  55 + color: #000;
49 } 56 }
  57 +
50 .content_box { 58 .content_box {
51 - background-color: #FFFFFF;  
52 - height: 375rpx;  
53 - margin: 10rpx 20rpx 0rpx 20rpx;  
54 - border-radius: 10rpx; 59 + background-color: #fff;
  60 + height: 375rpx;
  61 + margin: 0rpx 20rpx;
  62 + border-radius: 10rpx;
  63 + margin-bottom: 10rpx;
55 } 64 }
  65 +
56 .content_box_ware { 66 .content_box_ware {
57 - border-bottom: #f5f5f5 solid 2rpx;  
58 - display: -webkit-box;  
59 - display: -webkit-flex;  
60 - display: flex; 67 + border-bottom: #f5f5f5 solid 2rpx;
  68 + display: -webkit-box;
  69 + display: -webkit-flex;
  70 + display: flex;
61 } 71 }
  72 +
62 .content_box_img { 73 .content_box_img {
63 - margin: 20rpx 20rpx 20rpx 25rpx;  
64 - width: 35%;  
65 - display: -webkit-box;  
66 - display: -webkit-flex;  
67 - display: flex;  
68 - font-size: 8rpx;  
69 - position: relative; 74 + margin: 20rpx 20rpx 20rpx 25rpx;
  75 + width: 35%;
  76 + display: -webkit-box;
  77 + display: -webkit-flex;
  78 + display: flex;
  79 + font-size: 8rpx;
  80 + position: relative;
70 } 81 }
  82 +
71 .content_box_img image { 83 .content_box_img image {
72 - width: 100%;  
73 - height: 230rpx; 84 + width: 100%;
  85 + height: 230rpx;
74 } 86 }
  87 +
75 .content_box_img_title { 88 .content_box_img_title {
76 - position: absolute;  
77 - background: #D01119;  
78 - display: -webkit-box;  
79 - display: -webkit-flex;  
80 - display: flex;  
81 - padding: 8rpx;  
82 - border-radius: 0rpx 0rpx 10rpx 0rpx; 89 + position: absolute;
  90 + background: #d01119;
  91 + display: -webkit-box;
  92 + display: -webkit-flex;
  93 + display: flex;
  94 + padding: 8rpx;
  95 + border-radius: 0rpx 0rpx 10rpx 0rpx;
83 } 96 }
84 -.content_box_img_ground1{  
85 - background: #fb6451; 97 +
  98 +.content_box_img_ground1 {
  99 + background: #fb6451;
86 } 100 }
87 -.content_box_img_ground2{  
88 - background: #ffb72d; 101 +
  102 +.content_box_img_ground2 {
  103 + background: #ffb72d;
89 } 104 }
90 -.content_box_img_ground3{  
91 - background: #9be0e5; 105 +
  106 +.content_box_img_ground3 {
  107 + background: #9be0e5;
92 } 108 }
93 -.content_box_img_ground4{  
94 - background: #4784ef; 109 +
  110 +.content_box_img_ground4 {
  111 + background: #4784ef;
95 } 112 }
  113 +
96 .content_box_img_title image { 114 .content_box_img_title image {
97 - width: 30rpx;  
98 - height: 30rpx; 115 + width: 30rpx;
  116 + height: 30rpx;
99 } 117 }
  118 +
100 .content_box_img_title text { 119 .content_box_img_title text {
101 - font-size: 20rpx;  
102 - color: #FFFFFF;  
103 - line-height: 25rpx;  
104 - padding-top: 5rpx; 120 + font-size: 20rpx;
  121 + color: #fff;
  122 + line-height: 25rpx;
  123 + padding-top: 5rpx;
105 } 124 }
  125 +
106 .content_box_title { 126 .content_box_title {
107 - width: 65%;  
108 - margin: 25rpx 25rpx 10rpx 0rpx;  
109 - position: relative; 127 + width: 65%;
  128 + margin: 25rpx 25rpx 10rpx 0rpx;
  129 + position: relative;
110 } 130 }
  131 +
111 .content_ware_title { 132 .content_ware_title {
112 - font-size: 30rpx;  
113 - word-break: break-all;  
114 - /*属性规定自动换行的处理方法。normal(使用浏览器默认的换行规则。),break-all(允许在单词内换行。),keep-all(只能在半角空格或连字符处换行。)*/  
115 - text-overflow: ellipsis;  
116 - display: -webkit-box;  
117 - /** 对象作为伸缩盒子模型显示 **/  
118 - -webkit-box-orient: vertical;  
119 - /** 设置或检索伸缩盒对象的子元素的排列方式 **/  
120 - -webkit-line-clamp: 2;  
121 - /** 显示的行数 **/  
122 - overflow: hidden;  
123 - /** 隐藏超出的内容 **/ 133 + font-size: 30rpx;
  134 + word-break: break-all;
  135 + /*属性规定自动换行的处理方法。normal(使用浏览器默认的换行规则。),break-all(允许在单词内换行。),keep-all(只能在半角空格或连字符处换行。)*/
  136 + text-overflow: ellipsis;
  137 + display: -webkit-box;
  138 + /** 对象作为伸缩盒子模型显示 **/
  139 + -webkit-box-orient: vertical;
  140 + /** 设置或检索伸缩盒对象的子元素的排列方式 **/
  141 + -webkit-line-clamp: 2;
  142 + /** 显示的行数 **/
  143 + overflow: hidden;
  144 + /** 隐藏超出的内容 **/
124 } 145 }
  146 +
125 .content_ware_type { 147 .content_ware_type {
126 - font-size: 28rpx;  
127 - color: #c61a34;  
128 - margin-top: 10rpx;  
129 - position: absolute;  
130 - left: 0;  
131 - bottom: 100rpx; 148 + font-size: 28rpx;
  149 + color: #c61a34;
  150 + margin-top: 10rpx;
  151 + position: absolute;
  152 + left: 0;
  153 + bottom: 100rpx;
132 } 154 }
  155 +
133 .content_ware_price { 156 .content_ware_price {
134 - font-size: 20rpx;  
135 - color: #b9b5b5;  
136 - margin-top: 2rpx;  
137 - text-decoration: line-through;  
138 - position: absolute;  
139 - left: 0;  
140 - bottom: 70rpx; 157 + font-size: 20rpx;
  158 + color: #b9b5b5;
  159 + margin-top: 2rpx;
  160 + text-decoration: line-through;
  161 + position: absolute;
  162 + left: 0;
  163 + bottom: 70rpx;
141 } 164 }
  165 +
142 .content_ware_time { 166 .content_ware_time {
143 - font-size: 25rpx;  
144 - color: #c61a34;  
145 - margin-top: 20rpx;  
146 - position: absolute;  
147 - left: 0;  
148 - bottom: 25rpx; 167 + font-size: 25rpx;
  168 + color: #c61a34;
  169 + margin-top: 20rpx;
  170 + position: absolute;
  171 + left: 0;
  172 + bottom: 25rpx;
149 } 173 }
  174 +
150 .content_box_button { 175 .content_box_button {
151 - text-align: right;  
152 - margin: 20rpx 25rpx 20rpx 20rpx; 176 + text-align: right;
  177 + margin: 20rpx 25rpx 20rpx 20rpx;
153 } 178 }
  179 +
154 .content_box_button button { 180 .content_box_button button {
155 - display: inline-block;  
156 - width: 160rpx;  
157 - height: 50rpx;  
158 - font-size: 25rpx;  
159 - background: #d41c34;  
160 - color: #FFFFFF;  
161 - line-height: 50rpx; 181 + display: inline-block;
  182 + width: 160rpx;
  183 + height: 50rpx;
  184 + font-size: 25rpx;
  185 + background: #d41c34;
  186 + color: #fff;
  187 + line-height: 50rpx;
162 } 188 }
  189 +
163 .foot_box { 190 .foot_box {
164 - -webkit-align-content: center;  
165 - align-content: center;  
166 - text-align: center;  
167 - margin-top: 15rpx;  
168 - margin-bottom: 50rpx; 191 + -webkit-align-content: center;
  192 + align-content: center;
  193 + text-align: center;
  194 + margin-top: 15rpx;
  195 + margin-bottom: 50rpx;
169 } 196 }
  197 +
170 .foot_box text { 198 .foot_box text {
171 - font-size: 25rpx;  
172 - color: #FFFFFF;  
173 -}  
174 -.foot_empty{  
175 - background-color: #FFFFFF;  
176 - height: 375rpx;  
177 - margin: 10rpx 20rpx 0rpx 20rpx;  
178 - border-radius: 10rpx;  
179 - text-align: center;  
180 - padding: 150rpx 0rpx 300rpx 0rpx;  
181 - -webkit-box-pack: center;  
182 - -webkit-justify-content: center;  
183 - justify-content: center;  
184 -}  
185 -.foot_empty image{  
186 - width: 400rpx;  
187 - height: 273rpx;  
188 -}  
189 -.foot_empty text{  
190 - font-size: 30rpx;  
191 - color: #999999;  
192 -}  
193 -.foot_empty_button{  
194 - background: #ff6363;  
195 - margin: 60rpx 230rpx 0rpx 230rpx;  
196 - padding: 10rpx;  
197 - border-radius: 70rpx;  
198 - line-height: 40rpx;  
199 -}  
200 -.foot_empty_button text{  
201 - font-size: 28rpx;  
202 - color: #FFFFFF; 199 + font-size: 25rpx;
  200 + color: #fff;
  201 +}
  202 +
  203 +.foot_empty {
  204 + background-color: #fff;
  205 + height: 375rpx;
  206 + margin: 10rpx 20rpx 0rpx 20rpx;
  207 + border-radius: 10rpx;
  208 + text-align: center;
  209 + padding: 150rpx 0rpx 300rpx 0rpx;
  210 + -webkit-box-pack: center;
  211 + -webkit-justify-content: center;
  212 + justify-content: center;
203 } 213 }
  214 +
  215 +.foot_empty image {
  216 + width: 400rpx;
  217 + height: 273rpx;
  218 +}
  219 +
  220 +.foot_empty text {
  221 + font-size: 30rpx;
  222 + color: #999;
  223 +}
  224 +
  225 +.foot_empty_button {
  226 + background: #ff6363;
  227 + margin: 60rpx 230rpx 0rpx 230rpx;
  228 + padding: 10rpx;
  229 + border-radius: 70rpx;
  230 + line-height: 40rpx;
  231 +}
  232 +
  233 +.foot_empty_button text {
  234 + font-size: 28rpx;
  235 + color: #fff;
  236 +}
  237 +
204 page { 238 page {
205 - background-color: #fb7454; 239 + background-color: #fb7454;
  240 +}
  241 +.After_all {
  242 + height: 80rpx;
  243 + margin-bottom: 10rpx;
  244 + color: rgb(255, 255, 255);
  245 +}
  246 +
  247 +.After_all .Line {
  248 + border-top: 3rpx solid rgb(255, 255, 255);
  249 + width: 130rpx;
  250 +}
  251 +
  252 +.After_all .end {
  253 + margin: 0rpx 15rpx;
206 } 254 }
pages/user/index/index.wxml
@@ -216,14 +216,12 @@ @@ -216,14 +216,12 @@
216 <image class="xc-center-img " src="{{iurl}}/miniapp/images/yyservice/myservice.png"></image> 216 <image class="xc-center-img " src="{{iurl}}/miniapp/images/yyservice/myservice.png"></image>
217 <view class="four-level-word">我的服务</view> 217 <view class="four-level-word">我的服务</view>
218 </view> 218 </view>
219 - <view class="item t-c" data-url="/pages/giftpack/buygiftpack/giftpackbuy" bindtap="goto"> 219 + <view class="item t-c" data-url="/pages/giftpack/mygiftpack/mygiftpack" bindtap="goto">
220 <image class="xc-center-img " src="{{iurl}}/miniapp/images/yyservice/myservice.png"></image> 220 <image class="xc-center-img " src="{{iurl}}/miniapp/images/yyservice/myservice.png"></image>
221 <view class="four-level-word">我的礼包</view> 221 <view class="four-level-word">我的礼包</view>
222 </view> 222 </view>
223 </view> 223 </view>
224 224
225 -  
226 -  
227 </view> 225 </view>
228 </view> 226 </view>
229 <view style='width:100%;height:73rpx;'> 227 <view style='width:100%;height:73rpx;'>