Authored by hongyong.zhao

商品详情添加倒计时及ui修改

@@ -6,6 +6,14 @@ Component({ @@ -6,6 +6,14 @@ Component({
6 properties: { 6 properties: {
7 list: { 7 list: {
8 type: Array 8 type: Array
  9 + },
  10 + bannerSrc: {
  11 + type: String,
  12 + value: null
  13 + },
  14 + bannerUrl: {
  15 + type: String,
  16 + value: null
9 } 17 }
10 }, 18 },
11 19
@@ -20,6 +28,8 @@ Component({ @@ -20,6 +28,8 @@ Component({
20 * 组件的方法列表 28 * 组件的方法列表
21 */ 29 */
22 methods: { 30 methods: {
23 - 31 + jumpUrl:function() {
  32 + this.triggerEvent('tapUrl')
  33 + }
24 } 34 }
25 }) 35 })
@@ -5,6 +5,9 @@ @@ -5,6 +5,9 @@
5 </view> 5 </view>
6 6
7 <view class="desc-content"> 7 <view class="desc-content">
  8 + <view class="banner" bindtap="_jumpBanner" wx:if="{{bannerSrc != null}}">
  9 + <image class="banner-img" src="{{bannerSrc}}"></image>
  10 +</view>
8 <block wx:for="{{list}}"> 11 <block wx:for="{{list}}">
9 <block wx:if="{{item.floor_type === 1}}"> 12 <block wx:if="{{item.floor_type === 1}}">
10 <view >{{item.content}}</view> 13 <view >{{item.content}}</view>
@@ -34,3 +34,14 @@ @@ -34,3 +34,14 @@
34 width: 100%; 34 width: 100%;
35 margin: 50rpx 0; 35 margin: 50rpx 0;
36 } 36 }
  37 +
  38 +
  39 +.banner {
  40 + width: 100%;
  41 + height: 234rpx;
  42 +}
  43 +
  44 +.banner-img {
  45 + width: 100%;
  46 + height: 234rpx;
  47 +}
1 1
2 2
3 -<view class="help" bindtap="_onTap"> 活动说明 </view>  
  3 +<view class="help" bindtap="_onTap">
  4 +<image class="helpe-img" src="../images/que_ic@2x.png"></image>
  5 +<text>活动说明 </text>
  6 +</view>
1 /* page/subPackage/pages/zeroSell/components/help.wxss */ 1 /* page/subPackage/pages/zeroSell/components/help.wxss */
2 2
3 .help { 3 .help {
4 - width: 200rpx; 4 + width: 100%;
5 height: 65rpx; 5 height: 65rpx;
6 font-size: 24rpx; 6 font-size: 24rpx;
7 line-height: 65rpx; 7 line-height: 65rpx;
8 - background-color: rgba(0, 0, 0, 0.6);  
9 - border-radius: 40rpx;  
10 - color: white;  
11 - text-align: left;  
12 - padding-left: 20rpx; 8 + color: #222222;
  9 + text-align: center;
  10 + text-decoration: underline;
  11 +}
  12 +
  13 +.helpe-img {
  14 + width: 30rpx;
  15 + height: 30rpx;
  16 + vertical-align: middle;
  17 + margin-right: 10rpx;
13 } 18 }
@@ -4,6 +4,12 @@ Component({ @@ -4,6 +4,12 @@ Component({
4 properties: { 4 properties: {
5 product: { 5 product: {
6 type: Object 6 type: Object
  7 + },
  8 + avatars: {
  9 + type: Array
7 } 10 }
8 }, 11 },
  12 + ready:function() {
  13 + // console.log(`productdetail: ${this.properties.avatars}`)
  14 + }
9 }); 15 });
1 { 1 {
2 "component": true, 2 "component": true,
3 - "usingComponents": {} 3 + "usingComponents": {
  4 + "time-countdown": "./timeCountDown/time-countdown",
  5 + "avatars": "./avatar-swiper"
  6 + }
4 } 7 }
1 1
2 <wxs src="./helper.wxs" module="helper" /> 2 <wxs src="./helper.wxs" module="helper" />
  3 + <view wx:if="{{product.status === 2}}">
  4 + <view class="countdown_label">
  5 + <text class="countdown_labeltext">抽奖</text>
  6 + <text class="countdown_labeltext">倒计时</text>
  7 + </view>
  8 +
  9 + <time-countdown class="product_countdown" wx:if="{{product.status === 2}}" endTime="{{product.end_time}}"></time-countdown>
  10 + </view>
  11 +
  12 + <view class="avatars" wx:if="{{product.status === 2 && avatars.length > 0}}">
  13 + <avatars list="{{avatars}}"></avatars>
  14 + </view>
3 15
4 <image class="product_image" src="{{product.cover_img}}"></image> 16 <image class="product_image" src="{{product.cover_img}}"></image>
5 <view class="product_name" >{{product.name}}</view> 17 <view class="product_name" >{{product.name}}</view>
6 <view class="product_price" >{{product.price}}</view> 18 <view class="product_price" >{{product.price}}</view>
7 - <view class="product_time">{{helper.formatTime(product.start_time, product.end_time)}}</view>  
  19 + <view wx:if="{{product.status !== 2}}" class="product_time">{{helper.formatTime(product.start_time, product.end_time)}}</view>
  20 + <view class="product_margin"></view>
@@ -26,7 +26,6 @@ @@ -26,7 +26,6 @@
26 color: #B0B0B0; 26 color: #B0B0B0;
27 font-size: 24rpx; 27 font-size: 24rpx;
28 margin-top: 16rpx; 28 margin-top: 16rpx;
29 - margin-bottom: 40rpx;  
30 } 29 }
31 30
32 .product_time:before { 31 .product_time:before {
@@ -48,3 +47,38 @@ @@ -48,3 +47,38 @@
48 margin-left: 20rpx; 47 margin-left: 20rpx;
49 vertical-align: 6rpx 48 vertical-align: 6rpx
50 } 49 }
  50 +
  51 +.product_margin {
  52 + margin-bottom: 40rpx;
  53 +}
  54 +
  55 +.product_countdown {
  56 + display: inline-block;
  57 + height: 92rpx;
  58 + margin-top: 40rpx;
  59 + margin-bottom: 40rpx;
  60 +}
  61 +
  62 +.countdown_label {
  63 + width: 60rpx;
  64 + height: 56rpx;
  65 + font-family: PingFang-SC-Regular;
  66 + font-size: 20rpx;
  67 + color: #222222;
  68 + letter-spacing: -0.36rpx;
  69 + text-align: center;
  70 + display: inline-block;
  71 + margin-right: 16rpx;
  72 +}
  73 +
  74 +.countdown_labeltext {
  75 + display: block;
  76 +}
  77 +
  78 +.avatars {
  79 + display: inline-block;
  80 + text-align: center;
  81 + margin-left: auto;
  82 + margin-right: auto;
  83 + margin-bottom: 38rpx;
  84 +}
