Browse Source

解决问题

Limengbo 6 years ago
parent
commit
8e61eb4466

+ 8 - 1
pages/groupPage/grade-details/grade-details.js

@@ -26,7 +26,14 @@ Page({
       }
     ],
     share: false,
-    isIPX: app.globalData.isIPX
+    isIPX: app.globalData.isIPX,
+    flag: true
+  },
+  //tab切换
+  tabSwitch: function () {
+    this.setData({
+      flag: !this.data.flag
+    })
   },
   //获取团购信息并掉起支付
   pay: function ({

+ 7 - 6
pages/groupPage/grade-details/grade-details.wxml

@@ -3,19 +3,20 @@
     <scroll-view scroll-y="{{true}}">
         <view class="grade-details">
             <image src="{{titleIcon}}"></image>
-            <text>{{title}}</text>
-            <text>{{bookInfo}}</text>
         </view>
         <view class="catalog">
-            <image src="../../../static/groupImg/Rectangle34@2x.png"></image>
-            <text>课文目录</text>
+            <image class="bg2" src="../../../static/groupImg/Rectangle_9.png"></image> 
+            <text class="{{flag ? '' : 'select'}}" bindtap="tabSwitch">您需要知道</text>    
+            <text class="{{flag ? 'select' : ''}}" bindtap="tabSwitch">课文目录</text>
         </view>
-        <view class="catalog-list">
+        <view class="catalog-list" hidden="{{!flag}}">
             <view class="catalog-item" wx:for="{{lessonList}}" wx:key="{{index}}" data-id="{{item.id}}" data-title="{{item.title}}" bindtap="goToClass">
                 <text class="left">{{item.title}}</text>
                 <text class="right">{{item.readingNum}}朗读 ></text>
             </view>
         </view>
+        <view class="know" hidden="{{flag}}">
+        </view>       
     </scroll-view>
     <view class="group-btn {{isIPX ? 'bottomx' :''}}" wx:if="{{!share}}">
         <image class="bg1" src="../../../static/groupImg/Rectangle_9.png"></image>
@@ -23,7 +24,7 @@
         <block wx:for="{{payList}}" wx:key="{{index}}">
             <view class="Price" bindtap="pay" data-id="{{item.id}}" wx:if="{{share ? (index != 0) : true }}">
                 <text>¥{{item.price / 100}}</text>
-                <text>{{item.headcount}}人团</text>
+                <text>{{item.headcount == '1' ? '单' : item.headcount}}人团</text>
             </view>
         </block>
     </view>

+ 17 - 19
pages/groupPage/grade-details/grade-details.wxss

@@ -12,7 +12,6 @@ scroll-view {
 }
 
 .grade-details {
-    margin: 12rpx 0;
     background: #fff;
     display: flex;
     flex-direction: column;
@@ -25,36 +24,35 @@ scroll-view {
     border-radius: 20rpx;
 }
 
-.grade-details text {
-    font-size: 32rpx;
-}
-
-.grade-details text:nth-child(2) {
-    margin: 12rpx 0;
-}
-
 .catalog {
+    display: flex;
+    align-items: center;
     width: 100%;
-    height: 62rpx;
+    height: 136rpx;
     background: #fff;
     position: relative;
 }
 
 .catalog image {
     position: absolute;
-    left: 24rpx;
-    top: 10rpx;
-    width: 208rpx;
-    height: 42rpx;
+    left: 374rpx;
+    top: 36rpx;
+    width: 2rpx;
+    height: 66rpx;
 }
 
 .catalog text {
-    position: absolute;
-    left: 34rpx;
-    top: 7rpx;
-    z-index: 2;
-    color: #fff;
+    flex: 1;
+    height: 60rpx;
+    text-align: center;
     font-size: 36rpx;
+    margin: 0 100rpx;
+    box-sizing: border-box;
+}
+
+.catalog .select {
+    border-bottom: 2rpx solid #61CA54;
+    color: #61CA54;
 }
 
 .catalog-list {

+ 65 - 51
pages/groupPage/group-details/group-details.js

@@ -32,7 +32,14 @@ Page({
     isIPX: app.globalData.isIPX,
     bookList: [],
     sendGroupFlag: true,
-    selectFlag: []
+    selectFlag: [],
+    flag: true
+  },
+  //tab切换
+  tabSwitch: function () {
+    this.setData({
+      flag: !this.data.flag
+    })
   },
   jurisdiction: function () {
     //隐藏弹框
@@ -68,52 +75,56 @@ Page({
     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
         })
-        this.openGroup(productId)
+        wx.navigateTo({
+          url: `/pages/groupPage/grade-details/grade-details?productId=${productId}&title=${title}`
+        })
       }
     })
 
   },
   //开团
-  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;
-      }
+  // 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') {
-        //掉起支付
-        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}`
-        })
-      }
+  //     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) => {
+  //   }).fail((error) => {
 
-    })
-  },
+  //   })
+  // },
   //参团
   jionGroup: function () {
     const orderId = this.data.orderId;
@@ -182,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;
@@ -189,17 +201,19 @@ Page({
       this.setData({
         organizer: groupOrder.organizer,
       })
+      debugger
       if (type === 'join') {
         this.data.surplusList.pop();
-        debugger;
         if (groupOrder.status === 'SUCCESSED') {
           this.showSuccess(groupOrder.organizer, groupOrder.organizerPrice)
         } else {
           this.goToDetail(groupOrder.id)
         }
-      } if (type = 'create') {
-        debugger;
+      } 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);
@@ -309,20 +323,20 @@ Page({
     })
   },
 
-  //拼团是否成功并弹窗
-  // 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;
-  //   }).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();
   },
 
   /**

+ 6 - 5
pages/groupPage/group-details/group-details.wxml

@@ -44,19 +44,20 @@
     <scroll-view scroll-y="{{true}}">
         <view class="grade-details" bindtap="gradeDetails">
             <image src="{{titleIcon}}" ></image>
-            <text>{{title}}</text>
-            <text>{{bookInfo}}</text>
         </view>
         <view class="catalog">
-            <image src="../../../static/groupImg/Rectangle34@2x.png"></image>
-            <text>课文目录</text>
+            <image class="bg2" src="../../../static/groupImg/Rectangle_9.png"></image> 
+            <text class="{{flag ? '' : 'select'}}" bindtap="tabSwitch">您需要知道</text>    
+            <text class="{{flag ? 'select' : ''}}" bindtap="tabSwitch">课文目录</text>
         </view>
-        <view class="catalog-list">
+        <view class="catalog-list" hidden="{{!flag}}">
             <view class="catalog-item" wx:for="{{lessonList}}" wx:key="{{index}}" data-id="{{item.id}}" data-title="{{item.title}}" bindtap="goToClass">
                 <text class="left">{{item.title}}</text>
                 <text class="right">{{item.readingNum}}朗读 ></text>
             </view>           
         </view>
+        <view class="know" hidden="{{flag}}">
+        </view>
     </scroll-view>
     <view class="group-details-btn {{isIPX ? 'bottomx' :''}}" hidden="{{surplusNum == '0'}}">
         <!--

+ 17 - 19
pages/groupPage/group-details/group-details.wxss

@@ -95,7 +95,6 @@ scroll-view {
 }
 
 .grade-details {
-    margin: 12rpx 0;
     background: #fff;
     display: flex;
     flex-direction: column;
@@ -108,36 +107,35 @@ scroll-view {
     border-radius: 20rpx;
 }
 
-.grade-details text {
-    font-size: 32rpx;
-}
-
-.grade-details text:nth-child(2) {
-    margin: 12rpx 0;
-}
-
 .catalog {
+    display: flex;
+    align-items: center;
     width: 100%;
-    height: 62rpx;
+    height: 136rpx;
     background: #fff;
     position: relative;
 }
 
 .catalog image {
     position: absolute;
-    left: 24rpx;
-    top: 10rpx;
-    width: 208rpx;
-    height: 42rpx;
+    left: 374rpx;
+    top: 36rpx;
+    width: 2rpx;
+    height: 66rpx;
 }
 
 .catalog text {
-    position: absolute;
-    left: 34rpx;
-    top: 7rpx;
-    z-index: 2;
-    color: #fff;
+    flex: 1;
+    height: 60rpx;
+    text-align: center;
     font-size: 36rpx;
+    margin: 0 100rpx;
+    box-sizing: border-box;
+}
+
+.catalog .select {
+    border-bottom: 2rpx solid #61CA54;
+    color: #61CA54;
 }
 
 .catalog-list {

+ 1 - 1
pages/groupPage/my-group/my-group.js

@@ -73,7 +73,7 @@ Page({
       res.data.data.list.forEach(element => {
         if(element.groupPurchaseOrder.status == 'SUCCESSED') {
           this.data.closeFlags.push(true);
-          this.data.timeList.push(util.formatDate(element.groupPurchaseOrder.gmtModified, 1))
+          this.data.timeList.push(util.formatDate(element.groupPurchaseOrder.gmtModified, 4))
         }else {
           this.data.closeFlags.push(false);
           if(element.groupPurchaseOrder.closeTime - Date.parse(new Date()) < 0 ) {

+ 1 - 1
pages/groupPage/my-group/my-group.wxml

@@ -21,7 +21,7 @@
                         <text wx:if="{{!(item.groupPurchaseOrder.headcount - item.groupPurchaseOrder.joinCount)}}">{{timeList[index]}}</text>
                     </view>
                     <view class="jion-btn {{item.groupPurchaseOrder.status =='SUCCESSED' ? 'success-bg' : ''}}"  bindtap="collageDetails" data-ind="{{index}}" data-num="{{item.groupPurchaseOrder.status==='SUCCESSED'}}" data-orderId="{{item.groupPurchaseOrder.id}}" data-groupId="{{item.groupPurchaseOrder.groupId}}" data-productId="{{item.groupPurchaseOrder.productId}}" data-uid="{{item.groupPurchaseOrder.organizer}}">
-                        {{item.status =='SUCCESSED' ? '已成功' : '去参团'}}
+                        {{item.groupPurchaseOrder.status =='SUCCESSED' ? '已成功' : '去参团'}}
                     </view>
                 </view>
                 </view>

+ 2 - 0
utils/util.js

@@ -30,6 +30,8 @@ function formatDate(time, flag) {
 		return year + '-' + month + '-' + day
 	}else if(flag == 3){
 		return month + '-' + day + ' ' + hour + ':' + minute;
+	}else if( flag == 4) {
+		return year + '年' + month + '月' + day + '日';
 	}
 }
 function GetQueryString(str,name){