index.html 9.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293
  1. <extend name="Public:pinduoduobase" />
  2. <block name="content">
  3. <link rel="stylesheet" href="__PUBLIC__/pinduoduo/assets/css/spike_fa7d87b5cdf7fae91acff20eb96ae665.css">
  4. <style>
  5. .spike-goods{margin-left:0.2rem;}
  6. </style>
  7. <div id="main">
  8. <div id="spike-list" style="margin-top:20px;">
  9. <div class="base-list-wrapper" id="tuan_list">
  10. <volist name="list" id="d">
  11. <div class="spike-list-item-0" onclick="location.href='{:U('/goods/'.$d['goods_id'])}'">
  12. <div avalonctrl="spike-list-item-0">
  13. <?php
  14. $to_night = strtotime(date('Y-m-d')." 23:59:59");
  15. $tomo_night = $to_night + 86400;
  16. $aftmo_night = $to_night + 86400*2;
  17. ?>
  18. <?php if(empty($cur_btime) ){
  19. $cur_btime = $d['begin_time'];//首次进入
  20. ?>
  21. <?php if($d['begin_time'] <= time() && $d['end_time'] > time() ){
  22. $is_first = true;
  23. ?>
  24. <!-- 正在进行中,并且首次进入 -->
  25. <div class="time-line" style="display:none;">
  26. <!--ms-if-->
  27. <span class="icon"><div class="time-icon time-icon-current"></div><span>
  28. <span class="time-show time-show-current"> <?php echo date('H').':00'; ?> 正在进行中</span>
  29. </span></span>
  30. </div>
  31. <?php } else if($d['begin_time'] < $to_night){ ?>
  32. <div class="time-line" style="display:none;">
  33. <!--ms-if-->
  34. <span class="icon"><div class="time-icon"></div><span>
  35. <span class="time-show"> <?php echo date('H',$d['begin_time']).':00'; ?> </span>
  36. </span></span>
  37. </div>
  38. <?php }else if($d['begin_time'] > $to_night && $d['begin_time'] < $tomo_night){ ?>
  39. <!-- 明日 -->
  40. <div class="time-line">
  41. <!--ms-if-->
  42. <span class="icon"><div class="time-icon"></div><span>
  43. <span class="time-show">明日 <?php echo date('H',$d['begin_time']).':00'; ?> </span>
  44. </span></span>
  45. </div>
  46. <?php }else if($d['begin_time'] > $tomo_night && $d['begin_time'] < $aftmo_night){ ?>
  47. <!-- 后日 -->
  48. <div class="time-line">
  49. <!--ms-if-->
  50. <span class="icon"><div class="time-icon"></div><span>
  51. <span class="time-show">后天 <?php echo date('H',$d['begin_time']).':00'; ?> </span>
  52. </span></span>
  53. </div>
  54. <?php }else{ $is_first = false; ?>
  55. <!-- 很多天以后 -->
  56. <div class="time-line" style="display:none;">
  57. <!--ms-if-->
  58. <span class="icon"><div class="time-icon"></div><span>
  59. <span class="time-show"> <?php echo date('Y-m-d H',$d['begin_time']).':00'; ?> </span>
  60. </span></span>
  61. </div>
  62. <?php } ?>
  63. <?php }else if($d['begin_time'] != $cur_btime){
  64. $cur_btime = $d['begin_time'];
  65. $is_first = false;
  66. ?>
  67. <?php if($d['begin_time'] < $to_night){ ?>
  68. <div class="time-line" style="display:none;">
  69. <!--ms-if-->
  70. <span class="icon"><div class="time-icon"></div><span>
  71. <span class="time-show"> <?php echo date('H',$d['begin_time']).':00'; ?> </span>
  72. </span></span>
  73. </div>
  74. <?php }else if($d['begin_time'] > $to_night && $d['begin_time'] < $tomo_night){ ?>
  75. <!-- 明日 -->
  76. <div class="time-line">
  77. <!--ms-if-->
  78. <span class="icon"><div class="time-icon"></div><span>
  79. <span class="time-show">明日 <?php echo date('H',$d['begin_time']).':00'; ?> </span>
  80. </span></span>
  81. </div>
  82. <?php }else if($d['begin_time'] > $tomo_night && $d['begin_time'] < $aftmo_night){ ?>
  83. <!-- 后日 -->
  84. <div class="time-line">
  85. <!--ms-if-->
  86. <span class="icon"><div class="time-icon"></div><span>
  87. <span class="time-show">后天 <?php echo date('H',$d['begin_time']).':00'; ?> </span>
  88. </span></span>
  89. </div>
  90. <?php }else{ ?>
  91. <!-- 很多天以后 -->
  92. <div class="time-line">
  93. <!--ms-if-->
  94. <span class="icon"><div class="time-icon"></div><span>
  95. <span class="time-show"> <?php echo date('Y-m-d H',$d['begin_time']).':00'; ?> </span>
  96. </span></span>
  97. </div>
  98. <?php } ?>
  99. <?php }else {
  100. $cur_btime = $d['begin_time'];
  101. $is_first = false;
  102. ?>
  103. <?php } ?>
  104. <div class="spike-goods">
  105. <?php if($is_first){ ?>
  106. <div class="line line-current" style="display:none;"></div>
  107. <?php }else { ?>
  108. <div class="line " style="display:none;"></div>
  109. <?php } ?>
  110. <img class="spike-img scrollLoading" src="{$fan_ly_image}" data-echo="{$d.image}">
  111. <div class="spike-info">
  112. <div class="spike-goods-name">{$d.name}</div>
  113. <div class="spike-buy">
  114. <div class="all-price">
  115. <span class="sale-symbol">¥</span>
  116. <span class="sale-price">{$d.pinprice}</span>
  117. <span class="market-price">¥<span class="market">{$d.price}<span></span>
  118. </span></span></div>
  119. <?php if($d['quantity'] != 0 && $d['begin_time'] <= time() && $d['end_time'] > time()){ ?>
  120. <div class="left-time spike-button-on">
  121. <div class="quantity">
  122. <span class="head">剩余</span>
  123. <div class="quantity-detail">
  124. <span>{$d.quantity}件</span>
  125. </div>
  126. </div>
  127. <span class="btnClass">马上抢</span>
  128. </div>
  129. <?php } ?>
  130. <?php if($d['quantity'] == 0){ ?>
  131. <div class="left-time spike-button-off">
  132. <div class="quantity">
  133. <span class="head">剩余</span>
  134. <div class="quantity-detail">
  135. <span>{$d.quantity}件</span>
  136. </div>
  137. </div>
  138. <span class="btnClass">已售罄</span>
  139. </div>
  140. <?php } ?>
  141. <?php if($d['quantity'] != 0 && $d['begin_time'] > time()) { ?>
  142. <div class="left-time spike-button-coming">
  143. <div class="quantity">
  144. <span class="head">限量</span>
  145. <div class="quantity-detail">
  146. <span>{$d.quantity}件</span>
  147. </div>
  148. </div>
  149. <span class="btnClass">即将开抢</span>
  150. </div>
  151. <?php } ?>
  152. </div>
  153. </div>
  154. </div>
  155. <!--ms-if-->
  156. <?php if($is_first){ ?>
  157. <div class="view-more" id="more" style="display:none;">
  158. <span>查看之前时间段已售罄商品</span>
  159. </div>
  160. <?php } ?>
  161. <div class="final-icon" style="display:none;"></div>
  162. <!--ms-if-->
  163. </div>
  164. </div>
  165. <?php $last_btime = $d['begin_time']; ?>
  166. </volist>
  167. </div>
  168. </div>
  169. </div>
  170. <div class="center" id="center_pullup" style="display:none;">
  171. <span><img class="img_rotate" src="__PUBLIC__/pinduoduo/assets/img/pull_loading_8eba142.png"/>
  172. </span><span class="orders_text"></span>
  173. </div>
  174. <include file="Public:foot_lazy" />
  175. <style>
  176. .center {
  177. width: 170px;
  178. margin: 0 auto;
  179. text-align: center;
  180. }
  181. .img_rotate {
  182. width: 30px;
  183. height: 30px;
  184. margin-top: 7px;
  185. margin-right: 5px;
  186. -webkit-animation: loading 1s linear 0s infinite;
  187. }
  188. @-webkit-keyframes loading {
  189. 0% {
  190. -webkit-transform: rotate(0);
  191. }
  192. 100% {
  193. -webkit-transform: rotate(360deg);
  194. }
  195. }
  196. .orders_text {
  197. line-height: 45px;
  198. font-weight: 700;
  199. font-size: 15px;
  200. }
  201. </style>
  202. <script>
  203. var offset = 0;
  204. var _pa = 2;
  205. var is_can_next = 1;
  206. var cur_url = "{:U('Spike/index')}";
  207. var wait_url = "{:U('Spike/wait')}";
  208. var over_url = "{:U('Spike/over')}";
  209. var last_btime = "{$last_btime}";
  210. var req_step = 1;
  211. function loaddata()
  212. {
  213. var totalheight = parseFloat($(window).height()) + parseFloat($(window).scrollTop()); //浏览器的高度加上滚动条的高度
  214. if ($(document).height() <= totalheight+200) //当文档的高度小于或者等于总的高度的时候,开始动态加载数据
  215. {
  216. if(is_can_next == 1)//加载数据
  217. {
  218. is_can_next = 0;
  219. nextpage();
  220. }
  221. }
  222. }
  223. function nextpage()
  224. {
  225. $('#center_pullup').show();
  226. $.ajax(
  227. {
  228. url: cur_url,
  229. type:'post',
  230. data:{page:_pa,last_btime:last_btime},
  231. dataType: 'json',
  232. success: function(result){
  233. if(result.code == 1)
  234. {
  235. $('#tuan_list').append(result.html);
  236. $('#center_pullup').hide();
  237. last_btime = result.fc_last_end_time;
  238. _pa++;
  239. is_can_next = 1;
  240. bindImgEvent();
  241. } else if(result.code == 0) {
  242. $('#center_pullup').hide();
  243. if(req_step == 1){
  244. req_step++;
  245. _pa = 1;
  246. cur_url = wait_url;
  247. is_can_next = 0;
  248. nextpage();
  249. } else if(req_step == 2) {
  250. req_step++;
  251. _pa = 1;
  252. cur_url = over_url;
  253. is_can_next = 0;
  254. nextpage();
  255. } else if(req_step == 3) {
  256. $('#center_pullup').remove();
  257. }
  258. }
  259. }
  260. }
  261. );
  262. }
  263. $(function(){
  264. nextpage();
  265. $(window).scroll( function() {
  266. loaddata();
  267. });
  268. })
  269. </script>
  270. </block>