You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
568 lines
14 KiB
568 lines
14 KiB
<template>
|
|
<view class="shop">
|
|
<view class="navbarContent">
|
|
<u-navbar :is-back="false" :background="background" :border-bottom="false">
|
|
<uni-icons type="left" size="24" color="#fff" class="back" @click="back"></uni-icons>
|
|
<view class="search-box">
|
|
<view @click="search" class="search-model"></view>
|
|
<u-search shape="round" :disabled="true" placeholder="搜索本品牌商品" bg-color="#ffffff"
|
|
:show-action="false"></u-search>
|
|
</view>
|
|
</u-navbar>
|
|
</view>
|
|
<view class="page">
|
|
<view class="shop-tip">
|
|
<image src="/static/logo.png" mode="aspectFill" class="logo"></image>
|
|
<view class="tip">
|
|
<image src="/static/shop/t1.png" mode="aspectFill"></image>
|
|
100%正品
|
|
</view>
|
|
<view class="tip">
|
|
<image src="/static/shop/t2.png" mode="aspectFill"></image>
|
|
天天有特价
|
|
</view>
|
|
<view class="tip">
|
|
<image src="/static/shop/t3.png" mode="aspectFill"></image>
|
|
退货无忧
|
|
</view>
|
|
</view>
|
|
<view class="shop-info">
|
|
<image :src="shopDetail.logo" mode="aspectFill" class="logo"></image>
|
|
<view class="info-box">
|
|
<view class="name">{{ shopDetail.name }}</view>
|
|
<view class="intro">
|
|
<text class="label">{{ shopDetail.label }}</text>
|
|
<view @click="toCer">
|
|
<image src="/static/cer.png" mode="aspectFill"></image>
|
|
证书
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
<view class="shop-goods">
|
|
<view v-if="goodsCate.filter(v => v.name === firstCate)[0].children.length > 0" class="second-cate">
|
|
<scroll-view class="second-cate-tabs" scroll-x>
|
|
<view v-for="(item, index) in goodsCate.filter(v => v.name === firstCate)[0].children" :key="index" class="cate-item" :class="{active: secondCate === item.name}" @click="secondCate = item.name">
|
|
{{ item.name }}
|
|
</view>
|
|
</scroll-view>
|
|
</view>
|
|
<view class="goods-content">
|
|
<view class="first-cate">
|
|
<scroll-view class="first-cate-tabs" scroll-y>
|
|
<view v-for="(item, index) in goodsCate" :key="index" class="cate-item" :class="{active: firstCate === item.name}" @click="firstCate = item.name;secondCate = '';">
|
|
{{ item.name }}
|
|
</view>
|
|
</scroll-view>
|
|
</view>
|
|
<view class="content">
|
|
<view class="filter-box">
|
|
<view v-for="(item, index) in filterList" :key="index" class="filter-item" :class="{ active: activeFilter === item}" @click="changeFilter(item)">
|
|
{{ item }}
|
|
<text v-if="item === '价格'" class="down" :class="{ on: activeFilter === '价格' && filterDirection === 'DESC'}" style="top: 22rpx;"></text>
|
|
<text v-if="item === '价格'" class="up" :class="{ on: activeFilter === '价格' && filterDirection === 'ASC'}"></text>
|
|
</view>
|
|
</view>
|
|
<view class="goods-list">
|
|
<view v-for="(item, index) in goods" :key="index" class="good">
|
|
<image :src="item.pic" mode="aspectFill"></image>
|
|
<view class="name">{{ item.name }}</view>
|
|
<view class="price">
|
|
<text class="now-price">¥{{ item.price }}</text>
|
|
<text class="origin-price">¥{{ item.originPrice }}</text>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
<view v-if="goods.length && !loading" class="finished">{{ loadTitle }}</view>
|
|
<view v-if="finished && !goods.length" class="empty">
|
|
<image mode="aspectFill" src="@/static/empty.png" alt="暂无商品" />
|
|
<view>暂无商品</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
<view class="toTop" v-if="isTop" @click="openScrollTo()">
|
|
<image :src="$picUrl+'/static/toTop.png?=1'"></image>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</template>
|
|
|
|
<script>
|
|
import styleColor from '../styleColor';
|
|
import * as Api from '@/api/shop/index';
|
|
|
|
export default {
|
|
data() {
|
|
return {
|
|
background: {
|
|
background: 'url(https://www.royaum.com.cn/static/shop/shop-page-bg.png) center top no-repeat',
|
|
backgroundSize: '100% auto',
|
|
},
|
|
id: '',
|
|
scrollTop: 0,
|
|
shopDetail: {
|
|
logo: '',
|
|
name: '小米旗舰店',
|
|
label: '商家直营 正品保障'
|
|
},
|
|
goodsCate: [
|
|
{ id: 1, name: '热门分类', children: [{ id: 1, name: '二级分类1'}, { id: 1, name: '二级分类2'}, { id: 1, name: '二级分类3'}, { id: 1, name: '二级分类4'}, { id: 1, name: '二级分类5'}]},
|
|
{ id: 1, name: '手机', children: [{ id: 1, name: '二级分类1'}, { id: 1, name: '二级分类2'}, { id: 1, name: '二级分类3'}, { id: 1, name: '二级分类4'}, { id: 1, name: '二级分类5'}]},
|
|
{ id: 1, name: '平板', children: [{ id: 1, name: '二级分类1'}, { id: 1, name: '二级分类2'}, { id: 1, name: '二级分类3'}, { id: 1, name: '二级分类4'}, { id: 1, name: '二级分类5'}]},
|
|
{ id: 1, name: '电脑', children: [{ id: 1, name: '二级分类1'}, { id: 1, name: '二级分类2'}, { id: 1, name: '二级分类3'}, { id: 1, name: '二级分类4'}, { id: 1, name: '二级分类5'}]},
|
|
{ id: 1, name: '冰箱', children: [{ id: 1, name: '二级分类1'}, { id: 1, name: '二级分类2'}, { id: 1, name: '二级分类3'}, { id: 1, name: '二级分类4'}, { id: 1, name: '二级分类5'}]},
|
|
],
|
|
firstCate: '手机',
|
|
secondCate: '二级分类2',
|
|
activeFilter: '综合',
|
|
filterDirection: 'ASC',
|
|
filterList: ['综合', '价格', '折扣', '销量'],
|
|
isTop: false,
|
|
page: 1,
|
|
limit: 10,
|
|
loadTitle: '',
|
|
loading: false,
|
|
finished: true,
|
|
goods: [
|
|
{
|
|
pic: '',
|
|
name: '小米耳机最新版小米耳机最新版',
|
|
price: 208.00,
|
|
originPrice: 809,
|
|
},
|
|
{
|
|
pic: '',
|
|
name: '小米耳机最新版小米耳机最新版',
|
|
price: 208.00,
|
|
originPrice: 809,
|
|
},
|
|
{
|
|
pic: '',
|
|
name: '小米耳机最新版小米耳机最新版',
|
|
price: 208.00,
|
|
originPrice: 809,
|
|
},
|
|
{
|
|
pic: '',
|
|
name: '小米耳机最新版小米耳机最新版',
|
|
price: 208.00,
|
|
originPrice: 809
|
|
},
|
|
{
|
|
pic: '',
|
|
name: '小米耳机最新版小米耳机最新版',
|
|
price: 208.00,
|
|
originPrice: 809,
|
|
},
|
|
{
|
|
pic: '',
|
|
name: '小米耳机最新版小米耳机最新版',
|
|
price: 208.00,
|
|
originPrice: 809,
|
|
},
|
|
{
|
|
pic: '',
|
|
name: '小米耳机最新版小米耳机最新版',
|
|
price: 208.00,
|
|
originPrice: 809,
|
|
},
|
|
{
|
|
pic: '',
|
|
name: '小米耳机最新版小米耳机最新版',
|
|
price: 208.00,
|
|
originPrice: 809,
|
|
},
|
|
{
|
|
pic: '',
|
|
name: '小米耳机最新版小米耳机最新版',
|
|
price: 208.00,
|
|
originPrice: 809,
|
|
},
|
|
{
|
|
pic: '',
|
|
name: '小米耳机最新版小米耳机最新版',
|
|
price: 208.00,
|
|
originPrice: 809,
|
|
},
|
|
]
|
|
};
|
|
},
|
|
// computed: {
|
|
// styleIndex() {
|
|
// const index = uni.getStorageSync('styleIndex') || '';
|
|
// return index;
|
|
// },
|
|
// navBgColor() {
|
|
// return this.styleIndex ? (styleColor.shopNavBgColor[this.styleIndex - 1] || '#FFA3B2') : '#FFA3B2'
|
|
// }
|
|
// },
|
|
onPageScroll(e) {
|
|
if (e.scrollTop <= 200) { // 当滚动到顶部且向下滑动时为true
|
|
this.isTop = false
|
|
} else {
|
|
this.isTop = true
|
|
}
|
|
},
|
|
onLoad({ id }) {
|
|
this.id = id;
|
|
this.getShopDetail()
|
|
},
|
|
methods: {
|
|
back() {
|
|
uni.navigateBack();
|
|
},
|
|
search() {
|
|
// 跳转商品搜索
|
|
uni.navigateTo({
|
|
url: '/pages/search/index'
|
|
})
|
|
},
|
|
changeFilter(item) {
|
|
if (item !== this.activeFilter) {
|
|
this.activeFilter = item;
|
|
this.filterDirection = 'ASC';
|
|
} else if (item === '价格') {
|
|
this.filterDirection = this.filterDirection === 'ASC' ? 'DESC' : 'ASC';
|
|
}
|
|
},
|
|
openScrollTo() {
|
|
uni.pageScrollTo({
|
|
scrollTop: 0
|
|
})
|
|
},
|
|
toCer() {
|
|
uni.navigateTo({
|
|
url: `/pages/shopList/certificate?id=${this.id}`,
|
|
});
|
|
},
|
|
async getShopDetail() {
|
|
Api.getShopDetail({
|
|
id: this.id
|
|
})
|
|
.then(result => {
|
|
console.log(result);
|
|
})
|
|
.finally(() => this.loading = false)
|
|
},
|
|
}
|
|
};
|
|
</script>
|
|
|
|
<style lang="scss" scoped>
|
|
.shop {
|
|
height: 100vh;
|
|
display: flex;
|
|
flex-direction: column;
|
|
background: url(https://www.royaum.com.cn/static/shop/shop-page-bg.png) center top no-repeat;
|
|
background-size: 100% auto;
|
|
.navbarContent {
|
|
display: flex;
|
|
justify-content: flex-start;
|
|
align-items: center;
|
|
.back {
|
|
margin-right: 24rpx;
|
|
margin-left: 12rpx;
|
|
}
|
|
.search-box {
|
|
position: relative;
|
|
.search-model {
|
|
position: absolute;
|
|
width: 100%;
|
|
height: 100%;
|
|
top: 0;
|
|
left: 0;
|
|
z-index: 100;
|
|
}
|
|
}
|
|
|
|
&::v-deep .u-navbar-inner {
|
|
position: relative;
|
|
margin-right: 0 !important;
|
|
display: flex;
|
|
.search-box {
|
|
width: 442rpx;
|
|
}
|
|
}
|
|
}
|
|
.page {
|
|
flex: 1;
|
|
display: flex;
|
|
flex-direction: column;
|
|
padding-top: 30rpx;
|
|
.shop-tip {
|
|
padding: 0 24rpx;
|
|
display: flex;
|
|
align-items: center;
|
|
.logo {
|
|
width: 92rpx;
|
|
height: 34rpx;
|
|
margin-right: auto;
|
|
}
|
|
.tip {
|
|
font-size: 22rpx;
|
|
color: #fff;
|
|
margin-left: 20rpx;
|
|
image {
|
|
width: 26rpx;
|
|
height: 26rpx;
|
|
margin-right: 8rpx;
|
|
}
|
|
}
|
|
}
|
|
.shop-info {
|
|
display: flex;
|
|
.logo {
|
|
width: 90rpx;
|
|
height: 90rpx;
|
|
border-radius: 10rpx;
|
|
margin-right: 10rpx;
|
|
}
|
|
.info-box {
|
|
margin-top: 30rpx;
|
|
.name {
|
|
font-size: 30rpx;
|
|
color: #fff;
|
|
margin-bottom: 18rpx;
|
|
}
|
|
.intro {
|
|
display: flex;
|
|
align-items: center;
|
|
.label {
|
|
height: 36rpx;
|
|
background: #F34A40;
|
|
border-radius: 4rpx;
|
|
padding: 0 7rpx;
|
|
line-height: 36rpx;
|
|
text-align: center;
|
|
font-size: 24rpx;
|
|
color: #fff;
|
|
margin-right: 20rpx;
|
|
}
|
|
>view {
|
|
width: 90rpx;
|
|
height: 36rpx;
|
|
background: rgba(0, 0, 0, 0.2);
|
|
border-radius: 4rpx;
|
|
display: flex;
|
|
justify-content: center;
|
|
align-items: center;
|
|
color: #fff;
|
|
font-size: 24rpx;
|
|
>image {
|
|
width: 21rpx;
|
|
height: 20rpx;
|
|
margin-right: 7rpx;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
.shop-goods {
|
|
flex: 1;
|
|
display: flex;
|
|
flex-direction: column;
|
|
margin-top: 30rpx;
|
|
background: #F0F4F3;
|
|
border-radius: 20rpx 20rpx 0 0;
|
|
padding-top: 24rpx;
|
|
.second-cate {
|
|
padding: 0 24rpx;
|
|
margin-bottom: 24rpx;
|
|
.second-cate-tabs {
|
|
height: 80rpx;
|
|
align-items: center;
|
|
white-space: nowrap;
|
|
width: 100%;
|
|
overflow-x: auto;
|
|
overflow-y: hidden;
|
|
.cate-item {
|
|
display: inline-block;
|
|
height: 80rpx;
|
|
padding: 0 26rpx;
|
|
background: #FFFFFF;
|
|
border-radius: 10rpx;
|
|
line-height: 80rpx;
|
|
margin-right: 20rpx;
|
|
color: #333333;
|
|
font-size: 28rpx;
|
|
&:last-child {
|
|
margin-right: 0;
|
|
}
|
|
&.active {
|
|
background: #F34A40;
|
|
color: #fff;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
.goods-content {
|
|
flex: 1;
|
|
display: flex;
|
|
.first-cate {
|
|
height: 100%;
|
|
width: 108rpx;
|
|
.first-cate-tabs {
|
|
overflow-x: hidden;
|
|
overflow-y: auto;
|
|
.cate-item {
|
|
width: 100%;
|
|
padding: 20rpx 30rpx;
|
|
color: #999999;
|
|
font-size: 24rpx;
|
|
position: relative;
|
|
&.active {
|
|
background: #fff;
|
|
&::before {
|
|
content: '';
|
|
position: absolute;
|
|
top: 50%;
|
|
transform: translateY(-50%);
|
|
left: 0;
|
|
width: 4rpx;
|
|
height: calc(100% - 60rpx);
|
|
background: #F34A40;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
.content {
|
|
background: #fff;
|
|
height: 100%;
|
|
width: calc(100% - 108rpx);
|
|
display: flex;
|
|
flex-direction: column;
|
|
.filter-box {
|
|
height: 88rpx;
|
|
padding: 0 40rpx;
|
|
display: flex;
|
|
justify-content: space-between;
|
|
align-items: center;
|
|
.filter-item {
|
|
color: #333;
|
|
font-size: 28rpx;
|
|
position: relative;
|
|
display: flex;
|
|
justify-content: center;
|
|
&.active {
|
|
color: #F34A40;
|
|
}
|
|
text {
|
|
width: 0;
|
|
height: 0;
|
|
border: 10rpx solid;
|
|
border-color: #000 transparent transparent transparent;
|
|
vertical-align: top;
|
|
position: absolute;
|
|
left: 60rpx;
|
|
top: 15rpx;
|
|
&.up {
|
|
border-color: transparent transparent #000 transparent;
|
|
top: -1rpx;
|
|
&.on {
|
|
border-color: transparent transparent #F34A40 transparent;
|
|
}
|
|
}
|
|
&.down.on {
|
|
border-color: #F34A40 transparent transparent transparent;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
.goods-list {
|
|
padding: 0 20rpx;
|
|
overflow-x: hidden;
|
|
overflow-y: auto;
|
|
display: flex;
|
|
flex-wrap: wrap;
|
|
.good {
|
|
width: 290rpx;
|
|
height: 422rpx;
|
|
background: #FFFFFF;
|
|
border-radius: 10rpx;
|
|
border: 1px solid #EAEAEA;
|
|
margin-right: 22rpx;
|
|
margin-bottom: 20rpx;
|
|
border-radius: 10rpx;
|
|
border: 1px solid #EAEAEA;
|
|
&:nth-child(2n) {
|
|
margin-right: 0;
|
|
}
|
|
>image {
|
|
width: 290rpx;
|
|
height: 287rpx;
|
|
}
|
|
.name {
|
|
color: #333333;
|
|
font-size: 26rpx;
|
|
margin: 30rpx 0 24rpx;
|
|
line-height: 26rpx;
|
|
overflow: hidden;
|
|
text-overflow: ellipsis;
|
|
white-space: nowrap;
|
|
padding: 0 24rpx;
|
|
}
|
|
.price {
|
|
padding: 0 24rpx;
|
|
.now-price {
|
|
color: #E53623;
|
|
font-size: 34rpx;
|
|
}
|
|
.origin-price {
|
|
text-decoration: line-through;
|
|
color: #999999;
|
|
font-size: 24rpx;
|
|
margin-left: 10;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
.finished,
|
|
.loading {
|
|
font-size: 28rpx;
|
|
line-height: 100rpx;
|
|
text-align: center;
|
|
color: #bbb;
|
|
}
|
|
.empty {
|
|
margin-top: 100rpx;
|
|
font-size: 28rpx;
|
|
text-align: center;
|
|
color: #bbb;
|
|
}
|
|
|
|
.empty image {
|
|
display: block;
|
|
width: 306rpx;
|
|
height: 200rpx;
|
|
margin: 0 auto 20rpx;
|
|
pointer-events: none;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
.toTop {
|
|
position: fixed;
|
|
bottom: 120rpx;
|
|
right: 16rpx;
|
|
width: 99rpx;
|
|
height: 99rpx;
|
|
border-radius: 50%;
|
|
opacity: 1;
|
|
z-index: 999;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
|
|
image {
|
|
width: 100%;
|
|
height: 100%;
|
|
}
|
|
|
|
}
|
|
}
|
|
|
|
}
|
|
</style> |