Browse Source

再次更改团购后问题

Limengbo 5 years ago
parent
commit
0fc5fe8fc7

+ 5 - 2
component/dialog/dialog.wxml

@@ -1,8 +1,11 @@
 <!--compontents/dialog/dialog.wxml-->
 <view class="dialog">
     <view class="dialog-contain">
-        <text>登录后可继续操作</text>
-        <button class="btn" type="primary" open-type="getUserInfo" bindgetuserinfo="impower">授权微信后登录</button>
+        <view class="title">微信授权</view>
+        <image class="head-bg" src="" style="background: red;"></image>
+        <view class="text">小学语文朗读配音 申请获得以下权限</view>
+        <view class="shuoming">获得你的公开信(昵称、头像等)</view>
+        <button class="btn"  open-type="getUserInfo" bindgetuserinfo="impower">允许</button>
     </view>
 </view>
 

+ 41 - 2
component/dialog/dialog.wxss

@@ -16,15 +16,54 @@
     bottom: 0;
     right: 0;
     width: 80%;
-    height: 200rpx;
+    height: 470rpx;
     background: #fff;
     margin: auto;
     border-radius: 20rpx;
     text-align: center;
-    padding: 0 40rpx;
     box-sizing: border-box;
     display: flex;
     flex-direction: column;
     justify-content: space-around;
+    align-items: center;
     font-size: 32rpx;
 }
+
+.title {
+    font-size: 36rpx;
+    width: 100%;
+    border-bottom: 2rpx solid #ccc;
+    padding: 28rpx 0;
+}
+
+.head-bg {
+    width: 72rpx;
+    height: 72rpx;
+    border-radius: 50%;
+}
+
+.text {
+    font-size: 28rpx;
+    width: 80%;
+    border-bottom: 2rpx solid #ccc;
+    padding: 14rpx 0;
+}
+
+.shuoming {
+    font-size: 28rpx;
+    width: 100%;
+    border-bottom: 2rpx solid #ccc;
+    padding: 14rpx 0 46rpx 0;
+}
+
+.btn {
+    margin: 0;
+    padding: 0;
+    font-size: 36rpx;
+    color: #16B016;
+    background: #fff;
+}
+
+.btn::after {
+    border: none;
+}

+ 5 - 1
pages/groupPage/collage-details/collage-details.js

@@ -31,7 +31,8 @@ Page({
           color: "#FF4600"
       }
     ],
-    read: false
+    read: false,
+    organizerUid: ''
   },
 
   //规则页显示和隐藏
