首页和滚动优化
This commit is contained in:
parent
a3c032b3e4
commit
1669b9be74
@ -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) {
|
||||
|
@ -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"
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
@ -238,293 +524,3 @@
|
||||
}
|
||||
}
|
||||
</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>
|
@ -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,10 +69,7 @@
|
||||
</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_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">
|
||||
@ -82,8 +81,7 @@
|
||||
<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>
|
||||
<text style="font-size: 21.03rpx;color: #aaa;" v-if="item.sales>=100">月销{{item.sales}}</text>
|
||||
</view>
|
||||
<view class="content-two">
|
||||
<view class="score">
|
||||
@ -115,7 +113,6 @@
|
||||
</view>
|
||||
</view>
|
||||
<loadmore :type="isLoading" style="padding: 12rpx 0;"></loadmore>
|
||||
</scroll-view>
|
||||
</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;
|
||||
},
|
||||
|
||||
// 开始移动
|
||||
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;
|
||||
}
|
||||
},
|
||||
|
||||
onRefresh(e) {
|
||||
this.isTriggered = true;
|
||||
},
|
||||
|
||||
onScrollBottom(e) {
|
||||
this.storeMerchantList();
|
||||
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;
|
||||
|
@ -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,17 +65,11 @@
|
||||
</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>
|
||||
<view class="wholeSale-con">
|
||||
<!-- 流水瀑布 -->
|
||||
<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">
|
||||
@ -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;
|
||||
|
@ -576,7 +576,7 @@
|
||||
this.isScrolled = false
|
||||
}
|
||||
// 传入scrollTop值并触发所有easy-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) {
|
||||
|
@ -1,8 +1,7 @@
|
||||
<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>
|
||||
|
||||
@ -19,9 +18,12 @@
|
||||
</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-bottom: 24rpx;"></u-subsection>
|
||||
<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
|
||||
@ -45,8 +47,8 @@
|
||||
<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">
|
||||
<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>
|
||||
@ -88,8 +90,7 @@
|
||||
|
||||
<!-- 综合查询 -->
|
||||
<view class="comprehensive" v-if="subCurr!=1 || (subCurr==1 && tabsCurr!=2)">
|
||||
<view class="comprehensive-price" :class="{'comp-color': orderCurr==1}"
|
||||
@click="toOrder('price', 1)">
|
||||
<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'">
|
||||
@ -134,17 +135,12 @@
|
||||
</view>
|
||||
</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 class="wholeSale-con">
|
||||
<!-- 流水瀑布 -->
|
||||
<WaterfallsFlow v-if="subCurr!=1 || (subCurr==1 && tabsCurr!=2)" :wfList='hostProduct'
|
||||
@itemTap="goDetail" :type="0" :sale_type="2" />
|
||||
<WaterfallsFlow v-if="subCurr!=1 || (subCurr==1 && tabsCurr!=2)" :wfList='hostProduct' @itemTap="goDetail"
|
||||
:type="0" :sale_type="2" />
|
||||
|
||||
<!-- 列表 -->
|
||||
<view class="goods_list" v-else>
|
||||
@ -183,8 +179,7 @@
|
||||
<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>
|
||||
<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"
|
||||
@ -201,7 +196,6 @@
|
||||
<image :src="`${domain}/static/images/noCart.png`"></image>
|
||||
<view>暂无商品,看点别的吧</view>
|
||||
</view>
|
||||
</scroll-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: {
|
||||
// 开始滑动
|
||||
onTouchStart(e) {
|
||||
this.touchstarty = e.touches[0].clientY;
|
||||
},
|
||||
|
||||
// 下拉加载
|
||||
onPulling() {
|
||||
if (!this.isTriggered) {
|
||||
this.isTriggered = true;
|
||||
this.initData(true, 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();
|
||||
}
|
||||
},
|
||||
onRefresh(e) {
|
||||
this.isTriggered = true;
|
||||
},
|
||||
|
||||
onScrollBottom(e) {
|
||||
this.initData(false, true);
|
||||
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;
|
||||
}
|
||||
width: 100%;
|
||||
|
||||
.scrollview {
|
||||
display: flex;
|
||||
@ -678,12 +683,27 @@
|
||||
}
|
||||
}
|
||||
|
||||
.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;
|
||||
}
|
||||
|
||||
.wholeSale-nav {
|
||||
padding: 20rpx 0;
|
||||
|
||||
.search_content {
|
||||
margin-bottom: 40rpx;
|
||||
height: 70rpx;
|
||||
padding: 2px 2px 2px 21.05rpx;
|
||||
border-radius: 80rpx;
|
||||
@ -716,6 +736,7 @@
|
||||
color: #fff;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.category {
|
||||
width: 100%;
|
||||
@ -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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user