Merge branch 'develop' of git.yoho.cn:fe/yoho-brand-shop into develop
Showing
15 changed files
with
154 additions
and
29 deletions
1 | -<view hidden="{{!show}}" class="quick-navigation" style="bottom: {{marginBottom}}rpx"> | 1 | +<view hidden="{{!show}}" class="quick-navigation" style="bottom:{{marginBottom}}rpx"> |
2 | <view wx:if="{{showMenu}}" class="qn-menu-group" animation="{{menuAnimation}}"> | 2 | <view wx:if="{{showMenu}}" class="qn-menu-group" animation="{{menuAnimation}}"> |
3 | <view class="hide-menu-group"> | 3 | <view class="hide-menu-group"> |
4 | <view class="qn-menu" animation="{{homeAnimation}}" bindtap="jumpToHome"> | 4 | <view class="qn-menu" animation="{{homeAnimation}}" bindtap="jumpToHome"> |
@@ -19,7 +19,7 @@ | @@ -19,7 +19,7 @@ | ||
19 | </view> | 19 | </view> |
20 | </view> | 20 | </view> |
21 | </view> | 21 | </view> |
22 | - <view class="back-menu qn-menu" animation="{{indicatorAnimation}}" bindtap="backToTop"> | 22 | + <view wx:if="{{showBackTop}}" class="back-menu qn-menu" animation="{{indicatorAnimation}}" bindtap="backToTop"> |
23 | <text class="iconfont icon-backtop menu-text"></text> | 23 | <text class="iconfont icon-backtop menu-text"></text> |
24 | </view> | 24 | </view> |
25 | </view> | 25 | </view> |
@@ -24,7 +24,8 @@ Page({ | @@ -24,7 +24,8 @@ Page({ | ||
24 | currentPage: 1, | 24 | currentPage: 1, |
25 | totalPage: 0, | 25 | totalPage: 0, |
26 | pullRefresh: false, | 26 | pullRefresh: false, |
27 | - showBackTop: false | 27 | + showBackTop: false, |
28 | + showCopyright: false | ||
28 | }, | 29 | }, |
29 | onLoad: function () { | 30 | onLoad: function () { |
30 | this.productList({ page: 1, limit: 20}); | 31 | this.productList({ page: 1, limit: 20}); |
@@ -138,6 +139,12 @@ Page({ | @@ -138,6 +139,12 @@ Page({ | ||
138 | totalPage: res.data.page_total | 139 | totalPage: res.data.page_total |
139 | }); | 140 | }); |
140 | 141 | ||
142 | + if (!this.data.showCopyright) { | ||
143 | + this.setData({ | ||
144 | + showCopyright: true | ||
145 | + }); | ||
146 | + } | ||
147 | + | ||
141 | // 浮动筛选时滚动位置 | 148 | // 浮动筛选时滚动位置 |
142 | if (this.data.floatFilter && params.setScrollPos) { | 149 | if (this.data.floatFilter && params.setScrollPos) { |
143 | wx.pageScrollTo({ | 150 | wx.pageScrollTo({ |
@@ -27,7 +27,7 @@ | @@ -27,7 +27,7 @@ | ||
27 | </view> | 27 | </view> |
28 | </view> | 28 | </view> |
29 | <view> | 29 | <view> |
30 | - <copyright></copyright> | 30 | + <copyright wx:if="{{showCopyright}}"></copyright> |
31 | </view> | 31 | </view> |
32 | <quick-navigation show-back-top="{{showBackTop}}" show="{{true}}" | 32 | <quick-navigation show-back-top="{{showBackTop}}" show="{{true}}" |
33 | bindbacktop="backTop"></quick-navigation> | 33 | bindbacktop="backTop"></quick-navigation> |
@@ -13,6 +13,7 @@ import {Actionsheet} from '../../../vendors/zanui/index'; | @@ -13,6 +13,7 @@ import {Actionsheet} from '../../../vendors/zanui/index'; | ||
13 | let app = getApp(); | 13 | let app = getApp(); |
14 | let yas = new Yas(); | 14 | let yas = new Yas(); |
15 | let router = global.router; | 15 | let router = global.router; |
16 | +let {windowHeight} = app.getSystemInfo(); | ||
16 | 17 | ||
17 | Page({ | 18 | Page({ |
18 | ...Actionsheet, | 19 | ...Actionsheet, |
@@ -81,7 +82,9 @@ Page({ | @@ -81,7 +82,9 @@ Page({ | ||
81 | }, | 82 | }, |
82 | 83 | ||
83 | shopRecList: [], | 84 | shopRecList: [], |
84 | - preferList: [] | 85 | + preferList: [], |
86 | + | ||
87 | + showBackTop: false | ||
85 | }, | 88 | }, |
86 | onLoad: function (options) { | 89 | onLoad: function (options) { |
87 | let productSkn = options.productSkn ? options.productSkn : ''; | 90 | let productSkn = options.productSkn ? options.productSkn : ''; |
@@ -97,6 +100,20 @@ Page({ | @@ -97,6 +100,20 @@ Page({ | ||
97 | this.preferList(); | 100 | this.preferList(); |
98 | yas.pageOpenReport(); | 101 | yas.pageOpenReport(); |
99 | }, | 102 | }, |
103 | + onPageScroll: function ({scrollTop}) { | ||
104 | + const show = scrollTop > windowHeight * 2; | ||
105 | + | ||
106 | + if (show !== this.data.showBackTop) { | ||
107 | + this.setData({ | ||
108 | + showBackTop: show | ||
109 | + }); | ||
110 | + } | ||
111 | + }, | ||
112 | + backTop: function () { | ||
113 | + wx.pageScrollTo({ | ||
114 | + scrollTop: 0 | ||
115 | + }); | ||
116 | + }, | ||
100 | onShareAppMessage: function (res) { | 117 | onShareAppMessage: function (res) { |
101 | let params = { | 118 | let params = { |
102 | FROM: res.from, | 119 | FROM: res.from, |
@@ -4,6 +4,7 @@ | @@ -4,6 +4,7 @@ | ||
4 | "product-banner": "/components/product/detail/banner", | 4 | "product-banner": "/components/product/detail/banner", |
5 | "product-list": "/components/product/list", | 5 | "product-list": "/components/product/list", |
6 | "snapshot": "/components/product/detail/snapshot", | 6 | "snapshot": "/components/product/detail/snapshot", |
7 | - "view-title": "/components/layout/view-title/view-title" | 7 | + "view-title": "/components/layout/view-title/view-title", |
8 | + "quick-navigation": "/components/layout/quick-navigation/quick-navigation" | ||
8 | } | 9 | } |
9 | } | 10 | } |
@@ -2,8 +2,7 @@ | @@ -2,8 +2,7 @@ | ||
2 | <wxs src="../../../wxs/helper.wxs" module="helper"/> | 2 | <wxs src="../../../wxs/helper.wxs" module="helper"/> |
3 | <import src="../../../vendors/zanui/actionsheet/index.wxml"/> | 3 | <import src="../../../vendors/zanui/actionsheet/index.wxml"/> |
4 | 4 | ||
5 | -<scroll-view class="detail-container" scroll-y="true" enable-back-to-top="true" scroll-top="{{scrollTop}}" | ||
6 | - bindscroll="onScroll"> | 5 | +<view class="detail-container"> |
7 | <view class='topContainer'> | 6 | <view class='topContainer'> |
8 | <product-banner image-list="{{productImages}}" product-name="{{productName}}"></product-banner> | 7 | <product-banner image-list="{{productImages}}" product-name="{{productName}}"></product-banner> |
9 | </view> | 8 | </view> |
@@ -113,10 +112,12 @@ | @@ -113,10 +112,12 @@ | ||
113 | <text class="bottom-tip-view-title" style="display:{{is_supplyed?'none':'flex'}}">已售罄</text> | 112 | <text class="bottom-tip-view-title" style="display:{{is_supplyed?'none':'flex'}}">已售罄</text> |
114 | </view> | 113 | </view> |
115 | <view class="gap"></view> | 114 | <view class="gap"></view> |
116 | -</scroll-view> | 115 | +</view> |
117 | <view class="bottom-action"> | 116 | <view class="bottom-action"> |
118 | <view class='buy-btn' bindtap="buyImmediate">立即购买</view> | 117 | <view class='buy-btn' bindtap="buyImmediate">立即购买</view> |
119 | </view> | 118 | </view> |
119 | +<quick-navigation show-menu="{{true}}" show-back-top="{{showBackTop}}" show="{{true}}" | ||
120 | + bindbacktop="backTop" margin-bottom="{{150}}"></quick-navigation> | ||
120 | 121 | ||
121 | <snapshot isShow="{{showSnapshootShare}}" sourceType="product" shareData="{{snapshootShareData}}" | 122 | <snapshot isShow="{{showSnapshootShare}}" sourceType="product" shareData="{{snapshootShareData}}" |
122 | bind:hiddenSheet="hideSnap"></snapshot> | 123 | bind:hiddenSheet="hideSnap"></snapshot> |
@@ -4,6 +4,7 @@ import listModel from '../../../models/product/list'; | @@ -4,6 +4,7 @@ import listModel from '../../../models/product/list'; | ||
4 | import {parse} from '../../../vendors/query-stringify'; | 4 | import {parse} from '../../../vendors/query-stringify'; |
5 | 5 | ||
6 | const yas = new Yas(); | 6 | const yas = new Yas(); |
7 | +const {windowHeight} = getApp().getSystemInfo(); | ||
7 | 8 | ||
8 | Page({ | 9 | Page({ |
9 | data: { | 10 | data: { |
@@ -16,7 +17,9 @@ Page({ | @@ -16,7 +17,9 @@ Page({ | ||
16 | currentPage: 0, | 17 | currentPage: 0, |
17 | totalPage: 1, | 18 | totalPage: 1, |
18 | urlParams: {}, | 19 | urlParams: {}, |
19 | - showBackTop: true | 20 | + showBackTop: false, |
21 | + noResult: false, | ||
22 | + windowHeight: windowHeight + 48, | ||
20 | }, | 23 | }, |
21 | onLoad:function (options) { | 24 | onLoad:function (options) { |
22 | let title = decodeURIComponent(options.title) || '默认标题'; | 25 | let title = decodeURIComponent(options.title) || '默认标题'; |
@@ -32,6 +35,18 @@ Page({ | @@ -32,6 +35,18 @@ Page({ | ||
32 | this.productList(options); | 35 | this.productList(options); |
33 | yas.pageOpenReport(); | 36 | yas.pageOpenReport(); |
34 | }, | 37 | }, |
38 | + onPageScroll: function({scrollTop}) { | ||
39 | + if (scrollTop > windowHeight * 2 !== this.data.showBackTop) { | ||
40 | + this.setData({ | ||
41 | + showBackTop: scrollTop > windowHeight * 2 | ||
42 | + }); | ||
43 | + } | ||
44 | + }, | ||
45 | + backTop: function() { | ||
46 | + wx.pageScrollTo({ | ||
47 | + scrollTop: 0 | ||
48 | + }); | ||
49 | + }, | ||
35 | onReachBottom: function () { | 50 | onReachBottom: function () { |
36 | this.productList(this.data.urlParams); | 51 | this.productList(this.data.urlParams); |
37 | }, | 52 | }, |
@@ -75,9 +90,17 @@ Page({ | @@ -75,9 +90,17 @@ Page({ | ||
75 | productList: this.data.productList.concat(list), | 90 | productList: this.data.productList.concat(list), |
76 | currentPage: params.page, | 91 | currentPage: params.page, |
77 | totalPage: res.data.page_total, | 92 | totalPage: res.data.page_total, |
78 | - showNoMore: params.page === res.data.page_total | 93 | + showNoMore: params.page === res.data.page_total, |
94 | + noResult: !this.data.productList.concat(list).length | ||
95 | + }); | ||
96 | + | ||
97 | + if (params.resetScroll) { | ||
98 | + wx.pageScrollTo({ | ||
99 | + scrollTop: 0, | ||
100 | + duration: 10 | ||
79 | }); | 101 | }); |
80 | } | 102 | } |
103 | + } | ||
81 | }); | 104 | }); |
82 | }, | 105 | }, |
83 | sortChange: function (e) { | 106 | sortChange: function (e) { |
@@ -89,6 +112,6 @@ Page({ | @@ -89,6 +112,6 @@ Page({ | ||
89 | this.data.totalPage = 1; | 112 | this.data.totalPage = 1; |
90 | 113 | ||
91 | this.data.productList = []; | 114 | this.data.productList = []; |
92 | - this.productList(this.data.urlParams); | 115 | + this.productList(Object.assign({resetScroll: true}, this.data.urlParams)); |
93 | } | 116 | } |
94 | }); | 117 | }); |
1 | -<scroll-view class="list-container"> | 1 | +<view class="list-container" style="min-height:{{windowHeight}}px;"> |
2 | <view class="filter-view"> | 2 | <view class="filter-view"> |
3 | <product-list-filter bind:sortchange="sortChange"></product-list-filter> | 3 | <product-list-filter bind:sortchange="sortChange"></product-list-filter> |
4 | </view> | 4 | </view> |
5 | <view class="list-view"> | 5 | <view class="list-view"> |
6 | + <view class="no-res" wx:if="{{noResult}}"> | ||
7 | + <image class="no-res-img" src="../../../static/images/nosearch-ic@3x.png"></image> | ||
8 | + <view class="no-res-txt">未搜索到任何相关商品</view> | ||
9 | + </view> | ||
10 | + <view wx:if="{{productList.length}}"> | ||
6 | <product-list list="{{productList}}" | 11 | <product-list list="{{productList}}" |
7 | show-loading="{{showLoading}}" | 12 | show-loading="{{showLoading}}" |
8 | show-no-more="{{showNoMore}}"></product-list> | 13 | show-no-more="{{showNoMore}}"></product-list> |
9 | </view> | 14 | </view> |
10 | - <copyright></copyright> | ||
11 | - <quick-navigation show-menu="{{false}}" show-back-top="{{showBackTop}}" show="{{true}}" | ||
12 | - bindbacktop="backTop"></quick-navigation> | ||
13 | -</scroll-view> | ||
15 | + </view> | ||
16 | + <copyright class="copy-right"></copyright> | ||
17 | + <quick-navigation show-menu="{{true}}" show-back-top="{{showBackTop}}" bindbacktop="backTop"></quick-navigation> | ||
18 | +</view> |
1 | +.list-container { | ||
2 | + position: relative; | ||
3 | + padding-bottom: 180rpx; | ||
4 | + box-sizing: border-box; | ||
5 | +} | ||
6 | + | ||
1 | .list-container .filter-view { | 7 | .list-container .filter-view { |
2 | position: fixed; | 8 | position: fixed; |
3 | top: 0; | 9 | top: 0; |
@@ -13,3 +19,35 @@ | @@ -13,3 +19,35 @@ | ||
13 | padding-top: 88rpx; | 19 | padding-top: 88rpx; |
14 | padding-bottom: 65rpx; | 20 | padding-bottom: 65rpx; |
15 | } | 21 | } |
22 | + | ||
23 | +.copy-right { | ||
24 | + position: absolute; | ||
25 | + bottom: 0; | ||
26 | + right: 0; | ||
27 | + left: 0; | ||
28 | +} | ||
29 | + | ||
30 | +.no-res { | ||
31 | + position: fixed; | ||
32 | + top: 0; | ||
33 | + left: 0; | ||
34 | + right: 0; | ||
35 | + bottom: 0; | ||
36 | + padding-top: 220rpx; | ||
37 | + text-align: center; | ||
38 | + background-color: #fff; | ||
39 | + z-index: -1; | ||
40 | +} | ||
41 | + | ||
42 | +.no-res .no-res-img { | ||
43 | + width: 204rpx; | ||
44 | + height: 204rpx; | ||
45 | + margin-top: 80rpx; | ||
46 | +} | ||
47 | + | ||
48 | +.no-res .no-res-txt { | ||
49 | + font-size: 24rpx; | ||
50 | + text-align: center; | ||
51 | + margin-top: 21rpx; | ||
52 | + color: #444444; | ||
53 | +} |
@@ -121,6 +121,13 @@ Page({ | @@ -121,6 +121,13 @@ Page({ | ||
121 | currentPage: params.page, | 121 | currentPage: params.page, |
122 | totalPage: res.data.page_total | 122 | totalPage: res.data.page_total |
123 | }); | 123 | }); |
124 | + | ||
125 | + if (this.data.fixedFilter && params.resetScroll) { | ||
126 | + wx.pageScrollTo({ | ||
127 | + scrollTop: this.data.shopInfoHeight, | ||
128 | + duration: 10 | ||
129 | + }); | ||
130 | + } | ||
124 | } | 131 | } |
125 | }).catch(() => { | 132 | }).catch(() => { |
126 | this.data.isLoading = false; | 133 | this.data.isLoading = false; |
@@ -155,6 +162,7 @@ Page({ | @@ -155,6 +162,7 @@ Page({ | ||
155 | limit: 20 | 162 | limit: 20 |
156 | }; | 163 | }; |
157 | this.data.productList = []; | 164 | this.data.productList = []; |
165 | + params.resetScroll = true; | ||
158 | this.productList(params); | 166 | this.productList(params); |
159 | }, | 167 | }, |
160 | //店铺信息 | 168 | //店铺信息 |
@@ -252,13 +260,24 @@ Page({ | @@ -252,13 +260,24 @@ Page({ | ||
252 | }); | 260 | }); |
253 | }); | 261 | }); |
254 | }, | 262 | }, |
255 | - scroll: function (e) { | ||
256 | - const { scrollTop } = e.detail; | 263 | + onPageScroll: function({scrollTop}) { |
264 | + if (scrollTop >= this.data.shopInfoHeight !== this.data.fixedFilter) { | ||
257 | this.setData({ | 265 | this.setData({ |
258 | fixedFilter: scrollTop >= this.data.shopInfoHeight | 266 | fixedFilter: scrollTop >= this.data.shopInfoHeight |
259 | }); | 267 | }); |
268 | + } | ||
269 | + if (scrollTop > windowHeight * 2 !== this.data.showBackTop) { | ||
270 | + this.setData({ | ||
271 | + showBackTop: scrollTop > windowHeight * 2 | ||
272 | + }); | ||
273 | + } | ||
274 | + }, | ||
275 | + backTop: function() { | ||
276 | + wx.pageScrollTo({ | ||
277 | + scrollTop: 0 | ||
278 | + }); | ||
260 | }, | 279 | }, |
261 | - loadMore: function () { | 280 | + onReachBottom: function () { |
262 | if (this.data.currentPage < this.data.totalPage) { | 281 | if (this.data.currentPage < this.data.totalPage) { |
263 | this.setData({ | 282 | this.setData({ |
264 | showLoading: true | 283 | showLoading: true |
1 | <wxs src="../../../wxs/helper.wxs" module="helper"></wxs> | 1 | <wxs src="../../../wxs/helper.wxs" module="helper"></wxs> |
2 | <import src="../../../vendors/zanui/actionsheet/index.wxml"/> | 2 | <import src="../../../vendors/zanui/actionsheet/index.wxml"/> |
3 | -<scroll-view class="shop-container" scroll-y bindscroll="scroll" scroll-top="{{scrollTop}}" bindscrolltolower="loadMore" | 3 | +<view class="shop-container" scroll-y bindscroll="scroll" scroll-top="{{scrollTop}}" bindscrolltolower="loadMore" |
4 | style="height:{{windowHeight}}px;"> | 4 | style="height:{{windowHeight}}px;"> |
5 | <view class="shop-info"> | 5 | <view class="shop-info"> |
6 | <image class="shop-info-bg" src="{{bannerUrl}}"></image> | 6 | <image class="shop-info-bg" src="{{bannerUrl}}"></image> |
@@ -22,7 +22,6 @@ | @@ -22,7 +22,6 @@ | ||
22 | show-no-more="{{showNoMore}}"></product-list> | 22 | show-no-more="{{showNoMore}}"></product-list> |
23 | </view> | 23 | </view> |
24 | <copyright></copyright> | 24 | <copyright></copyright> |
25 | - <quick-navigation show-menu="{{false}}" show-back-top="{{showBackTop}}" show="{{true}}" | ||
26 | - bindbacktop="backTop"></quick-navigation> | ||
27 | -</scroll-view> | 25 | + <quick-navigation show-menu="{{true}}" show-back-top="{{showBackTop}}" bindbacktop="backTop"></quick-navigation> |
26 | +</view> | ||
28 | <template is="zan-actionsheet" data="{{...actionsheet}}" /> | 27 | <template is="zan-actionsheet" data="{{...actionsheet}}" /> |
@@ -3,6 +3,7 @@ import Yas from '../../../common/yas' | @@ -3,6 +3,7 @@ import Yas from '../../../common/yas' | ||
3 | import searchModel from '../../../models/product/search'; | 3 | import searchModel from '../../../models/product/search'; |
4 | 4 | ||
5 | const yas = new Yas(); | 5 | const yas = new Yas(); |
6 | +const {windowHeight} = getApp().getSystemInfo(); | ||
6 | 7 | ||
7 | Page({ | 8 | Page({ |
8 | data: { | 9 | data: { |
@@ -17,7 +18,7 @@ Page({ | @@ -17,7 +18,7 @@ Page({ | ||
17 | noResult: false, | 18 | noResult: false, |
18 | showLoading: false, | 19 | showLoading: false, |
19 | showNoMore: false, | 20 | showNoMore: false, |
20 | - showBackTop: true | 21 | + showBackTop: false |
21 | }, | 22 | }, |
22 | onReachBottom: function () { | 23 | onReachBottom: function () { |
23 | if (this.data.currentPage < this.data.totalPage) { | 24 | if (this.data.currentPage < this.data.totalPage) { |
@@ -40,6 +41,18 @@ Page({ | @@ -40,6 +41,18 @@ Page({ | ||
40 | onLoad: function() { | 41 | onLoad: function() { |
41 | yas.pageOpenReport(); | 42 | yas.pageOpenReport(); |
42 | }, | 43 | }, |
44 | + onPageScroll: function({scrollTop}) { | ||
45 | + if (scrollTop > windowHeight * 2 !== this.data.showBackTop) { | ||
46 | + this.setData({ | ||
47 | + showBackTop: scrollTop > windowHeight * 2 | ||
48 | + }); | ||
49 | + } | ||
50 | + }, | ||
51 | + backTop: function() { | ||
52 | + wx.pageScrollTo({ | ||
53 | + scrollTop: 0 | ||
54 | + }); | ||
55 | + }, | ||
43 | bindQueryInput: function(e) { | 56 | bindQueryInput: function(e) { |
44 | this.setData({ | 57 | this.setData({ |
45 | query: e.detail.value | 58 | query: e.detail.value |
@@ -105,10 +118,12 @@ Page({ | @@ -105,10 +118,12 @@ Page({ | ||
105 | noResult: this.data.productList.concat(list).length === 0 | 118 | noResult: this.data.productList.concat(list).length === 0 |
106 | }); | 119 | }); |
107 | 120 | ||
121 | + if (params.resetScroll) { | ||
108 | wx.pageScrollTo({ | 122 | wx.pageScrollTo({ |
109 | scrollTop: 0, | 123 | scrollTop: 0, |
110 | duration: 10 | 124 | duration: 10 |
111 | }); | 125 | }); |
126 | + } | ||
112 | wx.hideLoading(); | 127 | wx.hideLoading(); |
113 | } | 128 | } |
114 | }).catch(() => { | 129 | }).catch(() => { |
@@ -131,6 +146,7 @@ Page({ | @@ -131,6 +146,7 @@ Page({ | ||
131 | query: this.data.query | 146 | query: this.data.query |
132 | }; | 147 | }; |
133 | this.data.productList = []; | 148 | this.data.productList = []; |
149 | + params.resetScroll = true; | ||
134 | this.productList(params); | 150 | this.productList(params); |
135 | } | 151 | } |
136 | }); | 152 | }); |
@@ -20,6 +20,5 @@ | @@ -20,6 +20,5 @@ | ||
20 | </product-list> | 20 | </product-list> |
21 | </view> | 21 | </view> |
22 | </view> | 22 | </view> |
23 | - <quick-navigation show-menu="{{false}}" show-back-top="{{showBackTop}}" show="{{true}}" | ||
24 | - bindbacktop="backTop"></quick-navigation> | 23 | + <quick-navigation show-back-top="{{showBackTop}}" bindbacktop="backTop"></quick-navigation> |
25 | </view> | 24 | </view> |
-
Please register or login to post a comment