diff --git a/pages/integralmall/index.js b/pages/integralmall/index.js
index 97ab08b..eff9292 100644
--- a/pages/integralmall/index.js
+++ b/pages/integralmall/index.js
@@ -29,10 +29,13 @@ Page({
loading: true,
content: '数据正在加载中',
reloadIf: false,
- creditAmount: 0,
+ creditAmount: '',
score: '0',
sort:'',
hidden:false,
+ userCredit:'',
+ sortColumn:'',
+ sortOrder:''
},
qrcodeH: function () {
var that = this;
@@ -155,8 +158,6 @@ Page({
clearTimeout(st);
}, 1000)
},
-
-
// 获得积分,渲染页面
getPoints(){
let that = this;
@@ -189,33 +190,49 @@ Page({
},
//我可换购
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 () {
- console.log(this.data.hidden)
var that = this;
var hid = this.data.hidden;
if (hid == true) {
hid = false;
that.setData({
- sort :imgurl.up.url
+ sort :imgurl.up.url,
+ sortOrder: 'desc',
+ sortColumn: 'creditPrice'
})
- that.getList(1, 'creditPrice', 'desc')
+ that.getList(1)
}
else {
hid = true;
that.setData({
- sort: imgurl.down.url
+ sort: imgurl.down.url,
+ sortOrder: 'asc',
+ sortColumn: 'creditPrice'
})
- that.getList(1, 'creditPrice', 'asc')
+ that.getList(1)
}
this.setData({
hidden: hid // 改变状态
})
},
- getList(pageNum, sortColumn, sortOrder) {
+ getList(pageNum) {
var that = this;
if (that.data.allow_load) {
that.setData({
@@ -226,8 +243,9 @@ Page({
pageNum: pageNum,
pageSize: 10,
targetAd: 50,
- sortColumn: sortColumn,
- sortOrder: sortOrder
+ sortColumn: that.data.sortColumn,
+ sortOrder: that.data.sortOrder,
+ userCredit: that.data.userCredit
};
var url = config.api.couponChannelList;
// 请求接口
@@ -236,8 +254,6 @@ Page({
data: param,
}).then(res => {
console.log(res)
- console.log(this.data.creditAmount)
-
/**
* 加载完成
*/
@@ -267,12 +283,6 @@ Page({
that.setData({
lists: tmpArr
})
- // tmpArr.map(file => {
- // if (file.creditPrice <= that.data.creditAmount) {
- // that.data.arrays.push(file);
- // }
- // })
- // console.log(that.data.arrays)
wx.stopPullDownRefresh();
})
.catch(err => {
@@ -328,11 +338,14 @@ Page({
*/
onPullDownRefresh: function (e) {
let that = this;
- that.getList(1);
- that.getPoints();
that.setData({
- sort : ''
+ sort: '',
+ sortColumn: '',
+ sortOrder: '',
+ userCredit: ''
})
+ that.getList(1);
+ that.getPoints();
}
})
\ No newline at end of file
diff --git a/pages/integralmall/index.wxml b/pages/integralmall/index.wxml
index 1ab73b0..f58940e 100644
--- a/pages/integralmall/index.wxml
+++ b/pages/integralmall/index.wxml
@@ -37,10 +37,7 @@
-
-
- 暂无数据
-
+
我可换购
@@ -48,6 +45,10 @@
+
+
+ 暂无数据
+