Browse Source

no message

feature/v1.1.0
xpz2018 7 years ago
parent
commit
8aa9b94267
1 changed files with 57 additions and 53 deletions
  1. 110
      pages/activity_detail/activity_detail.js

110
pages/activity_detail/activity_detail.js

@ -1,6 +1,6 @@
//获取应用实例 //获取应用实例
const app = getApp() const app = getApp()
let interval
var WxParse = require('../../wxParse/wxParse.js');//主要为了能够显示获取的html代码 var WxParse = require('../../wxParse/wxParse.js');//主要为了能够显示获取的html代码
Page({ Page({
@ -13,7 +13,7 @@ Page({
memberList: [], memberList: [],
activityDetail: {}, activityDetail: {},
currentMemberType: -1,//参与人角色,-1游客,0发起者,10参与者 currentMemberType: -1,//参与人角色,-1游客,0发起者,10参与者
groupStatus:0,//团状态,0发起拼团,10正在拼团,20拼团成功,90拼团失败
groupStatus: 0,//团状态,0发起拼团,10正在拼团,20拼团成功,90拼团失败
rule_image_height: 0,//活动规则图片高度 rule_image_height: 0,//活动规则图片高度
detail_image_height: 0,//活动详情图片高度 detail_image_height: 0,//活动详情图片高度
bannerImage: '/images/activity_banner.png', bannerImage: '/images/activity_banner.png',
@ -32,7 +32,7 @@ Page({
buttomText: '我要开团', buttomText: '我要开团',
tagColor: "#F8B551", tagColor: "#F8B551",
remark: "none", remark: "none",
remarkText:"已退款",
remarkText: "已退款",
//分享 //分享
show: false, show: false,
cancelWithMask: true, cancelWithMask: true,
@ -99,15 +99,15 @@ Page({
groupNo: data.response.groupNo == undefined ? that.data.groupNo : data.response.groupNo, groupNo: data.response.groupNo == undefined ? that.data.groupNo : data.response.groupNo,
memberList: data.response.memberList == undefined ? [] : data.response.memberList, memberList: data.response.memberList == undefined ? [] : data.response.memberList,
groupStatus: data.response.status, groupStatus: data.response.status,
currentMemberType: data.response.currentMemberType== undefined ? -1 : data.response.currentMemberType,
currentMemberType: data.response.currentMemberType == undefined ? -1 : data.response.currentMemberType,
countdownSec: data.response.countdownSec, countdownSec: data.response.countdownSec,
});
});
let activityContent = data.response.activityContent; let activityContent = data.response.activityContent;
WxParse.wxParse('activityContent', 'html', activityContent, that); WxParse.wxParse('activityContent', 'html', activityContent, that);
//根据状态切换样式 //根据状态切换样式
if (that.data.groupNo !=""){
if (that.data.groupNo != "") {
//开团后页面变化 //开团后页面变化
if (that.data.groupStatus == 10){
if (that.data.groupStatus == 10) {
//团倒计时时 //团倒计时时
that.countActivityTime(data.response.countdownSec); that.countActivityTime(data.response.countdownSec);
//正在拼团 //正在拼团
@ -117,14 +117,14 @@ Page({
remark: "block", remark: "block",
tagColor: "#F8B551", tagColor: "#F8B551",
}); });
if (that.data.currentMemberType == -1){
if (that.data.currentMemberType == -1) {
//游客 //游客
that.setData({ that.setData({
one_content: "none", one_content: "none",
two_content: "block", two_content: "block",
buttomText: '参与拼团', buttomText: '参与拼团',
}); });
} else if (that.data.currentMemberType == 0 || that.data.currentMemberType == 10){
} else if (that.data.currentMemberType == 0 || that.data.currentMemberType == 10) {
//发起人和邀请人 //发起人和邀请人
that.setData({ that.setData({
one_content: "block", one_content: "block",
@ -133,33 +133,33 @@ Page({
buttomText: '邀请好友拼团', buttomText: '邀请好友拼团',
}); });
} }
} 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.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) {
//发起人和邀请人
that.setData({
tagColor: "#21BE8D",
one_content: "block",
two_content: "none",
bottomBGColor: '#21BE8D',
buttomText: '立即预约',
grounpInfo: "block",
grounpInfo2: "none",
remarkText: "",
});
}
} else if (that.data.groupStatus == 90){
});
} else if (that.data.currentMemberType == 0 || that.data.currentMemberType == 10) {
//发起人和邀请人
that.setData({
tagColor: "#21BE8D",
one_content: "block",
two_content: "none",
bottomBGColor: '#21BE8D',
buttomText: '立即预约',
grounpInfo: "block",
grounpInfo2: "none",
remarkText: "",
});
}
} else if (that.data.groupStatus == 90) {
//拼团失败 //拼团失败
if (that.data.currentMemberType == -1) { if (that.data.currentMemberType == -1) {
//游客 //游客
@ -187,11 +187,11 @@ Page({
} }
} }
}else{
} else {
that.countActivityTime(data.response.countdownSec); that.countActivityTime(data.response.countdownSec);
that.setData({ that.setData({
one_content: "block", one_content: "block",
grounpInfo: "none",
grounpInfo: "none",
grounpInfo2: "none", grounpInfo2: "none",
}); });
} }
@ -217,15 +217,19 @@ Page({
}) })
}, },
/** /**
*活动倒计时方法 *活动倒计时方法
*/ */
countActivityTime: function (timeStamp) { countActivityTime: function (timeStamp) {
var totalSecond = timeStamp - 1;
var interval = setInterval(function () {
var totalSecond = timeStamp - 1;
console.log("countActivityTime>>>" + timeStamp)
if (totalSecond < 0 || interval != undefined) {
return
}
interval = setInterval(function () {
// 秒数 // 秒数
var second = totalSecond; var second = totalSecond;
// 天数位 // 天数位
var day = Math.floor(second / 3600 / 24); var day = Math.floor(second / 3600 / 24);
var dayStr = day.toString(); var dayStr = day.toString();
@ -255,9 +259,6 @@ Page({
totalSecond--; totalSecond--;
if (totalSecond < 0) { if (totalSecond < 0) {
clearInterval(interval); clearInterval(interval);
wx.showToast({
title: '活动已结束',
});
this.getActivityDetail(); this.getActivityDetail();
this.setData({ this.setData({
countDownDay: '00', countDownDay: '00',
@ -282,7 +283,7 @@ Page({
}) })
}, },
//点击团按钮操作
//点击团按钮操作
groupTap: function (e) { groupTap: function (e) {
if (wx.getStorageSync('sessionId') == '') { if (wx.getStorageSync('sessionId') == '') {
wx.navigateTo({ wx.navigateTo({
@ -292,23 +293,23 @@ Page({
} }
let that = this; let that = this;
var url = ""; var url = "";
if (that.data.groupNo == ""){
if (that.data.groupNo == "") {
url = '/mall/wxa/activity/group/open'; url = '/mall/wxa/activity/group/open';
//首次开团 //首次开团
this.groupOpenOrJoin(url); this.groupOpenOrJoin(url);
}else{
} else {
if (that.data.groupStatus == 10) { if (that.data.groupStatus == 10) {
//正在拼团 //正在拼团
if (that.data.currentMemberType == -1) { if (that.data.currentMemberType == -1) {
//游客 //游客
url = '/mall/wxa/activity/group/join'; url = '/mall/wxa/activity/group/join';
this.groupOpenOrJoin(url); this.groupOpenOrJoin(url);
}else{
} else {
//团长与参与人点击分享 //团长与参与人点击分享
this.openActionsheet(); this.openActionsheet();
} }
} else if (that.data.groupStatus == 20) { } else if (that.data.groupStatus == 20) {
//拼团成功
//拼团成功
if (that.data.currentMemberType == -1) { if (that.data.currentMemberType == -1) {
//游客 //游客
url = '/mall/wxa/activity/group/open'; url = '/mall/wxa/activity/group/open';
@ -322,20 +323,20 @@ Page({
success: function (res) { success: function (res) {
if (res.confirm) { if (res.confirm) {
//用户点击确定 //用户点击确定
}
}
} }
}) })
wx.sh wx.sh
} }
} else if (that.data.groupStatus == 90){
} else if (that.data.groupStatus == 90) {
//拼团失败 //拼团失败
url = '/mall/wxa/activity/group/open'; url = '/mall/wxa/activity/group/open';
this.groupOpenOrJoin(url); this.groupOpenOrJoin(url);
}
}
} }
}, },
//开团与参团
//开团与参团
groupOpenOrJoin: function (url) { groupOpenOrJoin: function (url) {
let that = this; let that = this;
@ -432,7 +433,10 @@ Page({
* 生命周期函数--监听页面卸载 * 生命周期函数--监听页面卸载
*/ */
onUnload: function () { onUnload: function () {
if (interval != undefined){
clearInterval(interval);
interval = undefined
}
}, },
/** /**

Loading…
Cancel
Save