|
@@ -29,7 +29,17 @@ Page({
|
|
|
content: [],
|
|
|
organizer: '',
|
|
|
hide: true,
|
|
|
- isIPX: app.globalData.isIPX
|
|
|
+ isIPX: app.globalData.isIPX,
|
|
|
+ bookList: [],
|
|
|
+ sendGroupFlag: true,
|
|
|
+ selectFlag: [],
|
|
|
+ flag: true
|
|
|
+ },
|
|
|
+ //tab切换
|
|
|
+ tabSwitch: function () {
|
|
|
+ this.setData({
|
|
|
+ flag: !this.data.flag
|
|
|
+ })
|
|
|
},
|
|
|
jurisdiction: function () {
|
|
|
//隐藏弹框
|
|
@@ -39,60 +49,85 @@ Page({
|
|
|
//登录页信息
|
|
|
this.onLoad();
|
|
|
},
|
|
|
- //跳转到年级
|
|
|
- gradeDetails: function () {
|
|
|
- // wx.navigateTo({
|
|
|
- // url: '/pages/groupPage/grade-details/grade-details'
|
|
|
- // })
|
|
|
- // wx.setNavigationBarTitle({
|
|
|
- // title: '限量优惠团购'
|
|
|
- // })
|
|
|
-
|
|
|
+ //发起团购
|
|
|
+ sendGroup: function () {
|
|
|
+ this.setData({
|
|
|
+ sendGroupFlag: !this.data.sendGroupFlag
|
|
|
+ })
|
|
|
},
|
|
|
- //开团
|
|
|
- openGroup: function () {
|
|
|
-
|
|
|
- const productId = this.data.productId;
|
|
|
- const groupId = this.data.groupId;
|
|
|
- //开始发起团购
|
|
|
- httpRequestApi.SendGroupPurchas({
|
|
|
- productId,
|
|
|
- groupId
|
|
|
- }).success((res) => {
|
|
|
- console.log('发起团购', res);
|
|
|
- if (res.data.message) {
|
|
|
- wx.showModal({
|
|
|
- title: '提示',
|
|
|
- content: res.data.message,
|
|
|
- success(res) {
|
|
|
- if (res.confirm) {
|
|
|
- console.log('用户点击确定')
|
|
|
- } else if (res.cancel) {
|
|
|
- console.log('用户点击取消')
|
|
|
- }
|
|
|
- }
|
|
|
- })
|
|
|
- return false;
|
|
|
- }
|
|
|
- debugger;
|
|
|
- if (res.data.data.groupPurchaseOrder.groupType === 'BASE') {
|
|
|
- //掉起支付
|
|
|
- this.prePayMap(res.data.data.prePayMap, 'create');
|
|
|
+ //选中团购课程
|
|
|
+ selectImg: function ({ currentTarget }) {
|
|
|
+ const ind = currentTarget.dataset.ind;
|
|
|
+ //判断单选
|
|
|
+ this.data.selectFlag.forEach((item, index) => {
|
|
|
+ if(index == ind) {
|
|
|
+ this.data.selectFlag[ind] = !this.data.selectFlag[ind];
|
|
|
}else {
|
|
|
+ this.data.selectFlag[index] = true;
|
|
|
+ }
|
|
|
+ })
|
|
|
+ this.setData({
|
|
|
+ selectFlag: this.data.selectFlag
|
|
|
+ })
|
|
|
+ },
|
|
|
+ //点击确定
|
|
|
+ sure: function () {
|
|
|
+ this.data.selectFlag.forEach( (item ,index) => {
|
|
|
+ if(!item) {
|
|
|
+ const productId = this.data.bookList[index].id;
|
|
|
+ const title = this.data.bookList[index].title
|
|
|
+ this.setData({
|
|
|
+ sendGroupFlag: !this.data.sendGroupFlag
|
|
|
+ })
|
|
|
wx.navigateTo({
|
|
|
- url: `/pages/groupPage/make-money/make-money?productId=${productId}&id=${res.data.data.groupPurchaseOrder.id}&groupId=${groupId}`
|
|
|
+ url: `/pages/groupPage/grade-details/grade-details?productId=${productId}&title=${title}`
|
|
|
})
|
|
|
}
|
|
|
-
|
|
|
- }).fail((error) => {
|
|
|
-
|
|
|
})
|
|
|
+
|
|
|
},
|
|
|
+ //开团
|
|
|
+ // openGroup: function (productId) {
|
|
|
+ // //const productId = this.data.productId;
|
|
|
+ // const groupId = this.data.groupId;
|
|
|
+ // //开始发起团购
|
|
|
+ // httpRequestApi.SendGroupPurchas({
|
|
|
+ // productId,
|
|
|
+ // groupId
|
|
|
+ // }).success((res) => {
|
|
|
+ // console.log('发起团购', res);
|
|
|
+ // if (res.data.message) {
|
|
|
+ // wx.showModal({
|
|
|
+ // title: '提示',
|
|
|
+ // content: res.data.message,
|
|
|
+ // success(res) {
|
|
|
+ // if (res.confirm) {
|
|
|
+ // console.log('用户点击确定')
|
|
|
+ // } else if (res.cancel) {
|
|
|
+ // console.log('用户点击取消')
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // })
|
|
|
+ // return false;
|
|
|
+ // }
|
|
|
+
|
|
|
+ // if (res.data.data.groupPurchaseOrder.groupType === 'BASE') {
|
|
|
+ // debugger;
|
|
|
+ // //掉起支付
|
|
|
+ // this.prePayMap(res.data.data.prePayMap, 'create');
|
|
|
+ // }else {
|
|
|
+ // wx.navigateTo({
|
|
|
+ // url: `/pages/groupPage/make-money/make-money?productId=${productId}&id=${res.data.data.groupPurchaseOrder.id}&groupId=${groupId}`
|
|
|
+ // })
|
|
|
+ // }
|
|
|
+
|
|
|
+ // }).fail((error) => {
|
|
|
+
|
|
|
+ // })
|
|
|
+ // },
|
|
|
//参团
|
|
|
jionGroup: function () {
|
|
|
-
|
|
|
const orderId = this.data.orderId;
|
|
|
-
|
|
|
//开始发起团购
|
|
|
httpRequestApi.JoinGroupPurchas(orderId).success((res) => {
|
|
|
console.log('参加团购', res);
|
|
@@ -119,7 +154,6 @@ Page({
|
|
|
|
|
|
//支付
|
|
|
prePayMap: function (prePayMap, type) {
|
|
|
-
|
|
|
console.log(prePayMap)
|
|
|
const that = this;
|
|
|
wx.requestPayment({
|
|
@@ -159,6 +193,7 @@ Page({
|
|
|
},
|
|
|
//拼团详情
|
|
|
jionSuccess: function (orderId, type) {
|
|
|
+ debugger;
|
|
|
httpRequestApi.getMygroupInfo(orderId).success(res => {
|
|
|
console.log('拼团详情', res.data.data);
|
|
|
const groupOrder = res.data.data.groupPurchaseOrder;
|
|
@@ -166,6 +201,7 @@ Page({
|
|
|
this.setData({
|
|
|
organizer: groupOrder.organizer,
|
|
|
})
|
|
|
+ debugger
|
|
|
if (type === 'join') {
|
|
|
this.data.surplusList.pop();
|
|
|
if (groupOrder.status === 'SUCCESSED') {
|
|
@@ -173,7 +209,11 @@ Page({
|
|
|
} else {
|
|
|
this.goToDetail(groupOrder.id)
|
|
|
}
|
|
|
-
|
|
|
+ } else if (type === 'create') {
|
|
|
+ this.showSuccess(groupOrder.organizer, groupOrder.organizerPrice)
|
|
|
+ this.setData({
|
|
|
+ orderId: groupOrder.id
|
|
|
+ })
|
|
|
} else {
|
|
|
for (var i = 0; i < surplusNum; i++) {
|
|
|
this.data.surplusList.push(1);
|
|
@@ -208,6 +248,7 @@ Page({
|
|
|
},
|
|
|
// 弹成功信息框
|
|
|
showSuccess: function (organizerUid, price) {
|
|
|
+ debugger;
|
|
|
if (wx.getStorageSync('uid') == organizerUid) {
|
|
|
this.setData({
|
|
|
typeOf: 'success',
|
|
@@ -280,78 +321,21 @@ Page({
|
|
|
url: `../../main/class/class?id=${id}&title=${title}`
|
|
|
})
|
|
|
},
|
|
|
- //拼团是否成功并弹窗
|
|
|
- // groupSuccess: function (orderId, detailId) {
|
|
|
- // 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=${detailId}`
|
|
|
- // })
|
|
|
- // wx.setNavigationBarTitle({
|
|
|
- // title: '拼团详情'
|
|
|
- // })
|
|
|
- // }, 3000)
|
|
|
- // }
|
|
|
- // }).fail(error => {
|
|
|
- // console.log('错误', eroor)
|
|
|
- // })
|
|
|
- // },
|
|
|
+
|
|
|
//再次发起团
|
|
|
group: function () {
|
|
|
- this.openGroup();
|
|
|
+ const orderId = this.data.orderId;
|
|
|
+ this.goToDetail(orderId);
|
|
|
+ //拼团是否成功并弹窗
|
|
|
+ // httpRequestApi.groupSuccess(orderId).success(res => {
|
|
|
+ // console.log('团购是否成功', res.data.data)
|
|
|
+ // debugger;
|
|
|
+ // const status = res.data.data.status;
|
|
|
+ // const uid = res.data.data.uid;
|
|
|
+ // }).fail(error => {
|
|
|
+ // console.log('错误', eroor)
|
|
|
+ // })
|
|
|
+ //this.openGroup();
|
|
|
},
|
|
|
|
|
|
/**
|
|
@@ -378,7 +362,6 @@ Page({
|
|
|
})
|
|
|
//课本详情
|
|
|
httpRequestApi.getBookDetail(wx.getStorageSync('uid'), productId).success((res) => {
|
|
|
-
|
|
|
console.log('课本详情', res.data.data);
|
|
|
const bookInfo = res.data.data.product;
|
|
|
const lessonList = res.data.data.lessonList;
|
|
@@ -401,6 +384,19 @@ Page({
|
|
|
}).fail((error) => {
|
|
|
|
|
|
})
|
|
|
+ //全部课本
|
|
|
+ httpRequestApi.getAllBooks(1, 10).success((res) => {
|
|
|
+ console.log('全部课',res.data.data.list)
|
|
|
+ res.data.data.list.forEach(element => {
|
|
|
+ this.data.selectFlag.push(true);
|
|
|
+ });
|
|
|
+ this.setData({
|
|
|
+ bookList: res.data.data.list,
|
|
|
+ selectFlag: this.data.selectFlag
|
|
|
+ })
|
|
|
+ }).fail((error) => {
|
|
|
+ console.log('错误',error)
|
|
|
+ })
|
|
|
//获取拼团信息
|
|
|
this.jionSuccess(orderId);
|
|
|
},
|