diff --git a/pages/user/my_service/my_service.js b/pages/user/my_service/my_service.js index db5e677..8d3cd45 100644 --- a/pages/user/my_service/my_service.js +++ b/pages/user/my_service/my_service.js @@ -1,7 +1,8 @@ var e = getApp(), a = e.globalData.setting, os = a, - t = e.request; + t = e.request, + d = e.globalData; Page({ /** @@ -13,13 +14,14 @@ Page({ content: "请将二维码展示给核销员,服务更快捷!" }, iurl: a.imghost, - defimgurl:"/miniapp/images/yyservice/yyxmdefault.jpg", - service_List: null, //服务项目列表 + defimgurl: "/miniapp/images/yyservice/yyxmdefault.jpg", + service_List: [], //服务项目列表 is_service_read: 0, - curpage: 1, + curpage: 1, //当前分页数 + pageSize: 8, //页大小 total: 0, - ismore: 0, - userinfo: null + ismore: 0, //是否加载完毕 + userinfo: null, }, /** @@ -44,42 +46,36 @@ Page({ th.query_service(); }, onReachBottom: function() { - if (this.data.total <= 8) return; + var th = this; + if (this.data.total <= th.data.pageSize) return; if (this.data.ismore) return; this.query_service(); }, //查询服务项目列表 query_service: function() { var th = this; - var url = "http://172.20.0.13:8085/api/weshop/marketing/reservation/marketing/sm/list"; - wx.request({ - url: url, + var url = "/api/weshop/marketing/reservation/sm/page"; + getApp().request.promiseGet(url, { data: { - storeId: 1, - userId: 5682130 - }, - success: function(res) { - if (res.data.code == 0) { - - // th.data.curpage++; - // var arr1 = th.data.service_List; - // var arr2 = res.data.data.pageData; - // var arr3 = [...arr1, ...arr2]; - - // var ismore = 0; - // if (arr3.length == res.data.data.total) ismore = 1 - - // th.setData({ - // service_List: arr3, - // total: res.data.data.total, - // ismore: ismore, - // is_service_read: 1 - // }), wx.stopPullDownRefresh(); //停止下拉刷新 - - th.setData({ - service_List: res.data.data - }) - } + storeId: a.stoid, + userId: d.user_id, + page: th.data.curpage, + pageSize: th.data.pageSize + } + }).then(res => { + if (res.data.code == 0) { + th.data.curpage++; + var arr1 = th.data.service_List; + var arr2 = res.data.data.pageData; + var arr3 = [...arr1, ...arr2]; + var ismore = 0; + if (arr3.length == res.data.data.total) ismore = 1 + th.setData({ + service_List: arr3, + total: res.data.data.total, + ismore: ismore, + is_service_read: 1 + }), wx.stopPullDownRefresh(); //停止下拉刷新 } }) }, @@ -120,7 +116,7 @@ Page({ return fm; }, //跳转到首页 - goto:function(e){ + goto: function(e) { var url = e.currentTarget.dataset.url; getApp().goto(url); } diff --git a/pages/user/my_service/my_service.wxml b/pages/user/my_service/my_service.wxml index 6f9ebb4..4fea269 100644 --- a/pages/user/my_service/my_service.wxml +++ b/pages/user/my_service/my_service.wxml @@ -6,7 +6,7 @@ - + @@ -25,7 +25,7 @@ - + @@ -57,7 +57,7 @@ - +