|
@@ -29,7 +29,17 @@ Page({
|
|
|
content: [],
|
|
|
organizer: '',
|
|
|
hide: true,
|
|
|
- isIPX: app.globalData.isIPX
|
|
|
+ isIPX: app.globalData.isIPX,
|
|
|
+ bookList: [],
|
|
|
+ sendGroupFlag: true,
|
|
|
+ selectFlag: [],
|
|
|
+ flag: true
|
|
|
+ },
|
|
|
+
|
|
|
+ tabSwitch: function () {
|
|
|
+ this.setData({
|
|
|
+ flag: !this.data.flag
|
|
|
+ })
|
|
|
},
|
|
|
jurisdiction: function () {
|
|
|
|
|
@@ -39,60 +49,85 @@ Page({
|
|
|
|
|
|
this.onLoad();
|
|
|
},
|
|
|
-
|
|
|
- gradeDetails: function () {
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
+
|
|
|
+ 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) => {
|
|
|
-
|
|
|
})
|
|
|
+
|
|
|
},
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
|
|
|
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}`
|
|
|
})
|
|
|
},
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
+
|
|
|
|
|
|
group: function () {
|
|
|
- this.openGroup();
|
|
|
+ const orderId = this.data.orderId;
|
|
|
+ this.goToDetail(orderId);
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
},
|
|
|
|
|
|
|
|
@@ -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);
|
|
|
},
|