You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
328 lines
8.6 KiB
328 lines
8.6 KiB
var Api = require('../../../utils/common.js'); |
|
var re = require('../../../utils/request.js'); |
|
Page({ |
|
|
|
/** |
|
* 页面的初始数据 |
|
*/ |
|
data: { |
|
clubId:'', |
|
company:{}, |
|
nouse:[ |
|
{money:'1000',price:'10',startTime:'2020.10.01 18:00:00',endTime:'2020.10.31 23:59:00'}, |
|
{money:'1000',price:'10',startTime:'2020.10.01 18:00:00',endTime:'2020.10.31 23:59:00'} |
|
], |
|
otheractive:[ |
|
// {img:'../../../images/logo.jpg',intro:'欢乐游园亲子活动,全家人一起畅游欢乐谷,享受天...',time:'2020-10-13 07:00',name:'动感光波',views:'123',share:'22'}, |
|
// {img:'../../../images/logo.jpg',intro:'欢乐游园亲子活动,全家人一起畅游欢乐谷,享受天...',time:'2020-10-13 07:00',name:'动感光波',views:'123',share:'22'}, |
|
// {img:'../../../images/logo.jpg',intro:'欢乐游园亲子活动,全家人一起畅游欢乐谷,享受天...',time:'2020-10-13 07:00',name:'动感光波',views:'123',share:'22'} |
|
], |
|
endactive:[ |
|
// {img:'../../../images/logo.jpg',intro:'欢乐游园亲子活动,全家人一起畅游欢乐谷,享受天...',time:'2020-10-13 07:00',name:'动感光波',views:'123',share:'22'}, |
|
// {img:'../../../images/logo.jpg',intro:'欢乐游园亲子活动,全家人一起畅游欢乐谷,享受天...',time:'2020-10-13 07:00',name:'动感光波',views:'123',share:'22'}, |
|
// {img:'../../../images/logo.jpg',intro:'欢乐游园亲子活动,全家人一起畅游欢乐谷,享受天...',time:'2020-10-13 07:00',name:'动感光波',views:'123',share:'22'} |
|
], |
|
nojoin:false, |
|
isflage:5 |
|
}, |
|
seeJoin:function(){ |
|
wx.navigateTo({ |
|
url: '../join/join' |
|
}) |
|
}, |
|
jlbchengyuan(){ |
|
wx.navigateTo({ |
|
url:'../clubgroups/clubgroups?id='+this.data.company.clubId+'' |
|
}) |
|
}, |
|
tomanage:function(e){ |
|
let valData = JSON.stringify(this.data.company);//console.log('company-data:', this.data.company); |
|
wx.navigateTo({ |
|
url: '../manage/manage?val='+valData+'' |
|
}) |
|
}, |
|
toalbum:function(){ |
|
wx.navigateTo({ |
|
url: '../album/album?id='+this.data.clubId+'' |
|
}) |
|
}, |
|
toactiveDetail:function(e){ |
|
wx.navigateTo({ |
|
url: '../../index/activeDetail/activeDetail?id='+e.currentTarget.dataset.id+'' |
|
}) |
|
}, |
|
/** |
|
* 生命周期函数--监听页面加载 |
|
*/ |
|
onLoad: function (options) { |
|
var that = this; |
|
that.setData({ |
|
clubId:options.id |
|
}) |
|
that.getclubDetail(); |
|
that.actjoining(options.id); |
|
that.actjoined(options.id); |
|
var header = { |
|
token:wx.getStorageSync('token'), |
|
"Content-Type": "application/x-www-form-urlencoded" |
|
}; |
|
// re.request(Api.selectpower(),{clubId:options.id},header).then(res=>{ |
|
// console.log(res,'查询是否会长'); |
|
// if(res.data.code==200){ |
|
// this.setData({ |
|
// isflage:true |
|
// }) |
|
// } |
|
// }) |
|
re.request(Api.selectgrade(),{clubId:options.id},header).then(res=>{ |
|
// if(res.data.code==200){ |
|
console.log(res,'res'); |
|
this.setData({ |
|
isflage:res.data.data |
|
// isflage:1 |
|
}) |
|
// } |
|
}) |
|
|
|
}, |
|
getclubDetail:function(){ |
|
var that = this; |
|
const imgUrl = wx.getStorageSync('imgUrl') |
|
var header = { |
|
token:wx.getStorageSync('token'), |
|
"Content-Type": "application/x-www-form-urlencoded" |
|
}; |
|
var postData={ |
|
clubId:that.data.clubId |
|
}; |
|
re.request(Api.getclubDetail(), postData, header).then((res) => { |
|
let datas = res.data.data; |
|
datas.clubLogo = imgUrl + datas.clubLogo; |
|
datas.clubBgimg = imgUrl + datas.clubBgimg; |
|
switch (datas.isJoin) { |
|
case 'false': |
|
datas.isJoin=false |
|
break; |
|
case 'true': |
|
datas.isJoin=true |
|
break; |
|
} |
|
that.setData({ |
|
company:datas |
|
}) |
|
console.log(this.data.company,'this.data.company'); |
|
}) |
|
}, |
|
tuichu(){ |
|
let that=this |
|
var header = { |
|
token:wx.getStorageSync('token'), |
|
"Content-Type": "application/x-www-form-urlencoded" |
|
}; |
|
wx:wx.showModal({ |
|
content: '是否退出该俱乐部', |
|
showCancel: true, |
|
title: '提示', |
|
success: (result) => { |
|
if (result.confirm) { |
|
re.request(Api.memberexit(),{clubId:that.data.clubId},header).then(res=>{ |
|
console.log(res,'退出俱乐部'); |
|
this.setData({ |
|
'company.isJoin':false |
|
}) |
|
|
|
}) |
|
} else if (result.cancel) { |
|
// console.log('用户点击取消') |
|
} |
|
}, |
|
fail: (res) => {}, |
|
complete: (res) => {}, |
|
}) |
|
|
|
}, |
|
tojoinClub:function(){ |
|
var that = this; |
|
var header = { |
|
token:wx.getStorageSync('token'), |
|
"Content-Type": "application/x-www-form-urlencoded" |
|
}; |
|
var postData={ |
|
clubId:that.data.clubId, |
|
memberType:4, |
|
}; |
|
re.request(Api.addClub(), postData, header).then((res) => { |
|
let datas = res.data.data; |
|
wx.showToast({ |
|
title: '加入成功', |
|
icon:'success', |
|
duration: 1000 |
|
}) |
|
this.setData({ |
|
'company.isJoin':true |
|
}) |
|
}) |
|
}, |
|
getActiveListing:function(){ |
|
var that = this; |
|
const imgUrl = wx.getStorageSync('imgUrl') |
|
var header = { |
|
token:wx.getStorageSync('token'), |
|
"Content-Type": "application/x-www-form-urlencoded" |
|
}; |
|
var postData={ |
|
clubId:that.data.clubId, |
|
registerStatus:'1' |
|
}; |
|
re.request(Api.getActiveList(), postData, header).then((res) => { |
|
let datas = res.data.data; |
|
console.log(datas) |
|
// datas.clubLogo = imgUrl + datas.clubLogo; |
|
// datas.clubBgimg = imgUrl + datas.clubBgimg; |
|
// that.setData({ |
|
// company:datas |
|
// }) |
|
}) |
|
}, |
|
getActiveListed:function(){ |
|
var that = this; |
|
const imgUrl = wx.getStorageSync('imgUrl') |
|
var header = { |
|
token:wx.getStorageSync('token'), |
|
"Content-Type": "application/x-www-form-urlencoded" |
|
}; |
|
var postData={ |
|
clubId:that.data.clubId, |
|
registerStatus:'2' |
|
}; |
|
re.request(Api.getActiveList(), postData, header).then((res) => { |
|
let datas = res.data.data; |
|
console.log(datas) |
|
// datas.clubLogo = imgUrl + datas.clubLogo; |
|
// datas.clubBgimg = imgUrl + datas.clubBgimg; |
|
// that.setData({ |
|
// company:datas |
|
// }) |
|
}) |
|
}, |
|
actjoined:function(id){ |
|
var that = this; |
|
var header = { |
|
token:wx.getStorageSync('token'), |
|
"Content-Type": "application/x-www-form-urlencoded" |
|
}; |
|
var postData={ |
|
clubId:id |
|
}; |
|
re.request(Api.actjoined(), postData, header).then((res) => { |
|
let datas = res.data.data; |
|
that.setData({ |
|
endactive:datas |
|
}) |
|
}) |
|
}, |
|
actjoining:function(id){ |
|
var that = this; |
|
var header = { |
|
token:wx.getStorageSync('token'), |
|
"Content-Type": "application/x-www-form-urlencoded" |
|
}; |
|
var postData={ |
|
clubId:id, |
|
}; |
|
re.request(Api.actjoining(), postData, header).then((res) => { |
|
let datas = res.data.data; |
|
|
|
that.setData({ |
|
otheractive:datas |
|
}) |
|
console.log(">>",this.data.otheractive) |
|
}) |
|
}, |
|
getClubCoupon:function(){ |
|
var that = this; |
|
var header = { |
|
token:wx.getStorageSync('token'), |
|
"Content-Type": "application/x-www-form-urlencoded" |
|
}; |
|
var postData={ |
|
clubId:that.data.clubId, |
|
}; |
|
re.request(Api.getClubCoupon(), postData, header).then((res) => { |
|
let datas = res.data.data; |
|
that.setData({ |
|
nouse:datas |
|
}) |
|
}) |
|
}, |
|
getCoupon:function(e){ |
|
let id = e.currentTarget.dataset.id; |
|
var that = this; |
|
var header = { |
|
token:wx.getStorageSync('token'), |
|
"Content-Type": "application/x-www-form-urlencoded" |
|
}; |
|
var postData={ |
|
couponId:id, |
|
}; |
|
re.request(Api.getCoupon(), postData, header).then((res) => { |
|
let datas = res.data.data; |
|
wx.showToast({ |
|
title: '领取成功', |
|
icon: 'none', |
|
duration: 1000 |
|
}) |
|
that.getClubCoupon(); |
|
}) |
|
}, |
|
/** |
|
* 生命周期函数--监听页面初次渲染完成 |
|
*/ |
|
onReady: function () { |
|
|
|
}, |
|
|
|
/** |
|
* 生命周期函数--监听页面显示 |
|
*/ |
|
onShow: function () { |
|
this.getActiveListing(); |
|
this.getActiveListed(); |
|
this.getClubCoupon(); |
|
}, |
|
|
|
/** |
|
* 生命周期函数--监听页面隐藏 |
|
*/ |
|
onHide: function () { |
|
|
|
}, |
|
|
|
/** |
|
* 生命周期函数--监听页面卸载 |
|
*/ |
|
onUnload: function () { |
|
|
|
}, |
|
|
|
/** |
|
* 页面相关事件处理函数--监听用户下拉动作 |
|
*/ |
|
onPullDownRefresh: function () { |
|
|
|
}, |
|
|
|
/** |
|
* 页面上拉触底事件的处理函数 |
|
*/ |
|
onReachBottom: function () { |
|
|
|
}, |
|
|
|
/** |
|
* 用户点击右上角分享 |
|
*/ |
|
onShareAppMessage: function () { |
|
|
|
} |
|
}) |