Merge branch 'feature/task1.0.0-0507-zz' into feature/task1.0.0-0505-ch

merge-requests/32/merge
ch 3 years ago
commit 303e9e1d28

Binary file not shown.

After

Width:  |  Height:  |  Size: 728 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 553 B

@ -10,9 +10,9 @@
<div class="address__msg-line flex flex-middle"> <div class="address__msg-line flex flex-middle">
<span class="address__msg-line--type">收货地址:</span> <span class="address__msg-line--type">收货地址:</span>
<span class="address__msg-line--txt">{{ <span class="address__msg-line--txt">{{
curAddressListItem.area +
curAddressListItem.city +
curAddressListItem.province + curAddressListItem.province +
curAddressListItem.city +
curAddressListItem.area +
curAddressListItem.detailAddress curAddressListItem.detailAddress
}}</span> }}</span>
</div> </div>

@ -0,0 +1,81 @@
<template>
<div class="chosen">
<div class="chosen-title flex flex-between flex-middle">
<h3 class="chosen-title--txt">为你精选</h3>
<div class="chosen-title--btn flex" @click="getRecommendedGoodsList()">
<img src="@/assets/img/goods/each.png" alt="切换推荐" />
<span>换一组</span>
</div>
</div>
<div class="chosen-list">
<UiGoodsItem
:item="item"
v-for="item in recommendedData"
:key="item.id"
></UiGoodsItem>
</div>
</div>
</template>
<script>
import { ApiGetRecommendedGoodsList } from "@/plugins/api/goods";
import UiGoodsItem from "@/components/UiGoodsItem.vue";
export default {
components: { UiGoodsItem },
data() {
return {
recommendedData: [],
};
},
created() {
this.getRecommendedGoodsList();
},
methods: {
async getRecommendedGoodsList() {
let vm = this;
let res = await ApiGetRecommendedGoodsList();
vm.recommendedData = res.result;
},
},
};
</script>
<style lang="scss" scoped>
.chosen {
width: 100%;
padding: 30px 0 40px;
background: #f8f8f8;
&-title {
@include layout-box;
&--txt {
font-size: 24px;
font-family: Microsoft YaHei-Bold, Microsoft YaHei;
font-weight: bold;
color: #333333;
}
&--btn {
width: 140px;
cursor: pointer;
img {
width: 27px;
height: 27px;
margin-right: 5px;
}
span {
font-size: 18px;
font-family: Microsoft YaHei-Regular, Microsoft YaHei;
font-weight: 400;
color: #999999;
}
}
}
&-list {
@include layout-box;
padding-top: 40px;
display: grid;
grid-template-columns: repeat(auto-fill, 232px);
justify-content: space-between;
grid-row-gap: 10px;
}
}
</style>

