Authored by 郭成尧

Merge branch 'release/4.6' of git.yoho.cn:fe/yohobuy-node into release/4.6

@@ -5,8 +5,8 @@ @@ -5,8 +5,8 @@
5 {{#if discount}} 5 {{#if discount}}
6 <span class="discount">{{discount}}</span> 6 <span class="discount">{{discount}}</span>
7 {{/if}} 7 {{/if}}
8 - {{#if up}}  
9 - 8 + {{#if discountText}}
  9 + {{discountText}}
10 {{/if}} 10 {{/if}}
11 <div class="time pull-right"> 11 <div class="time pull-right">
12 <span class="iconfont">&#xe60a;</span> 12 <span class="iconfont">&#xe60a;</span>
@@ -78,8 +78,8 @@ function convertTime(time) { @@ -78,8 +78,8 @@ function convertTime(time) {
78 s = Math.floor(time / aSecond % 60); 78 s = Math.floor(time / aSecond % 60);
79 79
80 showTime += d > 0 ? d + '天' : ''; 80 showTime += d > 0 ? d + '天' : '';
81 - showTime += h > 0 ? h + '小时' : '';  
82 - showTime += m > 0 ? m + '分钟' : ''; 81 + showTime += h > 0 ? h + '时' : '';
  82 + showTime += m > 0 ? m + '分' : '';
83 showTime += s > 0 ? s + '秒' : ''; 83 showTime += s > 0 ? s + '秒' : '';
84 } 84 }
85 85
@@ -87,11 +87,23 @@ function convertTime(time) { @@ -87,11 +87,23 @@ function convertTime(time) {
87 } 87 }
88 88
89 function setPageTime() { 89 function setPageTime() {
90 - var i, showTime; 90 + var i, text, showTime;
91 91
92 for (i = 0; i < limitTime.length; i++) { 92 for (i = 0; i < limitTime.length; i++) {
  93 + if (limitTime[i].time < 0) {
  94 + return;
  95 + }
  96 +
93 limitTime[i].time -= 1000; 97 limitTime[i].time -= 1000;
94 showTime = convertTime(limitTime[i].time); 98 showTime = convertTime(limitTime[i].time);
  99 + if (showTime) {
  100 + text = showTime;
  101 + if (limitTime[i].pre) {
  102 + text = limitTime[i].pre + ' ' + text;
  103 + }
  104 + } else {
  105 + text = '活动已结束';
  106 + }
95 $('.time-calculate').removeClass('hidden'); 107 $('.time-calculate').removeClass('hidden');
96 $('.time-calculate').text(showTime); 108 $('.time-calculate').text(showTime);
97 } 109 }
@@ -100,7 +112,7 @@ function setPageTime() { @@ -100,7 +112,7 @@ function setPageTime() {
100 if (('.sale-discount-page').length > 0) { 112 if (('.sale-discount-page').length > 0) {
101 113
102 $('.time-calculate').each(function() { 114 $('.time-calculate').each(function() {
103 - var data = $(this).attr('data'); 115 + var data = $(this).attr('data') * 1000;
104 116
105 if (data) { 117 if (data) {
106 limitTime.push({ 118 limitTime.push({