|
@@ -1,45 +1,61 @@
|
|
<template>
|
|
<template>
|
|
- <div>
|
|
|
|
|
|
+ <div
|
|
|
|
+ class="padding-bottom-94">
|
|
<!--轮播图-->
|
|
<!--轮播图-->
|
|
- <Banner/>
|
|
|
|
|
|
+ <Banner
|
|
|
|
+ :arrBanner="goodsCarouselPictures"/>
|
|
<!--价格信息-->
|
|
<!--价格信息-->
|
|
<div class="main">
|
|
<div class="main">
|
|
<div class="header">
|
|
<div class="header">
|
|
<div class="price-wrap">
|
|
<div class="price-wrap">
|
|
<p class="price">
|
|
<p class="price">
|
|
<span>¥</span>
|
|
<span>¥</span>
|
|
- <span>129</span>
|
|
|
|
|
|
+ <span>{{ goodsInfo.price && goodsInfo.price.toFixed(2) }}</span>
|
|
</p>
|
|
</p>
|
|
<p class="origin">券后价</p>
|
|
<p class="origin">券后价</p>
|
|
</div>
|
|
</div>
|
|
<div class="income">
|
|
<div class="income">
|
|
<span>预估收益 ¥</span>
|
|
<span>预估收益 ¥</span>
|
|
- <span>44.77</span>
|
|
|
|
|
|
+ <span>{{ goodsInfo.commission && goodsInfo.commission.toFixed(2) }}</span>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
- <p class="origin-price">原价¥ 599</p>
|
|
|
|
|
|
+ <p class="origin-price">原价¥ {{ goodsInfo.market_price && goodsInfo.market_price.toFixed(2) }}</p>
|
|
<div
|
|
<div
|
|
class="name-wrap">
|
|
class="name-wrap">
|
|
- <img src="" alt="">
|
|
|
|
- <p>这是名字这是名字这是名字这是名字这是名字这是名这是名字这是名字这是名字这是名字这是名字这是名</p>
|
|
|
|
|
|
+ <p>{{ goodsInfo.goods_name }}</p>
|
|
</div>
|
|
</div>
|
|
- <div class="coupon-wrap">
|
|
|
|
|
|
+ <div
|
|
|
|
+ class="coupon-wrap"
|
|
|
|
+ v-if="couponInfo.fav > 0">
|
|
<div>
|
|
<div>
|
|
- <p class="amount">333元优惠券</p>
|
|
|
|
- <p class="expires">10月20日-11月11日</p>
|
|
|
|
|
|
+ <p class="amount">{{ couponInfo.fav }}元优惠券</p>
|
|
|
|
+ <p class="expires">{{
|
|
|
|
+ couponInfo.use_begin_time.replace(/\s\d{2}|:\d{2}/g, '').replace('-', '年').replace('-', '月') + '日'
|
|
|
|
+ }}-{{
|
|
|
|
+ couponInfo.use_end_time.replace(/\s\d{2}|:\d{2}/g, '').replace('-', '年').replace('-', '月') + '日'
|
|
|
|
+ }}</p>
|
|
</div>
|
|
</div>
|
|
<van-button type="default">立即领券</van-button>
|
|
<van-button type="default">立即领券</van-button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
+ <!--商品详情图片-->
|
|
|
|
+ <div
|
|
|
|
+ class="photo-list">
|
|
|
|
+ <img
|
|
|
|
+ v-lazy="str"
|
|
|
|
+ alt=""
|
|
|
|
+ v-for="(str, index) in goodsDetailPictures"
|
|
|
|
+ :key="index">
|
|
|
|
+ </div>
|
|
<!--底部按钮-->
|
|
<!--底部按钮-->
|
|
<div class="footer">
|
|
<div class="footer">
|
|
<a href="javascript:;">
|
|
<a href="javascript:;">
|
|
<span>分享赚</span>
|
|
<span>分享赚</span>
|
|
- <span>¥99999.79</span>
|
|
|
|
|
|
+ <span>¥{{ goodsInfo.commission }}</span>
|
|
</a>
|
|
</a>
|
|
<a href="javascript:;">
|
|
<a href="javascript:;">
|
|
<span>自购省</span>
|
|
<span>自购省</span>
|
|
- <span>券¥99999.79 + ¥99999999.79</span>
|
|
|
|
|
|
+ <span>券¥{{ couponInfo.fav }} + ¥{{ goodsInfo.commission }}</span>
|
|
</a>
|
|
</a>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
@@ -47,21 +63,65 @@
|
|
|
|
|
|
<script>
|
|
<script>
|
|
import Banner from './child/banner'
|
|
import Banner from './child/banner'
|
|
-import { Button } from 'vant'
|
|
|
|
|
|
+import { Button, Toast } from 'vant'
|
|
|
|
+import { apiGoodsDetail } from './api/api'
|
|
|
|
|
|
export default {
|
|
export default {
|
|
name: 'index',
|
|
name: 'index',
|
|
components: {
|
|
components: {
|
|
Banner,
|
|
Banner,
|
|
'van-button': Button
|
|
'van-button': Button
|
|
|
|
+ },
|
|
|
|
+ props: {
|
|
|
|
+ source: {
|
|
|
|
+ type: String,
|
|
|
|
+ default: ''
|
|
|
|
+ },
|
|
|
|
+ goodsId: {
|
|
|
|
+ type: [String, Number],
|
|
|
|
+ default: ''
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ data () {
|
|
|
|
+ return {
|
|
|
|
+ goodsInfo: {},
|
|
|
|
+ couponInfo: {}, // 优惠券相关
|
|
|
|
+ goodsCarouselPictures: [], // 商品轮播图
|
|
|
|
+ goodsDetailPictures: [] // 商品详情图片
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ created () {
|
|
|
|
+ this.funInit()
|
|
|
|
+ },
|
|
|
|
+ methods: {
|
|
|
|
+ async funInit () {
|
|
|
|
+ try {
|
|
|
|
+ const { status, data, msg } = await apiGoodsDetail(this.source, this.goodsId)
|
|
|
|
+ if (status) {
|
|
|
|
+ this.goodsInfo = data
|
|
|
|
+ this.couponInfo = data.coupon_info
|
|
|
|
+ if (Array.isArray(data.goods_carousel_pictures)) {
|
|
|
|
+ this.goodsCarouselPictures = data.goods_carousel_pictures
|
|
|
|
+ }
|
|
|
|
+ if (Array.isArray(data.goods_detail_pictures)) {
|
|
|
|
+ this.goodsDetailPictures = data.goods_detail_pictures
|
|
|
|
+ }
|
|
|
|
+ } else {
|
|
|
|
+ Toast(msg)
|
|
|
|
+ }
|
|
|
|
+ } catch (e) {}
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
</script>
|
|
</script>
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
<style lang="scss" scoped>
|
|
|
|
+.padding-bottom-94 {
|
|
|
|
+ padding-bottom: 94px;
|
|
|
|
+}
|
|
|
|
+
|
|
.main {
|
|
.main {
|
|
- width: 365px;
|
|
|
|
- padding-bottom: 120px;
|
|
|
|
|
|
+ width: 355px;
|
|
margin: 0 auto;
|
|
margin: 0 auto;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -137,7 +197,7 @@ export default {
|
|
}
|
|
}
|
|
|
|
|
|
.name-wrap {
|
|
.name-wrap {
|
|
- margin-top: 10px;
|
|
|
|
|
|
+ margin: 10px 0 14px;
|
|
overflow: hidden;
|
|
overflow: hidden;
|
|
|
|
|
|
img {
|
|
img {
|
|
@@ -161,7 +221,6 @@ export default {
|
|
justify-content: flex-end;
|
|
justify-content: flex-end;
|
|
width: 359px;
|
|
width: 359px;
|
|
height: 84px;
|
|
height: 84px;
|
|
- margin-top: 14px;
|
|
|
|
background: url("./image/ic_coupon_big.png") center center/100% 100% no-repeat;
|
|
background: url("./image/ic_coupon_big.png") center center/100% 100% no-repeat;
|
|
|
|
|
|
& > div {
|
|
& > div {
|
|
@@ -244,4 +303,15 @@ export default {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+.photo-list {
|
|
|
|
+ margin-top: 14px;
|
|
|
|
+
|
|
|
|
+ img {
|
|
|
|
+ display: block;
|
|
|
|
+ width: 100%;
|
|
|
|
+ max-width: 800px;
|
|
|
|
+ margin: 0 auto;
|
|
|
|
+ }
|
|
|
|
+}
|
|
</style>
|
|
</style>
|