@@ -88,6 +89,9 @@ Page({
       console.log(res);
       const groupOrder = res.data.data.groupPurchaseOrder;
       const surplusNum = groupOrder.headcount - groupOrder.joinCount;
+      this.setData({
+        organizerUid: groupOrder.organizer,
+      })
       for(var i = 0; i < surplusNum; i++) {
         this.data.surplusList.push(1);
       }

+ 2 - 1
pages/groupPage/collage-details/collage-details.wxml

@@ -11,7 +11,8 @@
     <view class="details-head">
         <view class="headImg">
             <block wx:for="{{joinUserList}}" wx:key="{{index}}">
-                <view class="headImg-item">
+                <view class="headImg-item {{organizerUid == item.uid ? 'bg-boder' : ''}}">
+                    <image wx:if="{{organizerUid == item.uid}}" class="tuanzhangIcon" src="../../../static/groupImg/tuanzhangIcon.png"></image>
                     <image src="{{item.avatar}}"></image>
                 </view>
             </block>

+ 13 - 0
pages/groupPage/collage-details/collage-details.wxss

@@ -45,6 +45,7 @@
 }
 
 .headImg-item {
+    position: relative;
     width: 106rpx;
     height: 106rpx;
     border-radius: 50%;
@@ -57,6 +58,18 @@
     border-radius: 50%;
 }
 
+.headImg-item .tuanzhangIcon {
+    position: absolute;
+    right: -20rpx;
+    top: -10rpx;
+    width: 80rpx;
+    height: 30rpx;
+}
+
+.bg-boder {
+    border: 2px solid #000;
+}
+
 .shengyu {
  display: flex;
  flex-direction: column;   

+ 21 - 6
pages/groupPage/group-details/group-details.js

@@ -1,4 +1,7 @@
 // pages/group-details/group-details.js
+import {
+  getOpenidSessionKey
+} from '../../../utils/httpUtil';
 import httpRequestApi from '../../../utils/APIClient';
 import util from '../../../utils/util';
 Page({
@@ -23,7 +26,16 @@ Page({
     headTextOne: '',
     headTextTwo: '',
     content: [],
-    organizer: ''
+    organizer: '',
+    hide: true
+  },
+  jurisdiction: function () {
+    //隐藏弹框
+    this.setData({
+      hide: !this.data.hide
+    })
+    //登录页信息
+    this.onLoad();
   },
   //跳转到年级
   gradeDetails: function () {
@@ -143,10 +155,6 @@ Page({
       }
     })
   },
-  //跳转到拼团详情
-  collage: function () {
-
-  },
   //拼团详情
   jionSuccess: function (orderId, type) {
     httpRequestApi.getMygroupInfo(orderId).success(res => {
@@ -157,7 +165,7 @@ Page({
         organizer: groupOrder.organizer,
       })
       if (type === 'join') {
-        this.data.surplusList.pop();
+        //this.data.surplusList.pop();
         if (groupOrder.status === 'SUCCESSED') {
           this.showSuccess(groupOrder.organizer, groupOrder.organizerPrice)
         } else {
@@ -165,6 +173,7 @@ Page({
         }
 
       } else {
+        debugger;
         for (var i = 0; i < surplusNum; i++) {
           this.data.surplusList.push(1);
         }
@@ -352,6 +361,12 @@ Page({
    * 生命周期函数--监听页面加载
    */
   onLoad: function (options) {
+    getOpenidSessionKey((res) => {}, (error) => {
+      this.setData({
+        hide: !this.data.hide
+      })
+      return;
+    });
     wx.setNavigationBarTitle({
       title: '拼团详情'
     })

+ 3 - 1
pages/groupPage/group-details/group-details.json

@@ -1,6 +1,8 @@
 {
     "component": true,
     "usingComponents": {
-        "popup": "/component/popup/popup"
+        "popup": "/component/popup/popup",
+        "Dialog": "/component/dialog/dialog"
+
     }  
 }

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

@@ -77,4 +77,8 @@
     headTextTwo="{{headTextTwo}}"
     content="{{content}}"
     bindGroup="group"
-></popup>
+></popup>
+
+<view hidden="{{hide}}">
+  <Dialog bindmyevent="jurisdiction" />
+</view>

+ 32 - 4
pages/groupPage/make-money/make-money.js

@@ -7,16 +7,29 @@ Page({
    * 页面的初始数据
    */
   data: {
+    organizer: {},
+    groupPurchaseInfo: {},
     joinUserList: [],
     surplusList: [],
     timeList: [],
     productId: '',
     orderId: '',
-    groupId: ''
+    groupId: '',
+    organizerUid: ''
   },
   //显示分享页 
   share: function () {
-    this.shareDialog.share();
+    this.shareDialog = this.selectComponent("#share-dialog");
+    const data = {
+      avatar: this.data.organizer.avatar,
+      author: this.data.organizer.wechatName,
+      iconImg: this.data.groupPurchaseInfo.bgImg,
+      title: this.data.groupPurchaseInfo.productTitle,
+      path: `pages/groupPage/collage-details/collage-details`,
+      scene: `QR${this.data.orderId}`,
+      groupPurchaseInfo: this.data.groupPurchaseInfo
+    }
+    this.shareDialog.share(data);
   },
 
   /**
@@ -40,13 +53,19 @@ Page({
     })
     httpRequestApi.getMygroupInfo(orderId).success( res => {
       console.log('支付详情', res.data.data);
-      const surplusNum = res.data.data.groupPurchaseOrder.headcount - res.data.data.groupPurchaseOrder.joinCount;
+      const groupOrder = res.data.data.groupPurchaseOrder;
+      const surplusNum = groupOrder.headcount - groupOrder.joinCount;
+      this.setData({
+        organizerUid: groupOrder.organizer,
+      })
       for(var i = 0; i < surplusNum; i++) {
         this.data.surplusList.push(1);
       }
       //时间转换
       const timeList = util.formatTime(res.data.data.groupPurchaseOrder.closeTime - res.data.data.groupPurchaseOrder.gmtModified);
       this.setData({
+        groupPurchaseInfo: res.data.data.groupPurchaseInfo,
+        organizer: res.data.data.organizer,
         surplusNum,
         joinUserList: res.data.data.joinUserList,
         surplusList: this.data.surplusList,
@@ -54,6 +73,15 @@ Page({
         productId: res.data.data.groupPurchaseOrder.productId,
         groupId: res.data.data.groupPurchaseOrder.groupId
       })
+      if(groupOrder.groupType === 'PROMOTION'){
+        this.data.joinUserList.unshift(res.data.data.organizer);
+        //this.data.surplusList.pop();
+        this.setData({
+          joinUserList: this.data.joinUserList,
+          //surplusList: this.data.surplusList,
+          //surplusNum: this.data.surplusNum
+        })
+      }
     }).fail( error => {
       console.log('错误', error)
     })
@@ -63,7 +91,7 @@ Page({
    * 生命周期函数--监听页面初次渲染完成
    */
   onReady: function () {
-    this.shareDialog = this.selectComponent("#share-dialog");
+    
   },
 
   /**

+ 3 - 2
pages/groupPage/make-money/make-money.wxml

@@ -2,7 +2,8 @@
 <view class="details-head">
     <view class="headImg">
         <block wx:for="{{joinUserList}}" wx:key="{{index}}">
-            <view class="headImg-item">
+            <view class="headImg-item {{organizerUid == item.uid ? 'bg-boder' : ''}}">
+                <image wx:if="{{organizerUid == item.uid}}" class="tuanzhangIcon" src="../../../static/groupImg/tuanzhangIcon.png"></image>
                 <image src="{{item.avatar}}"></image>
             </view>
         </block>
@@ -44,4 +45,4 @@
 </view>  
 
 <canvas canvas-id="myCanvas" style="width:370px; height: 507px; position: absolute; left: -999rpx; top: -9999rpx;"></canvas>
-<shareDialog id="share-dialog" bindcustomevent="eventListener"/>
+<shareDialog id="share-dialog" shareType='group' bindcustomevent="eventListener"/>

+ 14 - 0
pages/groupPage/make-money/make-money.wxss

@@ -14,10 +14,12 @@
 }
 
 .headImg-item {
+    position: relative;
     width: 106rpx;
     height: 106rpx;
     border-radius: 50%;
     margin: 20rpx 22rpx;
+    position: relative;
 }
 
 .headImg-item image {
@@ -26,6 +28,18 @@
     border-radius: 50%;
 }
 
+.headImg-item .tuanzhangIcon {
+    position: absolute;
+    right: -20rpx;
+    top: -10rpx;
+    width: 80rpx;
+    height: 30rpx;
+}
+
+.bg-boder {
+    border: 2px solid #000;
+}
+
 .shengyu {
  display: flex;
  flex-direction: column;   

+ 67 - 63
pages/groupPage/my-group/my-group.js

@@ -20,6 +20,9 @@ Page({
     //跳转到团购详情页
   collageDetails: function ({currentTarget}) {
     const orderId = currentTarget.dataset.orderid;
+    const productId = currentTarget.dataset.productid;
+    const groupId = currentTarget.dataset.groupid;
+    const uid = currentTarget.dataset.uid;
     const num = currentTarget.dataset.num;
     console.log(num)
     if(!num) {
@@ -27,8 +30,17 @@ Page({
         url: `/pages/groupPage/collage-details/collage-details?orderId=${orderId}`
       })
     } else {
+      this.setData({
+        closeFlag: true
+      })
       if(this.data.closeFlag) {
         this.popup.close();
+        this.setData({
+          productId,
+          orderId,
+          groupId
+        })
+        this.dialog(uid);
       }else {
         wx.navigateTo({
           url: `/pages/groupPage/collage-details/collage-details?orderId=${orderId}&read=true`
@@ -41,8 +53,7 @@ Page({
    * 生命周期函数--监听页面加载
    */
   onLoad: function (option) {
-    console.log(option.title);
-    if (option.title) {
+    if (option && option.title) {
       wx.setNavigationBarTitle({
         title: option.title//页面标题为路由参数
       });
@@ -58,71 +69,62 @@ Page({
       this.setData({
         myGroupList: res.data.data.list
       })
-      res.data.data.list.forEach(element => {
-        console.log(element.status)
-        if(element.status == 'SUCCESSED') {
-          this.setData({
-            productId: element.productId,
-            orderId: element.id,
-            groupId: element.groupId
-          })
-          if(wx.getStorageSync('uid') == element.organizer) {
-            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"
-                }                          
-              ],
-            })
-          }
-        }
-      });
     }).fail( error => {
       console.log('错误', error)
     })
   },
-
+  dialog: function (uid) {
+      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"
+            }                          
+          ],
+        })
+      }
+  },
   close: function () {
     this.setData({
       closeFlag: false
@@ -131,6 +133,7 @@ Page({
 
   //再次发起团
   group: function () {
+    debugger;
     const productId = this.data.productId;
     const groupId = this.data.groupId;
     const id = this.data.orderId;
@@ -140,6 +143,7 @@ Page({
       groupId
     }).success((res) => {
       console.log('发起团购', res);
+      debugger;
       if (res.data.message) {
         wx.showModal({
           title: '提示',

+ 3 - 2
pages/groupPage/my-group/my-group.wxml

@@ -3,9 +3,10 @@
     <scroll-view scroll-y="{{true}}">
         <view class="my-group-content">
             <block wx:for="{{myGroupList}}" wx:key="{{index}}">
-                <view class="group-item" bindtap="collageDetails" data-num="{{item.status==='SUCCESSED'}}" data-orderId="{{item.id}}">
-                    <image class="item-img" src="{{item.iconImg}}" style="background: red;"></image>
+                <view class="group-item" bindtap="collageDetails" data-num="{{item.status==='SUCCESSED'}}" data-orderId="{{item.id}}" data-groupId="{{item.groupId}}" data-productId="{{item.productId}}" data-uid="{{item.organizer}}">
+                    <image class="item-img" src="{{item.iconImg}}" ></image>
                     <view id="grade">{{item.groupTitle}}</view>
+                    <image class="jiang" src="../../../static/groupImg/jiang.png" wx:if="{{item.groupType== 'PROMOTION' }}"></image>
                     <image class="type-img" src="../../../static/groupImg/{{item.status==='SUCCESSED' ? 'yisuccess' : 'weisuccess' }}.png"></image>
                 </view> 
             </block>

+ 8 - 0
pages/groupPage/my-group/my-group.wxss

@@ -38,3 +38,11 @@
     width: 100rpx;
     height: 40rpx;
 }
+
+.jiang {
+    position: absolute;
+    right: 5rpx;
+    bottom: 55rpx;
+    width: 82rpx;
+    height: 68rpx;   
+}

+ 10 - 4
pages/index/index.js

@@ -194,9 +194,15 @@ Page({
     if (this.data.myIndex === 0) {
       groupInit(this);
     }
-    wx.startPullDownRefresh();
-    setTimeout(() => {
-      wx.stopPullDownRefresh()
-    },10)
+    
+    wx.showNavigationBarLoading() //在标题栏中显示加载
+    //模拟加载
+    setTimeout(function()
+    {
+      // complete
+      wx.hideNavigationBarLoading() //完成停止加载
+      wx.stopPullDownRefresh() //停止下拉刷新
+    },1500);
   }
+  
 })