248 lines
4.8 KiB
JavaScript
248 lines
4.8 KiB
JavaScript
// import { json } from "body-parser";
|
|
// packageD/team_sell/teamLimit/teamLimit.js
|
|
var app = getApp();
|
|
Page({
|
|
|
|
/**
|
|
* 页面的初始数据
|
|
*/
|
|
data: {
|
|
show:false,
|
|
value:'',
|
|
pageindx:0,
|
|
member:'',
|
|
level_id:0,
|
|
page:1,
|
|
info:{},
|
|
val_member:''
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面加载
|
|
*/
|
|
onLoad: function (options) {
|
|
this.getSearch();
|
|
},
|
|
souSuo(){
|
|
// if(this.data.val_member){
|
|
this.setData({
|
|
member : this.data.val_member
|
|
});
|
|
this.getSearch();
|
|
// }
|
|
},
|
|
keyValue(e){
|
|
let val = e.detail.value;
|
|
this.setData({
|
|
val_member : val
|
|
});
|
|
},
|
|
chooseTabData(e){
|
|
console.log(e);
|
|
this.setData({
|
|
pageindx:e.detail.index,
|
|
level_id:e.detail.index,
|
|
page:1,
|
|
});
|
|
this.getSearch();
|
|
},
|
|
toUpdate(e){
|
|
let uid = e.currentTarget.dataset.uid.uid;
|
|
console.log(e);
|
|
this.setData({
|
|
show : true,
|
|
upuid : uid
|
|
});
|
|
},
|
|
raidinp(e){
|
|
console.log(e);
|
|
this.setData({
|
|
value:Number(e.detail)
|
|
});
|
|
},
|
|
resultAdd(){
|
|
if(app._isTextEmpty(this.data.value)){
|
|
wx.showToast({
|
|
title: '请选择升级等级',
|
|
icon:'none',
|
|
duration:1000
|
|
});
|
|
}else{
|
|
this.setData({
|
|
show:false,
|
|
levelId:this.data.value
|
|
});
|
|
this.uplevel();
|
|
}
|
|
},
|
|
cancel(){
|
|
this.setData({
|
|
show:false
|
|
});
|
|
},
|
|
/**
|
|
* 生命周期函数--监听页面初次渲染完成
|
|
*/
|
|
onReady: function () {
|
|
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面显示
|
|
*/
|
|
onShow: function () {
|
|
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面隐藏
|
|
*/
|
|
onHide: function () {
|
|
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面卸载
|
|
*/
|
|
onUnload: function () {
|
|
|
|
},
|
|
|
|
/**
|
|
* 页面相关事件处理函数--监听用户下拉动作
|
|
*/
|
|
onPullDownRefresh: function () {
|
|
|
|
},
|
|
|
|
/**
|
|
* 页面上拉触底事件的处理函数
|
|
*/
|
|
onReachBottom: function () {
|
|
if(this.data.current_page >= this.data.last_page){
|
|
wx.showToast({
|
|
title: '暂无更多',
|
|
icon:'none',
|
|
duration:1000
|
|
});
|
|
}else{
|
|
this.setData({
|
|
page:this.data.page + 1
|
|
});
|
|
wx.showLoading({
|
|
title:'加载中'
|
|
});
|
|
this.getNext();
|
|
}
|
|
},
|
|
|
|
/**
|
|
* 用户点击右上角分享
|
|
*/
|
|
onShareAppMessage: function () {
|
|
|
|
},
|
|
getSearch(){
|
|
var that = this;
|
|
let json = {
|
|
member:this.data.member,
|
|
level_id:this.data.level_id,
|
|
page:this.data.page
|
|
};
|
|
let urlStr = app.getNetAddresss('plugin.team-sales.api.team.index');
|
|
app._postNetWork({
|
|
url: urlStr,
|
|
data:json,
|
|
success: (resdata) => {
|
|
var res = resdata.data;
|
|
if (res.result == 1) {
|
|
console.log(res);
|
|
that.setData({
|
|
info:res.data,
|
|
list:res.data.member.data,
|
|
current_page:res.data.member.current_page,
|
|
last_page:res.data.member.last_page
|
|
});
|
|
} else {
|
|
wx.showToast({
|
|
title: res.msg,
|
|
icon: 'none'
|
|
});
|
|
console.log(res.msg);
|
|
}
|
|
}
|
|
});
|
|
},
|
|
getNext(){
|
|
var that = this;
|
|
let json = {
|
|
member:this.data.member,
|
|
level_id:this.data.level_id,
|
|
page:this.data.page
|
|
};
|
|
let urlStr = app.getNetAddresss('plugin.team-sales.api.team.index');
|
|
app._postNetWork({
|
|
url: urlStr,
|
|
data:json,
|
|
success: (resdata) => {
|
|
var res = resdata.data;
|
|
if (res.result == 1) {
|
|
console.log(res);
|
|
that.setData({
|
|
info:res.data,
|
|
list:that.data.list.concat(res.data.member.data),
|
|
current_page:res.data.member.current_page,
|
|
last_page:res.data.member.last_page
|
|
});
|
|
wx.hideLoading({
|
|
complete: (res) => {},
|
|
});
|
|
} else {
|
|
wx.showToast({
|
|
title: res.msg,
|
|
icon: 'none'
|
|
});
|
|
console.log(res.msg);
|
|
wx.hideLoading({
|
|
complete: (res) => {},
|
|
});
|
|
}
|
|
}
|
|
});
|
|
},
|
|
uplevel(e){
|
|
var that = this;
|
|
var json = {
|
|
member_id:this.data.upuid,
|
|
level_id:this.data.levelId
|
|
};
|
|
let urlStr = app.getNetAddresss('plugin.team-sales.api.team.upgrade');
|
|
app._postNetWork({
|
|
url: urlStr,
|
|
data:json,
|
|
success: (resdata) => {
|
|
var res = resdata.data;
|
|
if (res.result == 1) {
|
|
console.log(res);
|
|
wx.showToast({
|
|
title: res.msg,
|
|
icon:'none',
|
|
duration:1000
|
|
});
|
|
that.getSearch();
|
|
} else {
|
|
wx.showToast({
|
|
title: res.msg,
|
|
icon: 'none'
|
|
});
|
|
}
|
|
},
|
|
fail:(res) =>{
|
|
wx.showToast({
|
|
title: res.msg,
|
|
icon: 'none'
|
|
});
|
|
}
|
|
});
|
|
}
|
|
}); |