|
|
@@ -29,9 +29,11 @@ Page({ |
|
|
|
}, |
|
|
|
onShow: function() { |
|
|
|
let that = this; |
|
|
|
if (that.data.current_scroll==4){ |
|
|
|
console.log("onShow") |
|
|
|
console.log(that.data.current_scroll) |
|
|
|
if (that.data.current_scroll == "4") { |
|
|
|
that.getList(4, 1); |
|
|
|
}else{ |
|
|
|
} else { |
|
|
|
that.getList('5,6,7', 1); |
|
|
|
} |
|
|
|
wx.setStorage({ |
|
|
@@ -42,7 +44,7 @@ Page({ |
|
|
|
index: 2 |
|
|
|
}) |
|
|
|
}, |
|
|
|
userule:function(){ |
|
|
|
userule: function() { |
|
|
|
wx.navigateTo({ |
|
|
|
url: '/pages/cardorder/userule/userule', |
|
|
|
}) |
|
|
@@ -52,15 +54,15 @@ Page({ |
|
|
|
let that = this; |
|
|
|
wx.scanCode({ |
|
|
|
success: (res) => { |
|
|
|
console.log(JSON.parse(res.result).merchant_id) |
|
|
|
if(JSON.parse(res.result).merchant_id&&e.currentTarget.dataset.cardid&&e.currentTarget.dataset.remainingamount){ |
|
|
|
console.log(JSON.parse(res.result).merchant_id) |
|
|
|
if (JSON.parse(res.result).merchant_id && e.currentTarget.dataset.cardid && e.currentTarget.dataset.remainingamount) { |
|
|
|
wx.navigateTo({ |
|
|
|
url: `/pages/scanPay/scanPay?merChant=${res.result}&cardid=${e.currentTarget.dataset.cardid}&remainingAmount=${e.currentTarget.dataset.remainingamount}`, |
|
|
|
}) |
|
|
|
}else{ |
|
|
|
} else { |
|
|
|
wx.showToast({ |
|
|
|
title:"未识别到商户二维码", |
|
|
|
icon:"none", |
|
|
|
title: "未识别到商户二维码", |
|
|
|
icon: "none", |
|
|
|
mask: false |
|
|
|
}) |
|
|
|
} |
|
|
@@ -88,101 +90,101 @@ Page({ |
|
|
|
e.currentTarget.dataset.quancode}&couponorderstatus=${mystatus}` |
|
|
|
}); |
|
|
|
}, |
|
|
|
gotoBuy:function(){ |
|
|
|
gotoBuy: function() { |
|
|
|
wx.navigateTo({ |
|
|
|
url: '/pages/discountCardList/discountCardList', |
|
|
|
}) |
|
|
|
}, |
|
|
|
getList(key, pageNum) { |
|
|
|
var that = this; |
|
|
|
console.log(key) |
|
|
|
if (that.data.allow_load) { |
|
|
|
that.setData({ |
|
|
|
loading: true, |
|
|
|
content: "小主,我在玩命加载中...", |
|
|
|
}); |
|
|
|
if (key == 4) { |
|
|
|
var data = { |
|
|
|
pageNum: pageNum, |
|
|
|
pageSize: 6, |
|
|
|
couponType: "7", |
|
|
|
couponOrderStatus: 4 |
|
|
|
} |
|
|
|
} else if (key == '5,6,7') { |
|
|
|
var data = { |
|
|
|
pageNum: pageNum, |
|
|
|
pageSize: 6, |
|
|
|
couponType: "7", |
|
|
|
statusStr: "5,6,7" |
|
|
|
} |
|
|
|
// if (that.data.allow_load) { |
|
|
|
that.setData({ |
|
|
|
loading: true, |
|
|
|
content: "小主,我在玩命加载中...", |
|
|
|
}); |
|
|
|
if (key == "4") { |
|
|
|
var data = { |
|
|
|
pageNum: pageNum, |
|
|
|
pageSize: 6, |
|
|
|
couponType: "7", |
|
|
|
couponOrderStatus: 4 |
|
|
|
} |
|
|
|
Http.get({ |
|
|
|
url: config.api.cardorderList, |
|
|
|
data: data |
|
|
|
}) |
|
|
|
.then(res => { |
|
|
|
if (res.code == 200) { |
|
|
|
that.setData({ |
|
|
|
showPage: true |
|
|
|
}) |
|
|
|
} |
|
|
|
res.data.list.map(file => { |
|
|
|
file.expiredTime = util.formatTime(file.expiredTime, "yyyy.MM.dd") |
|
|
|
if (file.couponOrderStatus == 5 || file.couponOrderStatus == 6 || file.couponOrderStatus == 7) { |
|
|
|
file.background = 'rgba(179,180,181,1)'; |
|
|
|
file.showImg = true; |
|
|
|
} else if (file.couponOrderStatus == 4) { |
|
|
|
if (file.remainingAmount > 0 && 29900 >= file.remainingAmount) { |
|
|
|
file.background = '#7184E2' |
|
|
|
} else if (file.remainingAmount >= 30000 && 49900 >= file.remainingAmount) { |
|
|
|
file.background = '#63AAE6' |
|
|
|
} else if (file.remainingAmount >= 50000 && 99900 >= file.remainingAmount) { |
|
|
|
file.background = '#E2A471' |
|
|
|
} else if (file.remainingAmount >= 100000){ |
|
|
|
file.background = '#E67663' |
|
|
|
} |
|
|
|
} else if (key == '5,6,7') { |
|
|
|
var data = { |
|
|
|
pageNum: pageNum, |
|
|
|
pageSize: 6, |
|
|
|
couponType: "7", |
|
|
|
statusStr: "5,6,7" |
|
|
|
} |
|
|
|
} |
|
|
|
Http.get({ |
|
|
|
url: config.api.cardorderList, |
|
|
|
data: data |
|
|
|
}) |
|
|
|
.then(res => { |
|
|
|
console.log(res) |
|
|
|
if (res.code == 200) { |
|
|
|
that.setData({ |
|
|
|
showPage: true |
|
|
|
}) |
|
|
|
} |
|
|
|
res.data.list.map(file => { |
|
|
|
file.expiredTime = util.formatTime(file.expiredTime, "yyyy.MM.dd") |
|
|
|
if (file.couponOrderStatus == 5 || file.couponOrderStatus == 6 || file.couponOrderStatus == 7) { |
|
|
|
file.background = 'rgba(179,180,181,1)'; |
|
|
|
file.showImg = true; |
|
|
|
} else if (file.couponOrderStatus == 4) { |
|
|
|
if (file.remainingAmount > 0 && 29900 >= file.remainingAmount) { |
|
|
|
file.background = '#7184E2' |
|
|
|
} else if (file.remainingAmount >= 30000 && 49900 >= file.remainingAmount) { |
|
|
|
file.background = '#63AAE6' |
|
|
|
} else if (file.remainingAmount >= 50000 && 99900 >= file.remainingAmount) { |
|
|
|
file.background = '#E2A471' |
|
|
|
} else if (file.remainingAmount >= 100000) { |
|
|
|
file.background = '#E67663' |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
}); |
|
|
|
setTimeout(function() { |
|
|
|
that.setData({ |
|
|
|
loading: false |
|
|
|
}); |
|
|
|
setTimeout(function() { |
|
|
|
that.setData({ |
|
|
|
loading: false |
|
|
|
}); |
|
|
|
}, 1400); |
|
|
|
if (pageNum >= res.data.pages) { |
|
|
|
that.setData({ |
|
|
|
allow_load: false |
|
|
|
}); |
|
|
|
} |
|
|
|
if (pageNum == 1) { |
|
|
|
that.setData({ |
|
|
|
list: [] |
|
|
|
}) |
|
|
|
} |
|
|
|
var tmpArr = that.data.list; |
|
|
|
tmpArr.push.apply(tmpArr, res.data.list); |
|
|
|
}, 1400); |
|
|
|
if (pageNum >= res.data.pages && pageNum != 1) { |
|
|
|
that.setData({ |
|
|
|
list: tmpArr |
|
|
|
allow_load: false |
|
|
|
}); |
|
|
|
} |
|
|
|
if (pageNum == 1) { |
|
|
|
that.setData({ |
|
|
|
list: [] |
|
|
|
}) |
|
|
|
} |
|
|
|
var tmpArr = that.data.list; |
|
|
|
tmpArr.push.apply(tmpArr, res.data.list); |
|
|
|
that.setData({ |
|
|
|
list: tmpArr |
|
|
|
}) |
|
|
|
.catch(err => { |
|
|
|
wx.showModal({ |
|
|
|
title: '提示', |
|
|
|
content: err.errMsg, |
|
|
|
showCancel: false |
|
|
|
}) |
|
|
|
}) |
|
|
|
.catch(err => { |
|
|
|
wx.showModal({ |
|
|
|
title: '提示', |
|
|
|
content: err.errMsg, |
|
|
|
showCancel: false |
|
|
|
}) |
|
|
|
} else { |
|
|
|
that.setData({ |
|
|
|
loading: true, |
|
|
|
content: "——— 再拉裤子就掉了啦 ———" |
|
|
|
}); |
|
|
|
setTimeout(function() { |
|
|
|
that.setData({ |
|
|
|
loading: false |
|
|
|
}); |
|
|
|
}, 1400); |
|
|
|
} |
|
|
|
}) |
|
|
|
// } else { |
|
|
|
// that.setData({ |
|
|
|
// loading: true, |
|
|
|
// content: "——— 再拉裤子就掉了啦 ———" |
|
|
|
// }); |
|
|
|
// setTimeout(function() { |
|
|
|
// that.setData({ |
|
|
|
// loading: false |
|
|
|
// }); |
|
|
|
// }, 1400); |
|
|
|
// } |
|
|
|
}, |
|
|
|
handleChangeScroll({ |
|
|
|
detail |
|
|
|