|
@@ -9,11 +9,11 @@ Page({
|
|
*/
|
|
*/
|
|
data: {
|
|
data: {
|
|
myGroupList: [],
|
|
myGroupList: [],
|
|
- typeOf:'',
|
|
|
|
|
|
+ typeOf: '',
|
|
title: '',
|
|
title: '',
|
|
headTextOne: '',
|
|
headTextOne: '',
|
|
headTextTwo: '',
|
|
headTextTwo: '',
|
|
- content: [],
|
|
|
|
|
|
+ content: [],
|
|
productId: '',
|
|
productId: '',
|
|
orderId: '',
|
|
orderId: '',
|
|
groupId: '',
|
|
groupId: '',
|
|
@@ -23,8 +23,10 @@ Page({
|
|
line1: '您还没有拼过团哦',
|
|
line1: '您还没有拼过团哦',
|
|
line2: '拼过团再来看看吧'
|
|
line2: '拼过团再来看看吧'
|
|
},
|
|
},
|
|
- //跳转到团购详情页
|
|
|
|
- collageDetails: function ({currentTarget}) {
|
|
|
|
|
|
+ //跳转到团购详情页
|
|
|
|
+ collageDetails: function ({
|
|
|
|
+ currentTarget
|
|
|
|
+ }) {
|
|
const orderId = currentTarget.dataset.orderid;
|
|
const orderId = currentTarget.dataset.orderid;
|
|
const productId = currentTarget.dataset.productid;
|
|
const productId = currentTarget.dataset.productid;
|
|
const groupId = currentTarget.dataset.groupid;
|
|
const groupId = currentTarget.dataset.groupid;
|
|
@@ -35,12 +37,12 @@ Page({
|
|
ind
|
|
ind
|
|
})
|
|
})
|
|
console.log(num)
|
|
console.log(num)
|
|
- if(!num) {
|
|
|
|
|
|
+ if (!num) {
|
|
wx.navigateTo({
|
|
wx.navigateTo({
|
|
url: `/pages/groupPage/collage-details/collage-details?orderId=${orderId}`
|
|
url: `/pages/groupPage/collage-details/collage-details?orderId=${orderId}`
|
|
})
|
|
})
|
|
} else {
|
|
} else {
|
|
- if(this.data.closeFlags[ind]) {
|
|
|
|
|
|
+ if (this.data.closeFlags[ind]) {
|
|
this.popup.close();
|
|
this.popup.close();
|
|
this.setData({
|
|
this.setData({
|
|
productId,
|
|
productId,
|
|
@@ -48,7 +50,7 @@ Page({
|
|
groupId
|
|
groupId
|
|
})
|
|
})
|
|
this.dialog(uid);
|
|
this.dialog(uid);
|
|
- }else {
|
|
|
|
|
|
+ } else {
|
|
wx.navigateTo({
|
|
wx.navigateTo({
|
|
url: `/pages/groupPage/collage-details/collage-details?orderId=${orderId}&read=true`
|
|
url: `/pages/groupPage/collage-details/collage-details?orderId=${orderId}&read=true`
|
|
})
|
|
})
|
|
@@ -68,7 +70,7 @@ Page({
|
|
// }
|
|
// }
|
|
if (option && option.title) {
|
|
if (option && option.title) {
|
|
wx.setNavigationBarTitle({
|
|
wx.setNavigationBarTitle({
|
|
- title: option.title//页面标题为路由参数
|
|
|
|
|
|
+ title: option.title //页面标题为路由参数
|
|
});
|
|
});
|
|
this.setData({
|
|
this.setData({
|
|
title: option.title
|
|
title: option.title
|
|
@@ -77,9 +79,9 @@ Page({
|
|
this.getMyGroup();
|
|
this.getMyGroup();
|
|
},
|
|
},
|
|
// 获取我的拼团
|
|
// 获取我的拼团
|
|
- getMyGroup: function(){
|
|
|
|
|
|
+ getMyGroup: function () {
|
|
httpRequestApi.getMygroup().success((res) => {
|
|
httpRequestApi.getMygroup().success((res) => {
|
|
- if(!res.data.data.list){
|
|
|
|
|
|
+ if (!res.data.data.list) {
|
|
return
|
|
return
|
|
}
|
|
}
|
|
this.setData({
|
|
this.setData({
|
|
@@ -89,12 +91,12 @@ Page({
|
|
});
|
|
});
|
|
console.log('我的团', res.data.data.list)
|
|
console.log('我的团', res.data.data.list)
|
|
res.data.data.list.forEach(element => {
|
|
res.data.data.list.forEach(element => {
|
|
- if(element.groupPurchaseOrder.status == 'SUCCESSED') {
|
|
|
|
|
|
+ if (element.groupPurchaseOrder.status == 'SUCCESSED') {
|
|
this.data.closeFlags.push(true);
|
|
this.data.closeFlags.push(true);
|
|
this.data.timeList.push(util.formatDate(element.groupPurchaseOrder.gmtModified, 4))
|
|
this.data.timeList.push(util.formatDate(element.groupPurchaseOrder.gmtModified, 4))
|
|
- }else {
|
|
|
|
|
|
+ } else {
|
|
this.data.closeFlags.push(false);
|
|
this.data.closeFlags.push(false);
|
|
- if(element.groupPurchaseOrder.closeTime - Date.parse(new Date()) < 0 ) {
|
|
|
|
|
|
+ if (element.groupPurchaseOrder.closeTime - Date.parse(new Date()) < 0) {
|
|
this.data.timeList.push('时间到了,')
|
|
this.data.timeList.push('时间到了,')
|
|
} else {
|
|
} else {
|
|
this.data.timeList.push(util.formatTime(element.groupPurchaseOrder.closeTime - Date.parse(new Date())).join(':'))
|
|
this.data.timeList.push(util.formatTime(element.groupPurchaseOrder.closeTime - Date.parse(new Date())).join(':'))
|
|
@@ -106,60 +108,58 @@ Page({
|
|
myGroupList: res.data.data.list,
|
|
myGroupList: res.data.data.list,
|
|
timeList: this.data.timeList
|
|
timeList: this.data.timeList
|
|
})
|
|
})
|
|
- }).fail( error => {
|
|
|
|
|
|
+ }).fail(error => {
|
|
console.log('错误', error)
|
|
console.log('错误', error)
|
|
})
|
|
})
|
|
},
|
|
},
|
|
dialog: function (uid) {
|
|
dialog: function (uid) {
|
|
- if(wx.getStorageSync('uid') == uid) {
|
|
|
|
- this.setData({
|
|
|
|
- typeOf: 'success',
|
|
|
|
- title: '恭喜',
|
|
|
|
- headTextOne: '您发起的团购拼团成功',
|
|
|
|
- headTextTwo: '领袖体质魅力无穷!',
|
|
|
|
- content: [
|
|
|
|
- {
|
|
|
|
- text: " 您可以继续发起新的团购",
|
|
|
|
- color: "#F97800"
|
|
|
|
- },
|
|
|
|
- {
|
|
|
|
- text: " 不再需要支付本课程费用",
|
|
|
|
- color: "#F97800"
|
|
|
|
- },
|
|
|
|
- {
|
|
|
|
- text: " 拼团成功,您将得到奖学金",
|
|
|
|
- color: "#F97800"
|
|
|
|
- }
|
|
|
|
- ],
|
|
|
|
- btnContent: '再接再厉 赚奖学金'
|
|
|
|
- })
|
|
|
|
- }else {
|
|
|
|
- this.setData({
|
|
|
|
- typeOf: 'success',
|
|
|
|
- title: '拼团成功',
|
|
|
|
- headTextOne: '您参与的团购拼团成功',
|
|
|
|
- headTextTwo: '感谢团长的分享',
|
|
|
|
- content: [
|
|
|
|
- {
|
|
|
|
- text: " 您也可以发起新的团购",
|
|
|
|
- color: "#F97800"
|
|
|
|
- },
|
|
|
|
- {
|
|
|
|
- text: "作为新的发起人",
|
|
|
|
- color: "#F97800"
|
|
|
|
- },
|
|
|
|
- {
|
|
|
|
- text: "您无需在支付本课程费用",
|
|
|
|
- color: "#F97800"
|
|
|
|
|
|
+ if (wx.getStorageSync('uid') == uid) {
|
|
|
|
+ this.setData({
|
|
|
|
+ typeOf: 'success',
|
|
|
|
+ title: '恭喜',
|
|
|
|
+ headTextOne: '您发起的团购拼团成功',
|
|
|
|
+ headTextTwo: '领袖体质魅力无穷!',
|
|
|
|
+ content: [{
|
|
|
|
+ text: " 您可以继续发起新的团购",
|
|
|
|
+ color: "#F97800"
|
|
},
|
|
},
|
|
- {
|
|
|
|
- text: "拼团成功,您将得到奖学金",
|
|
|
|
- color: "#F97800"
|
|
|
|
- }
|
|
|
|
- ],
|
|
|
|
- btnContent: '我也试试 赚奖学金'
|
|
|
|
- })
|
|
|
|
- }
|
|
|
|
|
|
+ {
|
|
|
|
+ text: " 不再需要支付本课程费用",
|
|
|
|
+ color: "#F97800"
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ text: " 拼团成功,您将得到奖学金",
|
|
|
|
+ color: "#F97800"
|
|
|
|
+ }
|
|
|
|
+ ],
|
|
|
|
+ btnContent: '再接再厉 赚奖学金'
|
|
|
|
+ })
|
|
|
|
+ } else {
|
|
|
|
+ this.setData({
|
|
|
|
+ typeOf: 'success',
|
|
|
|
+ title: '拼团成功',
|
|
|
|
+ headTextOne: '您参与的团购拼团成功',
|
|
|
|
+ headTextTwo: '感谢团长的分享',
|
|
|
|
+ content: [{
|
|
|
|
+ text: " 您也可以发起新的团购",
|
|
|
|
+ color: "#F97800"
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ text: "作为新的发起人",
|
|
|
|
+ color: "#F97800"
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ text: "您无需在支付本课程费用",
|
|
|
|
+ color: "#F97800"
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ text: "拼团成功,您将得到奖学金",
|
|
|
|
+ color: "#F97800"
|
|
|
|
+ }
|
|
|
|
+ ],
|
|
|
|
+ btnContent: '我也试试 赚奖学金'
|
|
|
|
+ })
|
|
|
|
+ }
|
|
},
|
|
},
|
|
close: function () {
|
|
close: function () {
|
|
const ind = this.data.ind;
|
|
const ind = this.data.ind;
|
|
@@ -175,28 +175,33 @@ Page({
|
|
const productId = this.data.productId;
|
|
const productId = this.data.productId;
|
|
const groupId = this.data.groupId;
|
|
const groupId = this.data.groupId;
|
|
const id = this.data.orderId;
|
|
const id = this.data.orderId;
|
|
|
|
+
|
|
|
|
+ wx.navigateTo({
|
|
|
|
+ url: `/pages/groupPage/grade-details/grade-details?productId=${productId}`
|
|
|
|
+ })
|
|
|
|
+
|
|
//开始发起团购
|
|
//开始发起团购
|
|
- httpRequestApi.SendGroupPurchas({
|
|
|
|
- productId,
|
|
|
|
- groupId
|
|
|
|
- }).success((res) => {
|
|
|
|
- console.log('发起团购', res);
|
|
|
|
- if (res.data.message) {
|
|
|
|
- wx.showModal({
|
|
|
|
- title: '提示',
|
|
|
|
- content: res.data.message,
|
|
|
|
- success:(res) => {
|
|
|
|
- }
|
|
|
|
- })
|
|
|
|
- return false;
|
|
|
|
- }
|
|
|
|
- wx.navigateTo({
|
|
|
|
- url: `/pages/groupPage/make-money/make-money?productId=${productId}&id=${res.data.data.groupPurchaseOrder.id}&groupId=${groupId}`
|
|
|
|
- })
|
|
|
|
- // this.getMygroup();
|
|
|
|
- }).fail((error) => {
|
|
|
|
|
|
+ // httpRequestApi.SendGroupPurchas({
|
|
|
|
+ // productId,
|
|
|
|
+ // groupId
|
|
|
|
+ // }).success((res) => {
|
|
|
|
+ // console.log('发起团购', res);
|
|
|
|
+ // if (res.data.message) {
|
|
|
|
+ // wx.showModal({
|
|
|
|
+ // title: '提示',
|
|
|
|
+ // content: res.data.message,
|
|
|
|
+ // success:(res) => {
|
|
|
|
+ // }
|
|
|
|
+ // })
|
|
|
|
+ // return false;
|
|
|
|
+ // }
|
|
|
|
+ // wx.navigateTo({
|
|
|
|
+ // url: `/pages/groupPage/make-money/make-money?productId=${productId}&id=${res.data.data.groupPurchaseOrder.id}&groupId=${groupId}`
|
|
|
|
+ // })
|
|
|
|
+ // // this.getMygroup();
|
|
|
|
+ // }).fail((error) => {
|
|
|
|
|
|
- })
|
|
|
|
|
|
+ // })
|
|
},
|
|
},
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -213,14 +218,13 @@ Page({
|
|
},
|
|
},
|
|
onPullDownRefresh: function () {
|
|
onPullDownRefresh: function () {
|
|
this.onLoad();
|
|
this.onLoad();
|
|
-
|
|
|
|
|
|
+
|
|
wx.showNavigationBarLoading() //在标题栏中显示加载
|
|
wx.showNavigationBarLoading() //在标题栏中显示加载
|
|
//模拟加载
|
|
//模拟加载
|
|
- setTimeout(function()
|
|
|
|
- {
|
|
|
|
|
|
+ setTimeout(function () {
|
|
// complete
|
|
// complete
|
|
wx.hideNavigationBarLoading() //完成停止加载
|
|
wx.hideNavigationBarLoading() //完成停止加载
|
|
wx.stopPullDownRefresh() //停止下拉刷新
|
|
wx.stopPullDownRefresh() //停止下拉刷新
|
|
- },1500);
|
|
|
|
|
|
+ }, 1500);
|
|
}
|
|
}
|
|
})
|
|
})
|