首页和滚动优化
This commit is contained in:
parent
a3c032b3e4
commit
1669b9be74
@ -216,17 +216,17 @@
|
|||||||
this.list = res.data.list;
|
this.list = res.data.list;
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
this.$util.getDom(this, '.tabs', res => {
|
this.$util.getDom(this, '.tabs', res => {
|
||||||
|
console.log(res.top);
|
||||||
|
|
||||||
// #ifdef APP
|
// #ifdef APP
|
||||||
this.tabsTop = res.top - 10;
|
this.tabsTop = res.top;
|
||||||
// #endif
|
// #endif
|
||||||
|
|
||||||
// #ifdef H5
|
// #ifdef H5
|
||||||
this.tabsTop = res.top;
|
this.tabsTop = res.top;
|
||||||
// #endif
|
// #endif
|
||||||
|
|
||||||
console.log(this.tabsTop);
|
|
||||||
})
|
})
|
||||||
}, 300)
|
}, 1000)
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
goDetail(item) {
|
goDetail(item) {
|
||||||
|
@ -51,7 +51,7 @@
|
|||||||
}, {
|
}, {
|
||||||
"path": "pages/whole_sale/index",
|
"path": "pages/whole_sale/index",
|
||||||
"style": {
|
"style": {
|
||||||
"enablePullDownRefresh": false,
|
"enablePullDownRefresh": true,
|
||||||
"navigationBarTitleText": "批发",
|
"navigationBarTitleText": "批发",
|
||||||
"navigationStyle": "custom"
|
"navigationStyle": "custom"
|
||||||
}
|
}
|
||||||
@ -388,14 +388,14 @@
|
|||||||
"style": {
|
"style": {
|
||||||
"navigationBarTitleText": "里海云仓",
|
"navigationBarTitleText": "里海云仓",
|
||||||
"navigationStyle": "custom",
|
"navigationStyle": "custom",
|
||||||
"enablePullDownRefresh": false
|
"enablePullDownRefresh": true
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"path": "market/market",
|
"path": "market/market",
|
||||||
"style": {
|
"style": {
|
||||||
"navigationBarTitleText": "供销云市场",
|
"navigationBarTitleText": "供销云市场",
|
||||||
"enablePullDownRefresh": false,
|
"enablePullDownRefresh": true,
|
||||||
"navigationStyle": "custom"
|
"navigationStyle": "custom"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -403,7 +403,7 @@
|
|||||||
"path": "specialty/specialty",
|
"path": "specialty/specialty",
|
||||||
"style": {
|
"style": {
|
||||||
"navigationBarTitleText": "名优特产",
|
"navigationBarTitleText": "名优特产",
|
||||||
"enablePullDownRefresh": false,
|
"enablePullDownRefresh": true,
|
||||||
"navigationStyle": "custom"
|
"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>
|
<style lang="scss" scoped>
|
||||||
page {
|
page {
|
||||||
background-color: #f8fafb !important;
|
background-color: #f8fafb !important;
|
||||||
@ -7,26 +291,28 @@
|
|||||||
background-color: #f8fafb !important;
|
background-color: #f8fafb !important;
|
||||||
|
|
||||||
.wholeSale-header {
|
.wholeSale-header {
|
||||||
position: sticky;
|
position: fixed;
|
||||||
top: 0;
|
top: 0;
|
||||||
z-index: 9;
|
z-index: 98;
|
||||||
|
width: 100%;
|
||||||
margin-bottom: 20rpx;
|
margin-bottom: 20rpx;
|
||||||
background-color: #40AE36;
|
background-color: #40AE36;
|
||||||
}
|
}
|
||||||
|
|
||||||
.wholeSale-section {
|
.wholeSale-section {
|
||||||
position: sticky;
|
position: fixed;
|
||||||
top: calc(82rpx + var(--status-bar-height));
|
z-index: 97;
|
||||||
|
width: 100%;
|
||||||
|
top: calc(80rpx + var(--status-bar-height));
|
||||||
padding: 0rpx 20rpx;
|
padding: 0rpx 20rpx;
|
||||||
background-color: #fff;
|
background-color: #fff;
|
||||||
transition: height .5s;
|
transition: height .5s;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
margin-bottom: 20rpx;
|
|
||||||
|
|
||||||
.wholeSale-nav {
|
.wholeSale-nav {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
padding-bottom: 20rpx;
|
padding: 20rpx 0;
|
||||||
|
|
||||||
.icon {
|
.icon {
|
||||||
margin-right: 20rpx;
|
margin-right: 20rpx;
|
||||||
@ -238,293 +524,3 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</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>
|
<template>
|
||||||
<view class="wholeSale">
|
<view class="wholeSale" @touchstart="onTouchStart" @touchmove="onTouchMove">
|
||||||
|
|
||||||
<!-- 适配不同机 -->
|
<!-- 适配不同机 -->
|
||||||
<view class="wholeSale-header">
|
<view class="wholeSale-header">
|
||||||
@ -26,6 +26,8 @@
|
|||||||
</view>
|
</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-section" :style="{height:wrapHeight + 'rpx'}">
|
||||||
<view class="wholeSale-nav">
|
<view class="wholeSale-nav">
|
||||||
@ -67,55 +69,50 @@
|
|||||||
</view>
|
</view>
|
||||||
|
|
||||||
<!-- 列表 -->
|
<!-- 列表 -->
|
||||||
<view class="goods_list" :style="{height:'calc(100vh - '+wrapHeight+'rpx - 142rpx)'}">
|
<view class="goods_list">
|
||||||
<scroll-view :scroll-y="true" @scrolltolower="onScrollBottom" @scroll="onScroll" style="height: 100%;"
|
<view class="goods" v-for="(item, index) in goodsList" :key="index" @click="goStore(item.mer_id)">
|
||||||
:refresher-enabled="true" :refresher-triggered="isTriggered" @refresherpulling="onPulling"
|
<view class="avatar">
|
||||||
@refresherrefresh="onRefresh" :refresher-threshold="45" :scroll-anchoring='true'>
|
<u--image width="160rpx" height="160rpx" :src="item.mer_avatar" mode="aspectFill">
|
||||||
<view class="goods" v-for="(item, index) in goodsList" :key="index" @click="goStore(item.mer_id)">
|
<template v-slot:loading>
|
||||||
<view class="avatar">
|
<u-loading-icon color="#999" size="15" />
|
||||||
<u--image width="160rpx" height="160rpx" :src="item.mer_avatar" mode="aspectFill">
|
</template>
|
||||||
<template v-slot:loading>
|
</u--image>
|
||||||
<u-loading-icon color="#999" size="15" />
|
</view>
|
||||||
</template>
|
<view class="content">
|
||||||
</u--image>
|
<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>
|
||||||
<view class="content">
|
<view class="content-two">
|
||||||
<view class="content-head">
|
<view class="score">
|
||||||
<view class="title">{{item.mer_name}}</view>
|
<view class="star">
|
||||||
<text style="font-size: 21.03rpx;color: #aaa;"
|
<view
|
||||||
v-if="item.sales>=100">月销{{item.sales}}</text>
|
: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>
|
</view>
|
||||||
</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>
|
</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>
|
||||||
</view>
|
</view>
|
||||||
<loadmore :type="isLoading" style="padding: 12rpx 0;"></loadmore>
|
</view>
|
||||||
</scroll-view>
|
<loadmore :type="isLoading" style="padding: 12rpx 0;"></loadmore>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<!-- 弹框大分类 -->
|
<!-- 弹框大分类 -->
|
||||||
@ -181,6 +178,7 @@
|
|||||||
cate_change: 0,
|
cate_change: 0,
|
||||||
goodsList: [],
|
goodsList: [],
|
||||||
isLoading: 0,
|
isLoading: 0,
|
||||||
|
isScroll: false,
|
||||||
isShowAddress: false,
|
isShowAddress: false,
|
||||||
street: '定位中',
|
street: '定位中',
|
||||||
where: {
|
where: {
|
||||||
@ -193,8 +191,7 @@
|
|||||||
location: ''
|
location: ''
|
||||||
},
|
},
|
||||||
wrapHeight: 300,
|
wrapHeight: 300,
|
||||||
scrollTop: 0,
|
touchstarty: 0,
|
||||||
isTriggered: false
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
@ -206,6 +203,19 @@
|
|||||||
hide_mer_status: '',
|
hide_mer_status: '',
|
||||||
}, mapGetters(['viewColor', 'keyColor'])),
|
}, mapGetters(['viewColor', 'keyColor'])),
|
||||||
},
|
},
|
||||||
|
|
||||||
|
onPageScroll() {
|
||||||
|
uni.$emit('scroll');
|
||||||
|
},
|
||||||
|
|
||||||
|
onPullDownRefresh() {
|
||||||
|
this.storeMerchantList(true);
|
||||||
|
},
|
||||||
|
|
||||||
|
onReachBottom() {
|
||||||
|
this.storeMerchantList();
|
||||||
|
},
|
||||||
|
|
||||||
onLoad(option) {
|
onLoad(option) {
|
||||||
let getAddress = uni.getStorageSync('getAddress');
|
let getAddress = uni.getStorageSync('getAddress');
|
||||||
let closeShow = uni.getStorageSync('closeShow');
|
let closeShow = uni.getStorageSync('closeShow');
|
||||||
@ -221,39 +231,33 @@
|
|||||||
this.merClassifly();
|
this.merClassifly();
|
||||||
this.storeMerchantList();
|
this.storeMerchantList();
|
||||||
},
|
},
|
||||||
onPageScroll() {
|
|
||||||
uni.$emit('scroll');
|
|
||||||
},
|
|
||||||
methods: {
|
methods: {
|
||||||
// 下拉加载
|
|
||||||
onPulling() {
|
// 开始滑动
|
||||||
if (!this.isTriggered) {
|
onTouchStart(e) {
|
||||||
this.isTriggered = true;
|
this.touchstarty = e.touches[0].clientY;
|
||||||
this.storeMerchantList(true);
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
|
|
||||||
onRefresh(e) {
|
// 开始移动
|
||||||
this.isTriggered = true;
|
onTouchMove(e) {
|
||||||
},
|
this.$nextTick(() => {
|
||||||
|
let deltaY = e.changedTouches[0].clientY - this.touchstarty;
|
||||||
onScrollBottom(e) {
|
if (deltaY <= 0) {
|
||||||
this.storeMerchantList();
|
console.log("上滑")
|
||||||
|
this.wrapHeight = 0;
|
||||||
|
} else {
|
||||||
|
console.log('下滑');
|
||||||
|
this.wrapHeight = 300;
|
||||||
|
}
|
||||||
|
this.$forceUpdate();
|
||||||
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
onAllCategory() {
|
onAllCategory() {
|
||||||
this.$refs.popup.open();
|
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) {
|
navTo(url) {
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
url: url,
|
url: url,
|
||||||
@ -279,12 +283,14 @@
|
|||||||
this.$refs.popup && this.$refs.popup.close();
|
this.$refs.popup && this.$refs.popup.close();
|
||||||
this.$forceUpdate();
|
this.$forceUpdate();
|
||||||
},
|
},
|
||||||
|
|
||||||
// 进店
|
// 进店
|
||||||
goStore(id) {
|
goStore(id) {
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
url: `/pages/store/home/index?id=${id}`
|
url: `/pages/store/home/index?id=${id}`
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
merClassifly() {
|
merClassifly() {
|
||||||
merClassifly().then(res => {
|
merClassifly().then(res => {
|
||||||
this.store_category = [{
|
this.store_category = [{
|
||||||
@ -294,6 +300,7 @@
|
|||||||
}, ...res.data];
|
}, ...res.data];
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
storeMerchantList(reLoad = false) {
|
storeMerchantList(reLoad = false) {
|
||||||
if (reLoad) {
|
if (reLoad) {
|
||||||
this.where.page = 1;
|
this.where.page = 1;
|
||||||
@ -303,19 +310,21 @@
|
|||||||
if (this.isLoading == -1) return;
|
if (this.isLoading == -1) return;
|
||||||
this.isLoading = 1;
|
this.isLoading = 1;
|
||||||
storeMerchantList(this.where).then(res => {
|
storeMerchantList(this.where).then(res => {
|
||||||
this.isTriggered = false;
|
uni.stopPullDownRefresh();
|
||||||
this.goodsList = [...this.goodsList, ...res.data.list];
|
this.goodsList = [...this.goodsList, ...res.data.list];
|
||||||
this.isLoading = 0;
|
this.isLoading = 0;
|
||||||
if (res.data.list.length < this.where.limit) this.isLoading = -1;
|
if (res.data.list.length < this.where.limit) this.isLoading = -1;
|
||||||
this.where.page++;
|
this.where.page++;
|
||||||
}).catch(() => {
|
}).catch(() => {
|
||||||
this.isTriggered = false;
|
uni.stopPullDownRefresh();
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
closeShowAddress() {
|
closeShowAddress() {
|
||||||
this.isShowAddress = false;
|
this.isShowAddress = false;
|
||||||
uni.setStorageSync('closeShow', true);
|
uni.setStorageSync('closeShow', true);
|
||||||
},
|
},
|
||||||
|
|
||||||
// 选择位置
|
// 选择位置
|
||||||
changeMap() {
|
changeMap() {
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
@ -347,6 +356,7 @@
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
getLocation() {
|
getLocation() {
|
||||||
uni.getLocation({
|
uni.getLocation({
|
||||||
type: 'gcj02',
|
type: 'gcj02',
|
||||||
@ -403,7 +413,7 @@
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
@ -421,33 +431,33 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.wholeSale-header {
|
.wholeSale-header {
|
||||||
position: sticky;
|
position: fixed;
|
||||||
top: 0;
|
top: 0;
|
||||||
z-index: 90;
|
z-index: 90;
|
||||||
margin-bottom: 20rpx;
|
width: 100%;
|
||||||
background-color: #40AE36;
|
background-color: #40AE36;
|
||||||
}
|
}
|
||||||
|
|
||||||
.wholeSale-section {
|
.wholeSale-section {
|
||||||
position: sticky;
|
position: fixed;
|
||||||
top: calc(82rpx + var(--status-bar-height));
|
z-index: 10;
|
||||||
|
top: calc(80rpx + var(--status-bar-height));
|
||||||
|
width: 100%;
|
||||||
padding: 0rpx 20rpx;
|
padding: 0rpx 20rpx;
|
||||||
background-color: #fff;
|
background-color: #fff;
|
||||||
transition: height .5s;
|
transition: height .5s;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
margin-bottom: 20rpx;
|
|
||||||
|
|
||||||
.wholeSale-nav {
|
.wholeSale-nav {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
margin-bottom: 40rpx;
|
padding: 20rpx 0;
|
||||||
|
|
||||||
.icon {
|
.icon {
|
||||||
margin-right: 20rpx;
|
margin-right: 20rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
.search_content {
|
.search_content {
|
||||||
// margin-bottom: 40rpx;
|
|
||||||
flex: 1;
|
flex: 1;
|
||||||
height: 70rpx;
|
height: 70rpx;
|
||||||
padding: 2px 2px 2px 21.05rpx;
|
padding: 2px 2px 2px 21.05rpx;
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
<template>
|
<template>
|
||||||
<view class="wholeSale">
|
<view class="wholeSale" @touchstart="onTouchStart" @touchmove="onTouchMove">
|
||||||
<!-- 适配不同机 -->
|
<!-- 适配不同机 -->
|
||||||
<view class="wholeSale-header">
|
<view class="wholeSale-header">
|
||||||
<view style="height: var(--status-bar-height);background-color: #40af37;"></view>
|
<view style="height: var(--status-bar-height);background-color: #40af37;"></view>
|
||||||
@ -9,6 +9,8 @@
|
|||||||
</view>
|
</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-section" :style="{height:wrapHeight + 'rpx'}">
|
||||||
<view class="wholeSale-nav">
|
<view class="wholeSale-nav">
|
||||||
<!-- 搜索 -->
|
<!-- 搜索 -->
|
||||||
@ -63,16 +65,10 @@
|
|||||||
</view>
|
</view>
|
||||||
|
|
||||||
<!-- 内容 -->
|
<!-- 内容 -->
|
||||||
<view class="wholeSale-con" :style="{height:'calc(100vh - '+wrapHeight+'rpx - 142rpx )'}">
|
<view class="wholeSale-con">
|
||||||
<scroll-view :scroll-y="true" @scrolltolower="onScrollBottom" @scroll="onScroll" style="height: 100%;"
|
<!-- 流水瀑布 -->
|
||||||
:refresher-enabled="true" :refresher-triggered="isTriggered" @refresherpulling="onPulling"
|
<WaterfallsFlow :wfList='hostProduct' @itemTap="goDetail" :type="0" />
|
||||||
@refresherrefresh="onRefresh" :refresher-threshold="45" :scroll-anchoring='true'>
|
<loadmore :type="isLoading" style="padding: 12rpx 0;"></loadmore>
|
||||||
<view>
|
|
||||||
<!-- 流水瀑布 -->
|
|
||||||
<WaterfallsFlow :wfList='hostProduct' @itemTap="goDetail" :type="0" />
|
|
||||||
<loadmore :type="isLoading" style="padding: 12rpx 0;"></loadmore>
|
|
||||||
</view>
|
|
||||||
</scroll-view>
|
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<!-- 弹框大分类 -->
|
<!-- 弹框大分类 -->
|
||||||
@ -123,6 +119,7 @@
|
|||||||
cate_change: 0,
|
cate_change: 0,
|
||||||
cate_change_children: 0,
|
cate_change_children: 0,
|
||||||
isLoading: 0,
|
isLoading: 0,
|
||||||
|
isScroll: false,
|
||||||
where: {
|
where: {
|
||||||
page: 1,
|
page: 1,
|
||||||
limit: 20,
|
limit: 20,
|
||||||
@ -132,46 +129,52 @@
|
|||||||
sale_type: 1, //1-零售, 2-批发
|
sale_type: 1, //1-零售, 2-批发
|
||||||
},
|
},
|
||||||
wrapHeight: 300,
|
wrapHeight: 300,
|
||||||
scrollTop: 0,
|
touchstarty: 0
|
||||||
isTriggered: true
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
onPageScroll() {
|
||||||
|
uni.$emit('scroll');
|
||||||
|
},
|
||||||
|
|
||||||
|
onPullDownRefresh() {
|
||||||
|
this.getProductslist(true);
|
||||||
|
},
|
||||||
|
|
||||||
|
onReachBottom() {
|
||||||
|
this.getProductslist();
|
||||||
|
},
|
||||||
|
|
||||||
onLoad(option) {
|
onLoad(option) {
|
||||||
this.getCategoryIndexList();
|
this.getCategoryIndexList();
|
||||||
this.getProductslist(true);
|
this.getProductslist(true);
|
||||||
},
|
},
|
||||||
onPageScroll() {
|
|
||||||
uni.$emit('scroll');
|
|
||||||
},
|
|
||||||
methods: {
|
methods: {
|
||||||
// 下拉加载
|
// 开始滑动
|
||||||
onPulling() {
|
onTouchStart(e) {
|
||||||
if (!this.isTriggered) {
|
this.touchstarty = e.touches[0].clientY;
|
||||||
this.isTriggered = true;
|
|
||||||
this.getProductslist(true);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
onRefresh(e) {
|
|
||||||
this.isTriggered = true;
|
|
||||||
},
|
},
|
||||||
|
|
||||||
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() {
|
onAllCategory() {
|
||||||
this.$refs.popup.open();
|
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) {
|
navTo(url) {
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
url: url,
|
url: url,
|
||||||
@ -241,13 +244,13 @@
|
|||||||
if (this.isLoading == -1) return;
|
if (this.isLoading == -1) return;
|
||||||
this.isLoading = 1;
|
this.isLoading = 1;
|
||||||
getProductslist(this.where).then(res => {
|
getProductslist(this.where).then(res => {
|
||||||
this.isTriggered = false;
|
uni.stopPullDownRefresh();
|
||||||
this.hostProduct = [...this.hostProduct, ...res.data.list];
|
this.hostProduct = [...this.hostProduct, ...res.data.list];
|
||||||
this.where.page++;
|
this.where.page++;
|
||||||
this.isLoading = 0;
|
this.isLoading = 0;
|
||||||
if (res.data.list.length < this.where.limit) this.isLoading = -1;
|
if (res.data.list.length < this.where.limit) this.isLoading = -1;
|
||||||
}).catch(() => {
|
}).catch(() => {
|
||||||
this.isTriggered = false;
|
uni.stopPullDownRefresh();
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
goDetail(item) {
|
goDetail(item) {
|
||||||
@ -282,27 +285,27 @@
|
|||||||
.wholeSale {
|
.wholeSale {
|
||||||
|
|
||||||
.wholeSale-header {
|
.wholeSale-header {
|
||||||
position: sticky;
|
position: fixed;
|
||||||
top: 0;
|
top: 0;
|
||||||
z-index: 90;
|
z-index: 90;
|
||||||
|
width: 100%;
|
||||||
background-color: #40AE36;
|
background-color: #40AE36;
|
||||||
}
|
}
|
||||||
|
|
||||||
.wholeSale-section {
|
.wholeSale-section {
|
||||||
position: sticky;
|
position: fixed;
|
||||||
top: calc(82rpx + var(--status-bar-height));
|
top: calc(80rpx + var(--status-bar-height));
|
||||||
|
width: 100%;
|
||||||
padding: 0rpx 20rpx;
|
padding: 0rpx 20rpx;
|
||||||
background-color: #fff;
|
background-color: #fff;
|
||||||
transition: height .5s;
|
transition: height .5s;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
margin-bottom: 20rpx;
|
z-index: 89;
|
||||||
padding-top: 20rpx;
|
|
||||||
z-index: 20;
|
|
||||||
|
|
||||||
.wholeSale-nav {
|
.wholeSale-nav {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
margin-bottom: 40rpx;
|
padding: 20rpx 0;
|
||||||
|
|
||||||
.icon {
|
.icon {
|
||||||
margin-right: 20rpx;
|
margin-right: 20rpx;
|
||||||
|
@ -576,7 +576,7 @@
|
|||||||
this.isScrolled = false
|
this.isScrolled = false
|
||||||
}
|
}
|
||||||
// 传入scrollTop值并触发所有easy-loadimage组件下的滚动监听事件
|
// 传入scrollTop值并触发所有easy-loadimage组件下的滚动监听事件
|
||||||
uni.$emit('scroll');
|
uni.$emit('scroll', e);
|
||||||
|
|
||||||
if (e.scrollTop >= 100) {
|
if (e.scrollTop >= 100) {
|
||||||
uni.setTabBarItem({
|
uni.setTabBarItem({
|
||||||
@ -662,6 +662,7 @@
|
|||||||
that.isScrolled = res[0].top <= -60
|
that.isScrolled = res[0].top <= -60
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
this.isIndexClick = false;
|
this.isIndexClick = false;
|
||||||
|
|
||||||
if (this.isLogin) {
|
if (this.isLogin) {
|
||||||
|
@ -1,207 +1,201 @@
|
|||||||
<template>
|
<template>
|
||||||
<view class="wholeSale">
|
<view class="wholeSale" @touchstart="onTouchStart" @touchmove="onTouchMove">
|
||||||
<!-- 顶部 -->
|
<!-- 顶部 -->
|
||||||
<view class="wholeSale-header">
|
<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 -->
|
<!-- 滚动tab -->
|
||||||
<scroll-view scroll-x="true" :scroll-top="100" :show-scrollbar="false" scroll-into-view="a1">
|
<scroll-view scroll-x="true" :scroll-top="100" :show-scrollbar="false" scroll-into-view="a1">
|
||||||
<view class="scrollview">
|
<view class="scrollview">
|
||||||
<block v-for="(item,indx) in tabsArr" :key="indx">
|
<block v-for="(item,indx) in tabsArr" :key="indx">
|
||||||
<view class="scrollview-item" :id="'a' + indx"
|
<view class="scrollview-item" :id="'a' + indx"
|
||||||
:class="{'scrollview-active':tabsCurr == item.val}" @click="tabsChange(item.val)">
|
:class="{'scrollview-active':tabsCurr == item.val}" @click="tabsChange(item.val)">
|
||||||
{{item.name}}
|
{{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>
|
</view>
|
||||||
</block>
|
</block>
|
||||||
</view>
|
</view>
|
||||||
</scroll-view>
|
</scroll-view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class="wholeSale-header-search-wrap" :style="{height:wrapHeight + 'rpx'}">
|
<!-- 综合查询 -->
|
||||||
<u-subsection v-if="tabsCurr==2" :list="subList" @change="changeSub" :current="subCurr"
|
<view class="comprehensive" v-if="subCurr!=1 || (subCurr==1 && tabsCurr!=2)">
|
||||||
mode="subsection" activeColor="#40ae36" fontSize="14" style="margin-bottom: 24rpx;"></u-subsection>
|
<view class="comprehensive-price" :class="{'comp-color': orderCurr==1}" @click="toOrder('price', 1)">
|
||||||
|
<text>价格</text>
|
||||||
<view class="wholeSale-nav">
|
<image v-if="orderCurr==1" style="width: 15rpx;height: 21rpx;"
|
||||||
<view
|
:src="where.order == 'price_asc' ? domain+'/static/diy/up'+keyColor+'.png' : domain+'/static/diy/down'+keyColor+'.png'">
|
||||||
@click="navTo(`/pages/columnGoods/goods_search/index?back=true&searchVal=${where.keyword}&shop=${subCurr!=1 || (subCurr==1 && tabsCurr!=2) ? false : true}`)"
|
</image>
|
||||||
hover-class="none" class="search_content flex_a_c_j_sb">
|
<view v-else style="width: 15rpx;height: 21rpx;"></view>
|
||||||
<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>
|
||||||
|
<view class="comprehensive-sales_num" :class="{'comp-color': orderCurr==2}"
|
||||||
<!-- 商品大分类 -->
|
@click="toOrder('sales', 2)">
|
||||||
<view class="category">
|
<text>销量</text>
|
||||||
<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>
|
||||||
|
<view class="comprehensive-discount" :class="{'comp-color': orderCurr==3}" v-if="tabsCurr!=1"
|
||||||
<!-- 商品小分类 -->
|
@click="toOrder('', 3)">
|
||||||
<view class="cate" v-if="store_category_children.length>1">
|
<text>综合</text>
|
||||||
<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="comprehensive-discount" v-else @click="deduction_rate=!deduction_rate;">
|
||||||
<!-- 综合查询 -->
|
<text>抵扣</text>
|
||||||
<view class="comprehensive" v-if="subCurr!=1 || (subCurr==1 && tabsCurr!=2)">
|
<image class="loudou" src="@/static/new_define/loudou.png"></image>
|
||||||
<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>
|
</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
<!-- 综合查询 -->
|
<!-- 综合查询 -->
|
||||||
<view class="comprehensive" v-if="deduction_rate && tabsCurr==1">
|
<view class="comprehensive" v-if="deduction_rate && tabsCurr==1">
|
||||||
<view class="comprehensive-sales_num" :class="{'comp-color': where.deduction_rate==''}"
|
<view class="comprehensive-sales_num" :class="{'comp-color': where.deduction_rate==''}"
|
||||||
@click="changeDeduction('')">
|
@click="changeDeduction('')">
|
||||||
<text>全部</text>
|
<text>全部</text>
|
||||||
</view>
|
</view>
|
||||||
<view class="comprehensive-sales_num" :class="{'comp-color': where.deduction_rate=='10'}"
|
<view class="comprehensive-sales_num" :class="{'comp-color': where.deduction_rate=='10'}"
|
||||||
@click="changeDeduction('10')">
|
@click="changeDeduction('10')">
|
||||||
<text>1:9</text>
|
<text>1:9</text>
|
||||||
</view>
|
</view>
|
||||||
<view class="comprehensive-sales_num" :class="{'comp-color': where.deduction_rate=='15'}"
|
<view class="comprehensive-sales_num" :class="{'comp-color': where.deduction_rate=='15'}"
|
||||||
@click="changeDeduction('15')">
|
@click="changeDeduction('15')">
|
||||||
<text>2:8</text>
|
<text>2:8</text>
|
||||||
</view>
|
</view>
|
||||||
<view class="comprehensive-sales_num" :class="{'comp-color': where.deduction_rate=='20'}"
|
<view class="comprehensive-sales_num" :class="{'comp-color': where.deduction_rate=='20'}"
|
||||||
@click="changeDeduction('20')">
|
@click="changeDeduction('20')">
|
||||||
<text>3:7</text>
|
<text>3:7</text>
|
||||||
</view>
|
</view>
|
||||||
<view class="comprehensive-sales_num" :class="{'comp-color': where.deduction_rate=='25'}"
|
<view class="comprehensive-sales_num" :class="{'comp-color': where.deduction_rate=='25'}"
|
||||||
@click="changeDeduction('25')">
|
@click="changeDeduction('25')">
|
||||||
<text>4:6</text>
|
<text>4:6</text>
|
||||||
</view>
|
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<!-- 内容 -->
|
<!-- 内容 -->
|
||||||
<view class="wholeSale-con"
|
<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%;"
|
<WaterfallsFlow v-if="subCurr!=1 || (subCurr==1 && tabsCurr!=2)" :wfList='hostProduct' @itemTap="goDetail"
|
||||||
:refresher-enabled="true" :refresher-triggered="isTriggered" @refresherpulling="onPulling"
|
:type="0" :sale_type="2" />
|
||||||
@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="goods_list" v-else>
|
<view class="goods_list" v-else>
|
||||||
<view class="goods" v-for="(item, index) in shopList" :key="index" @click="goStore(item.mer_id)">
|
<view class="goods" v-for="(item, index) in shopList" :key="index" @click="goStore(item.mer_id)">
|
||||||
<view class="avatar">
|
<view class="avatar">
|
||||||
<u--image width="160rpx" height="160rpx" :src="item.mer_avatar" mode="aspectFill">
|
<u--image width="160rpx" height="160rpx" :src="item.mer_avatar" mode="aspectFill">
|
||||||
<template v-slot:loading>
|
<template v-slot:loading>
|
||||||
<u-loading-icon color="#999" size="15" />
|
<u-loading-icon color="#999" size="15" />
|
||||||
</template>
|
</template>
|
||||||
</u--image>
|
</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>
|
||||||
<view class="content">
|
<view class="content-two">
|
||||||
<view class="content-head">
|
<view class="score">
|
||||||
<view class="title">{{item.mer_name}}</view>
|
<view class="star">
|
||||||
<text style="font-size: 21.03rpx;color: #aaa;"
|
<view
|
||||||
v-if="item.sales>=100">月销{{item.sales}}</text>
|
: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>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<text
|
</view>
|
||||||
style="margin-left: 20rpx;color: #FF6D20;font-size: 22.78rpx; ">{{item.service_score}}</text>
|
<text
|
||||||
<text v-if="item.distance"
|
style="margin-left: 20rpx;color: #FF6D20;font-size: 22.78rpx; ">{{item.service_score}}</text>
|
||||||
style="margin-left: 20rpx;font-size: 21.03rpx;color: #aaa;">{{item.distance}}</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>
|
<text style="margin-left: 20rpx;" class="line1">{{item.category_name}}</text>
|
||||||
</view>
|
</view>
|
||||||
<view class="content-two">
|
<view class="content-two">
|
||||||
<u--image :showLoading="true" src="/static/images/GXSC/DH.png" width="33.85rpx"
|
<u--image :showLoading="true" src="/static/images/GXSC/DH.png" width="33.85rpx"
|
||||||
height="33.85rpx"></u--image>
|
height="33.85rpx"></u--image>
|
||||||
<text> {{item.service_phone}}</text>
|
<text> {{item.service_phone}}</text>
|
||||||
<u--image style="margin-left: 28rpx;" v-if="item.mer_take_time" :showLoading="true"
|
<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>
|
src="/static/images/GXSC/SJ.png" width="33.85rpx" height="33.85rpx"></u--image>
|
||||||
<text
|
<text v-if="item.mer_take_time">{{item.mer_take_time[0]}}-{{item.mer_take_time[1]}}</text>
|
||||||
v-if="item.mer_take_time">{{item.mer_take_time[0]}}-{{item.mer_take_time[1]}}</text>
|
</view>
|
||||||
</view>
|
<view class="content-two">
|
||||||
<view class="content-two">
|
<u--image :showLoading="true" src="/static/images/GXSC/DW.png" width="33.85rpx"
|
||||||
<u--image :showLoading="true" src="/static/images/GXSC/DW.png" width="33.85rpx"
|
height="33.85rpx"></u--image>
|
||||||
height="33.85rpx"></u--image>
|
<text class="address">{{item.mer_address}}</text>
|
||||||
<text class="address">{{item.mer_address}}</text>
|
|
||||||
</view>
|
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
<loadmore :type="isLoading" v-if="isLoading || hostProduct.length > 0" style="padding: 12rpx 0;">
|
<loadmore :type="isLoading" v-if="isLoading || hostProduct.length > 0" style="padding: 12rpx 0;">
|
||||||
</loadmore>
|
</loadmore>
|
||||||
<view class='pictrue' v-if="!isLoading && hostProduct.length == 0">
|
<view class='pictrue' v-if="!isLoading && hostProduct.length == 0">
|
||||||
<image :src="`${domain}/static/images/noCart.png`"></image>
|
<image :src="`${domain}/static/images/noCart.png`"></image>
|
||||||
<view>暂无商品,看点别的吧</view>
|
<view>暂无商品,看点别的吧</view>
|
||||||
</view>
|
</view>
|
||||||
</scroll-view>
|
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<!-- 弹框大分类 -->
|
<!-- 弹框大分类 -->
|
||||||
@ -320,10 +314,8 @@
|
|||||||
bigTypeDomInfo: null,
|
bigTypeDomInfo: null,
|
||||||
smallTypeDomInfo: null,
|
smallTypeDomInfo: null,
|
||||||
categoryWrapHeight: 0,
|
categoryWrapHeight: 0,
|
||||||
wrapHeight: 332,
|
wrapHeight: 360,
|
||||||
isShowSmall: false,
|
touchstarty: 0
|
||||||
scrollTop: 0,
|
|
||||||
isTriggered: false
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
@ -366,54 +358,54 @@
|
|||||||
index: 1,
|
index: 1,
|
||||||
text: "批发",
|
text: "批发",
|
||||||
selectedIconPath: "/static/tabbar_icon/b-a.png"
|
selectedIconPath: "/static/tabbar_icon/b-a.png"
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
watch: {
|
// watch: {
|
||||||
'where.cate_pid'(newVal, oldVal) {
|
// 'where.cate_pid'(newVal, oldVal) {
|
||||||
if (newVal && !oldVal) {
|
// if (newVal && !oldVal) {
|
||||||
this.wrapHeight = this.tabsCurr == 2 ? 400 : (332 + 48);
|
// this.isShowSmall = true;
|
||||||
this.isShowSmall = true;
|
// }
|
||||||
}
|
// if (!newVal && oldVal) {
|
||||||
if (!newVal && oldVal) {
|
// this.isShowSmall = false;
|
||||||
this.wrapHeight = this.tabsCurr == 2 ? 400 : 332;
|
// }
|
||||||
this.isShowSmall = false;
|
// }
|
||||||
}
|
// },
|
||||||
}
|
|
||||||
|
onPullDownRefresh() {
|
||||||
|
this.initData(true, true);
|
||||||
|
},
|
||||||
|
|
||||||
|
onReachBottom() {
|
||||||
|
this.initData(false, true);
|
||||||
},
|
},
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
|
// 开始滑动
|
||||||
// 下拉加载
|
onTouchStart(e) {
|
||||||
onPulling() {
|
this.touchstarty = e.touches[0].clientY;
|
||||||
if (!this.isTriggered) {
|
|
||||||
this.isTriggered = true;
|
|
||||||
this.initData(true, true);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
onRefresh(e) {
|
|
||||||
this.isTriggered = true;
|
|
||||||
},
|
},
|
||||||
|
|
||||||
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() {
|
onAllCategory() {
|
||||||
this.$refs.popup.open();
|
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) {
|
initData(re = false, stop = false) {
|
||||||
if (!stop) this.getStoreCategory();
|
if (!stop) this.getStoreCategory();
|
||||||
if (this.tabsCurr == 2 && this.subCurr == 1) this.storeMerchantList(re, stop);
|
if (this.tabsCurr == 2 && this.subCurr == 1) this.storeMerchantList(re, stop);
|
||||||
@ -424,6 +416,7 @@
|
|||||||
this.getProductslist(true);
|
this.getProductslist(true);
|
||||||
},
|
},
|
||||||
changeSub(e) {
|
changeSub(e) {
|
||||||
|
console.log(e);
|
||||||
this.subCurr = e;
|
this.subCurr = e;
|
||||||
this.where = {
|
this.where = {
|
||||||
page: 1,
|
page: 1,
|
||||||
@ -435,6 +428,7 @@
|
|||||||
this.cate_change = 0;
|
this.cate_change = 0;
|
||||||
this.cate_change_children = 0;
|
this.cate_change_children = 0;
|
||||||
this.initData(true);
|
this.initData(true);
|
||||||
|
this.getHeight()
|
||||||
},
|
},
|
||||||
toOrder(type, index = -1) {
|
toOrder(type, index = -1) {
|
||||||
if (this.where.order == type) {
|
if (this.where.order == type) {
|
||||||
@ -484,9 +478,30 @@
|
|||||||
this.cate_change = 0;
|
this.cate_change = 0;
|
||||||
this.cate_change_children = 0;
|
this.cate_change_children = 0;
|
||||||
if (this.tabsCurr != 2 || (this.tabsCurr == 2 && this.subCurr != 1)) this.where.mer_type = e;
|
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);
|
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) {
|
changeCate(e) {
|
||||||
this.cate_change = e;
|
this.cate_change = e;
|
||||||
this.store_category_children = [];
|
this.store_category_children = [];
|
||||||
@ -507,8 +522,11 @@
|
|||||||
this.where.cate_pid = this.store_category[e].store_category_id;
|
this.where.cate_pid = this.store_category[e].store_category_id;
|
||||||
this.where.cate_id = "";
|
this.where.cate_id = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
this.getProductslist(true);
|
this.getProductslist(true);
|
||||||
|
|
||||||
|
this.getHeight();
|
||||||
|
|
||||||
// 关闭popup
|
// 关闭popup
|
||||||
this.$refs.popup && this.$refs.popup.close();
|
this.$refs.popup && this.$refs.popup.close();
|
||||||
},
|
},
|
||||||
@ -564,9 +582,9 @@
|
|||||||
if (this.where.order) this.where.rand = 0;
|
if (this.where.order) this.where.rand = 0;
|
||||||
else this.where.rand = 1;
|
else this.where.rand = 1;
|
||||||
getProductslist(this.where, true).then(res => {
|
getProductslist(this.where, true).then(res => {
|
||||||
|
uni.stopPullDownRefresh();
|
||||||
this.where.limit = res.data.limit
|
this.where.limit = res.data.limit
|
||||||
this.where.page = res.data.page
|
this.where.page = res.data.page
|
||||||
this.isTriggered = false;
|
|
||||||
if (reLoad) this.hostProduct = [];
|
if (reLoad) this.hostProduct = [];
|
||||||
this.hostProduct = [...this.hostProduct, ...res.data.list];
|
this.hostProduct = [...this.hostProduct, ...res.data.list];
|
||||||
this.isLoading = 0;
|
this.isLoading = 0;
|
||||||
@ -583,7 +601,6 @@
|
|||||||
if (this.isLoading == -1) return;
|
if (this.isLoading == -1) return;
|
||||||
this.isLoading = 1;
|
this.isLoading = 1;
|
||||||
storeMerchantList(this.where).then(res => {
|
storeMerchantList(this.where).then(res => {
|
||||||
this.isTriggered = false;
|
|
||||||
this.shopList = [...this.shopList, ...res.data.list];
|
this.shopList = [...this.shopList, ...res.data.list];
|
||||||
this.isLoading = 0;
|
this.isLoading = 0;
|
||||||
if (res.data.list.length < this.where.limit) this.isLoading = -1;
|
if (res.data.list.length < this.where.limit) this.isLoading = -1;
|
||||||
@ -627,23 +644,11 @@
|
|||||||
|
|
||||||
.wholeSale {
|
.wholeSale {
|
||||||
.wholeSale-header {
|
.wholeSale-header {
|
||||||
position: sticky;
|
position: fixed;
|
||||||
top: 0;
|
top: 0;
|
||||||
z-index: 90;
|
z-index: 90;
|
||||||
margin-bottom: 20rpx;
|
background-color: #40AE36;
|
||||||
|
width: 100%;
|
||||||
.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;
|
|
||||||
}
|
|
||||||
|
|
||||||
.scrollview {
|
.scrollview {
|
||||||
display: flex;
|
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 {
|
.wholeSale-con {
|
||||||
|
position: relative;
|
||||||
|
z-index: index;
|
||||||
margin: 0 10px;
|
margin: 0 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.search_content {
|
.wholeSale-nav {
|
||||||
margin-bottom: 40rpx;
|
padding: 20rpx 0;
|
||||||
height: 70rpx;
|
|
||||||
padding: 2px 2px 2px 21.05rpx;
|
|
||||||
border-radius: 80rpx;
|
|
||||||
background: #EDEFF2;
|
|
||||||
position: relative;
|
|
||||||
box-sizing: border-box;
|
|
||||||
|
|
||||||
.search_content_wrap {
|
.search_content {
|
||||||
width: 100%;
|
height: 70rpx;
|
||||||
|
padding: 2px 2px 2px 21.05rpx;
|
||||||
|
border-radius: 80rpx;
|
||||||
|
background: #EDEFF2;
|
||||||
|
position: relative;
|
||||||
|
box-sizing: border-box;
|
||||||
|
|
||||||
.icon-sousuo {
|
.search_content_wrap {
|
||||||
font-size: 26.32rpx;
|
width: 100%;
|
||||||
font-weight: bold;
|
|
||||||
color: #c8c7c6;
|
.icon-sousuo {
|
||||||
margin-right: 17.54rpx;
|
font-size: 26.32rpx;
|
||||||
|
font-weight: bold;
|
||||||
|
color: #c8c7c6;
|
||||||
|
margin-right: 17.54rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
input {
|
||||||
|
width: 80%;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
input {
|
.search_btn {
|
||||||
width: 80%;
|
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 {
|
.category {
|
||||||
@ -790,7 +811,7 @@
|
|||||||
.cate {
|
.cate {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
overflow: auto;
|
overflow: auto;
|
||||||
margin-bottom: 30rpx;
|
// margin-bottom: 30rpx;
|
||||||
|
|
||||||
.cate-wrap {
|
.cate-wrap {
|
||||||
display: flex;
|
display: flex;
|
||||||
@ -883,7 +904,7 @@
|
|||||||
display: flex;
|
display: flex;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
padding: 20rpx 50rpx;
|
padding: 10rpx 50rpx;
|
||||||
|
|
||||||
[class^=comprehensive-] {
|
[class^=comprehensive-] {
|
||||||
display: flex;
|
display: flex;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user