Parcourir la source

[积分商城][修改][我可换购接口]

tags/C.10.02
hurui il y a 5 ans
Parent
révision
fee73d2c96
2 fichiers modifiés avec 42 ajouts et 28 suppressions
  1. +37
    -24
      pages/integralmall/index.js
  2. +5
    -4
      pages/integralmall/index.wxml

+ 37
- 24
pages/integralmall/index.js Voir le fichier

@@ -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();
} }
}) })

+ 5
- 4
pages/integralmall/index.wxml Voir le fichier

@@ -37,10 +37,7 @@
</view> </view>
<view class='no-data01' wx:if='{{lists.length==0}}'>
<image src='{{nodata}}'></image>
<view class='no-data-text'>暂无数据</view>
</view>
<view class='sort'> <view class='sort'>
<view bindtap='canSort'>我可换购</view> <view bindtap='canSort'>我可换购</view>
<view class='need' bindtap='need'> <view class='need' bindtap='need'>
@@ -48,6 +45,10 @@
<image wx:if="{{sort }}" src='{{sort}}' moda="aspectFill" ></image> <image wx:if="{{sort }}" src='{{sort}}' moda="aspectFill" ></image>
</view> </view>
</view> </view>
<view class='no-data01' wx:if='{{lists.length==0}}'>
<image src='{{nodata}}'></image>
<view class='no-data-text'>暂无数据</view>
</view>
<view class='content' wx:if='{{lists.length>0}}' > <view class='content' wx:if='{{lists.length>0}}' >
<view class='sepll-list' wx:for="{{lists}}" wx:key="{{index}}" data-couponId='{{item.couponId}}' data-id='{{item.id}}' bindtap='invite'> <view class='sepll-list' wx:for="{{lists}}" wx:key="{{index}}" data-couponId='{{item.couponId}}' data-id='{{item.id}}' bindtap='invite'>
<view class='spell-left'> <view class='spell-left'>


Chargement…
Annuler
Enregistrer