Commit f214b6fc9d5db43c96d018f3de6bd135dadcb8cb

Authored by vking
1 parent 426e029f

商家红包活动

@@ -14,14 +14,14 @@ Page({ @@ -14,14 +14,14 @@ Page({
14 * 生命周期函数--监听页面加载 14 * 生命周期函数--监听页面加载
15 */ 15 */
16 onLoad: function (options) { 16 onLoad: function (options) {
17 - this.GetUserCard() 17 + //this.GetUserCard()
18 }, 18 },
19 19
20 /** 20 /**
21 * 生命周期函数--监听页面初次渲染完成 21 * 生命周期函数--监听页面初次渲染完成
22 */ 22 */
23 onReady: function () { 23 onReady: function () {
24 - 24 + this.selectComponent('#getpos').getPos();
25 }, 25 },
26 26
27 /** 27 /**
@@ -56,14 +56,30 @@ Page({ @@ -56,14 +56,30 @@ Page({
56 * 页面上拉触底事件的处理函数 56 * 页面上拉触底事件的处理函数
57 */ 57 */
58 onReachBottom: function () { 58 onReachBottom: function () {
  59 + if(this.hasMore){
  60 + this.page+=1;
  61 + this.GetUserCard()
  62 + }
59 63
60 }, 64 },
  65 + page:1,
  66 + size:10,
  67 + hasMore:true,
61 GetUserCard(){ 68 GetUserCard(){
62 App.Customer.GetUserCard({ 69 App.Customer.GetUserCard({
  70 + page:this.page,
  71 + size:this.size,
63 status:0, 72 status:0,
  73 + lat:this.location.latitude,
  74 + lng:this.location.longitude,
64 }).then(res=> { 75 }).then(res=> {
  76 + let list=this.data.list
  77 + list=list.concat(res.data)
  78 + if(res.data.length<this.size){
  79 + this.hasMore=false;
  80 + }
65 this.setData({ 81 this.setData({
66 - list: res.data 82 + list: list
67 }) 83 })
68 }) 84 })
69 }, 85 },
@@ -77,9 +93,9 @@ Page({ @@ -77,9 +93,9 @@ Page({
77 //lat=39.62420161&lng=118.1174469&multiIndex=0&centre_pos=39.62420161,118.1174469&hasSuggestion= 93 //lat=39.62420161&lng=118.1174469&multiIndex=0&centre_pos=39.62420161,118.1174469&hasSuggestion=
78 wx.navigateTo({ 94 wx.navigateTo({
79 url: util.http_build_query({ 95 url: util.http_build_query({
80 - lat:34.216529,  
81 - lng:108.894677,  
82 - centre_pos:'34.216529,108.894677', 96 + lat:this.location.latitude,
  97 + lng:this.location.longitude,
  98 + centre_pos:`${this.location.latitude},${this.location.longitude}`,
83 keyword:' ', 99 keyword:' ',
84 isopen_md:1, 100 isopen_md:1,
85 multiIndex:0, 101 multiIndex:0,
@@ -87,4 +103,10 @@ Page({ @@ -87,4 +103,10 @@ Page({
87 }) 103 })
88 } 104 }
89 }, 105 },
  106 + location:null,
  107 + onpos(e){
  108 + console.log('onpos',e);
  109 + this.location=e.detail
  110 + this.GetUserCard();
  111 + },
90 }) 112 })
@@ -4,6 +4,7 @@ @@ -4,6 +4,7 @@
4 "navigationBarTextStyle":"black", 4 "navigationBarTextStyle":"black",
5 "usingComponents": { 5 "usingComponents": {
6 "nav":"/components/nav/nav", 6 "nav":"/components/nav/nav",
7 - "quan":"/components/reserve/seller/quan" 7 + "quan":"/components/reserve/seller/quan",
  8 + "getpos":"/components/userinfo/getpos"
8 } 9 }
9 } 10 }
@@ -31,3 +31,4 @@ @@ -31,3 +31,4 @@
31 <view class="more"></view> 31 <view class="more"></view>
32 </view> 32 </view>
33 </navigator> 33 </navigator>
  34 +<getpos bindpos="onpos" id="getpos" hasAllowFail hasAllowLoading="{{false}}"></getpos>
@@ -120,7 +120,7 @@ Page({ @@ -120,7 +120,7 @@ Page({
120 this.param={ 120 this.param={
121 lat_extend:mapParam.lat, 121 lat_extend:mapParam.lat,
122 lng_extend:mapParam.lng, 122 lng_extend:mapParam.lng,
123 - keyword:mapParam.keyword, 123 + keyword:mapParam.keyword.trim(),
124 offset:this.offset, 124 offset:this.offset,
125 size:this.size, 125 size:this.size,
126 distance:500000, 126 distance:500000,
@@ -128,9 +128,6 @@ Page({ @@ -128,9 +128,6 @@ Page({
128 if(mapParam.lat){ 128 if(mapParam.lat){
129 this.param.centre_pos=`${mapParam.lat},${mapParam.lng}` 129 this.param.centre_pos=`${mapParam.lat},${mapParam.lng}`
130 } 130 }
131 - if(this.param.keyword=" "){  
132 - delete this.param.keyword  
133 - }  
134 if(mapParam.isopen_md){ 131 if(mapParam.isopen_md){
135 this.param.isopen_md=1 132 this.param.isopen_md=1
136 } 133 }