card.html 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  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. .card-container{width:100%;max-width:640px;margin:0px auto;border-bottom:1px solid #a5d7de;}
  12. .card-list{width:100%;margin:10px 0;padding:0 13px}
  13. .card-list .top{height:60px;line-height:60px;background:#a9d92d url(./resource/images/card_tpl.png) repeat-x 0 bottom;border-top-left-radius:5px;border-top-right-radius:5px;}
  14. .card-list .top .img{float:left;padding:0 10px}
  15. .card-list .top .img img{width:40px;height:40px;border-radius:35px;}
  16. .card-list .top .title{float:left;color:#FFF;font-weight:bold;font-size:16px;letter-spacing:1px}
  17. .card-list .bottom{color:#b7b7b7;height:30px;line-height:30px;background:#FFF;padding:0 6px;border-bottom-left-radius:5px;border-bottom-right-radius:5px;}
  18. .card-list .bottom .left-info{float:left;width:50%;overflow:hidden;}
  19. .card-list .bottom .right-info{float:right;width:50%;overflow:hidden;text-align:right;}
  20. .no-info{width:100%;padding:0 20px;text-align:center;height:40px;line-height:40px;color:#5ac5d4}
  21. .page{width:100%;margin:0 auto;text-align:center;}
  22. .page .pagination{padding:0;margin:0;}
  23. .page .pagination a{color:#5ac5d4;background:#d2e6e9;border:1px solid #a5d7de;}
  24. .page .pagination a:hover{color:#FFF;background:#addbe1;border:1px solid #a5d7de;}
  25. .card-info .card-top{ position:relative; width:100%; color:#fff; background-color:#a9d92d; padding:21px 12px 12px;}
  26. .card-top .logo img{width:38px; height:38px; border-radius:100%; margin-right:10px;}
  27. .card-top .title{font-size:24px; margin-bottom:10px;}
  28. .card-top .sub-title{margin-bottom:10px;}
  29. .card-top .border-img{position: absolute; bottom: -1px; left: 0; width: 100%; height: 5px; background: url(./resource/images/card_tpl.png) repeat-x;}
  30. .card-bottom{background:#fff; margin-bottom:15px; text-align:center; padding:15px 0;}
  31. .card-bottom .bar-code img{width:100%; height:auto; margin-bottom:5px;}
  32. .card-bottom .tips{margin:10px 0;}
  33. .wx-card .operate{background:#fff; padding:15px 10px;}
  34. .wx-card .operate input{margin-bottom:5px;}
  35. </style>
  36. {if $do == 'display'}
  37. <div class="btn-group-top-box">
  38. <div class="btn-group btn-group-top">
  39. <a href="{php echo url('wechat/card/display', array('type' => 'discount'))}" class="btn btn-default {if $type == 'discount'}active{/if}">折扣券</a>
  40. <a href="{php echo url('wechat/card/display', array('type' => 'cash'))}" class="btn btn-default {if $type == 'cash'}active{/if}">代金券</a>
  41. <a href="{php echo url('wechat/card/display', array('type' => 'groupon'))}" class="btn btn-default {if $type == 'groupon'}active{/if}">团购券</a>
  42. <a href="{php echo url('wechat/card/display', array('type' => 'gift'))}" class="btn btn-default {if $type == 'gift'}active{/if}">礼品券</a>
  43. <a href="{php echo url('wechat/card/display', array('type' => 'general_coupon'))}" class="btn btn-default {if $type == 'general_coupon'}active{/if}">优惠券</a>
  44. </div>
  45. </div>
  46. <div class="clearfix card-container">
  47. {if !empty($data)}
  48. {loop $data $da}
  49. <div class="card-list" data-id="{$da['id']}">
  50. <div class="top" style="background:{$colors[$da['color']]}">
  51. <div class="img">
  52. <img src="{$logo}"/>
  53. </div>
  54. <div class="title">{$da['title']}</div>
  55. </div>
  56. <div class="bottom">
  57. <div class="left-info">{$da['brand_name']}</div>
  58. <div class="right-info">{$da['endtime']}</div>
  59. </div>
  60. </div>
  61. {/loop}
  62. <div class="page">{$pager}</div>
  63. {else}
  64. <div class="no-info"><i class="fa fa-info-circle"></i> 没有符合条件的优惠券</div>
  65. {/if}
  66. </div>
  67. <script>
  68. require(['util'], function(u){
  69. $('.card-list').click(function(){
  70. var id = parseInt($(this).attr('data-id'));
  71. if(!id) return false;
  72. $.post("{php echo url('wechat/card/detail')}", {'id' : id}, function(data) {
  73. var data = $.parseJSON(data);
  74. if(data.errno) {
  75. u.message(data.error, '', 'error');
  76. } else {
  77. eval(data.error);
  78. }
  79. return false;
  80. });
  81. });
  82. });
  83. </script>
  84. {elseif $do == 'use'}
  85. <form action="" method="post" id="form1">
  86. <input type="hidden" name="token" value="{$_W['token']}"/>
  87. <input type="hidden" name="code" value="{$code['code']}"/>
  88. <div class="wx-card">
  89. <div class="card-info">
  90. <div class="card-top" style="background: {$colors[$card['color']]}">
  91. <div class="logo">
  92. <img src="{$card['logo_url']}" alt="" class="img-circle">
  93. <span>{$card['brand_name']}</span>
  94. </div>
  95. <div class="title text-center">{$card['title']}</div>
  96. <div class="sub-title text-center">{$card['sub_title']}</div>
  97. <div class="date text-center">
  98. {if $card['date_info']['time_type'] == 1}
  99. 有效期:{$card['date_info']['time_limit_start']}~{$card['date_info']['time_limit_end']}
  100. {else}
  101. 有效期:领取后{$card['date_info']['deadline']}天后生效,{$card['date_info']['limit']}天有效
  102. {/if}
  103. </div>
  104. <div class="border-img"></div>
  105. </div>
  106. <div class="card-bottom">
  107. {if $error_code == 1}
  108. <div class="text-muted">code码错误</div>
  109. {else}
  110. <img src="{php echo url('wechat/card/qr', array('id' => $record['id'], 'code' => $record['code']));}" alt=""/>
  111. <div class="text-muted">店员可使用微信扫描上面二维码进行核销</div>
  112. <div class="text-muted">code码:{$code['code']}</div>
  113. {/if}
  114. <div class="tips hide">{$card['notice']}</div>
  115. </div>
  116. </div>
  117. <div class="operate">
  118. {if $error_code == 1}
  119. <a class="btn btn-danger btn-block" disabled>code码错误</a>
  120. {else}
  121. <input type="password" id="password" name="password" class="form-control" placeholder="请输入店员密码" style="margin-bottom:20px">
  122. <input type="submit" class="btn btn-success btn-block" name="submit" value="确定核销"/>
  123. {/if}
  124. </div>
  125. </div>
  126. </form>
  127. <script>
  128. require(['util'], function(u){
  129. $('#form1').submit(function(){
  130. if(!$.trim($('#password').val())) {
  131. u.message('请输入店员密码');
  132. return false;
  133. }
  134. return true;
  135. });
  136. });
  137. </script>
  138. {/if}
  139. {template 'common/footer'}