소스 검색

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

tags/C.10.02
hurui 5 년 전
부모
커밋
fee73d2c96
2개의 변경된 파일42개의 추가작업 그리고 28개의 파일을 삭제
  1. +37
    -24
      pages/integralmall/index.js
  2. +5
    -4
      pages/integralmall/index.wxml

+ 37
- 24
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();
}
})

+ 5
- 4
pages/integralmall/index.wxml 파일 보기

@@ -37,10 +37,7 @@
</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 bindtap='canSort'>我可换购</view>
<view class='need' bindtap='need'>
@@ -48,6 +45,10 @@
<image wx:if="{{sort }}" src='{{sort}}' moda="aspectFill" ></image>
</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='sepll-list' wx:for="{{lists}}" wx:key="{{index}}" data-couponId='{{item.couponId}}' data-id='{{item.id}}' bindtap='invite'>
<view class='spell-left'>


불러오는 중...
취소
저장