yuminge-app/yun-min-program-plugin-master/packageB/member/integral/integral.js

146 lines
2.7 KiB
JavaScript

// pages/member/integral/integral.js
var app = getApp();
Page({
/**
* 页面的初始数据
*/
data: {
credit1: 0.00,
transfer: false, //是否开启转账
activity: false, //是否开启积分活动,
integral: '',
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function(options) {
this._getIntegral();
try {
const value = wx.getStorageSync('integral');
if (value) {
this.setData({
integral: value
});
// Do something with return value
if (this.data.integral) {
wx.setNavigationBarTitle({
title: this.data.integral
});
}
}
} catch (e) {
// Do something when catch error
}
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function() {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function() {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function() {
},
_getIntegral() {
let that = this;
let urlStr = app.getNetAddresss("finance.point-page.index");
app._getNetWork({
url: urlStr,
success: function(resdata) {
var res = resdata.data;
if (res.result == 1) {
that.setData({
credit1: res.data.credit1,
transfer: res.data.transfer
});
if (res.data.activity == 1) {
that.setData({
activity: true
});
} else {
that.setData({
activity: false
});
}
} else {
wx.showToast({
icon: 'none',
title: res.msg,
duration: 1500
});
}
},
fail: function(res) {
console.log(res);
}
});
},
//转账的响应方法
transferHandel() {
if (this.data.transfer) {
wx.navigateTo({
url: '/packageB/member/integral_transfer/integral_transfer?integral=' + this.data.credit1
});
} else {
wx.showToast({
icon: 'none',
title: '您的转账功能未开启',
duration: 1500
});
}
},
toIntegral() {
wx.navigateTo({
url: '/packageB/member/IntegralActivity/IntegralActivity?integral=' + this.data.credit1
});
},
integralgolist() {
wx.navigateTo({
url: '/packageB/member/integrallist/integrallist'
});
}
});