|
@@ -53,13 +53,31 @@ Page({
|
|
|
}
|
|
|
],
|
|
|
groupStatus: false,
|
|
|
- formIsANAsshole: true
|
|
|
+ formIsANAsshole: true,
|
|
|
+ dataLoading: true,
|
|
|
+ isLoading: false,
|
|
|
+ isIOS: app.globalData.isIOS,
|
|
|
+ damnDialogLine1: '您已拥有本课三年使用权或曾获得过体验权',
|
|
|
+ // damnDialogLine2:'',
|
|
|
+ damnDialogShow: false,
|
|
|
+ knowFlag: true,
|
|
|
+ menuFlag: false
|
|
|
},
|
|
|
//tab切换
|
|
|
- tabSwitch: function () {
|
|
|
- this.setData({
|
|
|
- flag: !this.data.flag
|
|
|
- })
|
|
|
+ //tab切换
|
|
|
+ tabSwitch: function (e) {
|
|
|
+ if (e.currentTarget.dataset.flag === "know" && this.data.knowFlag === false) {
|
|
|
+ this.setData({
|
|
|
+ knowFlag: true,
|
|
|
+ menuFlag: false
|
|
|
+ })
|
|
|
+ }
|
|
|
+ if (e.currentTarget.dataset.flag === "menu" && this.data.menuFlag === false) {
|
|
|
+ this.setData({
|
|
|
+ knowFlag: false,
|
|
|
+ menuFlag: true
|
|
|
+ })
|
|
|
+ }
|
|
|
},
|
|
|
jurisdiction: function () {
|
|
|
//隐藏弹框
|
|
@@ -110,40 +128,86 @@ Page({
|
|
|
},
|
|
|
//参团
|
|
|
jionGroup: function (e) {
|
|
|
- if (app.globalData.isIOS) {
|
|
|
- this.showAlert();
|
|
|
- return;
|
|
|
- }
|
|
|
+ // if (app.globalData.isIOS) {
|
|
|
+ // this.showAlert();
|
|
|
+ // return;
|
|
|
+ // }
|
|
|
const orderId = this.data.orderId;
|
|
|
const formId = e.detail.formId
|
|
|
console.log(e)
|
|
|
//开始发起团购
|
|
|
- httpRequestApi.JoinGroupPurchas(orderId,formId).success((res) => {
|
|
|
-
|
|
|
+ httpRequestApi.JoinGroupPurchas(orderId, formId).success((res) => {
|
|
|
console.log('参加团购', res);
|
|
|
if (res.data.message) {
|
|
|
- if (res.data.code === 801) {
|
|
|
- this.setData({
|
|
|
- isModalShow: true,
|
|
|
- modalType: 'text'
|
|
|
- })
|
|
|
- } else {
|
|
|
- wx.showModal({
|
|
|
- title: '提示',
|
|
|
- content: res.data.message,
|
|
|
- success(res) {
|
|
|
- if (res.confirm) {
|
|
|
- console.log('用户点击确定')
|
|
|
- } else if (res.cancel) {
|
|
|
- console.log('用户点击取消')
|
|
|
+ // if (res.data.code === 801) {
|
|
|
+ // this.setData({
|
|
|
+ // isModalShow: true,
|
|
|
+ // modalType: 'text'
|
|
|
+ // })
|
|
|
+ // } else {
|
|
|
+ // wx.showModal({
|
|
|
+ // title: '提示',
|
|
|
+ // content: res.data.message,
|
|
|
+ // success(res) {
|
|
|
+ // if (res.confirm) {
|
|
|
+ // console.log('用户点击确定')
|
|
|
+ // } else if (res.cancel) {
|
|
|
+ // console.log('用户点击取消')
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // })
|
|
|
+ // }
|
|
|
+ switch (res.data.code) {
|
|
|
+ case 801:
|
|
|
+ this.setData({
|
|
|
+ isModalShow: true,
|
|
|
+ modalType: 'text'
|
|
|
+ })
|
|
|
+ break;
|
|
|
+ case 802:
|
|
|
+ this.setData({
|
|
|
+ // damnDialogLine1:'您已拥有本课程使用权',
|
|
|
+ // damnDialogLine2:'快去朗读吧',
|
|
|
+ damnDialogShow: true
|
|
|
+ })
|
|
|
+ break;
|
|
|
+ case 806:
|
|
|
+ wx.pageScrollTo({
|
|
|
+ scrollTop: 0,
|
|
|
+ duration: 17
|
|
|
+ })
|
|
|
+ this.setData({
|
|
|
+ // isModalShow: true,
|
|
|
+ // modalType: 'text'
|
|
|
+ alertFlag: true
|
|
|
+ })
|
|
|
+ // wx.navigateTo({
|
|
|
+ // url:'/pages/groupPage/my-group/my-group'
|
|
|
+ // })
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ wx.showModal({
|
|
|
+ title: '提示',
|
|
|
+ content: res.data.message,
|
|
|
+ success(res) {
|
|
|
+ if (res.confirm) {
|
|
|
+ console.log('用户点击确定')
|
|
|
+ } else if (res.cancel) {
|
|
|
+ console.log('用户点击取消')
|
|
|
+ }
|
|
|
}
|
|
|
- }
|
|
|
- })
|
|
|
+ })
|
|
|
+ break;
|
|
|
}
|
|
|
return false;
|
|
|
}
|
|
|
//掉起支付
|
|
|
- this.prePayMap(res.data.data.prePayMap, 'join');
|
|
|
+ if (res.data.data.groupPurchaseOrder.os === 'IOS') {
|
|
|
+ this.jionSuccess(res.data.data.groupPurchaseOrder.id, 'join');
|
|
|
+ } else {
|
|
|
+ this.prePayMap(res.data.data.prePayMap, 'join');
|
|
|
+ }
|
|
|
+
|
|
|
}).fail((error) => {
|
|
|
|
|
|
})
|
|
@@ -156,11 +220,11 @@ Page({
|
|
|
//支付
|
|
|
prePayMap: function (prePayMap, type) {
|
|
|
console.log(prePayMap)
|
|
|
- if(this.data.haveTapMoney){
|
|
|
+ if (this.data.haveTapMoney) {
|
|
|
return false
|
|
|
}
|
|
|
this.setData({
|
|
|
- haveTapMoney : true
|
|
|
+ haveTapMoney: true
|
|
|
})
|
|
|
// const that = this;
|
|
|
this.setData({
|
|
@@ -211,26 +275,28 @@ Page({
|
|
|
//拼团详情
|
|
|
jionSuccess: function (orderId, type) {
|
|
|
httpRequestApi.getMygroupInfo(orderId).success(res => {
|
|
|
+ this.data.surplusList = [];
|
|
|
// 通过分享进入的用户,如果已经参加过本次团购,则跳转进入邀请好友的页面
|
|
|
- if (this.data.goBackHome) {
|
|
|
- const joinUser = res.data.data.joinUserList;
|
|
|
- const groupId = res.data.data.groupPurchaseOrder.id;
|
|
|
- const myUid = wx.getStorageSync('uid');
|
|
|
- if (myUid === res.data.data.organizer.uid) {
|
|
|
+ console.log(res)
|
|
|
+ // if (this.data.goBackHome) {
|
|
|
+ const joinUser = res.data.data.joinUserList;
|
|
|
+ const groupId = res.data.data.groupPurchaseOrder.id;
|
|
|
+ const myUid = wx.getStorageSync('uid');
|
|
|
+ if (myUid === res.data.data.organizer.uid) {
|
|
|
+ wx.redirectTo({
|
|
|
+ url: `../collage-details/collage-details?orderId=${groupId}&goBackHome=${this.data.goBackHome}`
|
|
|
+ })
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ joinUser.forEach(item => {
|
|
|
+ if (item.uid === myUid) {
|
|
|
wx.redirectTo({
|
|
|
url: `../collage-details/collage-details?orderId=${groupId}&goBackHome=${this.data.goBackHome}`
|
|
|
})
|
|
|
return;
|
|
|
}
|
|
|
- joinUser.forEach(item => {
|
|
|
- if (item.uid === myUid) {
|
|
|
- wx.redirectTo({
|
|
|
- url: `../collage-details/collage-details?orderId=${groupId}&goBackHome=${this.data.goBackHome}`
|
|
|
- })
|
|
|
- return;
|
|
|
- }
|
|
|
- })
|
|
|
- }
|
|
|
+ })
|
|
|
+ // }
|
|
|
|
|
|
console.log('拼团详情', res);
|
|
|
const groupOrder = res.data.data.groupPurchaseOrder;
|
|
@@ -242,8 +308,11 @@ Page({
|
|
|
organizer: groupOrder.organizer,
|
|
|
productId: res.data.data.groupPurchaseOrder.productId
|
|
|
})
|
|
|
+ for (var i = 0; i < surplusNum; i++) {
|
|
|
+ this.data.surplusList.push(1);
|
|
|
+ }
|
|
|
if (type === 'join') {
|
|
|
- this.data.surplusList.pop();
|
|
|
+ // this.data.surplusList.pop();
|
|
|
if (groupOrder.status === 'SUCCESSED') {
|
|
|
this.showSuccess(groupOrder.organizer, groupOrder.organizerPrice)
|
|
|
} else {
|
|
@@ -255,13 +324,13 @@ Page({
|
|
|
orderId: groupOrder.id
|
|
|
})
|
|
|
} else {
|
|
|
- for (var i = 0; i < surplusNum; i++) {
|
|
|
- this.data.surplusList.push(1);
|
|
|
- }
|
|
|
+ // for (var i = 0; i < surplusNum; i++) {
|
|
|
+ // this.data.surplusList.push(1);
|
|
|
+ // }
|
|
|
}
|
|
|
let timeList = [];
|
|
|
// || groupOrder.status ==='SUCCESSED'
|
|
|
- const stillGoing = groupOrder.closeTime - Date.parse(new Date()) <= 0 ? false : true
|
|
|
+ const stillGoing = groupOrder.closeTime - Date.parse(new Date()) <= 0 ? false : true
|
|
|
if (stillGoing) {
|
|
|
timeList = util.lastHoursInGroup(groupOrder.closeTime - Date.parse(new Date()));
|
|
|
console.log(timeList)
|
|
@@ -274,7 +343,7 @@ Page({
|
|
|
// })
|
|
|
// }
|
|
|
// const groupStatus = false;
|
|
|
- if (groupOrder.status === 'SUCCESSED'){
|
|
|
+ if (groupOrder.status === 'SUCCESSED') {
|
|
|
this.data.groupStatus = true
|
|
|
}
|
|
|
this.setData({
|
|
@@ -283,8 +352,18 @@ Page({
|
|
|
surplusList: this.data.surplusList,
|
|
|
timeList,
|
|
|
stillGoing,
|
|
|
- groupStatus: this.data.groupStatus
|
|
|
+ groupStatus: this.data.groupStatus,
|
|
|
+ dataLoading: false,
|
|
|
+ groupOSType: groupOrder.os,
|
|
|
+ isLoading: false
|
|
|
+ },()=>{
|
|
|
+ if(groupOrder.os === 'ANDROID' && app.globalData.isIOS){
|
|
|
+ wx.redirectTo({
|
|
|
+ url: `/pages/groupPage/grade-details/grade-details?productId=${res.data.data.groupPurchaseOrder.productId}&goBackHome=1`
|
|
|
+ })
|
|
|
+ }
|
|
|
})
|
|
|
+
|
|
|
if (groupOrder.groupType === 'PROMOTION') {
|
|
|
//this.data.joinUserList.unshift(res.data.data.organizer);
|
|
|
this.setData({
|
|
@@ -399,12 +478,13 @@ Page({
|
|
|
* 生命周期函数--监听页面加载
|
|
|
*/
|
|
|
onLoad: function (options) {
|
|
|
- // if (app.globalData.isIOS) {
|
|
|
- // wx.redirectTo({
|
|
|
- // url: '../../index/index'
|
|
|
- // })
|
|
|
- // return
|
|
|
- // }
|
|
|
+ console.log(this.data.isIOS)
|
|
|
+ if (options.scene || options.shareId) {
|
|
|
+ console.log(123)
|
|
|
+ this.setData({
|
|
|
+ isLoading: true
|
|
|
+ })
|
|
|
+ }
|
|
|
|
|
|
console.log('onload', options)
|
|
|
wx.setNavigationBarTitle({
|
|
@@ -429,6 +509,7 @@ Page({
|
|
|
this.setData({
|
|
|
goBackHome: true
|
|
|
})
|
|
|
+
|
|
|
}
|
|
|
}, (error) => {
|
|
|
this.setData({
|
|
@@ -439,6 +520,17 @@ Page({
|
|
|
});
|
|
|
|
|
|
},
|
|
|
+ // 鉴权
|
|
|
+ areYouSuperSecond: function (productId) {
|
|
|
+ httpRequestApi.areYouSuperSecond(productId).success(() => {
|
|
|
+ console.log(res)
|
|
|
+ this.setData({
|
|
|
+ imSuper: res.data.data.auth ? true : false,
|
|
|
+ haveCreatedHelp: res.data.data.createdShare, // 创建过助力团
|
|
|
+ haveJoinHelp: res.data.data.joinShare, // 参加过助力团
|
|
|
+ })
|
|
|
+ });
|
|
|
+ },
|
|
|
// 下拉刷新
|
|
|
onPullDownRefresh: function () {
|
|
|
//当前在团购页下拉加载
|