首页和滚动优化

This commit is contained in:
1154079537 2024-05-20 17:15:51 +08:00
parent a3c032b3e4
commit 1669b9be74
7 changed files with 722 additions and 691 deletions

View File

@ -216,17 +216,17 @@
this.list = res.data.list;
setTimeout(() => {
this.$util.getDom(this, '.tabs', res => {
console.log(res.top);
// #ifdef APP
this.tabsTop = res.top - 10;
this.tabsTop = res.top;
// #endif
// #ifdef H5
this.tabsTop = res.top;
// #endif
console.log(this.tabsTop);
})
}, 300)
}, 1000)
})
},
goDetail(item) {

View File

@ -51,7 +51,7 @@
}, {
"path": "pages/whole_sale/index",
"style": {
"enablePullDownRefresh": false,
"enablePullDownRefresh": true,
"navigationBarTitleText": "批发",
"navigationStyle": "custom"
}
@ -388,14 +388,14 @@
"style": {
"navigationBarTitleText": "里海云仓",
"navigationStyle": "custom",
"enablePullDownRefresh": false
"enablePullDownRefresh": true
}
},
{
"path": "market/market",
"style": {
"navigationBarTitleText": "供销云市场",
"enablePullDownRefresh": false,
"enablePullDownRefresh": true,
"navigationStyle": "custom"
}
},
@ -403,7 +403,7 @@
"path": "specialty/specialty",
"style": {
"navigationBarTitleText": "名优特产",
"enablePullDownRefresh": false,
"enablePullDownRefresh": true,
"navigationStyle": "custom"
}
}

View File

