Merge branch 'feature/task1.0.0' into 'msb_test'

Feature/task1.0.0

See merge request yanxuan-frontend/shop-pc!42
merge-requests/43/head
肖广 3 years ago
commit 0bac60fa84

Binary file not shown.

After

Width:  |  Height:  |  Size: 39 KiB

@ -35,3 +35,19 @@ a { text-decoration:none;
color: #333; color: #333;
&:hover { text-decoration:none; color: #FF512B;} &:hover { text-decoration:none; color: #FF512B;}
} }
/* 自定义滚动条样式 */
.scrollbar-self {
&::-webkit-scrollbar {
width: 4px;
background-color: none;
}
&::-webkit-scrollbar-track {
background-color: none;
}
&::-webkit-scrollbar-thumb {
background: #dddddd;
border-radius: 10px;
}
}

@ -108,3 +108,8 @@ $baseFontSize: 100 !default;
-webkit-line-clamp: $line; -webkit-line-clamp: $line;
-webkit-box-orient: vertical; -webkit-box-orient: vertical;
} }
/*可点击文字hover*/
.hover-text:hover {
color: #FF875B;
}

@ -8,13 +8,7 @@
<template> <template>
<div class="layout"> <div class="layout">
<BsLogin :visible.sync="loginVisible" /> <BsLogin :visible.sync="loginVisible" />
<Header <Header :is-sticky="isSticky" />
:is-categroy-open="isHomePage"
:hide-bar-line="isHideBarLinePage"
:hide-sticky-shadow="isHideSeckillPage"
:show-categroy-tab="showCategroyTab"
:is-sticky="isSticky"
/>
<Nuxt /> <Nuxt />
<Footer /> <Footer />
</div> </div>
@ -23,7 +17,6 @@
import BsLogin from "@/components/BsLogin.vue"; import BsLogin from "@/components/BsLogin.vue";
import Header from "./module/header/index.vue"; import Header from "./module/header/index.vue";
import Footer from "./module/footer/index.vue"; import Footer from "./module/footer/index.vue";
const CATEGROY_HIDE_PAGES = [/\/account/]; // tab
export default { export default {
name: "Layout", name: "Layout",
@ -43,20 +36,6 @@ export default {
this.$store.commit("setLoginVisible", val); this.$store.commit("setLoginVisible", val);
}, },
}, },
isHomePage() {
return this.$route.path === "/";
},
isHideBarLinePage() {
return ["/", "/seckill"].includes(this.$route.path);
},
isHideSeckillPage() {
return this.$route.path === "/seckill";
},
showCategroyTab() {
return !CATEGROY_HIDE_PAGES.some((reg) => {
return reg.test(this.$route.path);
});
},
}, },
mounted() { mounted() {
// //

@ -0,0 +1,263 @@
<template>
<!-- 购物车 -->
<el-popover
popper-class="header-cart-popover"
trigger="hover"
placement="bottom"
width="330"
>
<div
slot="reference"
class="header-cart-popover__refrence flex flex-middle"
@click="onJumpCart"
>
<img src="~/assets/img/layout/icon-shop.png" />
<span>购物车</span>
<div v-if="cartProducts.length > 0" class="wrap-right-cart__tip">
{{ cartProducts.length }}
</div>
</div>
<div class="header-cart-products scrollbar-self">
<div
v-for="item in products"
:key="item.id"
@click="onJumpGoodsDetail"
class="header-cart-products__wrap flex flex-middle flex-between"
>
<div class="cart-products-wrap__left flex felx-middle">
<div class="products-wrap-left__cover">
<img :src="item.productMainPicture" />
</div>
<div class="products-wrap-left__info">
<p class="wrap-left-info__title">{{ item.productName }}</p>
<div class="wrap-left-info__detail flex">
<span class="left-info-detail__skuname">{{
item.productSku.name
}}</span>
<span class="left-info-detail__count">{{ item.number }}</span>
</div>
</div>
</div>
<UiMoney
class="cart-products-wrap__right"
:float="true"
:money="item.product.startingPrice"
/>
</div>
<!-- 失效商品 -->
<template v-if="failureProducts.length > 0">
<div class="header-cart-products__bar">以下商品已失效</div>
<div
v-for="item in failureProducts"
:key="item.id"
@click="onJumpGoodsDetail"
class="header-cart-products__wrap flex flex-middle flex-between"
>
<div class="cart-products-wrap__left flex felx-middle">
<div class="products-wrap-left__cover">
<img :src="item.productMainPicture" />
</div>
<div class="products-wrap-left__info">
<p
class="wrap-left-info__title header-cart-products--failure-color"
>
{{ item.productName }}
</p>
<div class="wrap-left-info__detail flex">
<span class="left-info-detail__skuname">{{
item.productSku && item.productSku.name
}}</span>
<span class="left-info-detail__count">{{ item.number }}</span>
</div>
</div>
</div>
<UiMoney
class="header-cart-products--failure-color"
:float="true"
:money="item.product.startingPrice"
/>
</div>
</template>
</div>
<div class="header-cart-bottom flex flex-middle flex-between">
<p>{{ cartProducts.length }}件商品</p>
<UiButton type="red_panel" :radius="true" @click="onJumCartPage"
>去购物车</UiButton
>
</div>
</el-popover>
</template>
<script>
import { mapState } from "vuex";
import UiButton from "@/components/UiButton.vue";
export default {
name: "HeaderCart",
components: { UiButton },
data() {
return {
products: [],
failureProducts: [], //
};
},
computed: {
...mapState(["cartProducts"]),
},
watch: {
cartProducts: {
immediate: true,
deep: true,
handler(val) {
this.products = [];
this.failureProducts = [];
val.forEach((item) => {
if (item.product.isEnable) {
if (item.productSku && item.productSku.stock > 0) {
//
this.products.push(item);
return;
}
this.failureProducts.push(item);
return;
}
this.failureProducts.push(item);
});
},
},
},
created() {
this.$store.dispatch("getCartProducts");
},
methods: {
onJumpCart() {
if (!this.$isLoginValidate()) {
return;
}
this.$router.push("/cart");
},
onJumpGoodsDetail(id) {
this.$router.push(`/goods/detail/${id}`);
},
onJumCartPage() {
this.$router.push("/cart");
},
},
};
</script>
<style lang="scss">
.header-cart-popover {
padding: 16px 20px;
}
</style>
<style lang="scss" scoped>
.header-cart-popover__refrence {
padding: 0 18px;
height: 42px;
line-height: 42px;
color: #999999;
border-radius: 8px 8px 8px 8px;
border: 1px solid #eeeeee;
cursor: pointer;
.wrap-right-cart__tip {
min-width: 14px;
height: 14px;
padding: 0 3px;
font-size: 10px;
line-height: 14px;
text-align: center;
background: #ff512b;
border-radius: 50%;
color: #ffffff;
}
img {
width: 16px;
height: 16px;
margin: 0 4px 0 10px;
}
}
.header-cart-popover {
padding: 20px 16px;
.header-cart-products {
padding: 0 10px 50px 0;
max-height: 360px;
overflow: auto;
&--failure-color {
color: #999999 !important;
}
.header-cart-products__wrap {
margin-bottom: 20px;
cursor: pointer;
.cart-products-wrap__left {
.products-wrap-left__cover {
width: 54px;
height: 54px;
padding: 3px;
border: 1px solid #eeeeee;
border-radius: 4px;
margin-right: 11px;
img {
width: 100%;
height: 100%;
}
}
.products-wrap-left__info {
font-size: 12px;
color: #999999;
.wrap-left-info__title {
display: block;
width: 120px;
@include ellipsis;
font-size: 14px;
color: #333333;
margin-bottom: 10px;
}
.wrap-left-info__detail {
.left-info-detail__skuname {
display: block;
width: 70px;
@include ellipsis;
}
.left-info-detail__count {
&::before {
content: "X";
font-size: 8px;
}
}
}
}
}
.cart-products-wrap__right {
color: #ff512b;
}
}
.header-cart-products__bar {
font-size: 14px;
width: 298px;
height: 40px;
line-height: 40px;
padding: 0 11px;
background: #f8f8f8;
color: #999999;
margin-bottom: 20px;
}
}
.header-cart-bottom {
position: absolute;
left: 0;
bottom: 0;
width: 100%;
height: 50px;
background: #eeeeee;
padding: 0 16px;
font-size: 14px;
color: #666666;
/deep/.ui-button {
width: 84px;
height: 30px;
font-size: 14px;
font-weight: normal;
padding: 0;
}
}
}
</style>

@ -0,0 +1,219 @@
<template>
<div class="header-category">
<!-- 热门分类 -->
<div
v-show="showCategroyTab"
class="header-box-tab__category"
@mouseenter="handleCategoryChange(true)"
@mouseleave="handleCategoryChange(false)"
>
<div class="tab-category__label flex flex-center flex-middle">
<img src="~/assets/img/layout/icon-category.png" />
<span>热门分类</span>
</div>
<div
v-show="isCategroyOpen || categroyVisible"
class="tab-category__menu flex"
@mouseenter="handleCategoryTwoChange(true)"
@mouseleave="handleCategoryTwoChange(false)"
>
<!-- 左侧一级分类 -->
<div class="tab-category-menu__left">
<div
v-for="item in categroyData"
:key="item.id"
@mouseenter="handleCategoryHover(item.id)"
@click="onCategoryClick(item.id, CATEGROY_LEVEL.ONE)"
class="menu-left__item flex flex-middle"
:class="{
'menu-left__item--light': item.id === currentCategroyId,
}"
>
<img />
<span>{{ item.name }}</span>
</div>
</div>
<!-- 右侧二级分类 -->
<div
v-show="categroyTwoVisible"
class="tab-category-menu__right flex-1"
>
<div
v-for="item in categroyData"
:key="item.id"
@mouseenter="handleCategoryHover(item.id)"
class="category-menu-right__wrap"
:class="{
'category-menu-right__wrap--light': item.id === currentCategroyId,
}"
>
<span
v-for="itemList in item.list"
:key="itemList.id"
class="menu-right-wrap__item"
@click="onCategoryClick(itemList.id, CATEGROY_LEVEL.TWO)"
>{{ itemList.name }}</span
>
</div>
</div>
</div>
</div>
</div>
</template>
<script>
import {
ApiGetCategoryOneList,
ApiGetCategoryTwoAndGoods,
} from "@/plugins/api/goods";
const CATEGROY_HIDE_PAGES = [/\/account/]; // tab
export default {
name: "HeaderCategory",
data() {
return {
categroyTwoVisible: false, //
categroyVisible: false, //
currentCategroyId: 0, // id
categroyData: [],
};
},
computed: {
showCategroyTab() {
return !CATEGROY_HIDE_PAGES.some((reg) => {
return reg.test(this.$route.path);
});
},
//
isCategroyOpen() {
return this.$route.path === "/";
},
},
created() {
this.getCategroyData();
},
methods: {
//
async getCategroyData() {
const { result } = await ApiGetCategoryOneList();
if (result && result.length > 0) {
this.categroyData = await Promise.all(
result.map(async (item) => {
const { result: resultGoods } = await ApiGetCategoryTwoAndGoods({
categoryId: item.id,
});
if (resultGoods && resultGoods.length > 0) {
return {
...item,
list: resultGoods,
};
}
})
);
}
},
//
handleCategoryHover(id) {
this.currentCategroyId = id;
},
//
onCategoryClick(id, levelType) {
this.categroyVisible = false;
this.categroyTwoVisible = false;
this.$router.push({
path: "/goods/list",
query: {
id,
levelType,
},
});
},
//
handleCategoryChange(val) {
this.categroyVisible = val;
if (!val) {
this.currentCategroyId = 0;
}
},
//
handleCategoryTwoChange(val) {
this.categroyTwoVisible = val;
},
},
};
</script>
<style lang="scss" scoped>
.header-category {
height: 100%;
.header-box-tab__category {
position: relative;
height: 100%;
.tab-category__label {
width: 190px;
height: 100%;
background: linear-gradient(270deg, #ffa25a 0%, #ff7f39 100%);
border-radius: 4px 4px 0px 0px;
font-weight: bold;
color: #ffffff;
cursor: pointer;
img {
width: 20px;
height: 20px;
margin-right: 16px;
}
}
.tab-category__menu {
position: absolute;
top: 38px;
left: 0;
font-size: 14px;
color: #333333;
.tab-category-menu__left {
width: 190px;
padding: 15px 0;
background: #ffffff;
.menu-left__item {
height: 50px;
cursor: pointer;
padding: 0 24px 0 41px;
&:hover,
&--light {
color: #ff875b;
}
img {
width: 20px;
height: 20px;
margin-right: 16px;
}
}
}
.tab-category-menu__right {
padding: 15px 26px;
box-shadow: 7px 0px 10px 1px rgba(0, 0, 0, 0.1);
border: 1px solid #eeeeee;
background: #ffffff;
.category-menu-right__wrap {
height: 50px;
line-height: 50px;
padding: 0 16px;
font-size: 12px;
color: #999999;
white-space: nowrap;
&:hover,
&--light {
background: #f8f8f8;
}
.menu-right-wrap__item {
color: #999999;
margin-right: 20px;
cursor: pointer;
&:hover {
color: #ff875b;
}
}
}
}
}
}
}
</style>

@ -19,7 +19,7 @@
<span>你好{{ userInfo.nickname }}</span> <span>你好{{ userInfo.nickname }}</span>
<img class="content-login-info__logo" :src="menuIcon" /> <img class="content-login-info__logo" :src="menuIcon" />
</div> </div>
<el-dropdown-menu slot="dropdown" class="dropdown-menu-self"> <el-dropdown-menu slot="dropdown" class="header-info-bar__dropdown">
<div class="menu-item__wrap flex flex-middle"> <div class="menu-item__wrap flex flex-middle">
<img class="menu-item-wrap__avatar" :src="userInfo.avatar" /> <img class="menu-item-wrap__avatar" :src="userInfo.avatar" />
<span>{{ userInfo.nickname }}</span> <span>{{ userInfo.nickname }}</span>
@ -51,8 +51,10 @@
@click="onJumpPersonalPage('message')" @click="onJumpPersonalPage('message')"
> >
<img src="~/assets/img/layout/icon-message.png" /> <img src="~/assets/img/layout/icon-message.png" />
<span>消息</span> <span class="hover-text">消息</span>
<div class="wrap-content-message__tip">33</div> <div v-if="messageCount > 0" class="wrap-content-message__tip">
{{ messageCount }}
</div>
</div> </div>
</template> </template>
<div class="header-wrap-content--line"></div> <div class="header-wrap-content--line"></div>
@ -61,13 +63,28 @@
@click="onJumpPersonalPage('order/list')" @click="onJumpPersonalPage('order/list')"
> >
<img src="~/assets/img/layout/icon-order.png" /> <img src="~/assets/img/layout/icon-order.png" />
<span>我的订单</span> <span class="hover-text">我的订单</span>
</div> </div>
<div class="header-wrap-content--line"></div> <div class="header-wrap-content--line"></div>
<div class="header-wrap-content__common flex flex-middle"> <!-- 下载app -->
<img src="~/assets/img/layout/icon-phone.png" /> <el-popover
<span>下载app</span> popper-class="header-info-bar__popover"
</div> placement="bottom"
width="230"
trigger="hover"
>
<div
slot="reference"
class="header-wrap-content__common flex flex-middle"
>
<img src="~/assets/img/layout/icon-phone.png" />
<span class="hover-text">下载app</span>
</div>
<div class="info-bar-popover__qrcode">
<img src="~/assets/img/common/app-qrcode.png" />
<span>扫一扫上方二维码 下载APP</span>
</div>
</el-popover>
</div> </div>
</div> </div>
</div> </div>
@ -99,6 +116,7 @@ export default {
value: MENU_VALUE.LOGON_OUT, value: MENU_VALUE.LOGON_OUT,
}, },
], ],
messageCount: 0, //
}; };
}, },
computed: { computed: {
@ -136,14 +154,19 @@ export default {
}, },
}; };
</script> </script>
<style lang="scss">
.header-info-bar__dropdown,
.header-info-bar__popover {
.popper__arrow {
display: none;
}
}
</style>
<style lang="scss" scoped> <style lang="scss" scoped>
.dropdown-menu-self { .header-info-bar__dropdown {
width: 200px; width: 200px;
margin-top: 0 !important; margin-top: 0 !important;
padding-bottom: 0; padding-bottom: 0;
.popper__arrow {
display: none;
}
.el-dropdown-menu__item:hover { .el-dropdown-menu__item:hover {
background: #f8f9fb; background: #f8f9fb;
color: #666666; color: #666666;
@ -164,6 +187,7 @@ export default {
height: 50px; height: 50px;
margin-right: 13px; margin-right: 13px;
border-radius: 50%; border-radius: 50%;
object-fit: cover;
} }
} }
.menu-item__line { .menu-item__line {
@ -173,8 +197,18 @@ export default {
border-radius: 0px 0px 0px 0px; border-radius: 0px 0px 0px 0px;
} }
} }
</style> .header-info-bar__popover {
<style lang="scss" scoped> .info-bar-popover__qrcode {
font-size: 14px;
color: #666666;
text-align: center;
img {
width: 186px;
height: 186px;
margin-bottom: 15px;
}
}
}
.info-bar-header { .info-bar-header {
height: 30px; height: 30px;
color: #999999; color: #999999;

@ -4,7 +4,7 @@
<div v-show="isSticky"> <div v-show="isSticky">
<div <div
class="sticky-bar-header" class="sticky-bar-header"
:class="{ 'sticky-bar-header--hide-shadow': hideStickyShadow }" :class="{ 'sticky-bar-header--hide-shadow': hideBarShadow }"
> >
<div class="sticky-bar-header__wrap flex flex-middle flex-between"> <div class="sticky-bar-header__wrap flex flex-middle flex-between">
<div class="flex flex-middle"> <div class="flex flex-middle">
@ -15,7 +15,7 @@
<el-menu <el-menu
:default-active="tabPath" :default-active="tabPath"
mode="horizontal" mode="horizontal"
@select="handleTabSelect" @select="onTabSelect"
> >
<el-menu-item <el-menu-item
v-for="item in tabList" v-for="item in tabList"
@ -32,7 +32,7 @@
/> />
<div class="header-wrap-icons__shop" @click="$router.push('/cart')"> <div class="header-wrap-icons__shop" @click="$router.push('/cart')">
<img src="~/assets/img/layout/icon-shop-sticky.png" /> <img src="~/assets/img/layout/icon-shop-sticky.png" />
<span class="">3</span> <span v-if="cartCount > 0" class="">{{ cartCount }}</span>
</div> </div>
<div <div
v-if="token" v-if="token"
@ -66,6 +66,7 @@
<div class="search-input"> <div class="search-input">
<el-input <el-input
v-model="searchContent" v-model="searchContent"
clearable
placeholder="请输入商品名称" placeholder="请输入商品名称"
></el-input> ></el-input>
</div> </div>
@ -76,76 +77,12 @@
<img src="~/assets/img/layout/icon-search.png" /> <img src="~/assets/img/layout/icon-search.png" />
</div> </div>
</div> </div>
<div <!-- 购物车 -->
class="box-wrap-right__cart flex flex-middle" <HeaderCart />
@click="onJumpCart"
>
<img src="~/assets/img/layout/icon-shop.png" />
<span>购物车</span>
<div class="wrap-right-cart__tip">3</div>
</div>
</div> </div>
</div> </div>
<!-- 热门分类 -->
<div class="bar-header-box__tab flex flex-middle"> <div class="bar-header-box__tab flex flex-middle">
<div <HeaderCategory />
v-show="showCategroyTab"
class="header-box-tab__category"
@mouseenter="handleCategoryChange(true)"
@mouseleave="handleCategoryChange(false)"
>
<div class="tab-category__label flex flex-center flex-middle">
<img src="~/assets/img/layout/icon-category.png" />
<span>热门分类</span>
</div>
<div
v-show="isCategroyOpen || categroyVisible"
class="tab-category__menu flex"
@mouseenter="handleCategoryTwoChange(true)"
@mouseleave="handleCategoryTwoChange(false)"
>
<!-- 左侧一级分类 -->
<div class="tab-category-menu__left">
<div
v-for="item in categroyData"
:key="item.id"
@mouseenter="handleCategoryHover(item.id)"
@click="onCategoryClick(item.id, CATEGROY_LEVEL.ONE)"
class="menu-left__item flex flex-middle"
:class="{
'menu-left__item--light': item.id === currentCategroyId,
}"
>
<img />
<span>{{ item.name }}</span>
</div>
</div>
<!-- 右侧二级分类 -->
<div
v-show="categroyTwoVisible"
class="tab-category-menu__right flex-1"
>
<div
v-for="item in categroyData"
:key="item.id"
@mouseenter="handleCategoryHover(item.id)"
class="category-menu-right__wrap"
:class="{
'category-menu-right__wrap--light':
item.id === currentCategroyId,
}"
>
<span
v-for="itemList in item.list"
:key="itemList.id"
class="menu-right-wrap__item"
@click="onCategoryClick(itemList.id, CATEGROY_LEVEL.TWO)"
>{{ itemList.name }}</span
>
</div>
</div>
</div>
</div>
<div <div
v-for="item in tabList" v-for="item in tabList"
:key="item.value" :key="item.value"
@ -154,7 +91,7 @@
'header-box-tab__common--light': 'header-box-tab__common--light':
item.value === $nuxt.$route.fullPath, item.value === $nuxt.$route.fullPath,
}" }"
@click="onTabSelect(item)" @click="onTabSelect(item.value)"
> >
{{ item.label }} {{ item.label }}
</div> </div>
@ -167,135 +104,72 @@
</template> </template>
<script> <script>
import { mapState } from "vuex"; import { mapState } from "vuex";
import {
ApiGetCategoryOneList,
ApiGetCategoryTwoAndGoods,
} from "@/plugins/api/goods";
import { CATEGROY_LEVEL } from "@/constants"; import { CATEGROY_LEVEL } from "@/constants";
import HeaderInfoBar from "./HeaderInfoBar.vue"; import HeaderInfoBar from "./HeaderInfoBar.vue";
import HeaderCategory from "./HeaderCategory.vue";
import HeaderCart from "./HeaderCart.vue";
export default { export default {
name: "DefaultHeader", name: "DefaultHeader",
components: { HeaderInfoBar }, components: { HeaderInfoBar, HeaderCategory, HeaderCart },
props: { props: {
// //
isSticky: { isSticky: {
type: Boolean, type: Boolean,
default: false, default: false,
}, },
//
isCategroyOpen: {
type: Boolean,
default: false,
},
// tab
showCategroyTab: {
type: Boolean,
default: true,
},
//
hideBarLine: {
type: Boolean,
default: false,
},
// tab
hideStickyShadow: {
type: Boolean,
default: true,
},
}, },
data() { data() {
return { return {
CATEGROY_LEVEL, CATEGROY_LEVEL,
searchContent: "", searchContent: "",
tabPath: "/", tabPath: "/",
tabList: [ cartCount: 0, //
cartProductList: [], //
};
},
computed: {
...mapState(["userInfo", "token", "seckillTabVisible"]),
tabList() {
const defaultList = [
{ label: "首页", value: "/" }, { label: "首页", value: "/" },
{ {
label: "开发书籍", label: "开发书籍",
value: `/goods/list?id=6&levelType=${CATEGROY_LEVEL.ONE}`, value: `/goods/list?id=6&levelType=${CATEGROY_LEVEL.ONE}`,
}, },
{ label: "限时秒杀", value: "/seckill" }, ];
], if (this.seckillTabVisible) {
categroyTwoVisible: false, // return [...defaultList, { label: "限时秒杀", value: "/seckill" }];
categroyVisible: false, // }
currentCategroyId: 0, // id return defaultList;
categroyData: [],
};
},
computed: {
...mapState(["userInfo", "token"]),
},
mounted() {
this.getCategroyData();
},
methods: {
onLoginClick() {
this.$isLoginValidate();
}, },
//
handleCategoryHover(id) { // tab
this.currentCategroyId = id; hideBarShadow() {
return ["/seckill"].includes(this.$route.path);
}, },
//
onCategoryClick(id, levelType) { //
this.categroyVisible = false; hideBarLine() {
this.categroyTwoVisible = false; return ["/", "/seckill"].includes(this.$route.path);
this.$router.push({
path: "/goods/list",
query: {
id,
levelType,
},
});
}, },
// },
handleCategoryChange(val) { watch: {
this.categroyVisible = val; "$route.path"(val) {
if (!val) { if (val !== "/goods/list") {
this.currentCategroyId = 0; this.searchContent = "";
} }
}, },
// },
handleCategoryTwoChange(val) { methods: {
this.categroyTwoVisible = val; onLoginClick() {
}, this.$isLoginValidate();
handleTabSelect(value) {
this.$router.push({ path: value });
}, },
onTabSelect({ value }) { onTabSelect(value) {
this.tabPath = value; this.tabPath = value;
this.searchContent = "";
this.$router.push({ path: value }); this.$router.push({ path: value });
}, },
onJumpCart() {
if (!this.$isLoginValidate()) {
return;
}
this.$router.push("/cart");
},
//
async getCategroyData() {
const { result } = await ApiGetCategoryOneList();
if (result && result.length > 0) {
this.categroyData = await Promise.all(
result.map(async (item) => {
const { result: resultGoods } = await ApiGetCategoryTwoAndGoods({
categoryId: item.id,
});
if (resultGoods && resultGoods.length > 0) {
return {
...item,
list: resultGoods,
};
}
})
);
}
},
onSearch() { onSearch() {
this.$router.push({ this.$router.push({
path: "/goods/list", path: "/goods/list",
@ -308,6 +182,10 @@ export default {
}; };
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.layout-header-popover {
&__cart-content {
}
}
.sticky-bar-header { .sticky-bar-header {
position: fixed; position: fixed;
top: 0; top: 0;
@ -431,105 +309,10 @@ export default {
} }
} }
} }
.box-wrap-right__cart {
padding: 0 18px;
height: 42px;
line-height: 42px;
color: #999999;
border-radius: 8px 8px 8px 8px;
border: 1px solid #eeeeee;
cursor: pointer;
.wrap-right-cart__tip {
min-width: 14px;
height: 14px;
padding: 0 3px;
font-size: 10px;
line-height: 14px;
text-align: center;
background: #ff512b;
border-radius: 50%;
color: #ffffff;
}
img {
width: 16px;
height: 16px;
margin: 0 4px 0 10px;
}
}
} }
} }
.bar-header-box__tab { .bar-header-box__tab {
height: 38px; height: 38px;
.header-box-tab__category {
position: relative;
height: 100%;
.tab-category__label {
width: 190px;
height: 100%;
background: linear-gradient(270deg, #ffa25a 0%, #ff7f39 100%);
border-radius: 4px 4px 0px 0px;
font-weight: bold;
color: #ffffff;
cursor: pointer;
img {
width: 20px;
height: 20px;
margin-right: 16px;
}
}
.tab-category__menu {
position: absolute;
top: 38px;
left: 0;
font-size: 14px;
color: #333333;
.tab-category-menu__left {
width: 190px;
padding: 15px 0;
background: #ffffff;
.menu-left__item {
height: 50px;
cursor: pointer;
padding: 0 24px 0 41px;
&:hover,
&--light {
color: #ff875b;
}
img {
width: 20px;
height: 20px;
margin-right: 16px;
}
}
}
.tab-category-menu__right {
padding: 15px 26px;
box-shadow: 7px 0px 10px 1px rgba(0, 0, 0, 0.1);
border: 1px solid #eeeeee;
background: #ffffff;
.category-menu-right__wrap {
height: 50px;
line-height: 50px;
padding: 0 16px;
font-size: 12px;
color: #999999;
white-space: nowrap;
&:hover,
&--light {
background: #f8f8f8;
}
.menu-right-wrap__item {
color: #999999;
margin-right: 20px;
cursor: pointer;
&:hover {
color: #ff875b;
}
}
}
}
}
}
.header-box-tab__common--light { .header-box-tab__common--light {
color: #ff7f39 !important; color: #ff7f39 !important;
} }

@ -18,7 +18,10 @@
</div> </div>
<!-- 有物流信息 --> <!-- 有物流信息 -->
<div v-else v-loading="loading"> <div v-else v-loading="loading">
<div v-infinite-scroll="handleListload" class="home-logisitcs-content"> <div
v-infinite-scroll="handleListload"
class="home-logisitcs-content scrollbar-self"
>
<div <div
v-for="item in list" v-for="item in list"
:key="item.orderId" :key="item.orderId"
@ -165,17 +168,6 @@ export default {
max-height: 620px; max-height: 620px;
overflow: auto; overflow: auto;
padding: 30px; padding: 30px;
&::-webkit-scrollbar {
width: 4px;
background-color: none;
}
&::-webkit-scrollbar-track {
background-color: none;
}
&::-webkit-scrollbar-thumb {
background: #dddddd;
border-radius: 10px;
}
.home-logisitcs-content__item { .home-logisitcs-content__item {
margin-bottom: 30px; margin-bottom: 30px;
cursor: pointer; cursor: pointer;

@ -66,12 +66,18 @@ const NEW_COUNT = 5; // 新品上架商品数
export default { export default {
components: { Banner, Seckil, Pick, UiGoodsItem, UiPagination }, components: { Banner, Seckil, Pick, UiGoodsItem, UiPagination },
async asyncData() { async asyncData({ store }) {
// //
const { result: seckillData } = await ApiGetHomeSeckill(); let seckillData = { activityTimeVO: null };
//
let sekillGoodsList = []; let sekillGoodsList = [];
const { result: seckillDataResult } = await ApiGetHomeSeckill();
if (seckillData) {
seckillData = seckillDataResult;
}
if (seckillData.activityTimeVO) { if (seckillData.activityTimeVO) {
store.commit("setSeckillTabVisible", true);
//
const { result } = await ApiGetSeckillGoods({ const { result } = await ApiGetSeckillGoods({
pageIndex: 1, pageIndex: 1,
length: SECKILL_COUNT, length: SECKILL_COUNT,
@ -81,6 +87,7 @@ export default {
sekillGoodsList = result.records; sekillGoodsList = result.records;
} }
} }
// //
const { result: currentTime } = await ApiGetCurrentTime(); const { result: currentTime } = await ApiGetCurrentTime();
@ -101,7 +108,7 @@ export default {
currentTime, currentTime,
newData, newData,
sekillGoodsList, sekillGoodsList,
seckillData: seckillData || { activityTimeVO: null }, seckillData,
recommendData: recommendData || [], recommendData: recommendData || [],
}; };
}, },
@ -177,6 +184,9 @@ export default {
&:not(:nth-child(5n)) { &:not(:nth-child(5n)) {
margin-right: calc(5% / 4); margin-right: calc(5% / 4);
} }
img {
width: 100%;
}
} }
} }
} }

@ -81,12 +81,12 @@
<strong>新品上架</strong> <strong>新品上架</strong>
<img src="~/assets/img/common/icon-jump.png" /> <img src="~/assets/img/common/icon-jump.png" />
</div> </div>
<div <div class="home-pick-new__products flex">
@click="onJumpGoodsDetal(newGoodsOne.id)"
class="home-pick-new__products flex"
>
<!-- 左侧商品 --> <!-- 左侧商品 -->
<div class="pick-new-products__left"> <div
@click="onJumpGoodsDetal(newGoodsOne.id)"
class="pick-new-products__left"
>
<img <img
:src="newGoodsOne.mainPicture" :src="newGoodsOne.mainPicture"
class="new-products-left__cover" class="new-products-left__cover"

@ -239,6 +239,7 @@ export default {
this.seckillStatus === SECKILL_STATUS.GOING this.seckillStatus === SECKILL_STATUS.GOING
) { ) {
this.seckillEndVisible = true; this.seckillEndVisible = true;
this.$store.commit("setSeckillTabVisible", false);
return; return;
} }

@ -7,12 +7,15 @@
*/ */
import { TOKEN_KEY } from "@/constants"; import { TOKEN_KEY } from "@/constants";
import { ApiGetCurrentUser, ApiPostLogout } from "@/plugins/api/account"; import { ApiGetCurrentUser, ApiPostLogout } from "@/plugins/api/account";
import { ApiGetCartList } from "@/plugins/api/cart";
const ONE_DAY = 86400000; // 一天的毫秒数 24 * 60 * 60 * 1000; const ONE_DAY = 86400000; // 一天的毫秒数 24 * 60 * 60 * 1000;
const state = () => ({ const state = () => ({
token: "", token: "",
userInfo: {}, userInfo: {},
loginVisible: false, // 是否展示登录弹窗 loginVisible: false, // 是否展示登录弹窗
seckillTabVisible: false, // 公共头是否展示秒杀tab
cartProducts: [], // 购物车列表
}); });
const mutations = { const mutations = {
setUserInfo(state, info) { setUserInfo(state, info) {
@ -33,6 +36,12 @@ const mutations = {
setLoginVisible(state, visible) { setLoginVisible(state, visible) {
state.loginVisible = visible; state.loginVisible = visible;
}, },
setSeckillTabVisible(state, visible) {
state.seckillTabVisible = visible;
},
setCartProducts(state, val) {
state.cartProducts = val;
},
}; };
const actions = { const actions = {
async nuxtServerInit({ state, commit, dispatch }) { async nuxtServerInit({ state, commit, dispatch }) {
@ -54,6 +63,14 @@ const actions = {
await ApiPostLogout(); await ApiPostLogout();
commit("setLoginOut"); commit("setLoginOut");
}, },
// 获取购物车数据
async getCartProducts({ commit }) {
const { result } = await ApiGetCartList();
if (result) {
commit("setCartProducts", result);
}
},
}; };
export { state, mutations, actions }; export { state, mutations, actions };

Loading…
Cancel
Save