huanggang 7 jaren geleden
bovenliggende
commit
01fc703248

+ 2 - 1
app.json

@@ -22,7 +22,8 @@
     "backgroundTextStyle": "dark",
     "navigationBarBackgroundColor": "#eb4e4f",
     "navigationBarTitleText": "熊猫美妆",
-    "navigationBarTextStyle": "white"
+    "navigationBarTextStyle": "white",
+    "onReachBottomDistance":100
   },
   "tabBar": {
     "selectedColor": "#FF6760",

+ 6 - 0
app.wxss

@@ -158,4 +158,10 @@ mr16 {
     top: 50%;
     right: -15rpx;
     margin-top: -7rpx;
+}
+.back_top_btn {
+  position: fixed;
+  right: 50rpx;
+  bottom: 50rpx;
+  width: 70rpx;
 }

BIN
image/back_top.png


+ 24 - 2
pages/brand/brand.js

@@ -11,7 +11,8 @@ Page({
     curpage:1,
     brand_id : '',
     hot_id:'',
-    keyword:''
+    keyword:'',
+    isScroll: false
   },
 
   /**
@@ -43,7 +44,6 @@ Page({
       curpage
     }, function (res) {
       if (res.code == 200) {
-        console.log(res);
         self.setData({
           special_datas: res.datas,
           summery: res.datas.summary,
@@ -53,6 +53,28 @@ Page({
       }
     })
   },
+  onPageScroll(e) {
+    clearTimeout(this.showTop);
+    this.showTop = setTimeout(() => {
+      let scrollTop = e.scrollTop;
+      if (scrollTop >= 300) {
+        this.setData({
+          isScroll: true
+        })
+      }
+      else {
+        this.setData({
+          isScroll: false
+        })
+      }
+    }, 100);
+  },
+  backTop() {
+    wx.pageScrollTo({
+      scrollTop: 0,
+      duration: 300
+    })
+  },
 
   /**
    * 生命周期函数--监听页面初次渲染完成

+ 2 - 1
pages/brand/brand.wxml

@@ -1,4 +1,5 @@
 <!--pages/special/special.wxml-->
 <view class='brand_special'>
-  <blockList summery="{{summery}}" special_datas="{{special_datas}}"> </blockList>
+  <blockList prop_special="{{special_datas.special_list}}" summery="{{summery}}" special_datas="{{special_datas}}"> </blockList>
+   <image bindtap='backTop' style="display:{{isScroll?'block':'none'}}" mode='widthFix' class='back_top_btn' src='../../image/back_top.png'></image>
 </view>

+ 2 - 3
pages/components/blockItem/blockItem.wxss

@@ -24,6 +24,7 @@
   display: flex;
   width: 100%;
   padding: 25rpx 0 25rpx 25rpx;
+  box-sizing: border-box;
 }
 .fcode_goods image{
   border: 2rpx solid #D9D9D9;
@@ -34,7 +35,7 @@
   font-size: 20rpx;
 }
 .fcode_goods::after {
-  content: " ";
+  content: "";
   position: absolute;
   left: 0;
   bottom: 0;
@@ -42,8 +43,6 @@
   height: 1px;
   border-bottom: 1px solid #D9D9D9;
   color: #D9D9D9;
-  -webkit-transform-origin: 0 100%;
-  transform-origin: 0 100%;
   -webkit-transform: scaleY(0.5);
   transform: scaleY(0.5);
 }

+ 4 - 2
pages/components/blockList/blockList.js

@@ -9,14 +9,16 @@ Component({
     },
     summery:{
       type:Array
+    },
+    prop_special:{
+      type:Array
     }
   },
-
   /**
    * 组件的初始数据
    */
   data: {
-
+   
   },
 
   /**

+ 2 - 2
pages/components/blockList/blockList.wxml

@@ -1,4 +1,4 @@
-<view wx:key="item"  wx:for="{{special_datas.special_list}}">
+<view wx:key="item"  wx:for="{{prop_special}}">
     <carousel wx:if="{{item.item_type == 'adv_list'}}" image_list="{{item.items}}" scale="{{item.scale}}"></carousel>
     <divider wx:if="{{item.item_type == 'divider'}}" items="{{item}}"></divider> 
     <homeThree wx:if="{{item.item_type == 'home3'}}" specialData="{{item}}" items="{{item.items}}"></homeThree> 
@@ -8,5 +8,5 @@
     <horizon wx:if="{{item.item_type == 'horizon' || item.item_type == 'horizon_goods'}}" specialData="{{item}}" items="{{item.items}}"></horizon>
     <home_goods wx:if="{{item.item_type == 'home_goods'}}" specialData="{{item.item_title}}" summery="{{summery}}" goods_items="{{item.items}}"></home_goods>
     <homeGrid wx:if="{{item.item_type == 'home_grid'}}" items="{{item.items}}"></homeGrid>
-    <homeWords wx:if="{{item.item_type == 'homewords'}}" specialData="{{item.item_title}}" items="{{item.items}}"></homeWords>    
+    <homeWords wx:if="{{item.item_type == 'homewords'}}" specialData="{{item.item_title}}" items="{{item.items}}"></homeWords>  
 </view>

+ 17 - 7
pages/components/blocks/goods_item/goods_item.js

@@ -6,19 +6,29 @@ Component({
    * 组件的属性列表
    */
   properties: {
-    goods_item:{
-      type:Object
+    goods_item: {
+      type: Object
     },
-    summery:{
-      type:Array
+    summery: {
+      type: Array
     }
   },
-  attached(){
+  attached() {
     let goods_id = this.properties.goods_item.data;
     let summery = this.properties.summery;
     let getSummeryGoods = proxy.getSummeryGoods(goods_id, summery);
+    let discounts_price = ((getSummeryGoods.goods_price) - (getSummeryGoods.bonus_price)).toFixed(2);
+    let goods = Object.assign(
+      {},
+      getSummeryGoods,
+      {
+        discounts: discounts_price,
+        bonus_price: parseFloat(getSummeryGoods.bonus_price),
+        goods_price: parseFloat(getSummeryGoods.goods_price)
+      }
+    )
     this.setData({
-        goods: getSummeryGoods
+      goods
     })
   },
 
@@ -33,6 +43,6 @@ Component({
    * 组件的方法列表
    */
   methods: {
-  
+
   }
 })

+ 3 - 3
pages/components/blocks/goods_item/goods_item.wxml

@@ -6,8 +6,8 @@
   </view>
   <view class='goods_box'>
     <view class="goods_msg">
-      <view>
-          <text class='goods_name'>{{goods.goods_mobile_name}}</text>
+      <view class='goods_name'>
+          <text>{{goods.goods_mobile_name}}</text>
       </view>
       <view class='goods_desc'>
           <text>{{goods.goods_jingle}}</text>
@@ -19,7 +19,7 @@
       </view>
       <view class='deduction'>
         <view class="original_price">天猫价{{goods.goods_price}}</view>
-        <text class="discount">红包抵{{(((goods.goods_price)*10000 - (goods.bonus_price)*10000))/10000}}元</text>
+        <text class="discount">{{goods.bonus_price == 0 ? "红包全额抵扣" : "红包抵"+goods.discounts+"元"}}</text>
       </view>
     </view>
     <view class="goods_price" wx:if="{{goods.act_type == 1}}">

+ 4 - 1
pages/components/blocks/home_words/homeWords.wxss

@@ -1,6 +1,6 @@
 .category_btn {
   width:20%;
-  display:inline-block;
+  display:inline-block; 
   padding:10rpx;
   background:#fff;
   border-radius:5px;
@@ -8,6 +8,9 @@
   text-align:center;
   margin-right:19rpx;
   margin-bottom: 10rpx;
+  overflow: hidden;
+  text-overflow:ellipsis;
+  white-space: nowrap;
 }
 .special_label {
   font-size: 24rpx;

+ 4 - 1
pages/components/blocks/search_box/search_box.wxss

@@ -57,7 +57,10 @@
   width: 715rpx;
   height: 78rpx;
   line-height: 78rpx;
-  margin-left: 35rpx; 
+  margin-left: 35rpx;
+  overflow: hidden;
+  text-overflow:ellipsis;
+  white-space: nowrap; 
 }
 .search_item::after {
   content: "";

+ 1 - 1
pages/discover/discover.wxml

@@ -7,7 +7,7 @@
         class="discover_tab_ink-bar {{direction == 'backward' ? 'ink-bar-transition-backward' :     'ink-bar-transition-forward'}}">                 
       </view> 
    </view> 
-    <blockList class="{{direction == 'backward' ? '' : 'hide'}}" special_datas="{{special_datas}}"> </blockList>  
+    <blockList class="{{direction == 'backward' ? '' : 'hide'}}" prop_special="{{special_datas.special_list}}" special_datas="{{special_datas}}"> </blockList>  
     <effect class="{{direction == 'backward' ? 'hide' : ''}}" function_items="{{function_items}}"></effect> 
 
     

+ 1 - 1
pages/fcode/fcode.wxml

@@ -1,3 +1,3 @@
 <view>
-  <blockList summery="{{summery}}" special_datas="{{special_datas}}"> </blockList> 
+  <blockList summery="{{summery}}" prop_special="{{special_datas.special_list}}" special_datas="{{special_datas}}"> </blockList> 
 </view>

+ 59 - 1
pages/index/index.js

@@ -4,8 +4,12 @@ const getReq = require('./../../config.js').getReq;
 Page({
   data: {
     tabs: [],
+    prop_special:[],
+    surplus_special:[],
     special_datas: {},
-    summery: []
+    summery: [],
+    isScroll:false,
+    isSendProp:false
   },
 
   onShow: function() {
@@ -37,6 +41,8 @@ Page({
   },
   onMyEvent: function (e) {
     this.setData({
+      prop_special:[],
+      surplus_special:[],
       special_datas: {},
       summery: []
     });
@@ -57,7 +63,11 @@ Page({
     }, function (res) {
       console.log(res);
       if (res.code == 200) {
+        let prop_special = res.datas.special_list;
+        let sent_down_special = prop_special.splice(0, 8);
         self.setData({
+          surplus_special: prop_special,
+          prop_special: sent_down_special,
           special_datas: res.datas,
           summery: res.datas.summary
         });
@@ -67,10 +77,58 @@ Page({
       }, 1000)
     })
   },
+  onPageScroll(e){
+    clearTimeout(this.showTop);
+    this.showTop = setTimeout(()=>{
+      let scrollTop = e.scrollTop;
+      if (scrollTop >= 300) {
+        this.setData({
+          isScroll: true
+        })
+      }
+      else {
+        this.setData({
+          isScroll: false
+        })
+      }
+    },100);
+  },
+  backTop(){
+    wx.pageScrollTo({
+      scrollTop: 0,
+      duration: 300
+    })
+  },
   onShareAppMessage: function () {
     return {
       title:"熊猫美妆",
       path:"/pages/index/index"
     }
   },
+  onReachBottom: function(){
+    if (this.data.isSendProp){
+      return;
+    }
+    
+    let surplus_special_num = this.data.surplus_special.length;
+    if (surplus_special_num > 0){
+      wx.showLoading({
+        title: '加载中'
+      });
+      this.setData({
+        isSendProp:true
+      });
+      this.data.isSendProp = true;
+      let prop_special = this.data.surplus_special;
+      let sent_down_special = prop_special.splice(0, 8);
+      this.setData({
+        surplus_special: prop_special,
+        prop_special: this.data.prop_special.concat(sent_down_special)
+      })
+      this.setData({
+        isSendProp: false
+      });
+      wx.hideLoading();
+    }
+  }
 })

+ 2 - 1
pages/index/index.wxml

@@ -3,5 +3,6 @@
   <searchBox></searchBox>
   <tabs tabs="{{tabs}}" bind:myevent="onMyEvent"></tabs>
   <view class='clear_fixed'></view> 
-  <blockList summery="{{summery}}" special_datas="{{special_datas}}"> </blockList> 
+  <blockList prop_special="{{prop_special}}" summery="{{summery}}" special_datas="{{special_datas}}"> </blockList>
+  <image bindtap='backTop' style="display:{{isScroll?'block':'none'}}" mode='widthFix' class='back_top_btn' src='../../image/back_top.png'></image> 
 </view>

+ 1 - 1
pages/search/search.wxml

@@ -1,4 +1,4 @@
 <view style='background:#f9f9f9;'>
   <searchBox></searchBox>
-  <blockList summery="{{summery}}" special_datas="{{special_datas}}"> </blockList>
+  <blockList prop_special="{{special_datas.special_list}}" summery="{{summery}}" special_datas="{{special_datas}}"> </blockList>
 </view>

+ 1 - 1
pages/special/special.wxml

@@ -1,4 +1,4 @@
 <!--pages/special/special.wxml-->
 <view>
-  <blockList summery="{{summery}}" special_datas="{{special_datas}}"> </blockList>
+  <blockList prop_special="{{prop_special}}" summery="{{summery}}" special_datas="{{special_datas}}"> </blockList>
 </view>

+ 74 - 0
project.config.json

@@ -0,0 +1,74 @@
+{
+	"description": "项目配置文件。",
+	"setting": {
+		"urlCheck": false,
+		"es6": true,
+		"postcss": true,
+		"minified": true,
+		"newFeature": true
+	},
+	"compileType": "miniprogram",
+	"libVersion": "1.9.91",
+	"appid": "wxfdaeb25e38c4c47e",
+	"projectname": "panda_small_%20routine",
+	"isGameTourist": false,
+	"condition": {
+		"search": {
+			"current": -1,
+			"list": []
+		},
+		"conversation": {
+			"current": -1,
+			"list": []
+		},
+		"plugin": {
+			"current": -1,
+			"list": []
+		},
+		"game": {
+			"currentL": -1,
+			"list": []
+		},
+		"miniprogram": {
+			"current": -1,
+			"list": [
+				{
+					"id": 0,
+					"name": "details",
+					"pathName": "pages/details/details",
+					"query": ""
+				},
+				{
+					"id": 1,
+					"name": "comments",
+					"pathName": "pages/comments/comments",
+					"query": ""
+				},
+				{
+					"id": -1,
+					"name": "shopcart",
+					"pathName": "pages/shopCart/shopCart",
+					"query": ""
+				},
+				{
+					"id": -1,
+					"name": "person",
+					"pathName": "pages/person/person",
+					"query": ""
+				},
+				{
+					"id": -1,
+					"name": "orderTabs",
+					"pathName": "pages/order_tabs/orderTabs",
+					"query": ""
+				},
+				{
+					"id": -1,
+					"name": "addAddress",
+					"pathName": "pages/addAddress/addAddress",
+					"query": ""
+				}
+			]
+		}
+	}
+}