xbx #173

Merged
theluyuan merged 4 commits from xbx into master 2020-08-13 07:38:49 +00:00
2 changed files with 33 additions and 13 deletions

View File

@ -7,7 +7,7 @@
</view> </view>
<view class="evaluation" :class="{ 'current' : current == 2 }" @click="switchCurrent(2)">社区</view> <view class="evaluation" :class="{ 'current' : current == 2 }" @click="switchCurrent(2)">社区</view>
</view> </view>
<scroll-view scroll-y class="goods-container" :style="{ height: scrollHeight }" @scrolltolower="loadMore" v-show="current == 0"> <scroll-view scroll-y class="goods-container" :style="{ height: scrollHeight }" @scrolltolower="loadMore" v-show="current == 0" :scroll-top="scrollTop" @scroll="scroll">
<view v-for="goods in goodsList" :key="goods.store_id" class="goods-item" @click="toDetailsPage(goods.store_id)"> <view v-for="goods in goodsList" :key="goods.store_id" class="goods-item" @click="toDetailsPage(goods.store_id)">
<image :src="goods.store_avatar"></image> <image :src="goods.store_avatar"></image>
<view class="right"> <view class="right">
@ -18,7 +18,7 @@
<u-loadmore :status="loadStatus" bgColor="#FFFFFF" margin-top="20" margin-bottom="20" v-if="goodsList.length >= pageSize"></u-loadmore> <u-loadmore :status="loadStatus" bgColor="#FFFFFF" margin-top="20" margin-bottom="20" v-if="goodsList.length >= pageSize"></u-loadmore>
<u-empty mode="list" v-if="!goodsList.length"></u-empty> <u-empty mode="list" v-if="!goodsList.length"></u-empty>
</scroll-view> </scroll-view>
<scroll-view style="width:100%;" :style="{ height: scrollHeight }" scroll-y="true" @scrolltolower="loadMore" v-if=" current == 2 "> <scroll-view style="width:100%;" :style="{ height: scrollHeight }" scroll-y="true" @scrolltolower="loadMore" v-if=" current == 2 " :scroll-top="scrollTop" @scroll="scroll">
<view class="box" style="padding: 0 30rpx;"> <view class="box" style="padding: 0 30rpx;">
<view style="display:flex"> <view style="display:flex">
<view> <view>
@ -34,7 +34,7 @@
<u-loadmore :status="loadStatus" bgColor="#FFFFFF" margin-top="20" margin-bottom="20" v-if="goodsList.length >= pageSize"></u-loadmore> <u-loadmore :status="loadStatus" bgColor="#FFFFFF" margin-top="20" margin-bottom="20" v-if="goodsList.length >= pageSize"></u-loadmore>
<u-empty mode="list" v-if="!goodsList.length"></u-empty> <u-empty mode="list" v-if="!goodsList.length"></u-empty>
</scroll-view> </scroll-view>
<scroll-view style="width:100%;padding: 20rpx 30rpx;margin-right:23rpx;" :style="{ height: scrollHeight }" scroll-y="true" @scrolltolower="loadMore" v-if=" current == 1 "> <scroll-view style="width:100%;padding: 0rpx 30rpx;margin-right:23rpx;" :style="{ height: scrollHeight }" scroll-y="true" @scrolltolower="loadMore" v-if=" current == 1 " :scroll-top="scrollTop" @scroll="scroll">
<view class="list" > <view class="list" >
<darenItem style="margin-top:20rpx;margin-right:23rpx;box-shadow:0px 3rpx 7rpx 0px rgba(153, 153, 153, 0.35);" v-for="item in goodsList" :key="item.id" :info="item" v-on:pChangeType="changeType"></darenItem> <darenItem style="margin-top:20rpx;margin-right:23rpx;box-shadow:0px 3rpx 7rpx 0px rgba(153, 153, 153, 0.35);" v-for="item in goodsList" :key="item.id" :info="item" v-on:pChangeType="changeType"></darenItem>
</view> </view>
@ -59,7 +59,11 @@ export default {
scrollHeight: '', scrollHeight: '',
loadStatus: 'loadmore', loadStatus: 'loadmore',
timer: true, // , timer: true, // ,
value:"" value:"",
scrollTop: 0,
old: {
scrollTop: 0
}
} }
}, },
components:{ components:{
@ -86,10 +90,14 @@ export default {
}, },
onNavigationBarSearchInputConfirmed(value) { onNavigationBarSearchInputConfirmed(value) {
this.value = value.text this.value = value.text
this.page = 1
// console.log(this.value) // console.log(this.value)
this.ShopSearch() this.ShopSearch()
}, },
methods: { methods: {
scroll: function(e) {
this.old.scrollTop = e.detail.scrollTop; //
},
// //
setNavSearchInput(keyword) { setNavSearchInput(keyword) {
// #ifdef APP-PLUS // #ifdef APP-PLUS
@ -212,7 +220,7 @@ export default {
}, },
setViewHeight() { setViewHeight() {
const res = uni.getSystemInfoSync(); const res = uni.getSystemInfoSync();
this.scrollHeight = res.windowHeight - res.windowWidth / 750 * 90 + 'px'; this.scrollHeight = res.windowHeight - res.windowWidth / 750 * 92 + 'px';
}, },
toDetailsPage(id) { toDetailsPage(id) {
this.$u.route('/pageC/merchant/index', { this.$u.route('/pageC/merchant/index', {
@ -234,10 +242,11 @@ export default {
box-sizing: border-box; box-sizing: border-box;
padding: 30rpx 40rpx; padding: 30rpx 40rpx;
display: flex; display: flex;
margin-bottom: 30rpx; // margin-bottom: 30rpx;
height: 92rpx;
> view { > view {
height: 30rpx; height: 30rpx;
line-height: 30rpx; line-height: 1;
flex: 1; flex: 1;
font-size: 32rpx; font-size: 32rpx;
color: rgba(51,51,51,1); color: rgba(51,51,51,1);

View File

@ -11,7 +11,7 @@
</view> </view>
<view class="evaluation" :class="{ 'current' : current == 2 }" @click="switchCurrent(2)">好评</view> <view class="evaluation" :class="{ 'current' : current == 2 }" @click="switchCurrent(2)">好评</view>
</view> </view>
<scroll-view scroll-y class="goods-container" :style="{ height: scrollHeight }" @scrolltolower="loadMore" :scroll-top="top"> <scroll-view scroll-y class="goods-container" :style="{ height: scrollHeight }" @scrolltolower="loadMore" :scroll-top="scrollTop" @scroll="scroll">
<view v-for="goods in goodsList" :key="goods.goods_id" class="goods-item" @click="toDetailsPage(goods.goods_id)"> <view v-for="goods in goodsList" :key="goods.goods_id" class="goods-item" @click="toDetailsPage(goods.goods_id)">
<image :src="goods.goods_image"></image> <image :src="goods.goods_image"></image>
<view class="right"> <view class="right">
@ -39,7 +39,10 @@ export default {
loadStatus: 'loadmore', loadStatus: 'loadmore',
timer: true, // , timer: true, // ,
value:"", value:"",
top:0 scrollTop: 0,
old: {
scrollTop: 0
}
} }
}, },
watch: { watch: {
@ -61,9 +64,13 @@ export default {
}, },
onNavigationBarSearchInputConfirmed(value) { onNavigationBarSearchInputConfirmed(value) {
this.value = value.text this.value = value.text
this.page = 1
this.ShopSearch() this.ShopSearch()
}, },
methods: { methods: {
scroll: function(e) {
this.old.scrollTop = e.detail.scrollTop; //
},
setNavSearchInput(keyword) { setNavSearchInput(keyword) {
console.log(keyword); console.log(keyword);
// #ifdef APP-PLUS // #ifdef APP-PLUS
@ -132,13 +139,16 @@ export default {
switchCurrent(current) { switchCurrent(current) {
this.page = 1 this.page = 1
if(current == 1 && this.current == 1) this.priceOrderAsc = !this.priceOrderAsc; if(current == 1 && this.current == 1) this.priceOrderAsc = !this.priceOrderAsc;
this.top=0 this.scrollTop = this.old.scrollTop
this.$nextTick(function() {
this.scrollTop = 0
});
this.ShopSearch() this.ShopSearch()
this.current = current; this.current = current;
}, },
setViewHeight() { setViewHeight() {
const res = uni.getSystemInfoSync(); const res = uni.getSystemInfoSync();
this.scrollHeight = res.windowHeight - res.windowWidth / 750 * 90 + 'px'; this.scrollHeight = res.windowHeight - res.windowWidth / 750 * 92 + 'px';
}, },
toDetailsPage(id) { toDetailsPage(id) {
this.$u.route('/pageB/sdetails/index', { this.$u.route('/pageB/sdetails/index', {
@ -154,10 +164,11 @@ export default {
box-sizing: border-box; box-sizing: border-box;
padding: 30rpx 40rpx; padding: 30rpx 40rpx;
display: flex; display: flex;
margin-bottom: 30rpx; // margin-bottom: 30rpx;
height: 92rpx;
> view { > view {
height: 30rpx; height: 30rpx;
line-height: 30rpx; line-height: 1;
flex: 1; flex: 1;
font-size: 32rpx; font-size: 32rpx;
color: rgba(51,51,51,1); color: rgba(51,51,51,1);