|
@@ -17,7 +17,12 @@ Page({
|
|
timeList: [],
|
|
timeList: [],
|
|
productId: '',
|
|
productId: '',
|
|
groupId: '',
|
|
groupId: '',
|
|
- orderId: ''
|
|
|
|
|
|
+ orderId: '',
|
|
|
|
+ typeOf:'',
|
|
|
|
+ title: '',
|
|
|
|
+ headTextOne: '',
|
|
|
|
+ headTextTwo: '',
|
|
|
|
+ content: [],
|
|
},
|
|
},
|
|
//跳转到年级
|
|
//跳转到年级
|
|
gradeDetails: function () {
|
|
gradeDetails: function () {
|
|
@@ -39,9 +44,6 @@ Page({
|
|
groupId
|
|
groupId
|
|
}).success( (res) =>{
|
|
}).success( (res) =>{
|
|
console.log('发起团购',res);
|
|
console.log('发起团购',res);
|
|
- // wx.navigateTo({
|
|
|
|
- // url: `/pages/groupPage/collage-details/collage-details`
|
|
|
|
- // })
|
|
|
|
if(res.data.message) {
|
|
if(res.data.message) {
|
|
wx.showModal({
|
|
wx.showModal({
|
|
title: '提示',
|
|
title: '提示',
|
|
@@ -56,8 +58,11 @@ Page({
|
|
})
|
|
})
|
|
return false;
|
|
return false;
|
|
}
|
|
}
|
|
- //掉起支付
|
|
|
|
- this.prePayMap(res.data.data.prePayMap, res.data.data.groupPurchaseOrderDetail.orderId);
|
|
|
|
|
|
+ if(res.data.data.groupPurchaseOrder.groupType === 'BASE') {
|
|
|
|
+ //掉起支付
|
|
|
|
+ this.prePayMap(res.data.data.prePayMap, res.data.data.groupPurchaseOrderDetail.orderId);
|
|
|
|
+ }
|
|
|
|
+
|
|
}).fail( (error) => {
|
|
}).fail( (error) => {
|
|
|
|
|
|
})
|
|
})
|
|
@@ -81,9 +86,9 @@ Page({
|
|
}
|
|
}
|
|
})
|
|
})
|
|
return false;
|
|
return false;
|
|
- }
|
|
|
|
|
|
+ }
|
|
//掉起支付
|
|
//掉起支付
|
|
- this.prePayMap(res.data.data.prePayMap, res.data.data.groupPurchaseOrderDetail.orderId);
|
|
|
|
|
|
+ //this.prePayMap(res.data.data.prePayMap, res.data.data.orderId);
|
|
}).fail( (error) => {
|
|
}).fail( (error) => {
|
|
|
|
|
|
})
|
|
})
|
|
@@ -108,25 +113,14 @@ Page({
|
|
content: '支付成功',
|
|
content: '支付成功',
|
|
success (res) {
|
|
success (res) {
|
|
if (res.confirm) {
|
|
if (res.confirm) {
|
|
- that.popup.close();
|
|
|
|
- // setTimeout(() => {
|
|
|
|
- // wx.navigateTo({
|
|
|
|
- // url: `/pages/groupPage/collage-details/collage-details?orderId=${orderId}`
|
|
|
|
- // })
|
|
|
|
- // wx.setNavigationBarTitle({
|
|
|
|
- // title: '拼团详情'
|
|
|
|
- // })
|
|
|
|
- // }, 1000)
|
|
|
|
|
|
+ //获取拼团信息
|
|
|
|
+ this.jionSuccess(this.data.orderId);
|
|
|
|
+ this.groupSuccess(orderId);
|
|
|
|
+
|
|
} else if (res.cancel) {
|
|
} else if (res.cancel) {
|
|
- that.popup.close();
|
|
|
|
- setTimeout(() => {
|
|
|
|
- wx.navigateTo({
|
|
|
|
- url: `/pages/groupPage/collage-details/collage-details?orderId=${orderId}`
|
|
|
|
- })
|
|
|
|
- wx.setNavigationBarTitle({
|
|
|
|
- title: '拼团详情'
|
|
|
|
- })
|
|
|
|
- }, 1000)
|
|
|
|
|
|
+ //获取拼团信息
|
|
|
|
+ this.jionSuccess(this.data.orderId);
|
|
|
|
+ this.groupSuccess(orderId);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
})
|
|
})
|
|
@@ -141,6 +135,115 @@ Page({
|
|
collage: function () {
|
|
collage: function () {
|
|
|
|
|
|
},
|
|
},
|
|
|
|
+ //拼团详情
|
|
|
|
+ jionSuccess: function (orderId) {
|
|
|
|
+ httpRequestApi.getMygroupInfo(orderId).success( res => {
|
|
|
|
+ console.log('拼团详情', res.data.data);
|
|
|
|
+ const surplusNum = res.data.data.groupPurchaseOrder.headcount - res.data.data.groupPurchaseOrder.joinCount;
|
|
|
|
+ for(var i = 0; i < surplusNum; i++) {
|
|
|
|
+ this.data.surplusList.push(1);
|
|
|
|
+ }
|
|
|
|
+ console.log(res.data.data.groupPurchaseOrder.closeTimed - res.data.data.groupPurchaseOrder.gmtCreated)
|
|
|
|
+ //时间转换
|
|
|
|
+ const timeList = util.formatTime(res.data.data.groupPurchaseOrder.closeTimed - res.data.data.groupPurchaseOrder.gmtCreated);
|
|
|
|
+ this.setData({
|
|
|
|
+ surplusNum,
|
|
|
|
+ joinUserList: res.data.data.joinUserList,
|
|
|
|
+ surplusList: this.data.surplusList,
|
|
|
|
+ timeList,
|
|
|
|
+ })
|
|
|
|
+ }).fail( error => {
|
|
|
|
+ console.log('错误', error)
|
|
|
|
+ })
|
|
|
|
+ },
|
|
|
|
+
|
|
|
|
+ //拼团是否成功并弹窗
|
|
|
|
+ groupSuccess: function (orderId) {
|
|
|
|
+ httpRequestApi.groupSuccess(orderId).success( res => {
|
|
|
|
+ console.log('团购是否成功',res.data.data)
|
|
|
|
+ const status = res.data.data.status;
|
|
|
|
+ const uid = res.data.data.uid;
|
|
|
|
+ if(status == 'successed') {
|
|
|
|
+
|
|
|
|
+ if(wx.getStorageSync(uid) == uid) {
|
|
|
|
+ this.setData({
|
|
|
|
+ typeOf: 'success',
|
|
|
|
+ title: '恭喜 !',
|
|
|
|
+ headTextOne: '您发起的团购拼团成功',
|
|
|
|
+ content: [
|
|
|
|
+ {
|
|
|
|
+ text: "领袖体质魅力无穷!",
|
|
|
|
+ color: "#000"
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ text: " 您可以继续发起新的团购,",
|
|
|
|
+ color: "#000"
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ text: " 不再需要支付本课程费用,拼团成功,",
|
|
|
|
+ color: "#FF9B00"
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ text: " 您将得到xxx元奖励。",
|
|
|
|
+ color: "#FF0000"
|
|
|
|
+ }
|
|
|
|
+ ],
|
|
|
|
+ })
|
|
|
|
+ }else {
|
|
|
|
+ this.setData({
|
|
|
|
+ typeOf: 'success',
|
|
|
|
+ title: '拼团成功 ! ',
|
|
|
|
+ headTextOne: '您参与的团购拼团成功',
|
|
|
|
+ headTextTwo: '订单号:12344',
|
|
|
|
+ content: [
|
|
|
|
+ {
|
|
|
|
+ text: "感谢团长的分享",
|
|
|
|
+ color: "#000"
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ text: " 您也可以发起新的团购分享给需要的朋友们,",
|
|
|
|
+ color: "#000"
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ text: "作为新的发起人,您无需在支付本课程费用;",
|
|
|
|
+ color: "#FF0000"
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ text: "团购成功,您将得到xxx元奖励。",
|
|
|
|
+ color: "#FF0000"
|
|
|
|
+ }
|
|
|
|
+ ],
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+ }else {
|
|
|
|
+ setTimeout(() => {
|
|
|
|
+ wx.navigateTo({
|
|
|
|
+ url: `/pages/groupPage/collage-details/collage-details?orderId=${orderId}`
|
|
|
|
+ })
|
|
|
|
+ wx.setNavigationBarTitle({
|
|
|
|
+ title: '拼团详情'
|
|
|
|
+ })
|
|
|
|
+ }, 1000)
|
|
|
|
+ }
|
|
|
|
+ }).fail( error => {
|
|
|
|
+ console.log('错误', eroor)
|
|
|
|
+ })
|
|
|
|
+ },
|
|
|
|
+ //再次发起团
|
|
|
|
+ group: function () {
|
|
|
|
+ wx.showModal({
|
|
|
|
+ title: '提示',
|
|
|
|
+ content: '再次发起团',
|
|
|
|
+ success (res) {
|
|
|
|
+ if (res.confirm) {
|
|
|
|
+ console.log('用户点击确定')
|
|
|
|
+ } else if (res.cancel) {
|
|
|
|
+ console.log('用户点击取消')
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ },
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* 生命周期函数--监听页面加载
|
|
* 生命周期函数--监听页面加载
|
|
*/
|
|
*/
|
|
@@ -181,26 +284,8 @@ Page({
|
|
}).fail( (error) => {
|
|
}).fail( (error) => {
|
|
|
|
|
|
})
|
|
})
|
|
- //拼团详情
|
|
|
|
- httpRequestApi.getMygroupInfo(orderId).success( res => {
|
|
|
|
- console.log('支付详情', res.data.data);
|
|
|
|
- const surplusNum = res.data.data.groupPurchaseOrder.headcount - res.data.data.groupPurchaseOrder.joinCount;
|
|
|
|
- for(var i = 0; i < surplusNum; i++) {
|
|
|
|
- this.data.surplusList.push(1);
|
|
|
|
- }
|
|
|
|
- console.log(res.data.data.groupPurchaseOrder.closeTimed - res.data.data.groupPurchaseOrder.gmtCreated)
|
|
|
|
- //时间转换
|
|
|
|
- const timeList = util.formatTime(res.data.data.groupPurchaseOrder.closeTimed - res.data.data.groupPurchaseOrder.gmtCreated);
|
|
|
|
- this.setData({
|
|
|
|
- surplusNum,
|
|
|
|
- joinUserList: res.data.data.joinUserList,
|
|
|
|
- surplusList: this.data.surplusList,
|
|
|
|
- timeList,
|
|
|
|
- })
|
|
|
|
- }).fail( error => {
|
|
|
|
- console.log('错误', error)
|
|
|
|
- })
|
|
|
|
-
|
|
|
|
|
|
+ //获取拼团信息
|
|
|
|
+ this.jionSuccess(orderId);
|
|
},
|
|
},
|
|
|
|
|
|
/**
|
|
/**
|