@@ -20,6 +20,9 @@ Component({ @@ -20,6 +20,9 @@ Component({
20 }, 20 },
21 21
22 ready: function() { 22 ready: function() {
  23 + this.setData({
  24 + formatTime: this.formatCountDown(this.properties.endTime)
  25 + })
23 this.formatTime() 26 this.formatTime()
24 }, 27 },
25 /** 28 /**
1 // page/subPackage/pages/zeroSell/detail.js 1 // page/subPackage/pages/zeroSell/detail.js
2 2
3 import ZeroSellService from './service/zero-sell' 3 import ZeroSellService from './service/zero-sell'
  4 +import CommonService from './service/common'
4 import { 5 import {
5 decodePhoneNumber, 6 decodePhoneNumber,
6 getUnionID, 7 getUnionID,
@@ -16,6 +17,8 @@ import { @@ -16,6 +17,8 @@ import {
16 } from '../../vendors/zanui/index'; 17 } from '../../vendors/zanui/index';
17 import router from './router/router' 18 import router from './router/router'
18 import {wrapperName} from './helper' 19 import {wrapperName} from './helper'
  20 +import { formatImageUrl } from '../../utils/util'
  21 +import { jumpByUrl } from '../../libs/urlRoute';
19 22
20 const ACTIVITY = { 23 const ACTIVITY = {
21 UNKNOWN: 0, 24 UNKNOWN: 0,
@@ -68,6 +71,8 @@ Page(Object.assign({ @@ -68,6 +71,8 @@ Page(Object.assign({
68 hasUnionID: false, 71 hasUnionID: false,
69 uid: 0, 72 uid: 0,
70 isLogin: false, 73 isLogin: false,
  74 + bannerSrc:null,
  75 + bannerUrl: null,
71 76
72 actionsheet: { 77 actionsheet: {
73 componentId: 'shareActionSheet', 78 componentId: 'shareActionSheet',
@@ -120,6 +125,8 @@ Page(Object.assign({ @@ -120,6 +125,8 @@ Page(Object.assign({
120 this.setData(data); 125 this.setData(data);
121 126
122 new app.WeToast(); 127 new app.WeToast();
  128 +
  129 + this._getDetailBanner()
123 }, 130 },
124 131
125 /** 132 /**
@@ -358,6 +365,26 @@ Page(Object.assign({ @@ -358,6 +365,26 @@ Page(Object.assign({
358 showAuth: true 365 showAuth: true
359 }) 366 })
360 }, 367 },
  368 + _jumpBanner() {
  369 + if (this.data.bannerUrl == null) {
  370 + return;
  371 + }
  372 + jumpByUrl(that.data.bannerUrl);
  373 + },
  374 + _getDetailBanner() {
  375 + let commonService = new CommonService()
  376 + commonService.getResourceCode('ccc32dbedf164a52b4efa34383878860')
  377 + .then(data => {
  378 + // console.log(data)
  379 + this.setData({
  380 + bannerSrc: formatImageUrl(data.src, 340 * app.globalData.systemInfo.pixelRatio, 340 * app.globalData.systemInfo.pixelRatio, 2),
  381 + bannerUrl: data.url
  382 + })
  383 + })
  384 + .catch(error => {
  385 + console.log(error)
  386 + })
  387 + },
361 388
362 _getUser() { 389 _getUser() {
363 const userInfo = app.getUserInfo(); 390 const userInfo = app.getUserInfo();
@@ -3,24 +3,17 @@ @@ -3,24 +3,17 @@
3 3
4 <view class="header"> 4 <view class="header">
5 5
6 - <product-header product="{{product}}"></product-header> 6 + <product-header product="{{product}}" avatars="{{avatars}}"></product-header>
7 <view style="height: 20rpx;"></view> 7 <view style="height: 20rpx;"></view>
8 -  
9 - <view class="help">  
10 - <help></help>  
11 - </view>  
12 -  
13 - <view class="avatars" wx:if="{{product.status === 2 && avatars.length > 0}}">  
14 - <avatars list="{{avatars}}"></avatars>  
15 - </view>  
16 -  
17 </view> 8 </view>
18 9
19 <counter count="{{participantCount}}" num="{{product.limit}}" status="{{product.status}}"></counter> 10 <counter count="{{participantCount}}" num="{{product.limit}}" status="{{product.status}}"></counter>
20 11
21 <prize-progress step="{{step}}"></prize-progress> 12 <prize-progress step="{{step}}"></prize-progress>
22 -  
23 -<desc list="{{product.content}}"></desc> 13 + <view class="help">
  14 + <help></help>
  15 + </view>
  16 +<desc list="{{product.content}}" bind:tapUrl="_jumpBanner" bannerSrc="{{bannerSrc}}" bannerUrl="{{bannerUrl}}"></desc>
24 17
25 <view class="line"></view> 18 <view class="line"></view>
26 19
@@ -15,24 +15,19 @@ @@ -15,24 +15,19 @@
15 position: relative; 15 position: relative;
16 text-align: center; 16 text-align: center;
17 overflow: hidden; 17 overflow: hidden;
  18 + margin-top: 56rpx;
18 } 19 }
19 20
20 .help { 21 .help {
21 - position: absolute;  
22 - top: 20rpx;  
23 - right: -90rpx;  
24 -}  
25 -  
26 -.avatars {  
27 - position: absolute;  
28 - top: 20rpx;  
29 - left: 32rpx; 22 + width: 100%;
  23 + text-align: center;
  24 + margin-bottom: 60rpx;
30 } 25 }
31 26
32 .fellow-bar { 27 .fellow-bar {
33 position: fixed; 28 position: fixed;
34 width: 100%; 29 width: 100%;
35 - bottom: 100rpx; 30 + top: 0rpx;
36 } 31 }
37 32
38 .action-bar { 33 .action-bar {
@@ -3,6 +3,7 @@ @@ -3,6 +3,7 @@
3 3
4 <tabs-pane name="进行中"> 4 <tabs-pane name="进行中">
5 <view> 5 <view>
  6 + <image class="topgif" src="./images/yoluck.gif"/>
6 <block wx:for="{{list[0].products}}" wx:key="{{item.id}}"> 7 <block wx:for="{{list[0].products}}" wx:key="{{item.id}}">
7 <product-item product="{{item}}" class="product"></product-item> 8 <product-item product="{{item}}" class="product"></product-item>
8 </block> 9 </block>
@@ -53,3 +53,8 @@ @@ -53,3 +53,8 @@
53 .tabs-class { 53 .tabs-class {
54 border-bottom: 1rpx solid #E0E0E0; 54 border-bottom: 1rpx solid #E0E0E0;
55 } 55 }
  56 +
  57 +.topgif {
  58 + width: 100%;
  59 + height: 200rpx;
  60 +}