token.html 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238
  1. {template 'common/header'}
  2. <style>
  3. ul,li {padding:0; margin:0; border:0;}
  4. body{background:#d2e6e9; padding-bottom:63px;}
  5. .btn-group-top-box{padding:10px 0; border-bottom:1px solid #a5d7de; font-family:Helvetica, Arial, sans-serif; text-align:center; width:100%;}
  6. .btn-group-top{overflow:hidden;}
  7. .btn-group-top .btn{ -webkit-box-shadow:none; box-shadow:none; border-color:#5ac5d4; color:#5ac5d4; background:#d1e5e9; padding:6px;}
  8. .btn-group-top .btn:hover{color:#FFF; background:#addbe1;}
  9. .btn-group-top .btn.active{color:#FFF; background:#5ac5d4;}
  10. .btn.use{background:#56c6d6; color:#FFF; border:0; border-radius:4px;}
  11. .voucher-main{overflow:hidden;}
  12. .voucher-main .list-cash-coupon{padding:10px 0 0 0; list-style:none; margin:10px auto;}
  13. .voucher-main .list-cash-coupon li{margin:10px 0;}
  14. .voucher-main .list-cash-coupon a{display:block;width:281px;height:109px;margin:auto;background:url('resource/images/voucher.png') no-repeat 0 -9px;-webkit-background-size:575px auto;position:relative;}
  15. .voucher-main .list-cash-coupon a>p{position: absolute;max-width:200px;height:20px;color:#FFF;-webkit-box-sizing:border-box;}
  16. .voucher-main .list-cash-coupon a>p:nth-of-type(1){left:25px;top:20px;font-size:14px;}
  17. .voucher-main .list-cash-coupon a>p:nth-of-type(1)>span{font-size:30px;}
  18. .voucher-main .list-cash-coupon a>p:nth-of-type(2){left: 26px;top: 62px;font-size: 14px;}
  19. .voucher-main .list-cash-coupon a>p:nth-of-type(2):first-letter{font-size:14px;margin-right:3px;}
  20. .voucher-main .list-cash-coupon a>p:nth-of-type(3){left: 26px;top: 83px;font-size: 12px;}
  21. .voucher-main .list-cash-coupon a>p:nth-of-type(4){left: 160px;top: 42px;font-size: 11px;}
  22. .voucher-main .list-cash-coupon a>p:nth-of-type(5){right: 12px;top:18px;font-size:14px;width:25px; line-height:18px;}
  23. .voucher-main .list-cash-coupon li:nth-of-type(4n+2) a, .list-cash-coupon li .a2{background-position: 0 -133px;}
  24. .voucher-main .list-cash-coupon li:nth-of-type(4n+3) a, .list-cash-coupon li .a3{background-position: 0 -256px;}
  25. .voucher-main .list-cash-coupon li:nth-of-type(4n) a, .list-cash-coupon li .a4{background-position: 0 -378px;}
  26. .voucher-main .list-cash-coupon li[disabled] a{background-position: 0 -502px;}
  27. .voucher-main .list-cash-coupon li[disabled] a:after{content: "";-webkit-background-size: 110px auto;position: absolute;top: 0;left: 0;width: 100%;height: 100%;z-index: 100;pointer-events: none;}
  28. .voucher-main .list-cash-coupon li[disabled="expire"] a:after{background-image: url('resource/images/voucher02.png'); background-repeat: no-repeat; background-position:50px 15px;}
  29. .voucher-main .list-cash-coupon li[disabled] a>p{color:rgba(255,255,255,0.3)!important;}
  30. .voucher-main .list-cash-coupon li.used a{background-position-x:right!important;}
  31. .voucher-main .list-cash-coupon li.used:nth-of-type(4n+1) a>p:nth-of-type(5){color:#ee5375;}
  32. .voucher-main .list-cash-coupon li.used:nth-of-type(4n+2) a>p:nth-of-type(5){color:#ffa619;}
  33. .voucher-main .list-cash-coupon li.used:nth-of-type(4n+3) a>p:nth-of-type(5){color:#92c427;}
  34. .voucher-main .list-cash-coupon li.used:nth-of-type(4n) a>p:nth-of-type(5){color:#2f9abd;}
  35. .voucher-main .read-coupon .list-cash-coupon a>p:nth-of-type(3){left:210px; top:65px; font-size:10px;}
  36. .pagination>.active>a, .pagination>.active>span, .pagination>.active>a:hover, .pagination>.active>span:hover, .pagination>.active>a:focus, .pagination>.active>span:focus{background-color:#5ac5d4; border-color:#5ac5d4;}
  37. .pagination>li>a, .pagination>li>span{color:#5ac5d4; border:1px solid #a5d7de;}
  38. </style>
  39. {if $do == 'display'}
  40. <style media="all" type="text/css">
  41. .scroll-container .list-group {list-style:none; padding:0; margin:0; width:100%; text-align:left;}
  42. .scroll-container .list-group .list-group-item{border:none; background:#d2e6e9;}
  43. .scroll-container .list-group .list-group-item .con{background:#ffffff; width:280px; margin:0 auto;}
  44. .scroll-container .list-group .list-group-item .list-hd{padding:5px 20px;}
  45. .scroll-container .list-group .list-group-item .list-hd h5{font-weight:bold; margin-bottom:2px; font-size:16px; color:#444444;}
  46. .scroll-container .list-group .list-group-item .list-hd p{color:#b8b8b9;}
  47. .scroll-container .list-group .list-group-item .list-con img{display:block; width:90%; margin:0 auto;}
  48. .scroll-container .list-group .list-group-item .list-con .derpn{padding:10px 10px 0 10px; border-top:1px dotted rgb(204, 204, 204); margin-top:10px;display:none;}
  49. .scroll-container .list-group .list-group-item .list-ft{width:290px; background: transparent url('resource/images/ft-bg.png') no-repeat 0 0; background-size: 100% auto; height: 44px; line-height: 48px; overflow: hidden; position:relative; left:-5px; top:5px; padding:0 0 0 15px;}
  50. .scroll-container .list-group .list-group-item .list-ft b{color: #56c6d6; font-size: 30px; margin-right:5px;}
  51. .scroll-container .list-group .list-group-item .list-ft .btns{width:105px; text-align:center; font-size:18px; color:#ffffff; line-height:44px;}
  52. .scroll-container .list-group .list-group-item .list-ft .btns a{color:#ffffff;}
  53. .scroll-container .load-more{padding:10px;text-align:center;font-size:1em;}
  54. </style>
  55. {template 'activity/nav'}
  56. <div class="scroll-container">
  57. <div class="wrapper">
  58. <ul class="list-group" >
  59. {loop $lists $list}
  60. <li class="list-group-item">
  61. <div class="con">
  62. <div class="list-hd">
  63. <h5>{$list['title']}(代金券)</h5>
  64. <p>有效期至{php echo date('Y年m月d日', $list['endtime']);}</p>
  65. </div>
  66. <div class="list-con">
  67. <img src="{php echo tomedia($list['thumb'])}">
  68. <div class="derpn">
  69. {php echo htmlspecialchars_decode($list['description'])}
  70. </div>
  71. </div>
  72. <div class="list-ft">
  73. <div class="pull-left">{$creditnames[$list['credittype']]}:<b>{$list['credit']}</b></div>
  74. <div class="pull-right btns"><a href="javascript:;" data-id="{$list['couponid']}" class="use-token">立即兑换</a></div>
  75. </div>
  76. </div>
  77. </li>
  78. {/loop}
  79. </ul>
  80. <div class="btn-group-top-box">
  81. <div class="btn-group btn-group-top">
  82. {$pager}
  83. </div>
  84. </div>
  85. </div>
  86. </div>
  87. <script type="text/javascript">
  88. require(['util'], function(u){
  89. $('.con').click(function(){
  90. var description = $(this).find('.derpn').text();
  91. if (description.indexOf('<') >= 0) {
  92. $(this).find('.derpn').html(description);
  93. }
  94. $(this).find('.derpn').slideToggle(500);
  95. });
  96. $('.use-token').click(function(){
  97. var id = parseInt($(this).data('id'));
  98. if(!id) {
  99. return false;
  100. }
  101. $.post("{php echo url('activity/token/post');}", {'id':id}, function(data) {
  102. var data = $.parseJSON(data);
  103. if(data.message.errno < 0) {
  104. u.message(data.message.message, '', 'error');
  105. } else {
  106. u.message(data.message.message, "{php echo url('activity/token/mine');}", 'success');
  107. }
  108. return false;
  109. });
  110. });
  111. });
  112. </script>
  113. {elseif $do == 'mine'}
  114. <div class="voucher-main">
  115. <div class="btn-group-top-box">
  116. <div class="btn-group btn-group-top">
  117. <a href="{php echo url('activity/token/mine/', array('type' => ''))}" class="btn btn-default {if ($_GPC['type'] != 'used')}active{/if}">未使用</a>
  118. <a href="{php echo url('activity/token/mine/', array('type' => 'used'))}" class="btn btn-default {if ($_GPC['type'] == 'used')}active{/if}">已使用</a>
  119. </div>
  120. </div>
  121. <ul class="list-cash-coupon">
  122. {loop $data $row}
  123. {if $row['status'] == 1}
  124. {if $row['endtime'] < TIMESTAMP}
  125. <li disabled="expire">
  126. {else}
  127. <li>
  128. {/if}
  129. {else}
  130. <li disabled>
  131. {/if}
  132. {if $_GPC['type'] == 'used'}
  133. <a href="javascript:;">
  134. <p><span>{$row['discount']}</span>元</p>
  135. <p>★订单满{$row['condition']}元可使用</p>
  136. <p>有效期至{php echo date('Y年m月d日', $row['endtime'])}</p>
  137. <p>已使用{$row['cototal']}张</p>
  138. <p>已经使用</p>
  139. </a>
  140. {else}
  141. {if $row['endtime'] > TIMESTAMP}
  142. <a href="{php echo url('activity/token/use', array('id' => $row['couponid'], 'type' => $_GPC['type'], 'recid' => $row['recid']))}">
  143. {else}
  144. <a href="javascript:;" onclick="alert('该代金券已过期');">
  145. {/if}
  146. <p><span>{$row['discount']}</span>元</p>
  147. <p>★订单满{$row['condition']}元可使用</p>
  148. <p>有效期至{php echo date('Y年m月d日', $row['endtime'])}</p>
  149. <p>剩余{$row['cototal']}张</p>
  150. <p>立即使用</p>
  151. </a>
  152. {/if}
  153. </li>
  154. {/loop}
  155. </ul>
  156. <div class="btn-group-top-box">
  157. <div class="btn-group btn-group-top">
  158. {$pager}
  159. </div>
  160. </div>
  161. </div>
  162. {elseif $do == 'use'}
  163. <style media="all" type="text/css">
  164. .read-coupon{padding:10px;}
  165. .read-coupon .coupon-title{font-size:14px; color:#444; padding:20px 15px 10px; margin:0;}
  166. .read-coupon .coupon-content{background:url('resource/images/coupon02.png') no-repeat center bottom; -webkit-background-size:100% auto; padding-bottom:2%; min-height:100px;}
  167. .read-coupon .coupon-sn{height:55px; padding:8px 15px; -webkit-box-sizing:border-box; background:#5ac5d4; color:#d0f2f7; line-height:20px; font-size:14px; vertical-align:middle;}
  168. .read-coupon .coupon-sn p:first-of-type{font-size:14px;}
  169. .read-coupon .coupon-sn p:first-of-type span{color:#FFF; font-size:18px;}
  170. .coupon-form{padding:30px 5px 0 5px;}
  171. .coupon-form .form-group{margin:10px 0;}
  172. .coupon-form .form-group .btn{border-radius:2px;}
  173. .coupon-form .form-group:first-child .btn{background:#5ac5d4; border-color:#5ac5d4; color:#FFF;}
  174. </style>
  175. <div class="voucher-main">
  176. <div class="read-coupon">
  177. <h4 class="coupon-title">{$data['title']}</h4>
  178. <div class="coupon-content">
  179. <ul class="list-cash-coupon">
  180. <li>
  181. <a href="javascript:;" class="a2">
  182. <p><span>{$data['discount']}</span>元</p>
  183. <p>★订单满 {$data['condition']}元可使用 </p>
  184. <p>有效期至{php echo date('Y/m/d', $data['endtime'])}</p>
  185. </a>
  186. </li>
  187. </ul>
  188. </div>
  189. <div class="coupon-sn">
  190. <p>序列号:<span>{$data['code']}</span><br>请提供序列号给工作人员或在当前页面消费</p>
  191. </div>
  192. <div class="coupon-form">
  193. <form role="form" action="" method="post" class="form-horizontal" >
  194. <input type="hidden" name="id" value="{$id}">
  195. {if ($data['endtime'] > TIMESTAMP) && ($data['status'] == 1)}
  196. <div class="form-group">
  197. <input class="form-control" type="password" name="password" placeholder="请输入您的消费密码"/>
  198. </div>
  199. <div class="form-group">
  200. <input type="submit" name="submit" class="btn btn-default btn-block use" value="确定使用" />
  201. <input name="token" value="{$_W['token']}" type="hidden" />
  202. </div>
  203. <div class="form-group">
  204. <a href="javascript:;" data-toggle="modal" data-target="#qrcode-modal" class="btn btn-warning btn-block">生成核销二维码</a>
  205. </div>
  206. {elseif $data['status'] == 2}
  207. <a class="btn btn-default btn-block use">该代金券已使用</a>
  208. {else}
  209. <a class="btn btn-default btn-block use">该代金券已过期</a>
  210. {/if}
  211. </form>
  212. <div class="form-group">
  213. {if ($_GPC['type'] == 'used')}
  214. <a href="{php echo url('activity/token/mine', array('type' => 'used'));}" class="btn btn-default btn-block">返回</a>
  215. {else}
  216. <a href="{php echo url('activity/token/mine');}" class="btn btn-default btn-block">返回</a>
  217. {/if}
  218. </div>
  219. </div>
  220. </div>
  221. </div>
  222. {/if}
  223. <div class="modal fade modal-code" id="qrcode-modal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
  224. <div class="code-img text-center" data-dismiss="modal">
  225. <div class="qr">
  226. <img style="-webkit-user-select: none" src="{php echo url('activity/token/token_qrcode', array('id' => $id, 'recid' => $recid, 'type' => '2'));}">
  227. </div>
  228. <div class="text-center tip">核销时请交给店员扫一扫。该功能只能在微信中使用</div>
  229. </div>
  230. </div>
  231. {template 'common/toolbar'}
  232. {template 'common/footer'}