@ -199,10 +199,6 @@ export default {
tabPath: "/", tabPath: "/",
tabList: [ tabList: [
{ label: "首页", value: "/" }, { label: "首页", value: "/" },
{
label: "爆款推荐",
value: `/goods/list?id=recommend`,
},
{ {
label: "开发书籍", label: "开发书籍",
value: `/goods/list?id=6&levelType=${CATEGROY_LEVEL.ONE}`, value: `/goods/list?id=6&levelType=${CATEGROY_LEVEL.ONE}`,

@ -23,9 +23,9 @@
<el-table-column label="收货地址" width="430px"> <el-table-column label="收货地址" width="430px">
<template slot-scope="scope"> <template slot-scope="scope">
{{ {{
scope.row.area +
scope.row.city +
scope.row.province + scope.row.province +
scope.row.city +
scope.row.area +
scope.row.detailAddress scope.row.detailAddress
}} }}
</template> </template>

@ -11,7 +11,7 @@
Java从入门到项目实战 Java从入门到项目实战
</p> </p>
</nav> </nav>
<main class="main flex"> <main class="main flex" v-if="detailData.isEnable">
<aside class="main__preview"> <aside class="main__preview">
<img <img
class="main__preview-big" class="main__preview-big"
@ -56,9 +56,24 @@
{{ detailData.name }} {{ detailData.name }}
</p> </p>
<div class="main__details-msg"> <div class="main__details-msg">
<div class="main__details-msg--price flex"> <div class="main__details-msg--price flex flex-middle">
<span class="msg-txt">售价</span> <span class="msg-txt">售价</span>
<UiMoney :money="detailData.startingPrice"></UiMoney> <UiMoney :money="detailData.startingPrice"></UiMoney>
<div
v-if="
detailData.productActivityVO.isActivity &&
!detailData.productActivityVO.isStartActivity
"
class="main__details-msg--skill flex flex-column flex-bottom"
>
<span class="skill-txt">即将开始秒杀</span>
<div class="skill-2" v-if="isToday()">
<span>08</span>
<span>08</span>
<span>08</span>
</div>
<span class="skill-1" v-else>{{ getBeginTime() }}</span>
</div>
</div> </div>
<div class="hr"></div> <div class="hr"></div>
<div class="main__details-msg--service flex flex-middle"> <div class="main__details-msg--service flex flex-middle">
@ -73,7 +88,7 @@
/> />
</div> </div>
</div> </div>
<div class="main__details-option"> <div class="main__details-option" v-if="skuData.stock">
<div <div
class="main__details-option--line flex flex-middle" class="main__details-option--line flex flex-middle"
v-for="(item, index) in detailData.attributeGroupList" v-for="(item, index) in detailData.attributeGroupList"
@ -94,6 +109,16 @@
> >
</div> </div>
</div> </div>
<div class="main__details-option--line flex flex-middle">
<span class="line-txt">数量</span>
<div class="line-btns">
<el-input-number v-model="curBuyNum" :min="1"></el-input-number>
</div>
</div>
</div>
<div class="main__details-none flex flex-middle" v-else>
<img src="@/assets/img/goods/tips.png" alt="" />
<span>此商品暂无库存啦~看看其他的吧</span>
</div> </div>
<div class="main__details-pay"> <div class="main__details-pay">
<UiButton type="yellow_line">加入购物车</UiButton> <UiButton type="yellow_line">加入购物车</UiButton>
@ -102,7 +127,11 @@
</article> </article>
</main> </main>
<section class="section flex"> <main v-else class="main">
<img class="main-none-img" src="@/assets/img/goods/none.png" alt="" />
<p class="main-none-txt">商品已下架啦去逛逛别的吧~</p>
</main>
<section class="section flex" v-if="detailData.isEnable">
<div class="section-recommend"> <div class="section-recommend">
<p class="section-title">看了又看</p> <p class="section-title">看了又看</p>
<UiGoodsItem <UiGoodsItem
@ -113,22 +142,32 @@
</div> </div>
<div class="section-details"> <div class="section-details">
<p class="section-title">商品详情</p> <p class="section-title">商品详情</p>
<div class="rich" v-html="detailData.detail"></div> <div
class="rich"
v-html="detailData.detail"
v-if="detailData.detail"
></div>
<div class="section-details--none" v-else>
<img src="@/assets/img/goods/none.png" alt="" />
<p>暂无详情</p>
</div>
</div> </div>
</section> </section>
<UiChosen v-else></UiChosen>
</div> </div>
</template> </template>
<script> <script>
import UiMoney from "@/components/UiMoney.vue"; import UiMoney from "@/components/UiMoney.vue";
import UiButton from "@/components/UiButton.vue"; import UiButton from "@/components/UiButton.vue";
import UiGoodsItem from "@/components/UiGoodsItem.vue"; import UiGoodsItem from "@/components/UiGoodsItem.vue";
import UiChosen from "@/components/UiChosen.vue";
import { import {
ApiGetGoodsDetail, ApiGetGoodsDetail,
ApiGetGoodsSkus, ApiGetGoodsSkus,
ApiGetRecommendedGoodsList, ApiGetRecommendedGoodsList,
} from "@/plugins/api/goods"; } from "@/plugins/api/goods";
export default { export default {
componetns: { UiMoney, UiButton, UiGoodsItem }, componetns: { UiMoney, UiButton, UiGoodsItem, UiChosen },
data() { data() {
return { return {
curBuyNum: 1, curBuyNum: 1,
@ -136,8 +175,11 @@ export default {
recommendedData: [], recommendedData: [],
skuData: {}, skuData: {},
detailData: { detailData: {
isEnable: false,
pictureList: [], pictureList: [],
productActivityVO: {},
}, },
surplus: {},
}; };
}, },
async created() { async created() {
@ -149,9 +191,6 @@ export default {
vm.detailData = res1.result; vm.detailData = res1.result;
vm.skuData = res2.result; vm.skuData = res2.result;
vm.recommendedData = res3.result; vm.recommendedData = res3.result;
console.log(`res1`, res1.result);
console.log(`res2`, res2.result);
console.log(`res3`, res3.result);
}, },
computed: { computed: {
/** /**
@ -185,6 +224,68 @@ export default {
}, },
}, },
methods: { methods: {
/* 获取倒计时 */
getSurplus(startTime, endTime) {
let nowtime = new Date(startTime), //
endtime = new Date(endTime); //
let leftObj = {};
leftObj["lefttime"] = endtime.getTime() - nowtime.getTime(); //
leftObj["leftd"] = Math.floor(
leftObj["lefttime"] / (1000 * 60 * 60 * 24)
); //
leftObj["lefth"] = Math.floor(
(leftObj["lefttime"] / (1000 * 60 * 60)) % 24
); //
leftObj["leftm"] = Math.floor((leftObj["lefttime"] / (1000 * 60)) % 60); //
leftObj["lefts"] = Math.floor((leftObj["lefttime"] / 1000) % 60); //
return leftObj;
},
setSurplus() {
let vm = this;
let startTime = new Date(
vm.detailData.productActivityVO.currentTime
).getTime();
let endTime = new Date(
vm.detailData.productActivityVO.activityEndTime
).getTime();
vm.surplus = getSurplus(startTime, endTime);
if (vm.timer) {
return false;
}
vm.timer = setInterval(() => {
vm.startTime += 1000;
vm.surplus = getSurplus(vm.startTime, vm.endTime);
if (vm.surplus.lefttime <= 0) {
clearInterval(vm.timer);
location.reload();
}
}, 1000);
},
isToday() {
let vm = this;
let begin = new Date(
vm.detailData.productActivityVO.activityStartTime
).getTime();
let now = new Date(vm.detailData.productActivityVO.currentTime).getTime();
if (new Date(begin).toDateString() === new Date(now).toDateString()) {
return true;
} else if (new Date(begin) < new Date()) {
return false;
}
},
getBeginTime() {
let vm = this;
let begin = new Date(
vm.detailData.productActivityVO.activityStartTime
).getTime();
let timestr = new Date(begin);
let month = timestr.getMonth() + 1;
let date = timestr.getDate();
let hour = timestr.getHours();
let minute = timestr.getMinutes();
let datetime = `${month}${date}${hour}:${minute} 开始`;
return datetime;
},
onActiveImg(i) { onActiveImg(i) {
this.activeImg = i; this.activeImg = i;
}, },
@ -411,6 +512,34 @@ export default {
&--price { &--price {
padding-bottom: 30px; padding-bottom: 30px;
} }
&--skill {
margin-left: auto;
.skill-1 {
font-size: 16px;
font-family: PingFang SC-常规体, PingFang SC;
font-weight: normal;
color: #e83710;
}
.skill-2 {
margin-top: 6px;
span {
display: inline-block;
width: 22px;
height: 22px;
background: #e83710;
border-radius: 2px;
font-size: 14px;
font-family: PingFang SC-常规体, PingFang SC;
font-weight: normal;
color: #ffffff;
text-align: center;
line-height: 22px;
}
}
}
.hr { .hr {
width: 673px; width: 673px;
height: 1px; height: 1px;
@ -444,7 +573,7 @@ export default {
border-color: #ccc; border-color: #ccc;
} }
.attr-item__active { .attr-item__active {
border: 1px solid #FF512B; border: 1px solid #ff512b;
} }
.attr-item__disabled { .attr-item__disabled {
color: #999999; color: #999999;
@ -454,6 +583,27 @@ export default {
} }
} }
&-none {
width: 713px;
height: 40px;
background: #f3f3f3;
margin-top: 20px;
padding: 0 20px;
img {
width: 18px;
height: 18px;
margin-right: 12px;
}
span {
font-size: 14px;
font-family: Microsoft YaHei-Regular, Microsoft YaHei;
font-weight: 400;
color: #666666;
}
}
&-pay { &-pay {
margin-top: 40px; margin-top: 40px;
button { button {
@ -470,6 +620,21 @@ export default {
} }
} }
} }
&-none-img {
display: block;
width: 228px;
height: 144px;
margin: 60px auto 20px;
}
&-none-txt {
width: 100%;
text-align: center;
font-size: 14px;
font-family: PingFang SC-常规体, PingFang SC;
font-weight: normal;
color: #999999;
margin-bottom: 50px;
}
} }
.section { .section {
width: 1200px; width: 1200px;
@ -484,6 +649,24 @@ export default {
} }
&-details { &-details {
width: 960px; width: 960px;
&--none {
img {
display: block;
width: 228px;
height: 144px;
margin: 133px auto 20px;
}
p {
width: 100%;
text-align: center;
font-size: 14px;
font-family: PingFang SC-常规体, PingFang SC;
font-weight: normal;
color: #999999;
}
}
} }
&-title { &-title {
width: 100%; width: 100%;

@ -7,11 +7,13 @@
--> -->
<template> <template>
<div class="page"> <div :class="listData && listData.length ? 'page' : ''">
<main class="main"> <main class="main" v-if="listData && listData.length">
<nav class="main__nav"> <nav class="main__nav">
<p class="main__nav-crumbs"> <p class="main__nav-crumbs">
全部商品<i class="el-icon-arrow-right"></i>开发书籍 全部商品
<i class="el-icon-arrow-right"></i>
<!-- <span v-if="levelType == 2">{{}}</span> -->
</p> </p>
<div class="main__nav-sort flex flex-middle" v-if="levelType == 1"> <div class="main__nav-sort flex flex-middle" v-if="levelType == 1">
<span class="main__nav-sort-txt">分类 :</span> <span class="main__nav-sort-txt">分类 :</span>
@ -64,6 +66,11 @@
> >
</el-pagination> </el-pagination>
</main> </main>
<main v-else class="main">
<img class="main-none-img" src="@/assets/img/goods/none.png" alt="" />
<p class="main-none-txt">没有搜到你想要的商品哦换个关键词试试</p>
</main>
<UiChosen></UiChosen>
</div> </div>
</template> </template>
<script> <script>
@ -74,11 +81,11 @@ import {
} from "@/plugins/api/goods"; } from "@/plugins/api/goods";
import Sort from "./module/SortItem.vue"; import Sort from "./module/SortItem.vue";
import UiGoodsItem from "@/components/UiGoodsItem.vue"; import UiGoodsItem from "@/components/UiGoodsItem.vue";
import UiChosen from '@/components/UiChosen.vue';
export default { export default {
components: { Sort, UiGoodsItem }, components: { Sort, UiGoodsItem,UiChosen },
data() { data() {
return { return {
isRecommend: false,
navActive: 0, navActive: 0,
levelActive: 0, levelActive: 0,
listData: [], listData: [],
@ -106,7 +113,6 @@ export default {
this.levelType = this.$route.query.levelType || ""; this.levelType = this.$route.query.levelType || "";
this.levelId = this.$route.query.id || ""; this.levelId = this.$route.query.id || "";
this.levelType == 2 ? (this.params.categoryId = this.levelId) : ""; this.levelType == 2 ? (this.params.categoryId = this.levelId) : "";
this.isRecommend = this.levelId == "recommend" ? true : false;
if (this.levelType == 1) { if (this.levelType == 1) {
this.getCategoryTwoAndGoods(); this.getCategoryTwoAndGoods();
} else { } else {
@ -265,5 +271,20 @@ export default {
color: #fff; color: #fff;
} }
} }
&-none-img {
display: block;
width: 228px;
height: 144px;
margin: 60px auto 20px;
} }
&-none-txt {
width: 100%;
text-align: center;
font-size: 14px;
font-family: PingFang SC-常规体, PingFang SC;
font-weight: normal;
color: #999999;
}
}
</style> </style>

Loading…
Cancel
Save