yann 4 mēneši atpakaļ
vecāks
revīzija
e68ce02014

+ 4 - 0
components/product-list/product-list.js

@@ -14,6 +14,10 @@ Component({
         filterObj:{
             type:Object,
             value:{}
+        },
+        isMargin:{
+            type:Boolean,
+            value:false
         }
     },
     observers:{

+ 1 - 1
components/product-list/product-list.wxml

@@ -1,5 +1,5 @@
 <!--components/product-list/product-list.wxml-->
-<scroll-view class="scrollView {{position === 'index'&&'scrollViewIndex'}}" scroll-y bindscrolltolower="onReachBottom">
+<scroll-view class="scrollView {{position === 'index'&&'scrollViewIndex'}} {{isMargin && 'marginTop'}}" scroll-y bindscrolltolower="onReachBottom">
     <view class="products">
         <view class="goods-item" wx:for="{{goodsList}}" wx:key="index" data-prod="{{item}}" catchtap="goProdDetail">
             <view class="goods-image">

+ 3 - 0
components/product-list/product-list.wxss

@@ -5,6 +5,9 @@
 .scrollViewIndex{
     height: 2080rpx;
 }
+.marginTop{
+    margin-top: 350rpx;
+}
 .products{
     padding:0 30rpx;
     display: flex;

+ 9 - 6
pages/Mall/hotCommodity/hotCommodity.wxml

@@ -1,10 +1,13 @@
 <!--pages/Mall/hotCommodity/hotCommodity.wxml-->
+<view class="hot">
 
-<!-- 头部 -->
-<header position="hot"></header>
+    <!-- 头部 -->
+    <header position="hot"></header>
 
-<!-- 商品列表 -->
-<product-list position="hot" bindaddCart="showAddCartModal"></product-list>
+    <!-- 商品列表 -->
+    <product-list class="prodList" position="hot" isMargin="true" bindaddCart="showAddCartModal"></product-list>
 
-<!-- 商品属性模态框 -->
-<addCartModel visible="{{showAddCartModal}}" product="{{currentProduct}}" bindclose="handleCloseAddCartModal"></addCartModel>
+    <!-- 商品属性模态框 -->
+    <addCartModel visible="{{showAddCartModal}}" product="{{currentProduct}}" bindclose="handleCloseAddCartModal"></addCartModel>
+
+</view>

+ 4 - 1
pages/Mall/hotCommodity/hotCommodity.wxss

@@ -1 +1,4 @@
-/* pages/Mall/hotCommodity/hotCommodity.wxss */
+/* pages/Mall/hotCommodity/hotCommodity.wxss */
+.hot{
+    overflow: hidden;
+}

+ 9 - 6
pages/Mall/newCommodity/newCommodity.wxml

@@ -1,10 +1,13 @@
 <!--pages/Mall/newCommodity/newCommodity.wxml-->
+<view class="upNew">
 
-<!-- 头部 -->
-<header position="new"></header>
+    <!-- 头部 -->
+    <header position="new"></header>
 
-<!-- 商品列表 -->
-<product-list position="new" bindaddCart="showAddCartModal"></product-list>
+    <!-- 商品列表 -->
+    <product-list position="new" isMargin="true" bindaddCart="showAddCartModal"></product-list>
 
-<!-- 商品属性模态框 -->
-<addCartModel visible="{{showAddCartModal}}" product="{{currentProduct}}" bindclose="handleCloseAddCartModal"></addCartModel>
+    <!-- 商品属性模态框 -->
+    <addCartModel visible="{{showAddCartModal}}" product="{{currentProduct}}" bindclose="handleCloseAddCartModal"></addCartModel>
+
+</view>

+ 4 - 1
pages/Mall/newCommodity/newCommodity.wxss

@@ -1 +1,4 @@
-/* pages/Mall/newCommodity/newCommodity.wxss */
+/* pages/Mall/newCommodity/newCommodity.wxss */
+.upNew{
+    overflow: hidden;
+}

+ 9 - 6
pages/Mall/presaleCommodity/presaleCommodity.wxml

@@ -1,10 +1,13 @@
 <!--pages/Mall/presaleCommodity/presaleCommodity.wxml-->
+<view class="presalePage">
 
-<!-- 头部 -->
-<header position="presale"></header>
+    <!-- 头部 -->
+    <header position="presale"></header>
 
-<!-- 商品列表 -->
-<product-list position="presale" bindaddCart="showAddCartModal"></product-list>
+    <!-- 商品列表 -->
+    <product-list position="presale" isMargin="true" bindaddCart="showAddCartModal"></product-list>
 
-<!-- 商品属性模态框 -->
-<addCartModel visible="{{showAddCartModal}}" product="{{currentProduct}}" bindclose="handleCloseAddCartModal"></addCartModel>
+    <!-- 商品属性模态框 -->
+    <addCartModel visible="{{showAddCartModal}}" product="{{currentProduct}}" bindclose="handleCloseAddCartModal"></addCartModel>
+
+</view>

+ 4 - 1
pages/Mall/presaleCommodity/presaleCommodity.wxss

@@ -1 +1,4 @@
-/* pages/Mall/presaleCommodity/presaleCommodity.wxss */
+/* pages/Mall/presaleCommodity/presaleCommodity.wxss */
+.presalePage{
+    overflow: hidden;
+}

+ 2 - 2
pages/Mall/sortCommodity/sortCommodity.js

@@ -68,8 +68,8 @@ Page({
   /**
    * 生命周期函数--监听页面显示
    */
-  onShow() {
-
+  onShow(options) {
+    
   },
 
   /**

+ 0 - 1
pages/Mall/sortCommodity/sortCommodity.json

@@ -4,6 +4,5 @@
         "product-list":"/components/product-list/product-list",
         "addCartModel":"/components/addCartModel/addCartModel"
     },
-    "navigationStyle":"custom",
     "navigationBarTitleText":"分类商品"
   }

+ 23 - 20
pages/Mall/sortCommodity/sortCommodity.wxml

@@ -1,32 +1,35 @@
 <!--pages/Mall/sortCommodity/sortCommodity.wxml-->
+<view class="sortPage">
 
-<!-- 头部 -->
-<header position="sort"></header>
+    <!-- 头部 -->
+    <!-- <header position="sort"></header> -->
 
-<!-- 分类 -->
-<view class="sortView">
+    <!-- 分类 -->
+    <view class="sortView">
 
-   <view class="filterCriteria" wx:for="{{2}}" wx:for-item="sort" wx:key="index">
+    <view class="filterCriteria" wx:for="{{2}}" wx:for-item="sort" wx:key="index">
 
-      <view class="searchIcon">
+        <view class="searchIcon">
 
-        <image src="/images/mall/search.png" mode=""/>
-      
-      </view>
+            <image src="/images/mall/search.png" mode=""/>
+        
+        </view>
 
-    <scroll-view class="scrollView" scroll-x>
-    
-      <view wx:for="{{sort === 0?ipInfoList:prodClassList}}" wx:key="index" wx:for-index="index2" data-item="{{item}}" data-index="{{sort}}" data-index2="{{index2}}" class="filterText {{sort === 0 && filterIndex1 === index2?'selected':''}} {{sort === 1 && filterIndex2 === index2?'selected':''}}"  catchtap="selectFilter">
-         
-        <text>{{sort === 0?item.ipName:item.className}}</text>
+        <scroll-view class="scrollView" scroll-x>
+        
+        <view wx:for="{{sort === 0?ipInfoList:prodClassList}}" wx:key="index" wx:for-index="index2" data-item="{{item}}" data-index="{{sort}}" data-index2="{{index2}}" class="filterText {{sort === 0 && filterIndex1 === index2?'selected':''}} {{sort === 1 && filterIndex2 === index2?'selected':''}}"  catchtap="selectFilter">
+            
+            <text>{{sort === 0?item.ipName:item.className}}</text>
 
-      </view>
+        </view>
 
-    </scroll-view>
+        </scroll-view>
 
-   </view>
+    </view>
 
-</view>
+    </view>
 
-<!-- 商品列表 -->
-<product-list position="sort" filterObj="{{filterObj}}"></product-list>
+    <!-- 商品列表 -->
+    <product-list position="sort" filterObj="{{filterObj}}"></product-list>
+
+</view>

+ 3 - 0
pages/Mall/sortCommodity/sortCommodity.wxss

@@ -1,4 +1,7 @@
 /* pages/Mall/sortCommodity/sortCommodity.wxss */
+.sortPage{
+    overflow: hidden;
+}
 .sortView{
     padding: 0 20px 10px 20px;
 }

+ 109 - 1
pages/all/all.js

@@ -1 +1,109 @@
-Page({})
+// pages/Mall/sortCommodity/sortCommodity.js
+
+// 获取应用实例
+const {API} = require('../../service/api.js');
+Page({
+
+  /**
+   * 页面的初始数据
+   */
+  data: {
+    ipInfoList:[
+        {ipName:'全部',ipId:''}
+    ],
+    filterIndex1:-1,
+    filterIndex2:-1,
+    filterObj:{} //筛选条件
+  },
+
+  // 监听筛选
+  selectFilter(e){
+      let {index,index2,item} = e.currentTarget.dataset;
+      let filterObj = this.data.filterObj;
+      if(index === 0) filterObj.ipId = item.ipId;
+      if(index === 1) filterObj.prodClassId = item.prodClassId;
+      this.setData({
+          [index === 0?'filterIndex1':'filterIndex2']:index2,
+          filterObj
+      })
+  },
+
+  // 获取IP分类
+  getIpList(){
+      API.getIpInfos().then(res=>{
+          if(res){
+              res.ipInfoList.push({ipName:"全部",ipId:''})
+              this.setData({
+                ipInfoList:res.ipInfoList
+              })
+          };
+      })
+  },
+  // 获取商品分类
+  getProdClasses(){
+      API.getProdClasses().then(res=>{
+          if(res){
+              res.prodClassList.push({className:"全部",prodClassId:''})
+              this.setData({
+                prodClassList:res.prodClassList
+              })
+          };
+      })
+  },
+  /**
+   * 生命周期函数--监听页面加载
+   */
+  onLoad(options) {
+    this.getProdClasses();
+    this.getIpList();
+  },
+
+  /**
+   * 生命周期函数--监听页面初次渲染完成
+   */
+  onReady() {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面显示
+   */
+  onShow(options) {
+    
+  },
+
+  /**
+   * 生命周期函数--监听页面隐藏
+   */
+  onHide() {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面卸载
+   */
+  onUnload() {
+
+  },
+
+  /**
+   * 页面相关事件处理函数--监听用户下拉动作
+   */
+  onPullDownRefresh() {
+
+  },
+
+  /**
+   * 页面上拉触底事件的处理函数
+   */
+  onReachBottom() {
+
+  },
+
+  /**
+   * 用户点击右上角分享
+   */
+  onShareAppMessage() {
+
+  }
+})

+ 6 - 2
pages/all/all.json

@@ -1,4 +1,8 @@
 {
-  "navigationStyle": "custom",
-  "usingComponents": {}
+  "usingComponents": {
+    "header":"/components/header/header",
+    "product-list":"/components/product-list/product-list",
+    "addCartModel":"/components/addCartModel/addCartModel"
+  },
+  "navigationBarTitleText":"全部商品"
 }

+ 31 - 2
pages/all/all.wxml

@@ -1,3 +1,32 @@
-<view>
-  all
+<!--pages/Mall/sortCommodity/sortCommodity.wxml-->
+<view class="sortPage">
+
+<!-- 分类 -->
+<view class="sortView">
+
+<view class="filterCriteria" wx:for="{{2}}" wx:for-item="sort" wx:key="index">
+
+    <view class="searchIcon">
+
+        <image src="/images/mall/search.png" mode=""/>
+    
+    </view>
+
+    <scroll-view class="scrollView" scroll-x>
+    
+    <view wx:for="{{sort === 0?ipInfoList:prodClassList}}" wx:key="index" wx:for-index="index2" data-item="{{item}}" data-index="{{sort}}" data-index2="{{index2}}" class="filterText {{sort === 0 && filterIndex1 === index2?'selected':''}} {{sort === 1 && filterIndex2 === index2?'selected':''}}"  catchtap="selectFilter">
+        
+        <text>{{sort === 0?item.ipName:item.className}}</text>
+
+    </view>
+
+    </scroll-view>
+
+</view>
+
+</view>
+
+<!-- 商品列表 -->
+<product-list position="index" filterObj="{{filterObj}}"></product-list>
+
 </view>

+ 45 - 0
pages/all/all.wxss

@@ -0,0 +1,45 @@
+/* pages/Mall/sortCommodity/sortCommodity.wxss */
+.sortPage{
+    overflow: hidden;
+}
+.sortView{
+    padding: 0 20px 10px 20px;
+}
+.sortView .filterCriteria{
+    height: 65rpx;
+    border-bottom: 1px solid #CFEAE5;
+    margin-top: 35rpx;
+    display: flex;
+}
+.sortView .filterCriteria .searchIcon image{
+    width: 50rpx;
+    height: 50rpx;
+    align-self: center;
+    padding-right: 20rpx;
+}
+.sortView .filterCriteria .filterText{
+    font-size: 23rpx;
+    color: #7A7A7A;
+    text-align: center;
+    background: linear-gradient(to top, 
+    white 0%, 
+    white 20%, 
+    #CFEAE5 20%, 
+    #CFEAE5 80%, 
+    white 60%, 
+    white 100%
+  ) right center / 2rpx 100% no-repeat;
+    line-height: 65rpx;
+    box-sizing: border-box;
+    padding: 0 10rpx;
+    flex: 1;
+    display: inline-block;
+}
+.sortView .filterCriteria .selected{
+    background: #CFEAE5;
+}
+.sortView .filterCriteria .scrollView{
+    white-space: nowrap;
+    display: flex;
+    overflow: hidden;
+}