yann 6 ヶ月 前
コミット
1508e308c2

+ 15 - 3
components/product-list/product-list.js

@@ -60,19 +60,31 @@ Component({
         // 获取今日热门商品列表
         getHotCommodity(){
             API.getLeftProds().then(res=>{
-                console.log(res);
+                if(res){
+                    this.setData({
+                        goodsList:res.prodList
+                    })
+                };
             })
         },
         // 获取上新商品列表
         getNewCommodity(){
             API.getMiddleProds().then(res=>{
-                console.log(res);
+                if(res){
+                    this.setData({
+                        goodsList:res.prodList
+                    })
+                };
             })
         },
         // 获取预售商品列表
         getPresaleCommodity(){
             API.getRightProds().then(res=>{
-                console.log(res);
+                if(res){
+                    this.setData({
+                        goodsList:res.prodList
+                    })
+                }
             })
         }
     },

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

@@ -3,11 +3,11 @@
     <view class="products">
         <view class="goods-item" wx:for="{{goodsList}}" wx:key="index">
             <view class="goods-image">
-                <image src="{{item.image}}" mode="aspectFill" class="goods-image-inner"></image>
+                <image src="{{item.prodPicList[0].picUrl}}" mode="aspectFill" class="goods-image-inner"></image>
             </view>
             <view class="goods-info">
-                <text class="goods-name">{{item.name}}</text>
-                <text class="goods-price" wx:if="{{position !== 'presale'}}">¥{{item.price}}</text>
+                <text class="goods-name">{{item.prodName}}</text>
+                <text class="goods-price" wx:if="{{position !== 'presale'}}">¥{{item.prodPicList[0].price}}</text>
             </view>
             <view class="goods-action" wx:if="{{position !== 'presale'}}">
                 <view class="favorite">

+ 29 - 16
pages/Mall/sortCommodity/sortCommodity.js

@@ -1,25 +1,15 @@
 // pages/Mall/sortCommodity/sortCommodity.js
+
+// 获取应用实例
+const {API} = require('../../../service/api.js');
 Page({
 
   /**
    * 页面的初始数据
    */
   data: {
-    filterList1:[
-        {title:'火影忍者',id:1},
-        {title:'初音',id:1},
-        {title:'原神',id:1},
-        {title:'柯南',id:1},
-        {title:'非人哉',id:1},
-        {title:'全部',id:1}
-    ],
-    filterList2:[
-        {title:'立绘',id:1},
-        {title:'吧唧',id:1},
-        {title:'官周',id:1},
-        {title:'痛包',id:1},
-        {title:'卡牌',id:1},
-        {title:'全部',id:1}
+    ipInfoList:[
+        {ipName:'全部',ipId:''}
     ],
     filterIndex1:0,
     filterIndex2:0
@@ -33,11 +23,34 @@ Page({
       })
   },
 
+  // 获取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();
   },
 
   /**

+ 7 - 7
pages/Mall/sortCommodity/sortCommodity.wxml

@@ -7,23 +7,23 @@
 <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=""/>
-
-        <text class="markline"></text>
       
       </view>
 
-      <view wx:for="{{sort === 0?filterList1:filterList2}}" 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">
+    <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>{{item.title}}</text>
-
-        <text class="markline"></text>
+        <text>{{sort === 0?item.ipName:item.className}}</text>
 
       </view>
 
+    </scroll-view>
+
    </view>
 
 </view>

+ 16 - 9
pages/Mall/sortCommodity/sortCommodity.wxss

@@ -8,14 +8,6 @@
     margin-top: 35rpx;
     display: flex;
 }
-.sortView .filterCriteria .markline{
-    width: 2rpx;
-    height: 45rpx;
-    background: #CFEAE5;
-    display: block;
-    margin-top: 10rpx;
-    float: right;
-}
 .sortView .filterCriteria .searchIcon image{
     width: 50rpx;
     height: 50rpx;
@@ -26,10 +18,25 @@
     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;
 }

+ 3 - 1
service/api.js

@@ -72,7 +72,8 @@ export const API = {
     ]
   }
   */
-  getIpInfos: function (payload) {
+  // 获取IP信息
+  getIpInfos: function (payload={}) {
     return http.get("/api/store/homepage/ipInfos", {
       ...payload,
     });
@@ -215,6 +216,7 @@ export const API = {
     ]
   }
   */
+  // 获取商品分类信息
   getProdClasses: function (payload) {
     return http.get("/api/store/homepage/prodClasses", {
       ...payload,