spike time 8.8
This commit is contained in:
@@ -1,193 +1,59 @@
|
||||
<template>
|
||||
<view class="out">
|
||||
<u-tabs-swiper v-if="type == 'dianpu'" @change="tabsChange" :show-bar="false" :bold="false" :font-size="32"
|
||||
active-color="#FF780F" ref="uTabs" :list="list" :is-scroll="false" style="border-bottom: 1px solid #ececec;flex-shrink:0"
|
||||
height="88"></u-tabs-swiper>
|
||||
<swiper v-if="type == 'dianpu'" class="swiper" :current="swiperCurrent" @transition="transition"
|
||||
@animationfinish="animationfinish">
|
||||
<swiper-item>
|
||||
<scroll-view :scroll-y="true" style="height:100%">
|
||||
<view style="padding-top:30rpx">
|
||||
<shop></shop>
|
||||
</view>
|
||||
</scroll-view>
|
||||
</swiper-item>
|
||||
<swiper-item>
|
||||
<scroll-view :scroll-y="true" style="height:100%">
|
||||
<view class="list">
|
||||
<!-- <darenItem style="margin-top:20rpx;margin-right:23rpx;box-shadow:0rpx 3rpx 7rpx 0rpx rgba(153, 153, 153, 0.35);" v-for="item in 50"></darenItem> -->
|
||||
</view>
|
||||
</scroll-view>
|
||||
</swiper-item>
|
||||
</swiper>
|
||||
<view v-else style=" display: flex;flex-direction: column;height: calc(100vh - 88rpx);">
|
||||
<view class="select">
|
||||
<view @click="sx(0)" class="xz" data-type="xl">销量</view>
|
||||
<view class="xz" @click="sx(1)">
|
||||
<text>价格</text>
|
||||
<view class="jiage">
|
||||
<view class="top topxz"></view>
|
||||
<view class="bottom bottomxz"></view>
|
||||
</view>
|
||||
</view>
|
||||
<view data-type="hp" @click="sx(2)">好评</view>
|
||||
</view>
|
||||
<view class="swiper" :current="swiperCurrent" @change="huadong">
|
||||
<scroll-view :scroll-y="true" style="height:100%">
|
||||
<view style="padding-top:30rpx">
|
||||
<shop v-for="(i,j) in shoplist" :key="j" :name="i.goods_name" :id="i.goods_id" :commonid="i.goods_commonid"
|
||||
:image="i.goods_image"></shop>
|
||||
</view>
|
||||
</scroll-view>
|
||||
</view>
|
||||
</view>
|
||||
<u-tabs :list="list" :current="current" @change="tabsChange" active-color="#FF780F" :show-bar="false" height="88" font-size="32" inactive-color="#333333"></u-tabs>
|
||||
<swiper :current="swiperCurrent" @animationfinish="animationfinish">
|
||||
<!-- 店铺 -->
|
||||
<swiper-item class="swiper-item" v-for="(item, index) in dataList[current]" :key="index">
|
||||
<scroll-view scroll-y style="height: 800rpx;width: 100%;" @scrolltolower="onreachBottom">
|
||||
<view class="store"></view>
|
||||
</scroll-view>
|
||||
</swiper-item>
|
||||
<!-- 达人 -->
|
||||
<swiper-item class="swiper-item" v-for="(item, index) in dataList[current]" :key="index">
|
||||
<scroll-view scroll-y style="height: 800rpx;width: 100%;" @scrolltolower="onreachBottom">
|
||||
<view class="anchor"></view>
|
||||
</scroll-view>
|
||||
</swiper-item>
|
||||
<!-- 社区 -->
|
||||
<swiper-item class="swiper-item" v-for="(item, index) in dataList[current]" :key="index">
|
||||
<scroll-view scroll-y style="height: 800rpx;width: 100%;" @scrolltolower="onreachBottom">
|
||||
<view class="community"></view>
|
||||
</scroll-view>
|
||||
</swiper-item>
|
||||
</swiper>
|
||||
</view>
|
||||
</template>
|
||||
<style lang="scss" scoped>
|
||||
.out {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
height: 100vh;
|
||||
|
||||
.sosuo {
|
||||
width: 100%;
|
||||
height: 88rpx;
|
||||
border-bottom: 1rpx solid #ececec;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding: 0 30rpx;
|
||||
flex-shrink: 0;
|
||||
|
||||
>image {
|
||||
width: 18rpx;
|
||||
height: 32rpx;
|
||||
margin-right: 24rpx;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.swiper {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
|
||||
.list {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
width: 100%;
|
||||
padding-left: 30rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.select {
|
||||
width: 100%;
|
||||
height: 89rpx;
|
||||
border-bottom: 1rpx solid #ececec;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding: 0 40rpx;
|
||||
flex-shrink: 0;
|
||||
justify-content: space-between;
|
||||
|
||||
>view {
|
||||
font-size: 32rpx;
|
||||
color: #333;
|
||||
display: flex;
|
||||
font-weight: 400;
|
||||
|
||||
.jiage {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
|
||||
.top {
|
||||
width: 12rpx;
|
||||
border-bottom: 12rpx solid #707070;
|
||||
border-left: 11rpx solid #fff;
|
||||
border-right: 11rpx solid #fff;
|
||||
margin-bottom: 2rpx;
|
||||
}
|
||||
|
||||
.bottom {
|
||||
width: 12rpx;
|
||||
border-top: 12rpx solid #707070;
|
||||
border-left: 11rpx solid #fff;
|
||||
border-right: 11rpx solid #fff;
|
||||
}
|
||||
|
||||
.topxz {
|
||||
border-bottom: 12rpx solid #FF780F;
|
||||
}
|
||||
|
||||
.bottomxz {
|
||||
border-top: 12rpx solid #FF780F;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.xz {
|
||||
color: #FF780F;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
</style>
|
||||
<script>
|
||||
import shop from "../components/search/shop"
|
||||
import darenItem from "@/components/index/daren-item/index"
|
||||
export default {
|
||||
name: "out",
|
||||
components: {
|
||||
shop,
|
||||
darenItem
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
list: [{
|
||||
name: "店铺"
|
||||
}, {
|
||||
name: "达人"
|
||||
}],
|
||||
current: 0,
|
||||
swiperCurrent: 0,
|
||||
keyword: "",
|
||||
type: "",
|
||||
shoplist: []
|
||||
}
|
||||
},
|
||||
onLoad(o) {
|
||||
this.type = o.type
|
||||
this.keyword = o.value
|
||||
this.search()
|
||||
},
|
||||
methods: {
|
||||
tabsChange(index) {
|
||||
this.swiperCurrent = index;
|
||||
},
|
||||
transition(e) {
|
||||
let dx = e.detail.dx;
|
||||
this.$refs.uTabs.setDx(dx);
|
||||
},
|
||||
animationfinish(e) {
|
||||
let current = e.detail.current;
|
||||
this.$refs.uTabs.setFinishCurrent(current);
|
||||
this.swiperCurrent = current;
|
||||
this.current = current;
|
||||
},
|
||||
sx(type) {
|
||||
console.log(type)
|
||||
|
||||
},
|
||||
huadong(e) {
|
||||
console.log(e.detail.current)
|
||||
},
|
||||
search() {
|
||||
this.$u.api.ShopSearch({
|
||||
keyword: this.keyword
|
||||
}).then((res) => {
|
||||
this.shoplist = res.data.data
|
||||
})
|
||||
}
|
||||
},
|
||||
}
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
list: [{
|
||||
name: "店铺"
|
||||
}, {
|
||||
name: "达人"
|
||||
}, {
|
||||
name: "社区"
|
||||
}],
|
||||
current: 0,
|
||||
swiperCurrent: 0,
|
||||
dataList: [[1],[2],[3]],
|
||||
}
|
||||
},
|
||||
onLoad(option) {
|
||||
},
|
||||
methods: {
|
||||
tabsChange(index) {
|
||||
this.current = Number(index);
|
||||
this.swiperCurrent = this.current;
|
||||
},
|
||||
animationfinish(e) {
|
||||
const current = Number(e.detail.current);
|
||||
this.current = current;
|
||||
this.swiperCurrent = current;
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
</style>
|
||||
193
pageB/search/searchGoods.vue
Normal file
193
pageB/search/searchGoods.vue
Normal file
@@ -0,0 +1,193 @@
|
||||
<template>
|
||||
<view class="classify-goods">
|
||||
<view class="tab-container">
|
||||
<view class="salenum" :class="{ 'current' : current == 0 }" @click="switchCurrent(0)">销量</view>
|
||||
<view class="price" :class="{ 'current' : current == 1 }" @click="switchCurrent(1)">
|
||||
<view class="text">价格</view>
|
||||
<view class="icon">
|
||||
<u-icon name="arrow-up-fill" :color="(current == 1 && priceOrderAsc) ? '#FF780F' : '#333333'" size="22"></u-icon>
|
||||
<u-icon name="arrow-down-fill" :color="(current == 1 && !priceOrderAsc) ? '#FF780F' : '#333333'" size="22"></u-icon>
|
||||
</view>
|
||||
</view>
|
||||
<view class="evaluation" :class="{ 'current' : current == 2 }" @click="switchCurrent(2)">好评</view>
|
||||
</view>
|
||||
<scroll-view scroll-y class="goods-container" :style="{ height: scrollHeight }" @scrolltolower="loadMore">
|
||||
<view v-for="goods in goodsList" :key="goods.goods_id" class="goods-item" @click="toDetailsPage(goods.goods_id)">
|
||||
<image :src="goods.goods_image"></image>
|
||||
<view class="right">
|
||||
<view class="name u-line-1">{{ goods.goods_name }}</view>
|
||||
<view class="briefing u-line-2">{{ goods.goods_advword }}</view>
|
||||
</view>
|
||||
</view>
|
||||
<u-loadmore :status="loadStatus" bgColor="#FFFFFF" margin-top="20" margin-bottom="20" v-if="goodsList.length >= pageSize"></u-loadmore>
|
||||
<u-empty mode="list" v-if="!goodsList.length"></u-empty>
|
||||
</scroll-view>
|
||||
</view>
|
||||
</template>
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
pageSize: 12,
|
||||
cid: '',
|
||||
page: 1,
|
||||
current: 0,
|
||||
priceOrderAsc: true, // 是否升序
|
||||
goodsList: [],
|
||||
scrollHeight: '',
|
||||
loadStatus: 'loadmore',
|
||||
timer: true, // 防止上拉加载短时间内多次调用
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
current(value) {
|
||||
this.page = 1;
|
||||
this.goodsListByClassId({ laod: 'reload' });
|
||||
},
|
||||
priceOrderAsc(value) {
|
||||
this.page = 1;
|
||||
this.goodsListByClassId({ laod: 'reload' });
|
||||
}
|
||||
},
|
||||
onLoad(option) {
|
||||
this.cid = option.cid;
|
||||
this.goodsListByClassId({ load: 'reload' });
|
||||
this.setViewHeight();
|
||||
this.setTitle(option.cname);
|
||||
},
|
||||
methods: {
|
||||
setOrderSort() {
|
||||
let sort = '';
|
||||
if(this.current == 0) {
|
||||
sort = 'goods_salenum';
|
||||
} else if (this.current == 1) {
|
||||
if(this.priceOrderAsc) sort = 'goods_price_asc';
|
||||
else sort = 'goods_price_desc';
|
||||
} else if (this.current == 2) {
|
||||
sort = 'evaluation_count';
|
||||
}
|
||||
return sort;
|
||||
},
|
||||
// 排序方式 goods_salenum:销量 evaluation_count:评价 goods_price_asc:价格从低到高 goods_price_desc:价格从高到低
|
||||
async goodsListByClassId({ load = 'reload' } = {}) {
|
||||
const sort = this.setOrderSort();
|
||||
const res = await this.$u.api.goodsListByClassId({
|
||||
gc_id: this.cid,
|
||||
page: this.page,
|
||||
order: sort,
|
||||
})
|
||||
this.timer = true;
|
||||
if(res.errCode == 0) {
|
||||
if(load == 'reload') this.goodsList = res.data.data;
|
||||
else if(load == 'loadmore') this.goodsList.push(...res.data.data);
|
||||
}
|
||||
return res.data.data.length;
|
||||
},
|
||||
loadMore() {
|
||||
if(this.goodsList.length < this.pageSize) return false;
|
||||
if(!this.timer) return false;
|
||||
this.loadStatus = "loading";
|
||||
this.page++;
|
||||
this.goodsListByClassId({ load: 'loadmore' }).then(length => {
|
||||
if(length == 0) {
|
||||
this.page--;
|
||||
this.loadStatus = 'nomore';
|
||||
} else {
|
||||
this.loadStatus = 'loading';
|
||||
}
|
||||
}).catch(() => {
|
||||
this.loadStatus = "nomore";
|
||||
this.page--;
|
||||
})
|
||||
},
|
||||
switchCurrent(current) {
|
||||
if(current == 1 && this.current == 1) this.priceOrderAsc = !this.priceOrderAsc;
|
||||
this.current = current;
|
||||
},
|
||||
setViewHeight() {
|
||||
const res = uni.getSystemInfoSync();
|
||||
this.scrollHeight = res.windowHeight - (90 / 2) + 'px';
|
||||
},
|
||||
setTitle(title) {
|
||||
uni.setNavigationBarTitle({
|
||||
title: title
|
||||
});
|
||||
},
|
||||
toDetailsPage(id) {
|
||||
this.$u.route('/pageB/sdetails/index', {
|
||||
id: id,
|
||||
type: 1 // 商品详情 商品类型 1普通 2拼团 3秒杀 4优惠券
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
.classify-goods {
|
||||
.tab-container {
|
||||
box-sizing: border-box;
|
||||
padding: 30rpx 40rpx;
|
||||
display: flex;
|
||||
margin-bottom: 30rpx;
|
||||
> view {
|
||||
height: 30rpx;
|
||||
line-height: 30rpx;
|
||||
flex: 1;
|
||||
font-size: 32rpx;
|
||||
color: rgba(51,51,51,1);
|
||||
}
|
||||
.salenum {
|
||||
text-align: left;
|
||||
}
|
||||
.price {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
.text {
|
||||
margin-right: 5rpx;
|
||||
}
|
||||
.icon {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
}
|
||||
.evaluation {
|
||||
text-align: right;
|
||||
}
|
||||
.current {
|
||||
color: rgba(255,120,15,1);
|
||||
}
|
||||
}
|
||||
.goods-container {
|
||||
.goods-item {
|
||||
margin: 0 auto;
|
||||
width: 690rpx;
|
||||
display: flex;
|
||||
background-color: #F5F5F5;
|
||||
margin-bottom: 30rpx;
|
||||
align-items: center;
|
||||
> image {
|
||||
width: 220rpx;
|
||||
height: 200rpx;
|
||||
flex-shrink: 0;
|
||||
margin-right: 30rpx;
|
||||
}
|
||||
.right {
|
||||
width: 418rpx;
|
||||
.name {
|
||||
font-size: 30rpx;
|
||||
color: rgba(51,51,51,1);
|
||||
margin-bottom: 20rpx;
|
||||
}
|
||||
.briefing {
|
||||
font-size: 28rpx;
|
||||
color: rgba(102,102,102,1);
|
||||
line-height: 42rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user