@ -1,3 +1,287 @@
<template>
<view class="wholeSale" @touchstart="onTouchStart" @touchmove="onTouchMove">
<!-- 顶部 -->
<view class="wholeSale-header">
<!-- 适配不同机 -->
<view style="height: var(--status-bar-height);background-color: #40af37;"></view>
<view style="display: flex;padding: 20rpx 28rpx;background-color: #40af37;color: #fff;">
<view style="display: flex;font-weight: bold;font-size: 32rpx;"><u-icon style="margin-right: 20rpx;"
name="arrow-left" size="20" color="#fff" @click="navBack"></u-icon>里海云仓</view>
</view>
</view>
<view :style="{height:'calc(' +wrapHeight+ 'rpx + 92rpx + var(--status-bar-height))'}"></view>
<!-- 分类区域 -->
<view class="wholeSale-section" :style="{height:wrapHeight + 'rpx'}">
<view class="wholeSale-nav">
<view @click="navTo(`/pages/columnGoods/goods_search/index?back=true&searchVal=${where.keyword}`)"
hover-class="none" class="search_content flex_a_c_j_sb">
<view class="flex_a_c search_content_wrap">
<view class="iconfont icon-sousuo" style="font-size: 39rpx;"></view>
<input type="text" placeholder="搜索商品名称" :value="where.keyword"
placeholder-style="font-size: 30rpx;color:#999;" disabled style="pointer-events: none;">
</view>
</view>
</view>
<!-- 商品大分类 -->
<view class="category">
<scroll-view scroll-x="true">
<view class="category-wrap">
<block v-for="(item,index) in store_category" :key="index">
<view class="category-item" :class="{'category-item-active': index==cate_change}"
@click="changeCate(index)">
<u--image class="category-item-img" width="108rpx" :src="item.pic" height="108rpx"
shape="circle">
<template v-slot:loading>
<u-loading-icon color="#999" size="15" />
</template>
</u--image>
<text class="category-item-text">{{item.cate_name}}</text>
</view>
</block>
</view>
</scroll-view>
<view class="category-all" v-if="store_category.length > 0" @click="onAllCategory">
<view style="margin-bottom: 20rpx;">全部</view>
<u-icon name="list"></u-icon>
</view>
</view>
<!-- 商品小分类 -->
<view class="cate" v-if="store_category_children.length>1">
<scroll-view scroll-x="true">
<view class="cate-wrap">
<block v-for="(item,index) in store_category_children" :key="index">
<view class="cate-item" :class="{'cate-item-active':index == cate_change_children}"
@click="changeChildrenCate(index)">
<text>{{item.cate_name}}</text>
</view>
</block>
</view>
</scroll-view>
</view>
</view>
<!-- 内容 -->
<view class="wholeSale-con">
<!-- 流水瀑布 -->
<WaterfallsFlow :wfList='hostProduct' @itemTap="goDetail" :type="0" />
<loadmore :type="isLoading" style="padding: 12rpx 0;"></loadmore>
</view>
<!-- 弹框大分类 -->
<uni-popup ref="popup" type="top" border-radius="10px 10px 0 0" z-index="1000">
<view class="popup-wrap">
<view style="height: var(--status-bar-height);"></view>
<view class="popup-wrap-title">分类</view>
<view class="popup-wrap-category">
<view class="popup-wrap-category-wrap">
<block v-for="(item,index) in store_category" :key="index">
<view class="popup-wrap-category-item" :class="{'category-item-active': index==cate_change}"
@click="changeCate(index)">
<u--image class="popup-wrap-category-item-img" width="108rpx" :src="item.pic"
height="108rpx" shape="circle">
<template v-slot:loading>
<u-loading-icon color="#999" size="15" />
</template>
</u--image>
<text class="popup-wrap-category-item-text">{{item.cate_name}}</text>
</view>
</block>
</view>
</view>
</view>
</uni-popup>
</view>
</template>
<script>
import {
goShopDetail
} from '@/libs/order.js'
import WaterfallsFlow from '@/components/WaterfallsFlow/WaterfallsFlow.vue'
import {
getStoreCategory,
getProductslist
} from "@/api/store.js"
export default {
components: {
WaterfallsFlow
},
data() {
return {
hostProduct: [],
store_category: [], //
store_category_children: [], //
cate_change: 0,
cate_change_children: 0,
isLoading: 0,
isScroll: false,
where: {
page: 1,
limit: 20,
mer_type: 1, //1-, 2-, 3-
cate_pid: '',
keyword: '',
deduction_rate: '', //
rand: 1
},
wrapHeight: 300,
touchstarty: 0
}
},
onLoad(option) {
this.getStoreCategory();
this.getProductslist(true);
},
onPageScroll() {
uni.$emit('scroll');
},
onPullDownRefresh() {
this.getProductslist(true);
},
onReachBottom() {
this.getProductslist();
},
methods: {
//
onTouchStart(e) {
this.touchstarty = e.touches[0].clientY;
},
//
onTouchMove(e) {
this.$nextTick(() => {
let deltaY = e.changedTouches[0].clientY - this.touchstarty;
if (deltaY <= 0) {
console.log("上滑")
this.wrapHeight = 0;
} else {
console.log('下滑');
if (this.where.cate_pid) this.wrapHeight = 360;
else this.wrapHeight = 300;
}
this.$forceUpdate();
})
},
onAllCategory() {
this.$refs.popup.open();
},
navTo(url) {
uni.navigateTo({
url: url,
success: () => {
uni.$once('searchValue', (e) => {
this.$nextTick(() => {
this.where.keyword = e;
this.getProductslist(true);
})
})
}
})
},
changeCate(e) {
this.cate_change = e;
this.store_category_children = [];
if (this.store_category[e].children) this.store_category_children = [...this.store_category[e].children];
this.store_category_children.unshift({
cate_name: '全部',
store_category_id: ''
})
this.cate_change_children = 0;
this.where.cate_pid = this.store_category[e].store_category_id;
this.getProductslist(true);
if (this.where.cate_pid) this.wrapHeight = 360;
else this.wrapHeight = 300;
this.$refs.popup && this.$refs.popup.close();
},
changeChildrenCate(e) {
this.cate_change_children = e;
this.where.cate_pid = this.store_category_children[e].store_category_id;
if (e == 0) this.where.cate_pid = this.store_category[this.cate_change]
.store_category_id; // , id
this.getProductslist(true);
},
getStoreCategory() {
getStoreCategory(259).then(res => {
this.store_category = [{
cate_name: '全部',
pic: 'https://lihai001.oss-cn-chengdu.aliyuncs.com/def/0bc7a202404021652194310.png',
store_category_id: ''
}, ...res.data];
this.store_category_children = this.store_category[0].children || [];
this.store_category_children.unshift({
cate_name: '全部',
store_category_id: ''
})
})
},
getProductslist(reLoad = false) {
if (reLoad) {
this.where.page = 1;
this.hostProduct = [];
this.isLoading = 0;
}
if (this.isLoading == -1) return;
this.isLoading = 1;
getProductslist(this.where).then(res => {
uni.stopPullDownRefresh();
this.where.limit = res.data.limit
this.where.page = res.data.page
this.hostProduct = [...this.hostProduct, ...res.data.list];
this.isLoading = 0;
if (res.data.list.length < this.where.limit) {
this.isLoading = -1;
}
this.where.page++;
}).catch(err => {
uni.stopPullDownRefresh();
})
},
goDetail(item) {
goShopDetail(item, this.uid).then(res => {
if (this.isLogin) {
initiateAssistApi(item.activity_id).then(res => {
let id = res.data.product_assist_set_id;
uni.hideLoading();
uni.navigateTo({
url: '/pages/activity/assist_detail/index?id=' + id
});
}).catch((err) => {
uni.showToast({
title: err,
icon: 'none'
})
});
} else {
toLogin();
}
})
},
navBack() {
uni.navigateBack();
}
}
}
</script>
<style lang="scss" scoped>
page {
background-color: #f8fafb !important;
@ -7,26 +291,28 @@
background-color: #f8fafb !important;
.wholeSale-header {
position: sticky;
position: fixed;
top: 0;
z-index: 9;
z-index: 98;
width: 100%;
margin-bottom: 20rpx;
background-color: #40AE36;
}
.wholeSale-section {
position: sticky;
top: calc(82rpx + var(--status-bar-height));
position: fixed;
z-index: 97;
width: 100%;
top: calc(80rpx + var(--status-bar-height));
padding: 0rpx 20rpx;
background-color: #fff;
transition: height .5s;
overflow: hidden;
margin-bottom: 20rpx;
.wholeSale-nav {
display: flex;
align-items: center;
padding-bottom: 20rpx;
padding: 20rpx 0;
.icon {
margin-right: 20rpx;
@ -237,294 +523,4 @@
padding-bottom: 30rpx;
}
}
</style>
<template>
<view class="wholeSale">
<!-- 顶部 -->
<view class="wholeSale-header">
<!-- 适配不同机 -->
<view style="height: var(--status-bar-height);background-color: #40af37;"></view>
<view style="display: flex;padding: 20rpx 28rpx;background-color: #40af37;color: #fff;">
<view style="display: flex;font-weight: bold;font-size: 32rpx;"><u-icon style="margin-right: 20rpx;"
name="arrow-left" size="20" color="#fff" @click="navBack"></u-icon>里海云仓</view>
</view>
</view>
<!-- 分类区域 -->
<view class="wholeSale-section" :style="{height:wrapHeight + 'rpx'}">
<view class="wholeSale-nav">
<view @click="navTo(`/pages/columnGoods/goods_search/index?back=true&searchVal=${where.keyword}`)"
hover-class="none" class="search_content flex_a_c_j_sb">
<view class="flex_a_c search_content_wrap">
<view class="iconfont icon-sousuo" style="font-size: 39rpx;"></view>
<input type="text" placeholder="搜索商品名称" :value="where.keyword"
placeholder-style="font-size: 30rpx;color:#999;" disabled style="pointer-events: none;">
</view>
</view>
</view>
<!-- 商品大分类 -->
<view class="category">
<scroll-view scroll-x="true">
<view class="category-wrap">
<block v-for="(item,index) in store_category" :key="index">
<view class="category-item" :class="{'category-item-active': index==cate_change}"
@click="changeCate(index)">
<u--image class="category-item-img" width="108rpx" :src="item.pic" height="108rpx"
shape="circle">
<template v-slot:loading>
<u-loading-icon color="#999" size="15" />
</template>
</u--image>
<text class="category-item-text">{{item.cate_name}}</text>
</view>
</block>
</view>
</scroll-view>
<view class="category-all" v-if="store_category.length > 0" @click="onAllCategory">
<view style="margin-bottom: 20rpx;">全部</view>
<u-icon name="list"></u-icon>
</view>
</view>
<!-- 商品小分类 -->
<view class="cate" v-if="store_category_children.length>1">
<scroll-view scroll-x="true">
<view class="cate-wrap">
<block v-for="(item,index) in store_category_children" :key="index">
<view class="cate-item" :class="{'cate-item-active':index == cate_change_children}"
@click="changeChildrenCate(index)">
<text>{{item.cate_name}}</text>
</view>
</block>
</view>
</scroll-view>
</view>
</view>
<!-- 内容 -->
<view class="wholeSale-con"
:style="{height:'calc(100vh - '+wrapHeight+'rpx - 142rpx '+(isShowSmall?' - 48rpx':'')+')'}">
<scroll-view :scroll-y="true" @scrolltolower="onScrollBottom" @scroll="onScroll" style="height: 100%;"
:refresher-enabled="true" :refresher-triggered="isTriggered" @refresherpulling="onPulling"
@refresherrefresh="onRefresh" :refresher-threshold="45" :scroll-anchoring='true'>
<view>
<!-- 流水瀑布 -->
<WaterfallsFlow :wfList='hostProduct' @itemTap="goDetail" :type="0" />
<loadmore :type="isLoading" style="padding: 12rpx 0;"></loadmore>
</view>
</scroll-view>
</view>
<!-- 弹框大分类 -->
<uni-popup ref="popup" type="top" border-radius="10px 10px 0 0" z-index="1000">
<view class="popup-wrap">
<view style="height: var(--status-bar-height);"></view>
<view class="popup-wrap-title">分类</view>
<view class="popup-wrap-category">
<view class="popup-wrap-category-wrap">
<block v-for="(item,index) in store_category" :key="index">
<view class="popup-wrap-category-item" :class="{'category-item-active': index==cate_change}"
@click="changeCate(index)">
<u--image class="popup-wrap-category-item-img" width="108rpx" :src="item.pic"
height="108rpx" shape="circle">
<template v-slot:loading>
<u-loading-icon color="#999" size="15" />
</template>
</u--image>
<text class="popup-wrap-category-item-text">{{item.cate_name}}</text>
</view>
</block>
</view>
</view>
</view>
</uni-popup>
</view>
</template>
<script>
import {
goShopDetail
} from '@/libs/order.js'
import WaterfallsFlow from '@/components/WaterfallsFlow/WaterfallsFlow.vue'
import {
getStoreCategory,
getProductslist
} from "@/api/store.js"
export default {
components: {
WaterfallsFlow
},
data() {
return {
hostProduct: [],
store_category: [], //
store_category_children: [], //
cate_change: 0,
cate_change_children: 0,
isLoading: 0,
where: {
page: 1,
limit: 20,
mer_type: 1, //1-, 2-, 3-
cate_pid: '',
keyword: '',
deduction_rate: '', //
rand: 1
},
wrapHeight: 300,
isShowSmall: false,
scrollTop: 0,
isTriggered: true
}
},
onLoad(option) {
this.getStoreCategory();
this.getProductslist(true);
},
onPageScroll(e) {
uni.$emit('scroll');
},
watch: {
'where.cate_pid'(newVal, oldVal) {
if (newVal && !oldVal) {
this.wrapHeight = 300 + 48;
this.isShowSmall = true;
}
if (!newVal && oldVal) {
this.wrapHeight = 300;
this.isShowSmall = false;
}
}
},
methods: {
//
onPulling() {
if (!this.isTriggered) {
this.isTriggered = true;
this.getProductslist(true);
}
},
onRefresh(e) {
this.isTriggered = true;
},
onScrollBottom(e) {
this.getProductslist();
},
onAllCategory() {
this.$refs.popup.open();
},
onScroll(e) {
if (this.scrollTop > e.target.scrollTop) { //
this.wrapHeight = 300;
if (this.where.cate_pid) this.wrapHeight = this.wrapHeight + 48;
} else {
this.wrapHeight = 0;
}
this.scrollTop = e.target.scrollTop;
},
navTo(url) {
uni.navigateTo({
url: url,
success: () => {
uni.$once('searchValue', (e) => {
this.$nextTick(() => {
this.where.keyword = e;
this.getProductslist(true);
})
})
}
})
},
navBack() {
uni.navigateBack();
},
changeCate(e) {
this.cate_change = e;
this.store_category_children = [];
if (this.store_category[e].children) this.store_category_children = [...this.store_category[e].children];
this.store_category_children.unshift({
cate_name: '全部',
store_category_id: ''
})
this.cate_change_children = 0;
this.where.cate_pid = this.store_category[e].store_category_id;
this.getProductslist(true);
this.$refs.popup && this.$refs.popup.close();
},
changeChildrenCate(e) {
this.cate_change_children = e;
this.where.cate_pid = this.store_category_children[e].store_category_id;
if (e == 0) this.where.cate_pid = this.store_category[this.cate_change]
.store_category_id; // , id
this.getProductslist(true);
},
getStoreCategory() {
getStoreCategory(259).then(res => {
this.store_category = [{
cate_name: '全部',
pic: 'https://lihai001.oss-cn-chengdu.aliyuncs.com/def/0bc7a202404021652194310.png',
store_category_id: ''
}, ...res.data];
this.store_category_children = this.store_category[0].children || [];
this.store_category_children.unshift({
cate_name: '全部',
store_category_id: ''
})
})
},
getProductslist(reLoad = false) {
if (reLoad) {
this.where.page = 1;
this.hostProduct = [];
this.isLoading = 0;
}
if (this.isLoading == -1) return;
this.isLoading = 1;
getProductslist(this.where).then(res => {
this.where.limit = res.data.limit
this.where.page = res.data.page
this.isTriggered = false;
this.hostProduct = [...this.hostProduct, ...res.data.list];
this.isLoading = 0;
if (res.data.list.length < this.where.limit) this.isLoading = -1;
this.where.page++;
}).catch(err => {
this.isTriggered = false;
})
},
goDetail(item) {
goShopDetail(item, this.uid).then(res => {
if (this.isLogin) {
initiateAssistApi(item.activity_id).then(res => {
let id = res.data.product_assist_set_id;
uni.hideLoading();
uni.navigateTo({
url: '/pages/activity/assist_detail/index?id=' + id
});
}).catch((err) => {
uni.showToast({
title: err,
icon: 'none'
})
});
} else {
toLogin();
}
})
}
}
}
</script>
</style>

View File

@ -1,5 +1,5 @@
<template>
<view class="wholeSale">
<view class="wholeSale" @touchstart="onTouchStart" @touchmove="onTouchMove">
<!-- 适配不同机 -->
<view class="wholeSale-header">
@ -26,6 +26,8 @@
</view>
</view>
<view :style="{height:'calc(' + wrapHeight + 'rpx + 92rpx + var(--status-bar-height))'}"></view>
<!-- 分类区域 -->
<view class="wholeSale-section" :style="{height:wrapHeight + 'rpx'}">
<view class="wholeSale-nav">
@ -67,55 +69,50 @@
</view>
<!-- 列表 -->
<view class="goods_list" :style="{height:'calc(100vh - '+wrapHeight+'rpx - 142rpx)'}">
<scroll-view :scroll-y="true" @scrolltolower="onScrollBottom" @scroll="onScroll" style="height: 100%;"
:refresher-enabled="true" :refresher-triggered="isTriggered" @refresherpulling="onPulling"
@refresherrefresh="onRefresh" :refresher-threshold="45" :scroll-anchoring='true'>
<view class="goods" v-for="(item, index) in goodsList" :key="index" @click="goStore(item.mer_id)">
<view class="avatar">
<u--image width="160rpx" height="160rpx" :src="item.mer_avatar" mode="aspectFill">
<template v-slot:loading>
<u-loading-icon color="#999" size="15" />
</template>
</u--image>
<view class="goods_list">
<view class="goods" v-for="(item, index) in goodsList" :key="index" @click="goStore(item.mer_id)">
<view class="avatar">
<u--image width="160rpx" height="160rpx" :src="item.mer_avatar" mode="aspectFill">
<template v-slot:loading>
<u-loading-icon color="#999" size="15" />
</template>
</u--image>
</view>
<view class="content">
<view class="content-head">
<view class="title">{{item.mer_name}}</view>
<text style="font-size: 21.03rpx;color: #aaa;" v-if="item.sales>=100">月销{{item.sales}}</text>
</view>
<view class="content">
<view class="content-head">
<view class="title">{{item.mer_name}}</view>
<text style="font-size: 21.03rpx;color: #aaa;"
v-if="item.sales>=100">月销{{item.sales}}</text>
</view>
<view class="content-two">
<view class="score">
<view class="star">
<view
:style="{width: `${(item.service_score / 5 * 100).toFixed(0)}%`, backgroundImage: `url(${domain}/static/diy/score1${keyColor}.png)`}">
</view>
<view class="content-two">
<view class="score">
<view class="star">
<view
:style="{width: `${(item.service_score / 5 * 100).toFixed(0)}%`, backgroundImage: `url(${domain}/static/diy/score1${keyColor}.png)`}">
</view>
</view>
<text
style="margin-left: 20rpx;color: #FF6D20;font-size: 22.78rpx; ">{{item.service_score}}</text>
<text v-if="item.distance"
style="margin-left: 20rpx;font-size: 21.03rpx;color: #aaa;">{{item.distance}}</text>
<text style="margin-left:20rpx;" class="line1">{{item.category_name}}</text>
</view>
<view class="content-two">
<u--image :showLoading="true" src="/static/images/GXSC/DH.png" width="33.85rpx"
height="33.85rpx"></u--image>
<text> {{item.service_phone}}</text>
<u--image style="margin-left: 28rpx;" v-if="item.mer_take_time" :showLoading="true"
src="/static/images/GXSC/SJ.png" width="33.85rpx" height="33.85rpx"></u--image>
<text v-if="item.mer_take_time">{{item.mer_take_time[0]}}-{{item.mer_take_time[1]}}</text>
</view>
<view class="content-two">
<u--image :showLoading="true" src="/static/images/GXSC/DW.png" width="33.85rpx"
height="33.85rpx"></u--image>
<text class="address">{{item.mer_address}}</text>
</view>
<text
style="margin-left: 20rpx;color: #FF6D20;font-size: 22.78rpx; ">{{item.service_score}}</text>
<text v-if="item.distance"
style="margin-left: 20rpx;font-size: 21.03rpx;color: #aaa;">{{item.distance}}</text>
<text style="margin-left:20rpx;" class="line1">{{item.category_name}}</text>
</view>
<view class="content-two">
<u--image :showLoading="true" src="/static/images/GXSC/DH.png" width="33.85rpx"
height="33.85rpx"></u--image>
<text> {{item.service_phone}}</text>
<u--image style="margin-left: 28rpx;" v-if="item.mer_take_time" :showLoading="true"
src="/static/images/GXSC/SJ.png" width="33.85rpx" height="33.85rpx"></u--image>
<text v-if="item.mer_take_time">{{item.mer_take_time[0]}}-{{item.mer_take_time[1]}}</text>
</view>
<view class="content-two">
<u--image :showLoading="true" src="/static/images/GXSC/DW.png" width="33.85rpx"
height="33.85rpx"></u--image>
<text class="address">{{item.mer_address}}</text>
</view>
</view>
<loadmore :type="isLoading" style="padding: 12rpx 0;"></loadmore>
</scroll-view>
</view>
<loadmore :type="isLoading" style="padding: 12rpx 0;"></loadmore>
</view>
<!-- 弹框大分类 -->
@ -181,6 +178,7 @@
cate_change: 0,
goodsList: [],
isLoading: 0,
isScroll: false,
isShowAddress: false,
street: '定位中',
where: {
@ -193,8 +191,7 @@
location: ''
},
wrapHeight: 300,
scrollTop: 0,
isTriggered: false
touchstarty: 0,
}
},
computed: {
@ -206,6 +203,19 @@
hide_mer_status: '',
}, mapGetters(['viewColor', 'keyColor'])),
},
onPageScroll() {
uni.$emit('scroll');
},
onPullDownRefresh() {
this.storeMerchantList(true);
},
onReachBottom() {
this.storeMerchantList();
},
onLoad(option) {
let getAddress = uni.getStorageSync('getAddress');
let closeShow = uni.getStorageSync('closeShow');
@ -221,39 +231,33 @@
this.merClassifly();
this.storeMerchantList();
},
onPageScroll() {
uni.$emit('scroll');
},
methods: {
//
onPulling() {
if (!this.isTriggered) {
this.isTriggered = true;
this.storeMerchantList(true);
}
//
onTouchStart(e) {
this.touchstarty = e.touches[0].clientY;
},
onRefresh(e) {
this.isTriggered = true;
},
onScrollBottom(e) {
this.storeMerchantList();
//
onTouchMove(e) {
this.$nextTick(() => {
let deltaY = e.changedTouches[0].clientY - this.touchstarty;
if (deltaY <= 0) {
console.log("上滑")
this.wrapHeight = 0;
} else {
console.log('下滑');
this.wrapHeight = 300;
}
this.$forceUpdate();
})
},
onAllCategory() {
this.$refs.popup.open();
},
onScroll(e) {
if (this.scrollTop > e.target.scrollTop) { //
this.wrapHeight = 300;
} else {
this.wrapHeight = 0;
}
this.scrollTop = e.target.scrollTop;
},
navTo(url) {
uni.navigateTo({
url: url,
@ -279,12 +283,14 @@
this.$refs.popup && this.$refs.popup.close();
this.$forceUpdate();
},
//
goStore(id) {
uni.navigateTo({
url: `/pages/store/home/index?id=${id}`
})
},
merClassifly() {
merClassifly().then(res => {
this.store_category = [{
@ -294,6 +300,7 @@
}, ...res.data];
})
},
storeMerchantList(reLoad = false) {
if (reLoad) {
this.where.page = 1;
@ -303,19 +310,21 @@
if (this.isLoading == -1) return;
this.isLoading = 1;
storeMerchantList(this.where).then(res => {
this.isTriggered = false;
uni.stopPullDownRefresh();
this.goodsList = [...this.goodsList, ...res.data.list];
this.isLoading = 0;
if (res.data.list.length < this.where.limit) this.isLoading = -1;
this.where.page++;
}).catch(() => {
this.isTriggered = false;
uni.stopPullDownRefresh();
})
},
closeShowAddress() {
this.isShowAddress = false;
uni.setStorageSync('closeShow', true);
},
//
changeMap() {
uni.navigateTo({
@ -347,6 +356,7 @@
}
})
},
getLocation() {
uni.getLocation({
type: 'gcj02',
@ -403,7 +413,7 @@
})
}
})
},
}
}
}
</script>
@ -421,33 +431,33 @@
}
.wholeSale-header {
position: sticky;
position: fixed;
top: 0;
z-index: 90;
margin-bottom: 20rpx;
width: 100%;
background-color: #40AE36;
}
.wholeSale-section {
position: sticky;
top: calc(82rpx + var(--status-bar-height));
position: fixed;
z-index: 10;
top: calc(80rpx + var(--status-bar-height));
width: 100%;
padding: 0rpx 20rpx;
background-color: #fff;
transition: height .5s;
overflow: hidden;
margin-bottom: 20rpx;
.wholeSale-nav {
display: flex;
align-items: center;
margin-bottom: 40rpx;
padding: 20rpx 0;
.icon {
margin-right: 20rpx;
}
.search_content {
// margin-bottom: 40rpx;
flex: 1;
height: 70rpx;
padding: 2px 2px 2px 21.05rpx;

View File

@ -1,5 +1,5 @@
<template>
<view class="wholeSale">
<view class="wholeSale" @touchstart="onTouchStart" @touchmove="onTouchMove">
<!-- 适配不同机 -->
<view class="wholeSale-header">
<view style="height: var(--status-bar-height);background-color: #40af37;"></view>
@ -9,6 +9,8 @@
</view>
</view>
<view :style="{height:'calc(' + wrapHeight + 'rpx + 92rpx + var(--status-bar-height))'}"></view>
<view class="wholeSale-section" :style="{height:wrapHeight + 'rpx'}">
<view class="wholeSale-nav">
<!-- 搜索 -->
@ -63,16 +65,10 @@
</view>
<!-- 内容 -->
<view class="wholeSale-con" :style="{height:'calc(100vh - '+wrapHeight+'rpx - 142rpx )'}">
<scroll-view :scroll-y="true" @scrolltolower="onScrollBottom" @scroll="onScroll" style="height: 100%;"
:refresher-enabled="true" :refresher-triggered="isTriggered" @refresherpulling="onPulling"
@refresherrefresh="onRefresh" :refresher-threshold="45" :scroll-anchoring='true'>
<view>
<!-- 流水瀑布 -->
<WaterfallsFlow :wfList='hostProduct' @itemTap="goDetail" :type="0" />
<loadmore :type="isLoading" style="padding: 12rpx 0;"></loadmore>
</view>
</scroll-view>
<view class="wholeSale-con">
<!-- 流水瀑布 -->
<WaterfallsFlow :wfList='hostProduct' @itemTap="goDetail" :type="0" />
<loadmore :type="isLoading" style="padding: 12rpx 0;"></loadmore>
</view>
<!-- 弹框大分类 -->
@ -123,6 +119,7 @@
cate_change: 0,
cate_change_children: 0,
isLoading: 0,
isScroll: false,
where: {
page: 1,
limit: 20,
@ -132,46 +129,52 @@
sale_type: 1, //1-, 2-
},
wrapHeight: 300,
scrollTop: 0,
isTriggered: true
touchstarty: 0
}
},
onPageScroll() {
uni.$emit('scroll');
},
onPullDownRefresh() {
this.getProductslist(true);
},
onReachBottom() {
this.getProductslist();
},
onLoad(option) {
this.getCategoryIndexList();
this.getProductslist(true);
},
onPageScroll() {
uni.$emit('scroll');
},
methods: {
//
onPulling() {
if (!this.isTriggered) {
this.isTriggered = true;
this.getProductslist(true);
}
},
onRefresh(e) {
this.isTriggered = true;
//
onTouchStart(e) {
this.touchstarty = e.touches[0].clientY;
},
onScrollBottom(e) {
this.getProductslist();
//
onTouchMove(e) {
this.$nextTick(() => {
let deltaY = e.changedTouches[0].clientY - this.touchstarty;
if (deltaY <= 0) {
console.log("上滑")
this.wrapHeight = 0;
} else {
console.log('下滑');
this.wrapHeight = 300;
}
this.$forceUpdate();
})
},
onAllCategory() {
this.$refs.popup.open();
},
onScroll(e) {
if (this.scrollTop > e.target.scrollTop) { //
this.wrapHeight = 300;
} else {
this.wrapHeight = 0;
}
this.scrollTop = e.target.scrollTop;
},
navTo(url) {
uni.navigateTo({
url: url,
@ -241,13 +244,13 @@
if (this.isLoading == -1) return;
this.isLoading = 1;
getProductslist(this.where).then(res => {
this.isTriggered = false;
uni.stopPullDownRefresh();
this.hostProduct = [...this.hostProduct, ...res.data.list];
this.where.page++;
this.isLoading = 0;
if (res.data.list.length < this.where.limit) this.isLoading = -1;
}).catch(() => {
this.isTriggered = false;
uni.stopPullDownRefresh();
})
},
goDetail(item) {
@ -282,27 +285,27 @@
.wholeSale {
.wholeSale-header {
position: sticky;
position: fixed;
top: 0;
z-index: 90;
width: 100%;
background-color: #40AE36;
}
.wholeSale-section {
position: sticky;
top: calc(82rpx + var(--status-bar-height));
position: fixed;
top: calc(80rpx + var(--status-bar-height));
width: 100%;
padding: 0rpx 20rpx;
background-color: #fff;
transition: height .5s;
overflow: hidden;
margin-bottom: 20rpx;
padding-top: 20rpx;
z-index: 20;
z-index: 89;
.wholeSale-nav {
display: flex;
align-items: center;
margin-bottom: 40rpx;
padding: 20rpx 0;
.icon {
margin-right: 20rpx;

View File

@ -576,7 +576,7 @@
this.isScrolled = false
}
// scrollTopeasy-loadimage
uni.$emit('scroll');
uni.$emit('scroll', e);
if (e.scrollTop >= 100) {
uni.setTabBarItem({
@ -662,6 +662,7 @@
that.isScrolled = res[0].top <= -60
})
})
this.isIndexClick = false;
if (this.isLogin) {

View File

@ -1,207 +1,201 @@
<template>
<view class="wholeSale">
<view class="wholeSale" @touchstart="onTouchStart" @touchmove="onTouchMove">
<!-- 顶部 -->
<view class="wholeSale-header">
<view class="wholeSale-header-wrap">
<!-- 适配不同机 -->
<view style="height: var(--status-bar-height);"></view>
<!-- 适配不同机 -->
<view style="height: var(--status-bar-height);"></view>
<!-- 滚动tab -->
<scroll-view scroll-x="true" :scroll-top="100" :show-scrollbar="false" scroll-into-view="a1">
<view class="scrollview">
<block v-for="(item,indx) in tabsArr" :key="indx">
<view class="scrollview-item" :id="'a' + indx"
:class="{'scrollview-active':tabsCurr == item.val}" @click="tabsChange(item.val)">
{{item.name}}
<!-- 滚动tab -->
<scroll-view scroll-x="true" :scroll-top="100" :show-scrollbar="false" scroll-into-view="a1">
<view class="scrollview">
<block v-for="(item,indx) in tabsArr" :key="indx">
<view class="scrollview-item" :id="'a' + indx"
:class="{'scrollview-active':tabsCurr == item.val}" @click="tabsChange(item.val)">
{{item.name}}
</view>
</block>
</view>
</scroll-view>
</view>
<!-- 占位 -->
<view :style="{height:'calc(' + wrapHeight + 'rpx + 108rpx + var(--status-bar-height))'}"></view>
<view class="wholeSale-header-search-wrap" :style="{height:wrapHeight + 'rpx'}">
<u-subsection v-if="tabsCurr==2" :list="subList" @change="changeSub" :current="subCurr" mode="subsection"
activeColor="#40ae36" fontSize="14" style="margin-top: 20rpx;"></u-subsection>
<view class="wholeSale-nav">
<view
@click="navTo(`/pages/columnGoods/goods_search/index?back=true&searchVal=${where.keyword}&shop=${subCurr!=1 || (subCurr==1 && tabsCurr!=2) ? false : true}`)"
hover-class="none" class="search_content flex_a_c_j_sb">
<view class="flex_a_c search_content_wrap">
<view class="iconfont icon-sousuo" style="font-size: 39rpx;"></view>
<input type="text"
:placeholder="subCurr!=1 || (subCurr==1 && tabsCurr!=2) ? '搜索您需要批发进货的产品名称': '搜索店铺名称'"
:value="where.keyword" placeholder-style="font-size: 30rpx;color:#999;" disabled
style="pointer-events: none;">
</view>
</view>
</view>
<!-- 商品大分类 -->
<view class="category">
<scroll-view scroll-x="true">
<view class="category-wrap">
<block v-for="(item,index) in store_category" :key="index">
<view class="category-item" :class="{'category-item-active': index==cate_change}"
@click="changeCate(index)">
<block v-if="subCurr!=1 || (subCurr==1 && tabsCurr!=2)">
<u--image class="category-item-img" width="108rpx" :src="item.pic" height="108rpx"
shape="circle">
<template v-slot:loading>
<u-loading-icon color="#999" size="15" />
</template>
</u--image>
<text class="category-item-text">{{item.cate_name}}</text>
</block>
<block v-else>
<u--image class="category-item-img" width="108rpx" :src="item.background"
height="108rpx" shape="circle">
<template v-slot:loading>
<u-loading-icon color="#999" size="15" />
</template>
</u--image>
<text class="category-item-text">{{item.category_name}}</text>
</block>
</view>
</block>
</view>
</scroll-view>
<view class="category-all" v-if="store_category.length > 0" @click="onAllCategory">
<view style="margin-bottom: 20rpx;">全部</view>
<u-icon name="list"></u-icon>
</view>
</view>
<!-- 商品小分类 -->
<view class="cate" v-if="store_category_children.length>1">
<scroll-view scroll-x="true">
<view class="cate-wrap">
<block v-for="(item,index) in store_category_children" :key="index">
<view class="cate-item" :class="{'cate-item-active':index == cate_change_children}"
@click="changeChildrenCate(index)">
<text>{{item.cate_name}}</text>
</view>
</block>
</view>
</scroll-view>
</view>
<view class="wholeSale-header-search-wrap" :style="{height:wrapHeight + 'rpx'}">
<u-subsection v-if="tabsCurr==2" :list="subList" @change="changeSub" :current="subCurr"
mode="subsection" activeColor="#40ae36" fontSize="14" style="margin-bottom: 24rpx;"></u-subsection>
<view class="wholeSale-nav">
<view
@click="navTo(`/pages/columnGoods/goods_search/index?back=true&searchVal=${where.keyword}&shop=${subCurr!=1 || (subCurr==1 && tabsCurr!=2) ? false : true}`)"
hover-class="none" class="search_content flex_a_c_j_sb">
<view class="flex_a_c search_content_wrap">
<view class="iconfont icon-sousuo" style="font-size: 39rpx;"></view>
<input type="text"
:placeholder="subCurr!=1 || (subCurr==1 && tabsCurr!=2) ? '搜索您需要批发进货的产品名称': '搜索店铺名称'"
:value="where.keyword" placeholder-style="font-size: 30rpx;color:#999;" disabled
style="pointer-events: none;">
</view>
</view>
<!-- 综合查询 -->
<view class="comprehensive" v-if="subCurr!=1 || (subCurr==1 && tabsCurr!=2)">
<view class="comprehensive-price" :class="{'comp-color': orderCurr==1}" @click="toOrder('price', 1)">
<text>价格</text>
<image v-if="orderCurr==1" style="width: 15rpx;height: 21rpx;"
:src="where.order == 'price_asc' ? domain+'/static/diy/up'+keyColor+'.png' : domain+'/static/diy/down'+keyColor+'.png'">
</image>
<view v-else style="width: 15rpx;height: 21rpx;"></view>
</view>
<!-- 商品大分类 -->
<view class="category">
<scroll-view scroll-x="true">
<view class="category-wrap">
<block v-for="(item,index) in store_category" :key="index">
<view class="category-item" :class="{'category-item-active': index==cate_change}"
@click="changeCate(index)">
<block v-if="subCurr!=1 || (subCurr==1 && tabsCurr!=2)">
<u--image class="category-item-img" width="108rpx" :src="item.pic"
height="108rpx" shape="circle">
<template v-slot:loading>
<u-loading-icon color="#999" size="15" />
</template>
</u--image>
<text class="category-item-text">{{item.cate_name}}</text>
</block>
<block v-else>
<u--image class="category-item-img" width="108rpx" :src="item.background"
height="108rpx" shape="circle">
<template v-slot:loading>
<u-loading-icon color="#999" size="15" />
</template>
</u--image>
<text class="category-item-text">{{item.category_name}}</text>
</block>
</view>
</block>
</view>
</scroll-view>
<view class="category-all" v-if="store_category.length > 0" @click="onAllCategory">
<view style="margin-bottom: 20rpx;">全部</view>
<u-icon name="list"></u-icon>
</view>
<view class="comprehensive-sales_num" :class="{'comp-color': orderCurr==2}"
@click="toOrder('sales', 2)">
<text>销量</text>
</view>
<!-- 商品小分类 -->
<view class="cate" v-if="store_category_children.length>1">
<scroll-view scroll-x="true">
<view class="cate-wrap">
<block v-for="(item,index) in store_category_children" :key="index">
<view class="cate-item" :class="{'cate-item-active':index == cate_change_children}"
@click="changeChildrenCate(index)">
<text>{{item.cate_name}}</text>
</view>
</block>
</view>
</scroll-view>
<view class="comprehensive-discount" :class="{'comp-color': orderCurr==3}" v-if="tabsCurr!=1"
@click="toOrder('', 3)">
<text>综合</text>
</view>
<!-- 综合查询 -->
<view class="comprehensive" v-if="subCurr!=1 || (subCurr==1 && tabsCurr!=2)">
<view class="comprehensive-price" :class="{'comp-color': orderCurr==1}"
@click="toOrder('price', 1)">
<text>价格</text>
<image v-if="orderCurr==1" style="width: 15rpx;height: 21rpx;"
:src="where.order == 'price_asc' ? domain+'/static/diy/up'+keyColor+'.png' : domain+'/static/diy/down'+keyColor+'.png'">
</image>
<view v-else style="width: 15rpx;height: 21rpx;"></view>
</view>
<view class="comprehensive-sales_num" :class="{'comp-color': orderCurr==2}"
@click="toOrder('sales', 2)">
<text>销量</text>
</view>
<view class="comprehensive-discount" :class="{'comp-color': orderCurr==3}" v-if="tabsCurr!=1"
@click="toOrder('', 3)">
<text>综合</text>
</view>
<view class="comprehensive-discount" v-else @click="deduction_rate=!deduction_rate;">
<text>抵扣</text>
<image class="loudou" src="@/static/new_define/loudou.png"></image>
</view>
<view class="comprehensive-discount" v-else @click="deduction_rate=!deduction_rate;">
<text>抵扣</text>
<image class="loudou" src="@/static/new_define/loudou.png"></image>
</view>
</view>
<!-- 综合查询 -->
<view class="comprehensive" v-if="deduction_rate && tabsCurr==1">
<view class="comprehensive-sales_num" :class="{'comp-color': where.deduction_rate==''}"
@click="changeDeduction('')">
<text>全部</text>
</view>
<view class="comprehensive-sales_num" :class="{'comp-color': where.deduction_rate=='10'}"
@click="changeDeduction('10')">
<text>1:9</text>
</view>
<view class="comprehensive-sales_num" :class="{'comp-color': where.deduction_rate=='15'}"
@click="changeDeduction('15')">
<text>2:8</text>
</view>
<view class="comprehensive-sales_num" :class="{'comp-color': where.deduction_rate=='20'}"
@click="changeDeduction('20')">
<text>3:7</text>
</view>
<view class="comprehensive-sales_num" :class="{'comp-color': where.deduction_rate=='25'}"
@click="changeDeduction('25')">
<text>4:6</text>
</view>
<!-- 综合查询 -->
<view class="comprehensive" v-if="deduction_rate && tabsCurr==1">
<view class="comprehensive-sales_num" :class="{'comp-color': where.deduction_rate==''}"
@click="changeDeduction('')">
<text>全部</text>
</view>
<view class="comprehensive-sales_num" :class="{'comp-color': where.deduction_rate=='10'}"
@click="changeDeduction('10')">
<text>1:9</text>
</view>
<view class="comprehensive-sales_num" :class="{'comp-color': where.deduction_rate=='15'}"
@click="changeDeduction('15')">
<text>2:8</text>
</view>
<view class="comprehensive-sales_num" :class="{'comp-color': where.deduction_rate=='20'}"
@click="changeDeduction('20')">
<text>3:7</text>
</view>
<view class="comprehensive-sales_num" :class="{'comp-color': where.deduction_rate=='25'}"
@click="changeDeduction('25')">
<text>4:6</text>
</view>
</view>
</view>
<!-- 内容 -->
<view class="wholeSale-con"
:style="{height:'calc(100vh - '+wrapHeight+'rpx - 142rpx '+(isShowSmall?' - 48rpx':'')+')'}">
<scroll-view :scroll-y="true" @scrolltolower="onScrollBottom" @scroll="onScroll" style="height: 100%;"
:refresher-enabled="true" :refresher-triggered="isTriggered" @refresherpulling="onPulling"
@refresherrefresh="onRefresh" :refresher-threshold="45" :scroll-anchoring='true'>
<!-- 流水瀑布 -->
<WaterfallsFlow v-if="subCurr!=1 || (subCurr==1 && tabsCurr!=2)" :wfList='hostProduct'
@itemTap="goDetail" :type="0" :sale_type="2" />
<view class="wholeSale-con">
<!-- 流水瀑布 -->
<WaterfallsFlow v-if="subCurr!=1 || (subCurr==1 && tabsCurr!=2)" :wfList='hostProduct' @itemTap="goDetail"
:type="0" :sale_type="2" />
<!-- 列表 -->
<view class="goods_list" v-else>
<view class="goods" v-for="(item, index) in shopList" :key="index" @click="goStore(item.mer_id)">
<view class="avatar">
<u--image width="160rpx" height="160rpx" :src="item.mer_avatar" mode="aspectFill">
<template v-slot:loading>
<u-loading-icon color="#999" size="15" />
</template>
</u--image>
<!-- 列表 -->
<view class="goods_list" v-else>
<view class="goods" v-for="(item, index) in shopList" :key="index" @click="goStore(item.mer_id)">
<view class="avatar">
<u--image width="160rpx" height="160rpx" :src="item.mer_avatar" mode="aspectFill">
<template v-slot:loading>
<u-loading-icon color="#999" size="15" />
</template>
</u--image>
</view>
<view class="content">
<view class="content-head">
<view class="title">{{item.mer_name}}</view>
<text style="font-size: 21.03rpx;color: #aaa;"
v-if="item.sales>=100">月销{{item.sales}}</text>
</view>
<view class="content">
<view class="content-head">
<view class="title">{{item.mer_name}}</view>
<text style="font-size: 21.03rpx;color: #aaa;"
v-if="item.sales>=100">月销{{item.sales}}</text>
</view>
<view class="content-two">
<view class="score">
<view class="star">
<view
:style="{width: `${(item.service_score / 5 * 100).toFixed(0)}%`, backgroundImage: `url(${domain}/static/diy/score1${keyColor}.png)`}">
</view>
<view class="content-two">
<view class="score">
<view class="star">
<view
:style="{width: `${(item.service_score / 5 * 100).toFixed(0)}%`, backgroundImage: `url(${domain}/static/diy/score1${keyColor}.png)`}">
</view>
</view>
<text
style="margin-left: 20rpx;color: #FF6D20;font-size: 22.78rpx; ">{{item.service_score}}</text>
<text v-if="item.distance"
style="margin-left: 20rpx;font-size: 21.03rpx;color: #aaa;">{{item.distance}}</text>
</view>
<text
style="margin-left: 20rpx;color: #FF6D20;font-size: 22.78rpx; ">{{item.service_score}}</text>
<text v-if="item.distance"
style="margin-left: 20rpx;font-size: 21.03rpx;color: #aaa;">{{item.distance}}</text>
<text style="margin-left: 20rpx;" class="line1">{{item.category_name}}</text>
</view>
<view class="content-two">
<u--image :showLoading="true" src="/static/images/GXSC/DH.png" width="33.85rpx"
height="33.85rpx"></u--image>
<text> {{item.service_phone}}</text>
<u--image style="margin-left: 28rpx;" v-if="item.mer_take_time" :showLoading="true"
src="/static/images/GXSC/SJ.png" width="33.85rpx" height="33.85rpx"></u--image>
<text
v-if="item.mer_take_time">{{item.mer_take_time[0]}}-{{item.mer_take_time[1]}}</text>
</view>
<view class="content-two">
<u--image :showLoading="true" src="/static/images/GXSC/DW.png" width="33.85rpx"
height="33.85rpx"></u--image>
<text class="address">{{item.mer_address}}</text>
</view>
<text style="margin-left: 20rpx;" class="line1">{{item.category_name}}</text>
</view>
<view class="content-two">
<u--image :showLoading="true" src="/static/images/GXSC/DH.png" width="33.85rpx"
height="33.85rpx"></u--image>
<text> {{item.service_phone}}</text>
<u--image style="margin-left: 28rpx;" v-if="item.mer_take_time" :showLoading="true"
src="/static/images/GXSC/SJ.png" width="33.85rpx" height="33.85rpx"></u--image>
<text v-if="item.mer_take_time">{{item.mer_take_time[0]}}-{{item.mer_take_time[1]}}</text>
</view>
<view class="content-two">
<u--image :showLoading="true" src="/static/images/GXSC/DW.png" width="33.85rpx"
height="33.85rpx"></u--image>
<text class="address">{{item.mer_address}}</text>
</view>
</view>
</view>
</view>
<loadmore :type="isLoading" v-if="isLoading || hostProduct.length > 0" style="padding: 12rpx 0;">
</loadmore>
<view class='pictrue' v-if="!isLoading && hostProduct.length == 0">
<image :src="`${domain}/static/images/noCart.png`"></image>
<view>暂无商品看点别的吧</view>
</view>
</scroll-view>
<loadmore :type="isLoading" v-if="isLoading || hostProduct.length > 0" style="padding: 12rpx 0;">
</loadmore>
<view class='pictrue' v-if="!isLoading && hostProduct.length == 0">
<image :src="`${domain}/static/images/noCart.png`"></image>
<view>暂无商品看点别的吧</view>
</view>
</view>
<!-- 弹框大分类 -->
@ -320,10 +314,8 @@
bigTypeDomInfo: null,
smallTypeDomInfo: null,
categoryWrapHeight: 0,
wrapHeight: 332,
isShowSmall: false,
scrollTop: 0,
isTriggered: false
wrapHeight: 360,
touchstarty: 0
}
},
computed: {
@ -366,54 +358,54 @@
index: 1,
text: "批发",
selectedIconPath: "/static/tabbar_icon/b-a.png"
})
});
}
},
watch: {
'where.cate_pid'(newVal, oldVal) {
if (newVal && !oldVal) {
this.wrapHeight = this.tabsCurr == 2 ? 400 : (332 + 48);
this.isShowSmall = true;
}
if (!newVal && oldVal) {
this.wrapHeight = this.tabsCurr == 2 ? 400 : 332;
this.isShowSmall = false;
}
}
// watch: {
// 'where.cate_pid'(newVal, oldVal) {
// if (newVal && !oldVal) {
// this.isShowSmall = true;
// }
// if (!newVal && oldVal) {
// this.isShowSmall = false;
// }
// }
// },
onPullDownRefresh() {
this.initData(true, true);
},
onReachBottom() {
this.initData(false, true);
},
methods: {
//
onPulling() {
if (!this.isTriggered) {
this.isTriggered = true;
this.initData(true, true);
}
},
onRefresh(e) {
this.isTriggered = true;
//
onTouchStart(e) {
this.touchstarty = e.touches[0].clientY;
},
onScrollBottom(e) {
this.initData(false, true);
//
onTouchMove(e) {
this.$nextTick(() => {
let deltaY = e.changedTouches[0].clientY - this.touchstarty;
if (deltaY <= 0) {
console.log("上滑")
this.wrapHeight = 0;
} else {
console.log('下滑');
this.getHeight();
}
this.$forceUpdate();
})
},
onAllCategory() {
this.$refs.popup.open();
},
onScroll(e) {
if (this.scrollTop >= e.target.scrollTop) { //
this.wrapHeight = this.tabsCurr == 2 ? 400 : 332;
if (this.where.cate_pid) this.wrapHeight = this.wrapHeight + 48;
} else {
this.wrapHeight = 0;
}
this.scrollTop = e.target.scrollTop;
},
initData(re = false, stop = false) {
if (!stop) this.getStoreCategory();
if (this.tabsCurr == 2 && this.subCurr == 1) this.storeMerchantList(re, stop);
@ -424,6 +416,7 @@
this.getProductslist(true);
},
changeSub(e) {
console.log(e);
this.subCurr = e;
this.where = {
page: 1,
@ -435,6 +428,7 @@
this.cate_change = 0;
this.cate_change_children = 0;
this.initData(true);
this.getHeight()
},
toOrder(type, index = -1) {
if (this.where.order == type) {
@ -484,9 +478,30 @@
this.cate_change = 0;
this.cate_change_children = 0;
if (this.tabsCurr != 2 || (this.tabsCurr == 2 && this.subCurr != 1)) this.where.mer_type = e;
this.wrapHeight = this.tabsCurr == 2 ? 400 : this.where.cate_pid ? (332 + 48) : 332;
this.getHeight();
this.initData(true);
},
//
getHeight() {
if (this.tabsCurr == 1) {
if (this.cate_change) {
this.wrapHeight = 410;
} else {
this.wrapHeight = 360;
}
} else if (this.tabsCurr == 2) {
if (this.subCurr == 1) {
this.wrapHeight = 400;
} else {
this.wrapHeight = 440;
}
} else {
this.wrapHeight = 360;
}
},
changeCate(e) {
this.cate_change = e;
this.store_category_children = [];
@ -507,8 +522,11 @@
this.where.cate_pid = this.store_category[e].store_category_id;
this.where.cate_id = "";
}
this.getProductslist(true);
this.getHeight();
// popup
this.$refs.popup && this.$refs.popup.close();
},
@ -564,9 +582,9 @@
if (this.where.order) this.where.rand = 0;
else this.where.rand = 1;
getProductslist(this.where, true).then(res => {
uni.stopPullDownRefresh();
this.where.limit = res.data.limit
this.where.page = res.data.page
this.isTriggered = false;
if (reLoad) this.hostProduct = [];
this.hostProduct = [...this.hostProduct, ...res.data.list];
this.isLoading = 0;
@ -583,7 +601,6 @@
if (this.isLoading == -1) return;
this.isLoading = 1;
storeMerchantList(this.where).then(res => {
this.isTriggered = false;
this.shopList = [...this.shopList, ...res.data.list];
this.isLoading = 0;
if (res.data.list.length < this.where.limit) this.isLoading = -1;
@ -627,23 +644,11 @@
.wholeSale {
.wholeSale-header {
position: sticky;
position: fixed;
top: 0;
z-index: 90;
margin-bottom: 20rpx;
.wholeSale-header-wrap {
background-color: #40AE36;
}
.wholeSale-header-search-wrap {
position: sticky;
top: calc(82rpx + var(--status-bar-height));
transition: height .5s;
overflow: hidden;
padding: 30rpx 20rpx 0;
background-color: #fff;
}
background-color: #40AE36;
width: 100%;
.scrollview {
display: flex;
@ -678,43 +683,59 @@
}
}
.wholeSale-header-search-wrap {
position: fixed;
top: calc(98rpx + var(--status-bar-height));
z-index: 89;
width: 100%;
transition: height .5s;
overflow: hidden;
padding: 0rpx 20rpx;
background-color: #fff;
}
.wholeSale-con {
position: relative;
z-index: index;
margin: 0 10px;
}
.search_content {
margin-bottom: 40rpx;
height: 70rpx;
padding: 2px 2px 2px 21.05rpx;
border-radius: 80rpx;
background: #EDEFF2;
position: relative;
box-sizing: border-box;
.wholeSale-nav {
padding: 20rpx 0;
.search_content_wrap {
width: 100%;
.search_content {
height: 70rpx;
padding: 2px 2px 2px 21.05rpx;
border-radius: 80rpx;
background: #EDEFF2;
position: relative;
box-sizing: border-box;
.icon-sousuo {
font-size: 26.32rpx;
font-weight: bold;
color: #c8c7c6;
margin-right: 17.54rpx;
.search_content_wrap {
width: 100%;
.icon-sousuo {
font-size: 26.32rpx;
font-weight: bold;
color: #c8c7c6;
margin-right: 17.54rpx;
}
input {
width: 80%;
}
}
input {
width: 80%;
.search_btn {
width: 106rpx;
height: 60rpx;
line-height: 60rpx;
background: #40AE36;
border-radius: 100px;
font-size: 28rpx;
color: #fff;
}
}
.search_btn {
width: 106rpx;
height: 60rpx;
line-height: 60rpx;
background: #40AE36;
border-radius: 100px;
font-size: 28rpx;
color: #fff;
}
}
.category {
@ -790,7 +811,7 @@
.cate {
width: 100%;
overflow: auto;
margin-bottom: 30rpx;
// margin-bottom: 30rpx;
.cate-wrap {
display: flex;
@ -883,7 +904,7 @@
display: flex;
justify-content: space-between;
align-items: center;
padding: 20rpx 50rpx;
padding: 10rpx 50rpx;
[class^=comprehensive-] {
display: flex;