|  | @@ -29,10 +29,13 @@ Page({ | 
														
													
														
															
																|  |  | loading: true, |  |  | loading: true, | 
														
													
														
															
																|  |  | content: '数据正在加载中', |  |  | content: '数据正在加载中', | 
														
													
														
															
																|  |  | reloadIf: false, |  |  | reloadIf: false, | 
														
													
														
															
																|  |  | creditAmount: 0, |  |  |  | 
														
													
														
															
																|  |  |  |  |  | creditAmount: '', | 
														
													
														
															
																|  |  | score: '0', |  |  | score: '0', | 
														
													
														
															
																|  |  | sort:'', |  |  | sort:'', | 
														
													
														
															
																|  |  | hidden:false, |  |  | hidden:false, | 
														
													
														
															
																|  |  |  |  |  | userCredit:'', | 
														
													
														
															
																|  |  |  |  |  | sortColumn:'', | 
														
													
														
															
																|  |  |  |  |  | sortOrder:'' | 
														
													
														
															
																|  |  | }, |  |  | }, | 
														
													
														
															
																|  |  | qrcodeH: function () { |  |  | qrcodeH: function () { | 
														
													
														
															
																|  |  | var that = this; |  |  | var that = this; | 
														
													
												
													
														
															
																|  | @@ -155,8 +158,6 @@ Page({ | 
														
													
														
															
																|  |  | clearTimeout(st); |  |  | clearTimeout(st); | 
														
													
														
															
																|  |  | }, 1000) |  |  | }, 1000) | 
														
													
														
															
																|  |  | }, |  |  | }, | 
														
													
														
															
																|  |  | 
 |  |  |  | 
														
													
														
															
																|  |  | 
 |  |  |  | 
														
													
														
															
																|  |  | // 获得积分,渲染页面 |  |  | // 获得积分,渲染页面 | 
														
													
														
															
																|  |  | getPoints(){ |  |  | getPoints(){ | 
														
													
														
															
																|  |  | let that = this; |  |  | let that = this; | 
														
													
												
													
														
															
																|  | @@ -189,33 +190,49 @@ Page({ | 
														
													
														
															
																|  |  | }, |  |  | }, | 
														
													
														
															
																|  |  | //我可换购 |  |  | //我可换购 | 
														
													
														
															
																|  |  | canSort(){ |  |  | canSort(){ | 
														
													
														
															
																|  |  | 
 |  |  |  | 
														
													
														
															
																|  |  |  |  |  | let that = this; | 
														
													
														
															
																|  |  |  |  |  | if (that.data.creditAmount !== 0){ | 
														
													
														
															
																|  |  |  |  |  | that.setData({ | 
														
													
														
															
																|  |  |  |  |  | userCredit: that.data.creditAmount, | 
														
													
														
															
																|  |  |  |  |  | }) | 
														
													
														
															
																|  |  |  |  |  | that.getList(1) | 
														
													
														
															
																|  |  |  |  |  | } | 
														
													
														
															
																|  |  |  |  |  | if (that.data.creditAmount == 0){ | 
														
													
														
															
																|  |  |  |  |  | wx.showToast({ | 
														
													
														
															
																|  |  |  |  |  | title: '快去补充积分吧!', | 
														
													
														
															
																|  |  |  |  |  | icon: 'none', | 
														
													
														
															
																|  |  |  |  |  | duration: 2000, | 
														
													
														
															
																|  |  |  |  |  | mask: false | 
														
													
														
															
																|  |  |  |  |  | }); | 
														
													
														
															
																|  |  |  |  |  | } | 
														
													
														
															
																|  |  | }, |  |  | }, | 
														
													
														
															
																|  |  |  |  |  |  | 
														
													
														
															
																|  |  | //所需积分 |  |  | //所需积分 | 
														
													
														
															
																|  |  | need: function () { |  |  | need: function () { | 
														
													
														
															
																|  |  | console.log(this.data.hidden) |  |  |  | 
														
													
														
															
																|  |  | var that = this; |  |  | var that = this; | 
														
													
														
															
																|  |  | var hid = this.data.hidden; |  |  | var hid = this.data.hidden; | 
														
													
														
															
																|  |  | if (hid == true) { |  |  | if (hid == true) { | 
														
													
														
															
																|  |  | hid = false; |  |  | hid = false; | 
														
													
														
															
																|  |  | that.setData({ |  |  | that.setData({ | 
														
													
														
															
																|  |  | sort :imgurl.up.url |  |  |  | 
														
													
														
															
																|  |  |  |  |  | sort :imgurl.up.url, | 
														
													
														
															
																|  |  |  |  |  | sortOrder: 'desc', | 
														
													
														
															
																|  |  |  |  |  | sortColumn: 'creditPrice' | 
														
													
														
															
																|  |  | }) |  |  | }) | 
														
													
														
															
																|  |  | that.getList(1, 'creditPrice', 'desc') |  |  |  | 
														
													
														
															
																|  |  |  |  |  | that.getList(1) | 
														
													
														
															
																|  |  | } |  |  | } | 
														
													
														
															
																|  |  | else { |  |  | else { | 
														
													
														
															
																|  |  | hid = true; |  |  | hid = true; | 
														
													
														
															
																|  |  | that.setData({ |  |  | that.setData({ | 
														
													
														
															
																|  |  | sort: imgurl.down.url |  |  |  | 
														
													
														
															
																|  |  |  |  |  | sort: imgurl.down.url, | 
														
													
														
															
																|  |  |  |  |  | sortOrder: 'asc', | 
														
													
														
															
																|  |  |  |  |  | sortColumn: 'creditPrice' | 
														
													
														
															
																|  |  | }) |  |  | }) | 
														
													
														
															
																|  |  | that.getList(1, 'creditPrice', 'asc') |  |  |  | 
														
													
														
															
																|  |  |  |  |  | that.getList(1) | 
														
													
														
															
																|  |  | } |  |  | } | 
														
													
														
															
																|  |  | this.setData({ |  |  | this.setData({ | 
														
													
														
															
																|  |  | hidden: hid // 改变状态 |  |  | hidden: hid // 改变状态 | 
														
													
														
															
																|  |  | }) |  |  | }) | 
														
													
														
															
																|  |  | }, |  |  | }, | 
														
													
														
															
																|  |  | getList(pageNum, sortColumn, sortOrder) { |  |  |  | 
														
													
														
															
																|  |  |  |  |  | getList(pageNum) { | 
														
													
														
															
																|  |  | var that = this; |  |  | var that = this; | 
														
													
														
															
																|  |  | if (that.data.allow_load) { |  |  | if (that.data.allow_load) { | 
														
													
														
															
																|  |  | that.setData({ |  |  | that.setData({ | 
														
													
												
													
														
															
																|  | @@ -226,8 +243,9 @@ Page({ | 
														
													
														
															
																|  |  | pageNum: pageNum, |  |  | pageNum: pageNum, | 
														
													
														
															
																|  |  | pageSize: 10, |  |  | pageSize: 10, | 
														
													
														
															
																|  |  | targetAd: 50, |  |  | targetAd: 50, | 
														
													
														
															
																|  |  | sortColumn: sortColumn, |  |  |  | 
														
													
														
															
																|  |  | sortOrder: sortOrder |  |  |  | 
														
													
														
															
																|  |  |  |  |  | sortColumn: that.data.sortColumn, | 
														
													
														
															
																|  |  |  |  |  | sortOrder: that.data.sortOrder, | 
														
													
														
															
																|  |  |  |  |  | userCredit: that.data.userCredit | 
														
													
														
															
																|  |  | }; |  |  | }; | 
														
													
														
															
																|  |  | var url = config.api.couponChannelList; |  |  | var url = config.api.couponChannelList; | 
														
													
														
															
																|  |  | // 请求接口 |  |  | // 请求接口 | 
														
													
												
													
														
															
																|  | @@ -236,8 +254,6 @@ Page({ | 
														
													
														
															
																|  |  | data: param, |  |  | data: param, | 
														
													
														
															
																|  |  | }).then(res => { |  |  | }).then(res => { | 
														
													
														
															
																|  |  | console.log(res) |  |  | console.log(res) | 
														
													
														
															
																|  |  | console.log(this.data.creditAmount) |  |  |  | 
														
													
														
															
																|  |  |  |  |  |  | 
														
													
														
															
																|  |  | /** |  |  | /** | 
														
													
														
															
																|  |  | * 加载完成 |  |  | * 加载完成 | 
														
													
														
															
																|  |  | */ |  |  | */ | 
														
													
												
													
														
															
																|  | @@ -267,12 +283,6 @@ Page({ | 
														
													
														
															
																|  |  | that.setData({ |  |  | that.setData({ | 
														
													
														
															
																|  |  | lists: tmpArr |  |  | lists: tmpArr | 
														
													
														
															
																|  |  | }) |  |  | }) | 
														
													
														
															
																|  |  | // tmpArr.map(file => { |  |  |  | 
														
													
														
															
																|  |  | //   if (file.creditPrice <= that.data.creditAmount) { |  |  |  | 
														
													
														
															
																|  |  | //     that.data.arrays.push(file); |  |  |  | 
														
													
														
															
																|  |  | //   } |  |  |  | 
														
													
														
															
																|  |  | // }) |  |  |  | 
														
													
														
															
																|  |  | // console.log(that.data.arrays) |  |  |  | 
														
													
														
															
																|  |  | wx.stopPullDownRefresh(); |  |  | wx.stopPullDownRefresh(); | 
														
													
														
															
																|  |  | }) |  |  | }) | 
														
													
														
															
																|  |  | .catch(err => { |  |  | .catch(err => { | 
														
													
												
													
														
															
																|  | @@ -328,11 +338,14 @@ Page({ | 
														
													
														
															
																|  |  | */ |  |  | */ | 
														
													
														
															
																|  |  | onPullDownRefresh: function (e) { |  |  | onPullDownRefresh: function (e) { | 
														
													
														
															
																|  |  | let that = this; |  |  | let that = this; | 
														
													
														
															
																|  |  | that.getList(1); |  |  |  | 
														
													
														
															
																|  |  | that.getPoints(); |  |  |  | 
														
													
														
															
																|  |  | that.setData({ |  |  | that.setData({ | 
														
													
														
															
																|  |  | sort : '' |  |  |  | 
														
													
														
															
																|  |  |  |  |  | sort: '', | 
														
													
														
															
																|  |  |  |  |  | sortColumn: '', | 
														
													
														
															
																|  |  |  |  |  | sortOrder: '', | 
														
													
														
															
																|  |  |  |  |  | userCredit: '' | 
														
													
														
															
																|  |  | }) |  |  | }) | 
														
													
														
															
																|  |  |  |  |  | that.getList(1); | 
														
													
														
															
																|  |  |  |  |  | that.getPoints(); | 
														
													
														
															
																|  |  |  |  |  |  | 
														
													
														
															
																|  |  | } |  |  | } | 
														
													
														
															
																|  |  | }) |  |  | }) |