Initial Commit
This commit is contained in:
224
pages/my/my_wallet/my_wallet.js
Normal file
224
pages/my/my_wallet/my_wallet.js
Normal file
@ -0,0 +1,224 @@
|
||||
// pages/my/my_bill/my_bill.js
|
||||
const app = getApp();
|
||||
Page({
|
||||
|
||||
/**
|
||||
* 页面的初始数据
|
||||
*/
|
||||
data: {
|
||||
bgImg: app.globalData.bgImg,
|
||||
typeActive: 0,
|
||||
active:1, //1提现 2分销分润
|
||||
state: 0,//0全部 1套餐券 2折扣券 3现金券 4积分 5微信支付
|
||||
typeShow: false,
|
||||
name: '全部',
|
||||
type: [
|
||||
{ name: '全部', state: 0 },
|
||||
{ name: '审核中', state: 1 },
|
||||
{ name: '已完成', state: 2 },
|
||||
{ name: '提现失败', state: 3 },
|
||||
],
|
||||
page: 1,
|
||||
num: 10,
|
||||
dataList: [],
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
onLoad: function (options) {
|
||||
|
||||
},
|
||||
/**
|
||||
* 生命周期函数--监听页面显示
|
||||
*/
|
||||
onShow: function () {
|
||||
//个人信息
|
||||
wx.showLoading({
|
||||
title: '加载中..',
|
||||
})
|
||||
wx.request({
|
||||
url: app.globalData.ip + '/wisdommining/api/user/getTwoGoodsType',
|
||||
method: 'GET',
|
||||
header: {
|
||||
"content-type": "application/x-www-form-urlencoded",
|
||||
},
|
||||
data: {
|
||||
userId: app.globalData.userId
|
||||
},
|
||||
success: res => {
|
||||
wx.hideLoading()
|
||||
console.log(res)
|
||||
if (res.data.code == 1) {
|
||||
this.setData({
|
||||
user: res.data.value,
|
||||
dataList: [],
|
||||
page: 1
|
||||
})
|
||||
this.dataList()
|
||||
} else {
|
||||
wx.showModal({
|
||||
title: '提示!',
|
||||
content: res.data.message,
|
||||
showCancel: false,
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
},
|
||||
//选择分类
|
||||
active(e){
|
||||
var active = e.currentTarget.dataset.act;
|
||||
if(active==1){
|
||||
this.setData({
|
||||
active:active,
|
||||
dataList: [],
|
||||
page: 1
|
||||
})
|
||||
this.dataList()
|
||||
}else{
|
||||
this.setData({
|
||||
active:active
|
||||
})
|
||||
this.dataList2()
|
||||
}
|
||||
},
|
||||
|
||||
//分类显示
|
||||
typeShow() {
|
||||
this.setData({
|
||||
typeShow: true
|
||||
})
|
||||
},
|
||||
typeActive(e) {
|
||||
let index = e.currentTarget.dataset.index;
|
||||
let name = e.currentTarget.dataset.name;
|
||||
let state = e.currentTarget.dataset.state;
|
||||
this.setData({
|
||||
typeActive: index,
|
||||
name: name,
|
||||
typeShow: false,
|
||||
state: state,
|
||||
dataList: [],
|
||||
page: 1
|
||||
})
|
||||
this.dataList()
|
||||
},
|
||||
//提现
|
||||
dataList(e) {
|
||||
wx.showLoading({
|
||||
title: '加载中..',
|
||||
})
|
||||
wx.request({
|
||||
url: app.globalData.ip + '/wisdommining/api/user/getWisdWithdrawal',
|
||||
method: 'GET',
|
||||
header: {
|
||||
"content-type": "application/x-www-form-urlencoded",
|
||||
},
|
||||
data: {
|
||||
userId: app.globalData.userId,
|
||||
status: this.data.state,
|
||||
page: this.data.page,
|
||||
num: this.data.num,
|
||||
},
|
||||
success: res => {
|
||||
wx.hideLoading()
|
||||
console.log(res)
|
||||
if (res.data.code == 1) {
|
||||
let data = res.data.value.records;
|
||||
let dataList = this.data.dataList;
|
||||
for (let i = 0; i < data.length; i++) {
|
||||
dataList.push(data[i])
|
||||
}
|
||||
this.setData({
|
||||
dataList: dataList,
|
||||
page: this.data.page + 1
|
||||
})
|
||||
} else {
|
||||
wx.showModal({
|
||||
title: '提示!',
|
||||
content: res.data.message,
|
||||
showCancel: false,
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
//分销
|
||||
dataList2(e) {
|
||||
wx.showLoading({
|
||||
title: '加载中..',
|
||||
})
|
||||
wx.request({
|
||||
url: app.globalData.ip + '/wisdommining/api/user/getBill',
|
||||
method: 'GET',
|
||||
header: {
|
||||
"content-type": "application/x-www-form-urlencoded",
|
||||
},
|
||||
data: {
|
||||
userId: app.globalData.userId,
|
||||
category: 6,
|
||||
},
|
||||
success: res => {
|
||||
wx.hideLoading()
|
||||
console.log(res)
|
||||
if (res.data.code == 1) {
|
||||
let dataList = res.data.value;
|
||||
this.setData({
|
||||
dataList2: dataList,
|
||||
})
|
||||
} else {
|
||||
wx.showModal({
|
||||
title: '提示!',
|
||||
content: res.data.message,
|
||||
showCancel: false,
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
cash() {
|
||||
|
||||
wx.navigateTo({
|
||||
url: '/pages/my/my_cash/my_cash?moneyCan=' + this.data.user.userBalance,
|
||||
})
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面初次渲染完成
|
||||
*/
|
||||
onReady: function () {
|
||||
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面隐藏
|
||||
*/
|
||||
onHide: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面卸载
|
||||
*/
|
||||
onUnload: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面相关事件处理函数--监听用户下拉动作
|
||||
*/
|
||||
onPullDownRefresh: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面上拉触底事件的处理函数
|
||||
*/
|
||||
onReachBottom: function () {
|
||||
this.dataList()
|
||||
},
|
||||
})
|
||||
Reference in New Issue
Block a user