|
@@ -34,7 +34,8 @@ Page({
|
|
sendGroupFlag: true,
|
|
sendGroupFlag: true,
|
|
selectFlag: [],
|
|
selectFlag: [],
|
|
flag: true,
|
|
flag: true,
|
|
- colonelName: ''
|
|
|
|
|
|
+ colonelName: '',
|
|
|
|
+ article: ''
|
|
},
|
|
},
|
|
//tab切换
|
|
//tab切换
|
|
tabSwitch: function () {
|
|
tabSwitch: function () {
|
|
@@ -57,13 +58,15 @@ Page({
|
|
})
|
|
})
|
|
},
|
|
},
|
|
//选中团购课程
|
|
//选中团购课程
|
|
- selectImg: function ({ currentTarget }) {
|
|
|
|
|
|
+ selectImg: function ({
|
|
|
|
+ currentTarget
|
|
|
|
+ }) {
|
|
const ind = currentTarget.dataset.ind;
|
|
const ind = currentTarget.dataset.ind;
|
|
//判断单选
|
|
//判断单选
|
|
this.data.selectFlag.forEach((item, index) => {
|
|
this.data.selectFlag.forEach((item, index) => {
|
|
- if(index == ind) {
|
|
|
|
|
|
+ if (index == ind) {
|
|
this.data.selectFlag[ind] = !this.data.selectFlag[ind];
|
|
this.data.selectFlag[ind] = !this.data.selectFlag[ind];
|
|
- }else {
|
|
|
|
|
|
+ } else {
|
|
this.data.selectFlag[index] = true;
|
|
this.data.selectFlag[index] = true;
|
|
}
|
|
}
|
|
})
|
|
})
|
|
@@ -73,8 +76,8 @@ Page({
|
|
},
|
|
},
|
|
//点击确定
|
|
//点击确定
|
|
sure: function () {
|
|
sure: function () {
|
|
- this.data.selectFlag.forEach( (item ,index) => {
|
|
|
|
- if(!item) {
|
|
|
|
|
|
+ this.data.selectFlag.forEach((item, index) => {
|
|
|
|
+ if (!item) {
|
|
const productId = this.data.bookList[index].id;
|
|
const productId = this.data.bookList[index].id;
|
|
const title = this.data.bookList[index].title
|
|
const title = this.data.bookList[index].title
|
|
this.setData({
|
|
this.setData({
|
|
@@ -111,7 +114,7 @@ Page({
|
|
// })
|
|
// })
|
|
// return false;
|
|
// return false;
|
|
// }
|
|
// }
|
|
-
|
|
|
|
|
|
+
|
|
// if (res.data.data.groupPurchaseOrder.groupType === 'BASE') {
|
|
// if (res.data.data.groupPurchaseOrder.groupType === 'BASE') {
|
|
// debugger;
|
|
// debugger;
|
|
// //掉起支付
|
|
// //掉起支付
|
|
@@ -194,15 +197,17 @@ Page({
|
|
},
|
|
},
|
|
//拼团详情
|
|
//拼团详情
|
|
jionSuccess: function (orderId, type) {
|
|
jionSuccess: function (orderId, type) {
|
|
- debugger;
|
|
|
|
httpRequestApi.getMygroupInfo(orderId).success(res => {
|
|
httpRequestApi.getMygroupInfo(orderId).success(res => {
|
|
- console.log('拼团详情', res.data.data);
|
|
|
|
|
|
+ console.log('拼团详情', res);
|
|
const groupOrder = res.data.data.groupPurchaseOrder;
|
|
const groupOrder = res.data.data.groupPurchaseOrder;
|
|
const surplusNum = groupOrder.headcount - groupOrder.joinCount;
|
|
const surplusNum = groupOrder.headcount - groupOrder.joinCount;
|
|
|
|
+ if (this.data.article === '') {
|
|
|
|
+ this.getBooksInfo(res.data.data.groupPurchaseOrder.productId)
|
|
|
|
+ }
|
|
|
|
+
|
|
this.setData({
|
|
this.setData({
|
|
organizer: groupOrder.organizer,
|
|
organizer: groupOrder.organizer,
|
|
})
|
|
})
|
|
- debugger
|
|
|
|
if (type === 'join') {
|
|
if (type === 'join') {
|
|
this.data.surplusList.pop();
|
|
this.data.surplusList.pop();
|
|
if (groupOrder.status === 'SUCCESSED') {
|
|
if (groupOrder.status === 'SUCCESSED') {
|
|
@@ -232,7 +237,7 @@ Page({
|
|
surplusList: this.data.surplusList,
|
|
surplusList: this.data.surplusList,
|
|
timeList,
|
|
timeList,
|
|
})
|
|
})
|
|
- if(groupOrder.groupType === 'PROMOTION'){
|
|
|
|
|
|
+ if (groupOrder.groupType === 'PROMOTION') {
|
|
//this.data.joinUserList.unshift(res.data.data.organizer);
|
|
//this.data.joinUserList.unshift(res.data.data.organizer);
|
|
this.setData({
|
|
this.setData({
|
|
colonelName: res.data.data.organizer.wechatName
|
|
colonelName: res.data.data.organizer.wechatName
|
|
@@ -259,8 +264,7 @@ Page({
|
|
titles: '恭喜 !',
|
|
titles: '恭喜 !',
|
|
headTextOne: '您发起的团购拼团成功',
|
|
headTextOne: '您发起的团购拼团成功',
|
|
headTextTwo: '领袖体质魅力无穷!',
|
|
headTextTwo: '领袖体质魅力无穷!',
|
|
- content: [
|
|
|
|
- {
|
|
|
|
|
|
+ content: [{
|
|
text: " 您可以继续发起新的团购,",
|
|
text: " 您可以继续发起新的团购,",
|
|
color: "#F97800"
|
|
color: "#F97800"
|
|
},
|
|
},
|
|
@@ -273,7 +277,7 @@ Page({
|
|
color: "#F97800"
|
|
color: "#F97800"
|
|
}
|
|
}
|
|
],
|
|
],
|
|
- },()=>{
|
|
|
|
|
|
+ }, () => {
|
|
this.popup.close()
|
|
this.popup.close()
|
|
})
|
|
})
|
|
} else {
|
|
} else {
|
|
@@ -282,8 +286,7 @@ Page({
|
|
titles: '拼团成功 ! ',
|
|
titles: '拼团成功 ! ',
|
|
headTextOne: '您参与的团购拼团成功',
|
|
headTextOne: '您参与的团购拼团成功',
|
|
headTextTwo: '感谢团长的分享',
|
|
headTextTwo: '感谢团长的分享',
|
|
- content: [
|
|
|
|
- {
|
|
|
|
|
|
+ content: [{
|
|
text: " 您也可以发起新的团购",
|
|
text: " 您也可以发起新的团购",
|
|
color: "#F97800"
|
|
color: "#F97800"
|
|
},
|
|
},
|
|
@@ -300,7 +303,7 @@ Page({
|
|
color: "#F97800"
|
|
color: "#F97800"
|
|
}
|
|
}
|
|
],
|
|
],
|
|
- },()=>{
|
|
|
|
|
|
+ }, () => {
|
|
this.popup.close()
|
|
this.popup.close()
|
|
})
|
|
})
|
|
}
|
|
}
|
|
@@ -349,7 +352,7 @@ Page({
|
|
wx.redirectTo({
|
|
wx.redirectTo({
|
|
url: '../../index/index'
|
|
url: '../../index/index'
|
|
})
|
|
})
|
|
- return
|
|
|
|
|
|
+ return
|
|
}
|
|
}
|
|
getOpenidSessionKey((res) => {}, (error) => {
|
|
getOpenidSessionKey((res) => {}, (error) => {
|
|
this.setData({
|
|
this.setData({
|
|
@@ -360,24 +363,54 @@ Page({
|
|
wx.setNavigationBarTitle({
|
|
wx.setNavigationBarTitle({
|
|
title: '拼团详情'
|
|
title: '拼团详情'
|
|
})
|
|
})
|
|
- if (!options.productId) return false;
|
|
|
|
- const productId = options.productId;
|
|
|
|
- const groupId = options.groupId;
|
|
|
|
- const orderId = options.id;
|
|
|
|
- this.setData({
|
|
|
|
- productId,
|
|
|
|
- groupId,
|
|
|
|
- orderId
|
|
|
|
- })
|
|
|
|
|
|
+ console.log(options)
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ // if (oprions.shareId) {
|
|
|
|
+ // const orderId = options.shareId
|
|
|
|
+ // }
|
|
|
|
+ if (options.orderId) {
|
|
|
|
+ // const productId = options.productId;
|
|
|
|
+ // const groupId = options.groupId;
|
|
|
|
+ const orderId = options.id;
|
|
|
|
+ this.setData({
|
|
|
|
+ // productId,
|
|
|
|
+ // groupId,
|
|
|
|
+ orderId
|
|
|
|
+ })
|
|
|
|
+ this.jionSuccess(orderId);
|
|
|
|
+ } else {
|
|
|
|
+ // 从分享页面进入的
|
|
|
|
+ const orderId = options.productId ? options.productId : options.scene ? options.scene.replace('QR', '') : options.shareId;
|
|
|
|
+ this.jionSuccess(orderId);
|
|
|
|
+ }
|
|
|
|
+ if (options.scene || options.shareId) {
|
|
|
|
+ this.setData({
|
|
|
|
+ goBackHome: true
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ //获取拼团信息
|
|
|
|
+
|
|
|
|
+ },
|
|
|
|
+ // 获取课本详情
|
|
|
|
+ getBooksInfo: function (productId) {
|
|
//课本详情
|
|
//课本详情
|
|
httpRequestApi.getBookDetail(wx.getStorageSync('uid'), productId).success((res) => {
|
|
httpRequestApi.getBookDetail(wx.getStorageSync('uid'), productId).success((res) => {
|
|
console.log('课本详情', res.data.data);
|
|
console.log('课本详情', res.data.data);
|
|
const bookInfo = res.data.data.product;
|
|
const bookInfo = res.data.data.product;
|
|
const lessonList = res.data.data.lessonList;
|
|
const lessonList = res.data.data.lessonList;
|
|
|
|
+ const data = app.towxml.toJson(
|
|
|
|
+ bookInfo.description,
|
|
|
|
+ 'markdown',
|
|
|
|
+ this
|
|
|
|
+ )
|
|
this.setData({
|
|
this.setData({
|
|
titleIcon: bookInfo.bgImg,
|
|
titleIcon: bookInfo.bgImg,
|
|
title: bookInfo.title,
|
|
title: bookInfo.title,
|
|
- bookInfo: bookInfo.description
|
|
|
|
|
|
+ bookInfo: bookInfo.description,
|
|
|
|
+ article: data
|
|
})
|
|
})
|
|
const lessonTemp = [];
|
|
const lessonTemp = [];
|
|
lessonList.forEach(item => {
|
|
lessonList.forEach(item => {
|
|
@@ -388,14 +421,14 @@ Page({
|
|
lessonTemp.push(temp);
|
|
lessonTemp.push(temp);
|
|
});
|
|
});
|
|
this.setData({
|
|
this.setData({
|
|
- lessonList: lessonTemp
|
|
|
|
|
|
+ lessonList: lessonTemp,
|
|
});
|
|
});
|
|
}).fail((error) => {
|
|
}).fail((error) => {
|
|
|
|
|
|
})
|
|
})
|
|
//全部课本
|
|
//全部课本
|
|
httpRequestApi.getAllBooks(1, 10).success((res) => {
|
|
httpRequestApi.getAllBooks(1, 10).success((res) => {
|
|
- console.log('全部课',res.data.data.list)
|
|
|
|
|
|
+ console.log('全部课', res.data.data.list)
|
|
res.data.data.list.forEach(element => {
|
|
res.data.data.list.forEach(element => {
|
|
this.data.selectFlag.push(true);
|
|
this.data.selectFlag.push(true);
|
|
});
|
|
});
|
|
@@ -404,12 +437,9 @@ Page({
|
|
selectFlag: this.data.selectFlag
|
|
selectFlag: this.data.selectFlag
|
|
})
|
|
})
|
|
}).fail((error) => {
|
|
}).fail((error) => {
|
|
- console.log('错误',error)
|
|
|
|
|
|
+ console.log('错误', error)
|
|
})
|
|
})
|
|
- //获取拼团信息
|
|
|
|
- this.jionSuccess(orderId);
|
|
|
|
},
|
|
},
|
|
-
|
|
|
|
/**
|
|
/**
|
|
* 生命周期函数--监听页面初次渲染完成
|
|
* 生命周期函数--监听页面初次渲染完成
|
|
*/
|
|
*/
|