|
|
|
@ -46,6 +46,9 @@ Page({ |
|
|
|
icon: '../../images/moments_ico.png' |
|
|
|
}], |
|
|
|
qrImageUrl: "", |
|
|
|
groupList:[], |
|
|
|
group: null, |
|
|
|
showM: true |
|
|
|
}, |
|
|
|
/** |
|
|
|
* 生命周期函数--监听页面加载 |
|
|
|
@ -65,6 +68,33 @@ Page({ |
|
|
|
this.getActivityDetail(); |
|
|
|
}, |
|
|
|
|
|
|
|
//获取活动拼团列表信息
|
|
|
|
fetchActivityGroupList: function(){ |
|
|
|
let that = this; |
|
|
|
// /mall/wxa/activity/group/recommend 推荐正在拼的团
|
|
|
|
wx.request({ |
|
|
|
url: app.gw.hostUrl + '/mall/wxa/activity/group/recommend', |
|
|
|
method: 'get', |
|
|
|
data: { activityNo: that.data.activityNo, pageNum: 1, pageSize: 3 }, |
|
|
|
header: { |
|
|
|
'Content-Type': 'application/x-www-form-urlencoded', |
|
|
|
'sessionId': wx.getStorageSync('sessionId') |
|
|
|
}, |
|
|
|
success: function (res) { |
|
|
|
if(res.data.code == 0){ |
|
|
|
that.setData({ |
|
|
|
groupList: res.data.response |
|
|
|
}) |
|
|
|
} |
|
|
|
} |
|
|
|
}) |
|
|
|
}, |
|
|
|
|
|
|
|
getMemberNickname: function(index){ |
|
|
|
console.log('index>>' + index) |
|
|
|
return 'Index' |
|
|
|
}, |
|
|
|
|
|
|
|
getActivityDetail: function () { |
|
|
|
let that = this; |
|
|
|
that.stopInterval(); |
|
|
|
@ -88,7 +118,6 @@ Page({ |
|
|
|
'sessionId': wx.getStorageSync('sessionId') |
|
|
|
}, |
|
|
|
success: function (res) { |
|
|
|
console.log(res); |
|
|
|
var data = res.data; |
|
|
|
var status = data.code; |
|
|
|
if (status == 0) { |
|
|
|
@ -116,14 +145,7 @@ Page({ |
|
|
|
remark: "block", |
|
|
|
tagColor: "#F8B551", |
|
|
|
}); |
|
|
|
if (that.data.currentMemberType == -1) { |
|
|
|
//游客
|
|
|
|
that.setData({ |
|
|
|
one_content: "none", |
|
|
|
two_content: "block", |
|
|
|
buttomText: '参与拼团', |
|
|
|
}); |
|
|
|
} else if (that.data.currentMemberType == 0 || that.data.currentMemberType == 10) { |
|
|
|
if (that.data.currentMemberType == 0 || that.data.currentMemberType == 10) { |
|
|
|
//发起人和邀请人
|
|
|
|
that.setData({ |
|
|
|
one_content: "block", |
|
|
|
@ -134,18 +156,7 @@ Page({ |
|
|
|
} |
|
|
|
} else if (that.data.groupStatus == 20) { |
|
|
|
//拼团成功
|
|
|
|
if (that.data.currentMemberType == -1) { |
|
|
|
//游客
|
|
|
|
that.setData({ |
|
|
|
one_content: "block", |
|
|
|
two_content: "none", |
|
|
|
bottomBGColor: '#F36619', |
|
|
|
buttomText: '我要拼团', |
|
|
|
grounpInfo: "none", |
|
|
|
grounpInfo2: "block", |
|
|
|
|
|
|
|
}); |
|
|
|
} else if (that.data.currentMemberType == 0 || that.data.currentMemberType == 10) { |
|
|
|
if (that.data.currentMemberType == 0 || that.data.currentMemberType == 10) { |
|
|
|
//发起人和邀请人
|
|
|
|
that.setData({ |
|
|
|
tagColor: "#21BE8D", |
|
|
|
@ -160,6 +171,7 @@ Page({ |
|
|
|
} |
|
|
|
} else if (that.data.groupStatus == 90) { |
|
|
|
//拼团失败
|
|
|
|
that.fetchActivityGroupList() |
|
|
|
if (that.data.currentMemberType == -1) { |
|
|
|
//游客
|
|
|
|
that.setData({ |
|
|
|
@ -169,7 +181,6 @@ Page({ |
|
|
|
buttomText: '我要拼团', |
|
|
|
grounpInfo: "none", |
|
|
|
grounpInfo2: "block", |
|
|
|
|
|
|
|
}); |
|
|
|
} else if (that.data.currentMemberType == 0 || that.data.currentMemberType == 10) { |
|
|
|
//发起人和邀请人
|
|
|
|
@ -186,7 +197,6 @@ Page({ |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} else { |
|
|
|
that.countActivityTime(data.response.countdownSec); |
|
|
|
that.setData({ |
|
|
|
@ -194,6 +204,7 @@ Page({ |
|
|
|
grounpInfo: "none", |
|
|
|
grounpInfo2: "none", |
|
|
|
}); |
|
|
|
that.fetchActivityGroupList() |
|
|
|
} |
|
|
|
} else { |
|
|
|
wx.showToast({ |
|
|
|
@ -300,14 +311,14 @@ Page({ |
|
|
|
if (that.data.groupNo == "") { |
|
|
|
url = '/mall/wxa/activity/group/open'; |
|
|
|
//首次开团
|
|
|
|
this.groupOpenOrJoin(url); |
|
|
|
this.groupOpenOrJoin(url, that.data.groupNo); |
|
|
|
} else { |
|
|
|
if (that.data.groupStatus == 10) { |
|
|
|
//正在拼团
|
|
|
|
if (that.data.currentMemberType == -1) { |
|
|
|
//游客
|
|
|
|
url = '/mall/wxa/activity/group/join'; |
|
|
|
this.groupOpenOrJoin(url); |
|
|
|
this.groupOpenOrJoin(url, that.data.groupNo); |
|
|
|
} else { |
|
|
|
//团长与参与人点击分享
|
|
|
|
this.openActionsheet(); |
|
|
|
@ -317,7 +328,7 @@ Page({ |
|
|
|
if (that.data.currentMemberType == -1) { |
|
|
|
//游客
|
|
|
|
url = '/mall/wxa/activity/group/open'; |
|
|
|
this.groupOpenOrJoin(url); |
|
|
|
this.groupOpenOrJoin(url, that.data.groupNo); |
|
|
|
} else { |
|
|
|
//团长与参与人立即预约
|
|
|
|
wx.showModal({ |
|
|
|
@ -335,13 +346,13 @@ Page({ |
|
|
|
} else if (that.data.groupStatus == 90) { |
|
|
|
//拼团失败
|
|
|
|
url = '/mall/wxa/activity/group/open'; |
|
|
|
this.groupOpenOrJoin(url); |
|
|
|
this.groupOpenOrJoin(url, that.data.groupNo); |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
|
|
|
|
//开团与参团
|
|
|
|
groupOpenOrJoin: function (url) { |
|
|
|
groupOpenOrJoin: function (url, groupNo) { |
|
|
|
let that = this; |
|
|
|
wx.showToast({ |
|
|
|
title: '正在调起支付', |
|
|
|
@ -353,7 +364,7 @@ Page({ |
|
|
|
data: { |
|
|
|
openid: app.globalData.openid, |
|
|
|
activityNo: that.data.activityNo, |
|
|
|
groupNo: that.data.groupNo, |
|
|
|
groupNo: groupNo, |
|
|
|
}, |
|
|
|
header: { |
|
|
|
'Content-Type': 'application/x-www-form-urlencoded', |
|
|
|
@ -375,7 +386,6 @@ Page({ |
|
|
|
groupNo: data.response.orderNo == undefined ? that.data.groupNo : data.response.orderNo, |
|
|
|
}); |
|
|
|
let dr = data.response.weixinTransParameters; |
|
|
|
console.log(dr); |
|
|
|
wx.requestPayment({//微信支付
|
|
|
|
"timeStamp": dr.timeStamp,//时间戳
|
|
|
|
"nonceStr": dr.nonceStr,//随机字符串
|
|
|
|
@ -383,7 +393,6 @@ Page({ |
|
|
|
"signType": dr.signType,//签名算法
|
|
|
|
"paySign": dr.paySign,//签名
|
|
|
|
"success": function (res) {//成功时回调
|
|
|
|
console.log(res); |
|
|
|
wx.showToast({ |
|
|
|
title: '支付成功', |
|
|
|
icon: 'success', |
|
|
|
@ -395,7 +404,6 @@ Page({ |
|
|
|
}) |
|
|
|
}, |
|
|
|
"fail": function (res) {//接口调用失败的回调
|
|
|
|
console.log(res); |
|
|
|
if (res.errMsg == 'requestPayment:fail cancel') { |
|
|
|
wx.showToast({ |
|
|
|
title: '取消支付', |
|
|
|
@ -422,13 +430,15 @@ Page({ |
|
|
|
}); |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
* 生命周期函数--监听页面隐藏 |
|
|
|
*/ |
|
|
|
onHide: function () { |
|
|
|
|
|
|
|
showDialog: function (e) { |
|
|
|
if (wx.getStorageSync('sessionId') == '') { |
|
|
|
wx.navigateTo({ url: '../login/login' }) |
|
|
|
return; |
|
|
|
} |
|
|
|
this.setData({ |
|
|
|
showM: false, |
|
|
|
group: this.data.groupList[e.currentTarget.dataset.index] |
|
|
|
}) |
|
|
|
}, |
|
|
|
|
|
|
|
/** |
|
|
|
@ -438,18 +448,13 @@ Page({ |
|
|
|
this.stopInterval(); |
|
|
|
}, |
|
|
|
|
|
|
|
/** |
|
|
|
* 页面相关事件处理函数--监听用户下拉动作 |
|
|
|
*/ |
|
|
|
onPullDownRefresh: function () { |
|
|
|
|
|
|
|
cancelR: function () { |
|
|
|
this.setData({ showM: true }) |
|
|
|
}, |
|
|
|
|
|
|
|
/** |
|
|
|
* 页面上拉触底事件的处理函数 |
|
|
|
*/ |
|
|
|
onReachBottom: function () { |
|
|
|
|
|
|
|
|
|
|
|
confirmR: function () { |
|
|
|
this.setData({ showM: true }) |
|
|
|
this.groupOpenOrJoin('/mall/wxa/activity/group/join', this.data.group.groupNo); |
|
|
|
}, |
|
|
|
|
|
|
|
//打败Actionsheet,进行分享
|
|
|
|
|