0000
This commit is contained in:
53
pages/goodsDetails/pageHeader/pageHeader.js
Normal file
53
pages/goodsDetails/pageHeader/pageHeader.js
Normal file
@@ -0,0 +1,53 @@
|
||||
Component({
|
||||
properties: {
|
||||
info: Object,
|
||||
formData: Array
|
||||
},
|
||||
data: {
|
||||
day: "",
|
||||
hour: "",
|
||||
minute: "",
|
||||
second: "",
|
||||
swiperHeight: 240,
|
||||
sell_times: null,
|
||||
startTime: []
|
||||
},
|
||||
observers: {
|
||||
info: function(t) {
|
||||
1 == t.status ? this.setTime() : -1 == t.status ? this.setStartTime(t.sell_times[0]) : -2 == t.status && this.setStartTime(t.sell_times[1]);
|
||||
}
|
||||
},
|
||||
timer: null,
|
||||
methods: {
|
||||
setStartTime: function(t) {
|
||||
var e = new Date(1e3 * t), i = [ e.getFullYear(), this.changeNum(e.getMonth() + 1), this.changeNum(e.getDate()) ].join("/"), s = [ this.changeNum(e.getHours()), this.changeNum(e.getMinutes()), this.changeNum(e.getSeconds()) ].join(":");
|
||||
console.log(i), console.log(s), this.setData({
|
||||
startTime: [ i, s ]
|
||||
});
|
||||
},
|
||||
changeNum: function(t) {
|
||||
return t > 9 ? t : "0" + t;
|
||||
},
|
||||
setTime: function() {
|
||||
var t = 1e3 * this.properties.info.sell_times[1] - new Date().getTime();
|
||||
if (t <= 0) clearTimeout(this.timer); else {
|
||||
var e, i, s, a, o = t / 1e3 / 3600 / 24, n = 24 * (o - (e = Math.floor(o))), r = 60 * (n - (i = Math.floor(n))), h = 60 * (r - (s = Math.floor(r)));
|
||||
a = Math.floor(h), this.setData({
|
||||
day: (e + "").padStart(2, "0"),
|
||||
hour: (i + "").padStart(2, "0"),
|
||||
minute: (s + "").padStart(2, "0"),
|
||||
second: (a + "").padStart(2, "0")
|
||||
});
|
||||
}
|
||||
setTimeout(function() {
|
||||
this.setTime();
|
||||
}.bind(this), 1e3);
|
||||
},
|
||||
load: function(t) {
|
||||
var e = wx.getSystemInfoSync().windowWidth;
|
||||
this.setData({
|
||||
swiperHeight: Math.max(e * t.detail.height / t.detail.width, this.data.swiperHeight)
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
4
pages/goodsDetails/pageHeader/pageHeader.json
Normal file
4
pages/goodsDetails/pageHeader/pageHeader.json
Normal file
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"component": true,
|
||||
"usingComponents": {}
|
||||
}
|
||||
55
pages/goodsDetails/pageHeader/pageHeader.wxml
Normal file
55
pages/goodsDetails/pageHeader/pageHeader.wxml
Normal file
@@ -0,0 +1,55 @@
|
||||
<view>
|
||||
<view class="header" style="position: relative;">
|
||||
<swiper circular="true" class="info-swiper" indicatorActiveColor="#ffffff" indicatorColor="rgba(235,237,240,0.3)" indicatorDots="true" style="height: {{swiperHeight}}px">
|
||||
<swiper-item wx:for="{{info.attachment}}" wx:for-index="i" wx:for-item="s" wx:key="i">
|
||||
<image bindload="load" class="swiper-item-img" mode="widthFix" src="{{s}}"></image>
|
||||
</swiper-item>
|
||||
</swiper>
|
||||
<view class=""></view>
|
||||
<swiper autoplay="true" circular="true" class="top-swiper" interval="5000" style="width:190px;" vertical="true" wx:if="{{formData.length>0}}">
|
||||
<swiper-item wx:for="{{formData}}" wx:for-index="i" wx:for-item="s" wx:key="i">
|
||||
<view>
|
||||
<view class="swperitem van-swipe-item" data-v-87e7c3a0="" style="width: 190px; height: 28px; transform: translateY(0px);">
|
||||
<image class="avatar" src="{{s.avatar}}"></image>
|
||||
<view class="txt" data-v-87e7c3a0="">{{s.nickname}} 刚刚购买了本商品</view>
|
||||
</view>
|
||||
</view>
|
||||
</swiper-item>
|
||||
</swiper>
|
||||
<view class="like" wx:if="{{info.num_views>0}}">{{info.num_views}}人喜欢</view>
|
||||
</view>
|
||||
<view>
|
||||
<view class="type-bar">
|
||||
<view class="lt">
|
||||
<view class="info-price">
|
||||
<view class="count">
|
||||
<view class="discount">
|
||||
<view class="doller">¥ </view>
|
||||
<view class="_price_free">{{info.price}}</view>
|
||||
</view>
|
||||
<view class="original">
|
||||
<view>¥{{info.marketprice}}</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="rt" wx:if="{{info.status==1}}">
|
||||
<view> 距结束还剩 <view class="countdown">
|
||||
<view class="day">{{day}}</view>
|
||||
<view class="separator">天</view>
|
||||
<view class="time-item">{{hour}}</view>
|
||||
<view class="separator">:</view>
|
||||
<view class="time-item">{{minute}}</view>
|
||||
<view class="separator">:</view>
|
||||
<view class="time-item">{{second}}</view>
|
||||
<view class="separator"></view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="rt" wx:if="{{info.status==-1||info.status==-2}}">
|
||||
<view class="time"> {{info.status==-1?'开始':'结束'}}时间 {{startTime[0]}} <view> {{startTime[1]}} </view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
245
pages/goodsDetails/pageHeader/pageHeader.wxss
Normal file
245
pages/goodsDetails/pageHeader/pageHeader.wxss
Normal file
@@ -0,0 +1,245 @@
|
||||
.swiper-item-img {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.top-swiper {
|
||||
animation: fadein 5s infinite;
|
||||
background-color: rgba(0,0,0,.6);
|
||||
border-radius: 3.733vw;
|
||||
box-sizing: border-box;
|
||||
color: #fff;
|
||||
font-size: 2.933vw;
|
||||
height: 7.467vw;
|
||||
left: 4vw;
|
||||
opacity: 0;
|
||||
padding: 0 .8vw;
|
||||
position: fixed;
|
||||
top: 10.667vw;
|
||||
width: 50.667vw;
|
||||
z-index: 5;
|
||||
}
|
||||
|
||||
@-webkit-keyframes fadein {
|
||||
0% {
|
||||
opacity: 0;
|
||||
}
|
||||
|
||||
10% {
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
70% {
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
75% {
|
||||
opacity: 0;
|
||||
}
|
||||
|
||||
100% {
|
||||
opacity: 0;
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes fadein {
|
||||
0% {
|
||||
opacity: 0;
|
||||
}
|
||||
|
||||
10% {
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
70% {
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
75% {
|
||||
opacity: 0;
|
||||
}
|
||||
|
||||
100% {
|
||||
opacity: 0;
|
||||
}
|
||||
}
|
||||
|
||||
.swperitem {
|
||||
-webkit-box-align: center;
|
||||
-ms-flex-align: center;
|
||||
align-items: center;
|
||||
display: -webkit-box;
|
||||
display: -ms-flexbox;
|
||||
display: -webkit-flex;
|
||||
display: flex;
|
||||
}
|
||||
|
||||
.top-swiper swiper-item {
|
||||
-webkit-box-align: center;
|
||||
-ms-flex-align: center;
|
||||
align-items: center;
|
||||
display: -webkit-box;
|
||||
display: -ms-flexbox;
|
||||
display: -webkit-flex;
|
||||
display: flex;
|
||||
}
|
||||
|
||||
.top-swiper .avatar {
|
||||
border-radius: 50%;
|
||||
height: 6.4vw;
|
||||
margin-right: 2.667vw;
|
||||
width: 6.4vw;
|
||||
}
|
||||
|
||||
.top-swiper .txt {
|
||||
-webkit-box-flex: 1;
|
||||
-webkit-box-orient: vertical;
|
||||
-webkit-line-clamp: 1;
|
||||
display: -webkit-box;
|
||||
flex: 1;
|
||||
height: 4.533vw;
|
||||
line-height: 4.533vw;
|
||||
overflow: hidden;
|
||||
padding-right: 2.667vw;
|
||||
text-overflow: ellipsis;
|
||||
word-break: break-all;
|
||||
}
|
||||
|
||||
.fade-in {
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
.header .like {
|
||||
-webkit-box-pack: center;
|
||||
-ms-flex-pack: center;
|
||||
background-color: rgba(42,42,42,.7);
|
||||
border-radius: 3.333vw 0 0 3.333vw;
|
||||
font-size: 3.2vw;
|
||||
height: 6.667vw;
|
||||
justify-content: center;
|
||||
position: absolute;
|
||||
right: 0;
|
||||
text-align: center;
|
||||
top: 81%;
|
||||
width: 24vw;
|
||||
z-index: 5;
|
||||
}
|
||||
|
||||
.header .like,.type-bar {
|
||||
-webkit-box-align: center;
|
||||
-ms-flex-align: center;
|
||||
align-items: center;
|
||||
color: #fff;
|
||||
display: -webkit-box;
|
||||
display: -ms-flexbox;
|
||||
display: -webkit-flex;
|
||||
display: flex;
|
||||
}
|
||||
|
||||
.type-bar {
|
||||
-webkit-box-pack: justify;
|
||||
-ms-flex-pack: justify;
|
||||
background: rgba(6,162,179,.1);
|
||||
font-size: 3.733vw;
|
||||
height: 12.8vw;
|
||||
justify-content: space-between;
|
||||
line-height: 5.333vw;
|
||||
}
|
||||
|
||||
.type-bar .lt {
|
||||
background: #06a2b3;
|
||||
border-radius: 0 1.6vw 1.6vw 0;
|
||||
color: #fff;
|
||||
height: 100%;
|
||||
padding-left: 4vw;
|
||||
width: 70.4vw;
|
||||
}
|
||||
|
||||
.type-bar .lt .info-price {
|
||||
-webkit-box-align: center;
|
||||
-ms-flex-align: center;
|
||||
align-items: center;
|
||||
display: -webkit-box;
|
||||
display: -ms-flexbox;
|
||||
display: -webkit-flex;
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
height: 100%;
|
||||
width: 60vw;
|
||||
}
|
||||
|
||||
.type-bar .lt .count {
|
||||
display: inline-block;
|
||||
font-family: DIN;
|
||||
}
|
||||
|
||||
.type-bar .lt .discount {
|
||||
display: inline-block;
|
||||
font-size: 3.467vw;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.type-bar .lt .discount .doller {
|
||||
display: inline-block;
|
||||
font-size: 4vw;
|
||||
}
|
||||
|
||||
.type-bar .lt .discount ._price_free,.type-bar .lt .discount .now {
|
||||
display: inline-block;
|
||||
font-size: 6.667vw;
|
||||
}
|
||||
|
||||
.type-bar .lt .discount .is-qi {
|
||||
display: inline-block;
|
||||
font-size: 2.667vw;
|
||||
}
|
||||
|
||||
.type-bar .lt .original {
|
||||
display: inline-block;
|
||||
font-size: 3.2vw;
|
||||
height: 4vw;
|
||||
margin-left: 1.867vw;
|
||||
text-decoration: line-through;
|
||||
}
|
||||
|
||||
.type-bar .rt {
|
||||
color: #2a2a2a;
|
||||
font-size: 2.667vw;
|
||||
line-height: 4vw;
|
||||
text-align: center;
|
||||
width: 29.6vw;
|
||||
}
|
||||
|
||||
.type-bar .rt .time {
|
||||
font-size: 18rpx;
|
||||
}
|
||||
|
||||
.countdown {
|
||||
display: inline-block;
|
||||
vertical-align: top;
|
||||
}
|
||||
|
||||
.time-item {
|
||||
font-family: DIN;
|
||||
margin-left: .533vw;
|
||||
margin-right: .533vw;
|
||||
}
|
||||
|
||||
.type-bar .rt .time-item {
|
||||
background: #06a2b3;
|
||||
border-radius: .933vw;
|
||||
color: #fff;
|
||||
display: inline-block;
|
||||
height: 4.8vw;
|
||||
line-height: 4.8vw;
|
||||
padding: 0 .8vw;
|
||||
width: 3vw;
|
||||
}
|
||||
|
||||
.type-bar .rt .day {
|
||||
display: inline-block;
|
||||
margin-right: .2rem;
|
||||
}
|
||||
|
||||
.separator {
|
||||
display: inline;
|
||||
}
|
||||
Reference in New Issue
Block a user