mirror of
https://gitee.com/beijing_hongye_huicheng/lilishop-ui.git
synced 2026-11-07 17:38:55 +08:00
楼层装修新特征
This commit is contained in:
@@ -1,25 +1,32 @@
|
||||
<template>
|
||||
<div class="box">
|
||||
<div class="nav">
|
||||
<ul class="location">
|
||||
<li v-if="$route.path.includes('home')" style="margin-left:10px"><router-link to="/">首页</router-link></li>
|
||||
<ul class="location flex">
|
||||
<li v-if="$route.path.includes('home')" style="margin-left:10px">
|
||||
<router-link to="/">首页</router-link>
|
||||
</li>
|
||||
<ul class="flex">
|
||||
<li>Hi,欢迎来到{{ config.title }}</li>
|
||||
<li class="first" v-show="!userInfo.username">
|
||||
<router-link :to="`/signUp`" class="nav-item">
|
||||
<span>立即注册</span>
|
||||
</router-link>
|
||||
</li>
|
||||
<li v-show="!userInfo.username">
|
||||
<router-link class="nav-item" :to="`/login?rePath=${$route.path}&query=${JSON.stringify($route.query)}`">
|
||||
<span>请登录</span>
|
||||
</router-link>
|
||||
</li>
|
||||
</ul>
|
||||
</ul>
|
||||
<ul class="detail">
|
||||
<li class="first" v-show="!userInfo.username">
|
||||
<router-link :to="`/signUp`">
|
||||
<span style="border:none">立即注册</span>
|
||||
</router-link>
|
||||
</li>
|
||||
<li v-show="!userInfo.username">
|
||||
<router-link :to="`/login?rePath=${$route.path}&query=${JSON.stringify($route.query)}`">
|
||||
<span style="border:none">请登录</span>
|
||||
</router-link>
|
||||
</li>
|
||||
<ul class="detail flex">
|
||||
<li v-show="!!userInfo.username">
|
||||
<div class="username-p">
|
||||
<div>
|
||||
<Avatar class="person-icon" :src="userInfo.face" icon="person" size="small" />
|
||||
<span class="username">{{ userInfo.nickName? userInfo.nickName : userInfo.username | secrecyMobile }}</span>
|
||||
<Avatar class="person-icon" :src="userInfo.face" icon="person" size="small"/>
|
||||
<span class="username">{{
|
||||
userInfo.nickName ? userInfo.nickName : userInfo.username | secrecyMobile
|
||||
}}</span>
|
||||
</div>
|
||||
<transition name='fade'>
|
||||
<ul class="drop-items">
|
||||
@@ -31,16 +38,15 @@
|
||||
</transition>
|
||||
</div>
|
||||
</li>
|
||||
<li @click="goUserCenter('/home/MyOrder')"><span class="nav-item hover-color">我的订单</span></li>
|
||||
<li @click="goUserCenter('/home/MyTracks')"><span class="nav-item hover-color">我的足迹</span></li>
|
||||
<li @click="goUserCenter('/home/MsgList')"><span class="nav-item hover-color">我的消息</span></li>
|
||||
<li @click="goUserCenter('/home/MyOrder')"><span class="nav-item">我的订单</span></li>
|
||||
<li @click="goUserCenter('/home/MyTracks')"><span class="nav-item">我的足迹</span></li>
|
||||
<li @click="goUserCenter('/home/MsgList')"><span class="nav-item">我的消息</span></li>
|
||||
<li v-if="$route.name !== 'Cart'" style="position:relative;">
|
||||
<i class="cart-badge" v-show="Number(cartNum)">{{cartNum < 100 ? cartNum : '99'}}</i>
|
||||
<Dropdown placement="bottom-start">
|
||||
<router-link to="/cart" target="_blank">
|
||||
<span @mouseenter="getCartList">
|
||||
<span class="nav-item" @mouseenter="getCartList">
|
||||
<Icon size="18" type="ios-cart-outline"></Icon>
|
||||
购物车
|
||||
购物车({{ cartNum < 100 ? cartNum : '99' }})
|
||||
</span>
|
||||
</router-link>
|
||||
<DropdownMenu slot="list">
|
||||
@@ -52,25 +58,25 @@
|
||||
<div class="shopping-cart-list" v-show="shoppingCart.length > 0">
|
||||
<div class="shopping-cart-box" v-for="(item, index) in shoppingCart" @click="goToPay" :key="index">
|
||||
<div class="shopping-cart-img">
|
||||
<img :src="item.goodsSku.thumbnail" class="hover-pointer" />
|
||||
<img :src="item.goodsSku.thumbnail" class="hover-pointer"/>
|
||||
</div>
|
||||
<div class="shopping-cart-info">
|
||||
<div class="shopping-cart-title ">
|
||||
<p class="hover-pointer goods-title ellipsis">{{ item.goodsSku.goodsName }}</p>
|
||||
</div>
|
||||
<div class="shopping-cart-detail">
|
||||
<p>
|
||||
<div>
|
||||
数量:
|
||||
<span class="shopping-cart-text">{{ item.num }}</span>
|
||||
价钱:
|
||||
<span class="shopping-cart-text">{{ item.purchasePrice | unitPrice('¥') }}</span>
|
||||
</p>
|
||||
|
||||
</div>
|
||||
<div class="shopping-price">
|
||||
{{ item.purchasePrice | unitPrice('¥') }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="go-to-buy">
|
||||
<Button type="error" size="small" @click="goToPay">去结账</Button>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</DropdownMenu>
|
||||
</Dropdown>
|
||||
@@ -78,6 +84,7 @@
|
||||
<li>
|
||||
<span class="nav-item" @click="shopEntry">店铺入驻</span>
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
@@ -85,42 +92,45 @@
|
||||
|
||||
<script>
|
||||
import storage from '@/plugins/storage.js';
|
||||
import { cartGoodsAll } from '@/api/cart.js';
|
||||
import { logout } from '@/api/account.js';
|
||||
import {cartGoodsAll} from '@/api/cart.js';
|
||||
import {logout} from '@/api/account.js';
|
||||
|
||||
|
||||
export default {
|
||||
name: 'M-Header',
|
||||
created () {
|
||||
created() {
|
||||
if (storage.getItem('userInfo')) {
|
||||
this.userInfo = JSON.parse(storage.getItem('userInfo'));
|
||||
}
|
||||
},
|
||||
|
||||
data () {
|
||||
data() {
|
||||
return {
|
||||
config: require('@/config'),
|
||||
userInfo: {}, // 用户信息
|
||||
shoppingCart: [] // 购物车
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
// 购物车商品数量
|
||||
cartNum () {
|
||||
cartNum() {
|
||||
return this.$store.state.cartNum;
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
goToPay () { // 跳转购物车
|
||||
goToPay() { // 跳转购物车
|
||||
let url = this.$router.resolve({
|
||||
path: '/cart'
|
||||
});
|
||||
window.open(url.href, '_blank');
|
||||
},
|
||||
myInfo () { // 跳转会员中心
|
||||
myInfo() { // 跳转会员中心
|
||||
let url = this.$router.resolve({
|
||||
path: '/home'
|
||||
});
|
||||
window.open(url.href, '_blank');
|
||||
},
|
||||
signOutFun () { // 退出登录
|
||||
signOutFun() { // 退出登录
|
||||
logout().then(res => {
|
||||
storage.removeItem('accessToken');
|
||||
storage.removeItem('refreshToken');
|
||||
@@ -130,10 +140,10 @@ export default {
|
||||
this.$router.push('/login');
|
||||
});
|
||||
},
|
||||
goUserCenter (path) {
|
||||
goUserCenter(path) {
|
||||
// 跳转我的订单,我的足迹、收藏等
|
||||
if (this.userInfo.username) {
|
||||
this.$router.push({ path: path });
|
||||
this.$router.push({path: path});
|
||||
} else {
|
||||
this.$Modal.confirm({
|
||||
title: '请登录',
|
||||
@@ -152,19 +162,19 @@ export default {
|
||||
});
|
||||
}
|
||||
},
|
||||
shopEntry () {
|
||||
shopEntry() {
|
||||
// 店铺入驻
|
||||
if (storage.getItem('accessToken')) {
|
||||
let routeUrl = this.$router.resolve({
|
||||
path: '/shopEntry',
|
||||
query: { id: 1 }
|
||||
query: {id: 1}
|
||||
});
|
||||
window.open(routeUrl.href, '_blank');
|
||||
} else {
|
||||
this.$router.push('login');
|
||||
}
|
||||
},
|
||||
getCartList () {
|
||||
getCartList() {
|
||||
// 获取购物车列表
|
||||
if (this.userInfo.username) {
|
||||
cartGoodsAll().then((res) => {
|
||||
@@ -179,106 +189,91 @@ export default {
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.shopping-cart-detail,
|
||||
.shopping-cart-text,
|
||||
.shopping-cart-info,
|
||||
.nav a,
|
||||
.location,
|
||||
.first,
|
||||
.username,
|
||||
.shopping-cart-null span {
|
||||
|
||||
}
|
||||
|
||||
.box {
|
||||
width: 100%;
|
||||
font-size: 12px!important;
|
||||
// height: 35px;
|
||||
@include background_color($light_white_background_color);
|
||||
font-size: 12px !important;
|
||||
height: 36px;
|
||||
background: #333;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.nav {
|
||||
margin: 0 auto;
|
||||
width: 1200px;
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
justify-content: space-between;
|
||||
|
||||
}
|
||||
|
||||
.nav ul {
|
||||
list-style: none;
|
||||
}
|
||||
|
||||
.nav li {
|
||||
cursor: pointer;
|
||||
float: left;
|
||||
font-size: 12px;
|
||||
line-height: 35px;
|
||||
margin-right: 10px;
|
||||
font-weight: bold;
|
||||
line-height: 36px;
|
||||
margin-right: 15px;
|
||||
|
||||
}
|
||||
|
||||
.nav a,
|
||||
.nav-item {
|
||||
font-size: 13px;
|
||||
font-weight: normal;
|
||||
text-decoration: none;
|
||||
padding-left: 14px;
|
||||
border-left: 1px solid #ccc;
|
||||
color: #999;
|
||||
|
||||
border-left: 1px solid #ccc !important;
|
||||
cursor: pointer;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.nav-item {
|
||||
padding-left: 20px;
|
||||
}
|
||||
|
||||
.location a {
|
||||
border-left: none;
|
||||
}
|
||||
.nav a:hover {
|
||||
color: $theme_color;
|
||||
}
|
||||
|
||||
|
||||
.icon {
|
||||
color: gray;
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
.first a:first-child {
|
||||
padding-left: 3px;
|
||||
border-left: none;
|
||||
}
|
||||
.city {
|
||||
padding: 10px 15px;
|
||||
}
|
||||
|
||||
.city-item {
|
||||
font-weight: bold;
|
||||
cursor: pointer;
|
||||
padding: 5px;
|
||||
}
|
||||
|
||||
.city-item:hover {
|
||||
color: $theme_color;
|
||||
}
|
||||
|
||||
.person-icon {
|
||||
color: $theme_color;
|
||||
background-color: #f0cdb2;
|
||||
}
|
||||
|
||||
.shopping-cart-list {
|
||||
padding: 10px 15px;
|
||||
box-sizing: border-box;
|
||||
max-height: 300px;
|
||||
overflow: scroll;
|
||||
}
|
||||
.shopping-cart-box {
|
||||
margin: 8px 0px;
|
||||
margin-top: 15px;
|
||||
padding-bottom: 15px;
|
||||
height: 40px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
border-bottom: 1px #ccc dotted;
|
||||
}
|
||||
.shopping-cart-box:first-child {
|
||||
margin-top: 8px;
|
||||
}
|
||||
|
||||
.shopping-cart-img {
|
||||
margin-right: 15px;
|
||||
width: 40px;
|
||||
height: 40px;
|
||||
}
|
||||
|
||||
.shopping-cart-img img {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.shopping-cart-info {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
@@ -290,10 +285,7 @@ export default {
|
||||
line-height: 20px;
|
||||
}
|
||||
|
||||
.go-to-buy {
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
}
|
||||
|
||||
.shopping-cart-null {
|
||||
padding: 15px;
|
||||
display: flex;
|
||||
@@ -301,22 +293,28 @@ export default {
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.cart-null-icon {
|
||||
font-size: 38px;
|
||||
margin-bottom: 15px;
|
||||
}
|
||||
|
||||
.shopping-cart-null span {
|
||||
font-size: 12px;
|
||||
line-height: 16px;
|
||||
}
|
||||
|
||||
.username-p {
|
||||
position: relative;
|
||||
div{
|
||||
|
||||
div {
|
||||
cursor: pointer;
|
||||
>span{
|
||||
|
||||
> span {
|
||||
margin-left: 5px;
|
||||
}
|
||||
}
|
||||
|
||||
.drop-items {
|
||||
position: absolute;
|
||||
display: none;
|
||||
@@ -335,19 +333,21 @@ export default {
|
||||
li {
|
||||
color: rgb(107, 106, 106);
|
||||
width: 100%;
|
||||
border-bottom:1px solid rgb(207, 206, 206);
|
||||
border-bottom: 1px solid rgb(207, 206, 206);
|
||||
font-weight: normal;
|
||||
text-align: center;
|
||||
&:last-child{
|
||||
|
||||
&:last-child {
|
||||
border: none;
|
||||
}
|
||||
&:hover{
|
||||
|
||||
&:hover {
|
||||
cursor: pointer;
|
||||
color: $theme_color;
|
||||
}
|
||||
}
|
||||
|
||||
&::before{
|
||||
&::before {
|
||||
position: absolute;
|
||||
top: -20px;
|
||||
left: 30px;
|
||||
@@ -355,10 +355,10 @@ export default {
|
||||
width: 0;
|
||||
height: 0;
|
||||
border: 10px solid #999;
|
||||
border-color: transparent transparent #fff transparent ;
|
||||
border-color: transparent transparent #fff transparent;
|
||||
}
|
||||
|
||||
&::after{
|
||||
&::after {
|
||||
content: '';
|
||||
position: absolute;
|
||||
width: 80px;
|
||||
@@ -367,8 +367,9 @@ export default {
|
||||
left: 0;
|
||||
}
|
||||
}
|
||||
&:hover{
|
||||
.drop-items{
|
||||
|
||||
&:hover {
|
||||
.drop-items {
|
||||
display: block;
|
||||
}
|
||||
}
|
||||
@@ -382,11 +383,13 @@ export default {
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.my-page a {
|
||||
margin: 0px;
|
||||
padding: 0px;
|
||||
border: none;
|
||||
}
|
||||
|
||||
.my-info {
|
||||
padding: 5px;
|
||||
width: 50%;
|
||||
@@ -394,15 +397,19 @@ export default {
|
||||
text-align: center;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.my-info:hover {
|
||||
box-shadow: 0px 0px 5px #ccc;
|
||||
}
|
||||
|
||||
.my-info i {
|
||||
font-size: 28px;
|
||||
}
|
||||
|
||||
.my-info p {
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.sign-out {
|
||||
padding: 5px;
|
||||
width: 50%;
|
||||
@@ -410,18 +417,23 @@ export default {
|
||||
text-align: center;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.sign-out:hover {
|
||||
box-shadow: 0px 0px 5px $border_color;
|
||||
}
|
||||
|
||||
.sign-out i {
|
||||
font-size: 28px;
|
||||
}
|
||||
|
||||
.sign-out p {
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.goods-title:hover {
|
||||
color: $theme_color;
|
||||
}
|
||||
|
||||
.cart-badge {
|
||||
position: absolute;
|
||||
right: -8px;
|
||||
@@ -437,4 +449,34 @@ export default {
|
||||
z-index: 3;
|
||||
top: 3px;
|
||||
}
|
||||
|
||||
.shopping-cart-box {
|
||||
padding: 8px 0;
|
||||
cursor: pointer;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
border-bottom: 1px #ccc dotted;
|
||||
}
|
||||
|
||||
.shopping-cart-list {
|
||||
padding: 10px 10px;
|
||||
box-sizing: border-box;
|
||||
max-height: 300px;
|
||||
overflow-y: scroll;
|
||||
color: #333;
|
||||
|
||||
}
|
||||
|
||||
.shopping-cart-detail {
|
||||
color: #999;
|
||||
font-size: 12px;
|
||||
|
||||
}
|
||||
|
||||
.shopping-price {
|
||||
color: $theme_color;
|
||||
font-size: 14px;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user