|
|
@@ -6,13 +6,15 @@ |
|
|
|
<view class="image-wrapper"> |
|
|
|
<image :src="item" class="loaded" @click="previewImage(index)" mode="aspectFill"></image> |
|
|
|
</view> |
|
|
|
</swiper-item> |
|
|
|
</swiper-item> |
|
|
|
</swiper> |
|
|
|
</view> |
|
|
|
|
|
|
|
<!-- 秒杀的话才显示 --> |
|
|
|
<view class="flash" v-if="flash"> |
|
|
|
<view class="sales_price" v-if="product.market_price"><view class="symbol">¥</view>{{specProduct.sales_price}}</view> |
|
|
|
<view class="sales_price" v-if="product.market_price"> |
|
|
|
<view class="symbol">¥</view>{{specProduct.sales_price}} |
|
|
|
</view> |
|
|
|
<view class="left" v-if="product.market_price"> |
|
|
|
<view class="market_price">¥{{specProduct.market_price}}</view> |
|
|
|
<view class="sold" v-if="progress.number">秒{{progress.number}}件</view> |
|
|
@@ -20,29 +22,14 @@ |
|
|
|
<view class="right"> |
|
|
|
<view class="time" v-if="countdown && progress.number != progress.sold"> |
|
|
|
{{product.flash.text}} |
|
|
|
<uni-countdown |
|
|
|
ref="countd" |
|
|
|
:showDay="countdown.day > 0 ? true : false" |
|
|
|
:day="countdown.day" |
|
|
|
:hour="countdown.hour" |
|
|
|
:minute="countdown.minute" |
|
|
|
:second="countdown.second" |
|
|
|
@timeup="timeup" |
|
|
|
color="#fffa30" |
|
|
|
borderWidth="22rpx" |
|
|
|
splitorColor="#fffa30" |
|
|
|
background-color="#282f2c00" |
|
|
|
border-color="#00B26A"></uni-countdown> |
|
|
|
<uni-countdown ref="countd" :showDay="countdown.day > 0 ? true : false" :day="countdown.day" :hour="countdown.hour" |
|
|
|
:minute="countdown.minute" :second="countdown.second" @timeup="timeup" color="#fffa30" borderWidth="22rpx" |
|
|
|
splitorColor="#fffa30" background-color="#282f2c00" border-color="#00B26A"></uni-countdown> |
|
|
|
</view> |
|
|
|
<view class="time" v-else :class="{'flashDone': progress.number == false}">抢购已结束</view> |
|
|
|
<view class="progress" v-if="progress.number"> |
|
|
|
<ProgressBar |
|
|
|
class="ProgressBar" |
|
|
|
:Sold="progress.sold" |
|
|
|
:widthUpx="250" |
|
|
|
:Width="percentage(progress.number, progress.sold)" |
|
|
|
Type="candy" |
|
|
|
:Vice="true"></ProgressBar> |
|
|
|
<ProgressBar class="ProgressBar" :Sold="progress.sold" :widthUpx="250" :Width="percentage(progress.number, progress.sold)" |
|
|
|
Type="candy" :Vice="true"></ProgressBar> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
@@ -150,7 +137,10 @@ |
|
|
|
</view> |
|
|
|
|
|
|
|
<view class="action-btn-group" v-if="countdown && progress.number != progress.sold"> |
|
|
|
<button :class="{'only': flash}" type="primary" class=" action-btn no-border buy-now-btn" @click="buy">Buy Now</button> |
|
|
|
<button v-if="product.flash.text=='距开始:'" :class="{'only': flash}" type="primary" disabled class=" action-btn-gray action-btn no-border buy-now-btn">Buy |
|
|
|
Now</button> |
|
|
|
<button v-else :class="{'only': flash}" type="primary" class=" action-btn no-border buy-now-btn" @click="buy">Buy |
|
|
|
Now</button> |
|
|
|
<!-- <button v-if="!flash" type="primary" class=" action-btn no-border add-cart-btn" @click="addCart">加入购物车</button> --> |
|
|
|
</view> |
|
|
|
<view class="p-b-btn" v-else> |
|
|
@@ -164,7 +154,7 @@ |
|
|
|
<!-- 遮罩层 --> |
|
|
|
<view class="mask"></view> |
|
|
|
<view class="layer attr-content content-coupon" @click.stop="stopPrevent"> |
|
|
|
|
|
|
|
|
|
|
|
<!-- 优惠券页面,仿mt --> |
|
|
|
<view class="coupon-item" v-for="(item, index) in product.coupon" :key="index"> |
|
|
|
<view class="con"> |
|
|
@@ -237,7 +227,7 @@ |
|
|
|
}, |
|
|
|
computed: { |
|
|
|
...mapGetters(['userInfo', 'hasLogin']), |
|
|
|
|
|
|
|
|
|
|
|
specSelectedName() { |
|
|
|
return this.specSelected.join(' '); |
|
|
|
}, |
|
|
@@ -283,17 +273,17 @@ |
|
|
|
flash: false, |
|
|
|
id: false, |
|
|
|
countdown: {}, |
|
|
|
progress:{ |
|
|
|
sold:1, |
|
|
|
number:1 |
|
|
|
progress: { |
|
|
|
sold: 1, |
|
|
|
number: 1 |
|
|
|
} |
|
|
|
}; |
|
|
|
}, |
|
|
|
onPullDownRefresh(){ |
|
|
|
onPullDownRefresh() { |
|
|
|
if (this.$refs && this.$refs.countd) { |
|
|
|
this.$refs.countd.syncFlag = false; |
|
|
|
} |
|
|
|
this.getDetail(this.id, this.flash?this.flash:0); |
|
|
|
this.getDetail(this.id, this.flash ? this.flash : 0); |
|
|
|
}, |
|
|
|
onShareAppMessage(e) { |
|
|
|
return { |
|
|
@@ -310,8 +300,8 @@ |
|
|
|
}, |
|
|
|
methods: { |
|
|
|
// 为0时刷新页面 |
|
|
|
timeup(){ |
|
|
|
this.getDetail(this.id, this.flash?this.flash:0); |
|
|
|
timeup() { |
|
|
|
this.getDetail(this.id, this.flash ? this.flash : 0); |
|
|
|
}, |
|
|
|
// 获取商品详情 |
|
|
|
async getDetail(id, flash_id) { |
|
|
@@ -319,7 +309,7 @@ |
|
|
|
let product = await this.$api.request(apiUrl + `?id=${id}&flash_id=${flash_id}`, 'GET'); |
|
|
|
uni.stopPullDownRefresh(); |
|
|
|
if (!product) { |
|
|
|
setTimeout(function(){ |
|
|
|
setTimeout(function() { |
|
|
|
uni.navigateBack(); |
|
|
|
}, 3000); |
|
|
|
return; |
|
|
@@ -333,7 +323,7 @@ |
|
|
|
if (this.product.use_spec) { |
|
|
|
let specList = this.product.spec_list; |
|
|
|
let specTableList = this.product.spec_table_list; |
|
|
|
|
|
|
|
|
|
|
|
let e = 1; |
|
|
|
let ee = 1; |
|
|
|
let specChildList = []; |
|
|
@@ -352,7 +342,7 @@ |
|
|
|
this.specTableList = specTableList; |
|
|
|
//console.log(this.specList) |
|
|
|
//console.log(specChildList) |
|
|
|
|
|
|
|
|
|
|
|
//规格 默认选中第一条 |
|
|
|
this.specSelected = []; |
|
|
|
this.specList.forEach(item => { |
|
|
@@ -444,7 +434,7 @@ |
|
|
|
url = url + `&flash_id=${this.flash}`; |
|
|
|
} |
|
|
|
uni.navigateTo({ |
|
|
|
url:url |
|
|
|
url: url |
|
|
|
}); |
|
|
|
} |
|
|
|
}, |
|
|
@@ -457,10 +447,10 @@ |
|
|
|
let is_login = await this.$api.checkLogin(); |
|
|
|
if (is_login) { |
|
|
|
let spec = ''; |
|
|
|
if(this.product.use_spec == 1) { |
|
|
|
if (this.product.use_spec == 1) { |
|
|
|
spec = this.specSelected.join(','); |
|
|
|
} |
|
|
|
let data = await this.$api.request('/cart/add?id=' + this.product.product_id + '&spec='+ spec); |
|
|
|
let data = await this.$api.request('/cart/add?id=' + this.product.product_id + '&spec=' + spec); |
|
|
|
if (data) { |
|
|
|
this.product.cart_num++; |
|
|
|
} |
|
|
@@ -475,11 +465,11 @@ |
|
|
|
return parseInt(sold / number * 100); |
|
|
|
}, |
|
|
|
// 查看图片 |
|
|
|
previewImage(index){ |
|
|
|
previewImage(index) { |
|
|
|
uni.previewImage({ |
|
|
|
current:this.product.images_text[index], |
|
|
|
urls:this.product.images_text, |
|
|
|
indicator:"number", |
|
|
|
current: this.product.images_text[index], |
|
|
|
urls: this.product.images_text, |
|
|
|
indicator: "number", |
|
|
|
loop: true |
|
|
|
}) |
|
|
|
} |
|
|
@@ -749,7 +739,7 @@ |
|
|
|
font-size: $font-base; |
|
|
|
color: $font-color-base; |
|
|
|
padding-left: 26upx; |
|
|
|
|
|
|
|
|
|
|
|
.con { |
|
|
|
font-size: $font-base; |
|
|
|
color: $font-color-dark; |
|
|
@@ -769,6 +759,7 @@ |
|
|
|
.detail-desc { |
|
|
|
background: #fff; |
|
|
|
margin-top: 16upx; |
|
|
|
|
|
|
|
.d-header { |
|
|
|
display: flex; |
|
|
|
justify-content: center; |
|
|
@@ -1001,9 +992,9 @@ |
|
|
|
width: 96upx; |
|
|
|
height: 80upx; |
|
|
|
position: relative; |
|
|
|
|
|
|
|
|
|
|
|
/* 购物车数量 */ |
|
|
|
.cart-count{ |
|
|
|
.cart-count { |
|
|
|
border: 4rpx solid #fa436a; |
|
|
|
width: 40rpx; |
|
|
|
height: 40rpx; |
|
|
@@ -1038,9 +1029,9 @@ |
|
|
|
background: linear-gradient(to right, #ffac30, #fa436a, #F56C6C); |
|
|
|
margin-left: 20upx; |
|
|
|
position: relative; |
|
|
|
|
|
|
|
|
|
|
|
.only { |
|
|
|
width: 360rpx!important; |
|
|
|
width: 360rpx !important; |
|
|
|
} |
|
|
|
|
|
|
|
&:after { |
|
|
@@ -1054,6 +1045,13 @@ |
|
|
|
border-right: 1px solid rgba(255, 255, 255, .5); |
|
|
|
} |
|
|
|
|
|
|
|
.action-btn-gray { |
|
|
|
filter: grayscale(10%) !important; |
|
|
|
color: #c5c8ce !important; |
|
|
|
background-color: #f7f7f7 !important; |
|
|
|
border-color: #dcdee2!important; |
|
|
|
} |
|
|
|
|
|
|
|
.action-btn { |
|
|
|
display: flex; |
|
|
|
align-items: center; |
|
|
@@ -1066,90 +1064,103 @@ |
|
|
|
background: transparent; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
.flash { |
|
|
|
height: 100upx; |
|
|
|
background: linear-gradient(to right, #ffac30, #fa436a, #F56C6C); |
|
|
|
display: flex; |
|
|
|
flex-direction: row; |
|
|
|
position: relative; |
|
|
|
.sales_price{ |
|
|
|
.symbol{ |
|
|
|
|
|
|
|
.sales_price { |
|
|
|
.symbol { |
|
|
|
font-size: 30upx; |
|
|
|
display: inline; |
|
|
|
} |
|
|
|
|
|
|
|
color: #fff; |
|
|
|
font-size: 50upx; |
|
|
|
} |
|
|
|
.left{ |
|
|
|
|
|
|
|
.left { |
|
|
|
font-size: 28upx; |
|
|
|
padding: 10upx; |
|
|
|
.market_price{ |
|
|
|
|
|
|
|
.market_price { |
|
|
|
color: #DCDFE6; |
|
|
|
text-decoration: line-through; |
|
|
|
} |
|
|
|
.sold{ |
|
|
|
|
|
|
|
.sold { |
|
|
|
color: #E4E7ED; |
|
|
|
} |
|
|
|
} |
|
|
|
.right{ |
|
|
|
|
|
|
|
.right { |
|
|
|
height: 100%; |
|
|
|
width: 300upx; |
|
|
|
position: absolute; |
|
|
|
right: 0; |
|
|
|
padding: 4upx; |
|
|
|
margin-right: 20upx; |
|
|
|
.time{ |
|
|
|
|
|
|
|
.time { |
|
|
|
font-size: 30upx; |
|
|
|
color: #fffa30; |
|
|
|
text-align: center; |
|
|
|
.uni-countdown{ |
|
|
|
|
|
|
|
.uni-countdown { |
|
|
|
display: inline-flex; |
|
|
|
} |
|
|
|
} |
|
|
|
.progress{ |
|
|
|
|
|
|
|
.progress { |
|
|
|
position: absolute; |
|
|
|
bottom: 7rpx; |
|
|
|
right: 10upx; |
|
|
|
} |
|
|
|
.flashDone{ |
|
|
|
|
|
|
|
.flashDone { |
|
|
|
font-size: 40rpx; |
|
|
|
height: 90rpx; |
|
|
|
line-height: 90rpx; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* 优惠券列表 */ |
|
|
|
.content-coupon{ |
|
|
|
.content-coupon { |
|
|
|
padding-bottom: 100rpx; |
|
|
|
max-height: 800rpx; |
|
|
|
overflow: auto; |
|
|
|
} |
|
|
|
.retract{ |
|
|
|
|
|
|
|
.retract { |
|
|
|
position: fixed; |
|
|
|
bottom: 0; |
|
|
|
width: 700rpx; |
|
|
|
z-index: 100; |
|
|
|
margin: 20rpx 25rpx; |
|
|
|
color:#ffffff; |
|
|
|
color: #ffffff; |
|
|
|
background: #fa436a; |
|
|
|
} |
|
|
|
|
|
|
|
.coupon-item { |
|
|
|
display: flex; |
|
|
|
flex-direction: column; |
|
|
|
background: #fff; |
|
|
|
|
|
|
|
|
|
|
|
.con { |
|
|
|
display: flex; |
|
|
|
align-items: center; |
|
|
|
position: relative; |
|
|
|
height: 120upx; |
|
|
|
padding: 0 30upx; |
|
|
|
|
|
|
|
|
|
|
|
&:after { |
|
|
|
position: absolute; |
|
|
|
left: 0; |
|
|
@@ -1161,7 +1172,7 @@ |
|
|
|
transform: scaleY(50%); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
.left { |
|
|
|
display: flex; |
|
|
|
flex-direction: column; |
|
|
@@ -1170,18 +1181,18 @@ |
|
|
|
overflow: hidden; |
|
|
|
height: 100upx; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
.title { |
|
|
|
font-size: 32upx; |
|
|
|
color: $font-color-dark; |
|
|
|
margin-bottom: 10upx; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
.time { |
|
|
|
font-size: 24upx; |
|
|
|
color: $font-color-light; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
.right { |
|
|
|
display: flex; |
|
|
|
flex-direction: column; |
|
|
@@ -1191,24 +1202,24 @@ |
|
|
|
color: $font-color-base; |
|
|
|
height: 100upx; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
.price { |
|
|
|
font-size: 44upx; |
|
|
|
color: $base-color; |
|
|
|
|
|
|
|
|
|
|
|
&:before { |
|
|
|
content: '¥'; |
|
|
|
font-size: 34upx; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
.tips { |
|
|
|
font-size: 24upx; |
|
|
|
color: $font-color-light; |
|
|
|
line-height: 60upx; |
|
|
|
padding-left: 30upx; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
.circle { |
|
|
|
position: absolute; |
|
|
|
left: -6upx; |
|
|
@@ -1218,7 +1229,7 @@ |
|
|
|
height: 20upx; |
|
|
|
background: #f3f3f3; |
|
|
|
border-radius: 100px; |
|
|
|
|
|
|
|
|
|
|
|
&.r { |
|
|
|
left: auto; |
|
|
|
right: -6upx; |
|
|
|