Jelajahi Sumber

更改更多

Limengbo 6 tahun lalu
induk
melakukan
285406d46d

+ 11 - 5
component/group/group.js

@@ -33,12 +33,18 @@ export const groupInit = (that) => {
     })
   }();
   //点击跳转
-  that.more = function () {
+  that.more = function ({currentTarget}) {
+    let type;
+    let title;
+    if(currentTarget.dataset.type == 'group') {
+      type = true
+      title = '限量优惠团购'
+    }else {
+      type = false
+      title = '全部课'
+    }
     wx.navigateTo({
-      url: '/pages/groupPage/discount-group/discount-group'
-    })
-    wx.setNavigationBarTitle({
-      title: '限量优惠团购'
+      url: `/pages/groupPage/discount-group/discount-group?type=${type}&title=${title}`
     })
   }
   //发起团购

+ 2 - 2
component/group/group.wxml

@@ -6,7 +6,7 @@
           <view class="title">
             <image class="ren" src="../../static/groupImg/tuandui@2x.png"></image>
             <text class="left">限量优惠团购<text class="quota">(仅有1000份,售完为止)</text></text>
-            <text class="right" bindtap="more">更多 ></text>
+            <text class="right" bindtap="more" data-type="group">更多 ></text>
           </view>
           <view class="group-box">
             <block wx:for="{{groupData.recommendList}}" wx:key="{{index}}">
@@ -27,7 +27,7 @@
           <view class="title">
             <image class="ren" src="../../static/groupImg/Shape3.png" style="width: 30rpx; height: 38rpx;"></image>
             <text class="left">全部课程<text class="quota" style="margin-left: 20rpx;">拼团大不同</text></text>
-            <text class="right">更多 ></text>
+            <text class="right" bindtap="more" data-type="course">更多 ></text>
           </view>
           <view class="group-box"> 
             <block wx:for="{{groupData.bookList}}" wx:key="{{index}}">

+ 30 - 5
pages/groupPage/discount-group/discount-group.js

@@ -1,23 +1,48 @@
 // pages/groupPage//discount-group/discount-group.js
+import httpRequestApi from '../../../utils/APIClient';
 Page({
 
   /**
    * 页面的初始数据
    */
   data: {
-
+    recommendList: [],
+    bookList: []
   },
 
-//点击跳转到团购详情
-groupDetails:function () {
+  //点击跳转到团购详情
+  groupDetails:function () {
 
-},
+  },
 
   /**
    * 生命周期函数--监听页面加载
    */
   onLoad: function (options) {
-
+    wx.setNavigationBarTitle({
+      title: options.title
+    })
+    if(options.type == 'true') {
+      //优惠内容
+      httpRequestApi.getGroupList().success( (res) => {
+        console.log('推荐团购',res.data.data)
+        this.setData({
+          recommendList: res.data.data
+        })
+      }).fail((error) => {
+        console.log('错误',error)
+      })
+    }else {
+      //全部课
+      httpRequestApi.getAllBooks(1, 10).success((res) => {
+        console.log('全部课',res.data.data.list)
+        this.setData({
+          bookList: res.data.data.list
+        })
+      }).fail((error) => {
+        console.log('错误',error)
+      })
+    }
   },
 
   /**

+ 18 - 73
pages/groupPage/discount-group/discount-group.wxml

@@ -4,80 +4,25 @@
       <view class="group-container">
         <view class="less-group">
           <view class="group-box">
-            <view class="group-item" bindtap="groupDetails">
-              <image src="" style="background: red;"></image>
-              <view>拼团价 <text>¥1</text></view>
-              <view>原价 <text style="text-decoration: line-through;">¥99</text></view>
-            </view>
-            <view class="group-item">
-              <image src="" style="background: red;"></image>
-              <view>拼团价 <text>¥1</text></view>
-              <view>原价 <text style="text-decoration: line-through;">¥99</text></view>
-            </view>   
-            <view class="group-item">
-              <image src="" style="background: red;"></image>
-              <view>拼团价 <text>¥1</text></view>
-              <view>原价 <text style="text-decoration: line-through;">¥99</text></view>
-            </view>                  
-          </view>
+            <block wx:for="{{recommendList}}" wx:key="{{index}}">
+              <view class="group-item" bindtap="groupDetail" data-id="{{item.id}}" data-productId="{{item.productId}}" data-groupId="{{item.groupId}}">
+                <image class="item-img" src="{{item.iconImg}}"></image>
+                <view>拼团价 <text>¥{{item.price / 100}}</text></view>
+                <view>原价 <text style="text-decoration: line-through;">¥{{item.originPrice / 100}}</text></view>
+                <view class="group-num">
+                  <image src="../../../static/groupImg/Rectangle_30.png" ></image>
+                  <text>{{item.headcount}}人团</text>
+                </view>
+              </view>
+            </block> 
+            <block wx:for="{{bookList}}" wx:key="{{index}}">
+              <view class="group-item">
+                <image class="item-img" src="{{item.iconImg}}"></image>
+                <view id="grade">一年级</view>
+              </view>    
+            </block>                
+          </view>                        
         </view>
-<view class="less-group">
-          <view class="group-box">
-            <view class="group-item">
-              <image src="" style="background: red;"></image>
-              <view>拼团价 <text>¥1</text></view>
-              <view>原价 <text style="text-decoration: line-through;">¥99</text></view>
-            </view>
-            <view class="group-item">
-              <image src="" style="background: red;"></image>
-              <view>拼团价 <text>¥1</text></view>
-              <view>原价 <text style="text-decoration: line-through;">¥99</text></view>
-            </view>   
-            <view class="group-item">
-              <image src="" style="background: red;"></image>
-              <view>拼团价 <text>¥1</text></view>
-              <view>原价 <text style="text-decoration: line-through;">¥99</text></view>
-            </view>                  
-          </view>
         </view>
-<view class="less-group">
-          <view class="group-box">
-            <view class="group-item">
-              <image src="" style="background: red;"></image>
-              <view>拼团价 <text>¥1</text></view>
-              <view>原价 <text style="text-decoration: line-through;">¥99</text></view>
-            </view>
-            <view class="group-item">
-              <image src="" style="background: red;"></image>
-              <view>拼团价 <text>¥1</text></view>
-              <view>原价 <text style="text-decoration: line-through;">¥99</text></view>
-            </view>   
-            <view class="group-item">
-              <image src="" style="background: red;"></image>
-              <view>拼团价 <text>¥1</text></view>
-              <view>原价 <text style="text-decoration: line-through;">¥99</text></view>
-            </view>                  
-          </view>
-        </view>   
-<view class="less-group">
-          <view class="group-box">
-            <view class="group-item">
-              <image src="" style="background: red;"></image>
-              <view>拼团价 <text>¥1</text></view>
-              <view>原价 <text style="text-decoration: line-through;">¥99</text></view>
-            </view>
-            <view class="group-item">
-              <image src="" style="background: red;"></image>
-              <view>拼团价 <text>¥1</text></view>
-              <view>原价 <text style="text-decoration: line-through;">¥99</text></view>
-            </view>   
-            <view class="group-item">
-              <image src="" style="background: red;"></image>
-              <view>拼团价 <text>¥1</text></view>
-              <view>原价 <text style="text-decoration: line-through;">¥99</text></view>
-            </view>                  
-          </view>
-        </view>                           
-      </view>
     </scroll-view>
   </view>

+ 23 - 0
pages/groupPage/discount-group/discount-group.wxss

@@ -35,6 +35,7 @@ scroll-view {
 .group-item {
     display: flex;
     flex-direction: column;
+    position: relative;
 }
 
 .group-item image {
@@ -81,4 +82,26 @@ scroll-view {
 
 .Collage-bottom text {
     vertical-align: middle;
+}
+
+.group-item .group-num {
+    position: absolute;
+    left: 0;
+    top: 14rpx;
+    width: 100rpx;
+    height: 40rpx;
+}
+
+.group-item .group-num image {
+    width: 100%;
+    height: 100%;
+}
+
+.group-item .group-num text {
+    color: #fff;
+    position: absolute;
+    left: 6rpx;
+    top: 4rpx;
+    z-index: 3;
+    font-size: 24rpx;
 }