index.php 9.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298
  1. <!DOCTYPE html>
  2. <html class="" lang="zh-cmn-Hans">
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  5. <meta http-equiv="X-UA-Compatible" content="IE=edge">
  6. <meta name="renderer" content="webkit">
  7. <meta name="referrer" content="always">
  8. <meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
  9. <meta name="HandheldFriendly" content="True">
  10. <meta name="MobileOptimized" content="320">
  11. <meta name="format-detection" content="telephone=no">
  12. <meta http-equiv="cleartype" content="on">
  13. <meta name="keywords" content="">
  14. <meta name="description" content="">
  15. <title>刮刮乐</title>
  16. <link rel="stylesheet" href="/css/gua/lucky-card.css?v=5">
  17. <link rel="stylesheet" href="/css/gua/base.css" media="screen">
  18. <link rel="stylesheet" href="/css/gua/common.css" media="screen">
  19. <link rel="stylesheet" href="/css/gua/global-sales-card-icon.css" media="screen">
  20. <link rel="stylesheet" href="/css/gua/cards.css?v=5" media="screen">
  21. <style>
  22. .copyright, .footer {
  23. text-align: center;
  24. line-height: 16px
  25. }
  26. a {
  27. text-decoration: none
  28. }
  29. .copyright {
  30. background-color: #f8f8f8;
  31. color: #999;
  32. font-size: 0
  33. }
  34. .copyright .ft-links {
  35. padding: 30px 15px 10px
  36. }
  37. .copyright .ft-links a {
  38. padding: 0 6px;
  39. color: #666;
  40. font-size: 12px
  41. }
  42. .copyright .ft-links a:not(:last-child) {
  43. border-right: 1px solid #e5e5e5
  44. }
  45. .copyright .ft-copyright {
  46. padding: 20px 0 24px;
  47. margin: 0 15px;
  48. font-size: 12px;
  49. background-size: 110px 30px
  50. }
  51. .ft-copyright a {
  52. padding-top: 45px;
  53. color: #bfbfc3
  54. }
  55. .ft-copyright .yz-logo {
  56. padding-left: 14px;
  57. position: relative
  58. }
  59. .ft-copyright .yz-logo::before {
  60. content: '';
  61. background-size: 10px 12px;
  62. width: 10px;
  63. height: 12px;
  64. position: absolute;
  65. bottom: 1px;
  66. left: 0
  67. }
  68. .footer {
  69. padding: 0;
  70. min-height: 1px;
  71. background-color: #f8f8f8;
  72. margin: 0 auto
  73. }
  74. .customer-tips {
  75. margin-top: 30px;
  76. }
  77. .customer-tips-a {
  78. margin-top: 13px;
  79. }
  80. .xhCenterModal {
  81. background-color: #8dc63f;
  82. border-color: #8dc63f;
  83. color: #ffffff;
  84. position: fixed;
  85. width: 20%;
  86. font-size: 12px;
  87. height: auto;
  88. padding: 15px;
  89. z-index: 9999;
  90. display: none;
  91. width: 180px;
  92. text-align: center;
  93. }
  94. </style>
  95. </head>
  96. <body>
  97. <div name="xhCenterModal" class="xhCenterModal"></div>
  98. <div class="page-content" style="min-height: 812px; min-height: 100vh;">
  99. <div class="cards">
  100. <div class="cards-scratch">
  101. <div id="scratch">
  102. <div id="card">
  103. <div class="not_hit">
  104. <span>没有中奖</span>
  105. </div>
  106. <div class="hit">
  107. <p class="bless">恭喜你获得</p><span id="winPrize" class="win_prize"></span>
  108. <?php if (isset($userInfo['mobile']) && !empty($userInfo['mobile'])) { ?>
  109. <p class="look">可到“我的奖品”查看</p>
  110. <?php } else { ?>
  111. <p class="look">到店填写手机号即可领取</p>
  112. <?php } ?>
  113. </div>
  114. </div>
  115. </div>
  116. <div class="guide"><p class="guide-tips">刮开试试手气</p>
  117. <?php if ($this->context->isLogin == false) { ?>
  118. <button onclick="goLogin()" class="guide-btn">一键登陆</button>
  119. <?php } else { ?>
  120. <button onclick="gua(this)" class="guide-btn">点我刮奖</button>
  121. <?php } ?>
  122. </div>
  123. </div>
  124. <p class="cards-count">
  125. <?php if ($this->context->isLogin == false) { ?>
  126. 请点击上面一键登陆
  127. <?php } else { ?>
  128. 你还有 <em class="cards-count__number"><?= $remainNum ?></em> 次刮奖机会
  129. <?php } ?>
  130. </p>
  131. <?php if ($card['showWin'] == 1) { if(!empty($winUser)){ ?>
  132. <div style="text-align:center;font-size:1rem;color:white;margin-top:1rem;">幸运用户</div>
  133. <style>
  134. .box {
  135. height: 10px;
  136. padding: 8px;
  137. overflow: hidden;
  138. margin: 9px 24px 0 24px;
  139. line-height: 32px;
  140. background: hsla(0, 0%, 100%, .16);
  141. font-size: 14px;
  142. color: #fff;
  143. }
  144. .box li {
  145. list-style: none;
  146. }
  147. .box ul li {
  148. line-height: 20px;
  149. }
  150. </style>
  151. <div class="box">
  152. <ul>
  153. <?php foreach($winUser as $winner){ ?>
  154. <li>
  155. <span style="width:2.5rem;display:inline-block;margin-left:4rem;"><?= "<img style='width:1rem;border-radius:.4rem;' src='".$winner['avatar']."' />"?></span>
  156. <span style="width:4rem;display:inline-block;"><?= $winner['userName'] ?></span>
  157. <span style="width:6rem;display:inline-block;"><?= $winner['prizeName'] ?></span>
  158. </li>
  159. <?php } ?>
  160. </ul>
  161. </div>
  162. <?php } } ?>
  163. <section class="apps-rules-wrap cards-rules"><h3 class="title">活动规则</h3>
  164. <div class="rules-list"><label class="label">· 活动时间:</label>
  165. <p class="rules"><?= date("Y-m-d", $card['startTime']) ?> 至 <?= date("Y-m-d", $card['endTime']) ?></p>
  166. </div>
  167. <div class="rules-list description"><label class="label">· 活动说明:</label>
  168. <p class="rules description-rules"><?php echo $card['introduce']; ?></p></div>
  169. <div class="rules-list"><label class="label">· 发行方:</label>
  170. <p class="rules"><?php echo $this->context->merchantName; ?></p></div>
  171. </section>
  172. <div class="apps-footer-btns">
  173. <button class="btn home-btn" onclick="window.location.href='/mobile/index?account=<?= $this->context->merchantId ?>'">
  174. 进店逛逛
  175. </button>
  176. <button class="btn prize-btn" <?php if ($this->context->isLogin){ ?>onclick="window.location.href='./my-prize?account=<?= $this->context->merchantId ?>&id=<?= $card['id'] ?>'" <?php } ?>>
  177. 我的奖品
  178. </button>
  179. </div>
  180. </div>
  181. </div>
  182. <div class="footer">
  183. <div class="copyright">
  184. <div class="ft-copyright" style="">
  185. <a class="" href=""> 花卉宝 </a><br/><a href="javascript:void(0);"> 提供技术支持 </a>
  186. </div>
  187. </div>
  188. </div>
  189. <script src="/js/jquery-1.11.1.min.js"></script>
  190. <script src="/js/util.js"></script>
  191. <script src="/js/gua/lucky-card.min.js"></script>
  192. <script>
  193. (function ($) {
  194. $.fn.scrollTop = function (options) {
  195. var defaults = {
  196. speed: 30
  197. }
  198. var opts = $.extend(defaults, options);
  199. this.each(function () {
  200. var $timer;
  201. var scroll_top = 0;
  202. var obj = $(this);
  203. var $height = obj.find("ul").height();
  204. obj.find("ul").clone().appendTo(obj);
  205. obj.hover(function () {
  206. clearInterval($timer);
  207. }, function () {
  208. $timer = setInterval(function () {
  209. scroll_top++;
  210. if (scroll_top > $height) {
  211. scroll_top = 0;
  212. }
  213. obj.find("ul").first().css("margin-top", -scroll_top);
  214. }, opts.speed);
  215. }).trigger("mouseleave");
  216. })
  217. }
  218. })(jQuery)
  219. $(function () {
  220. $(".box").scrollTop({
  221. speed: 100 //数值越大 速度越慢
  222. });
  223. })
  224. function goLogin() {
  225. xhPopMsg('正在登陆...');
  226. setTimeout(function () {
  227. window.location.href = '<?php echo Yii::$app->request->getHostInfo() . Yii::$app->request->url; ?>&authScope=snsapi_userinfo';
  228. }, 1500);
  229. }
  230. function gua(o) {
  231. <?php if($remainNum == 0){ ?>
  232. xhPopMsg('您的刮奖次数用完了');
  233. return false;
  234. <?php } ?>
  235. $(o).parent().remove();
  236. }
  237. //标识当前没有进行刮奖 shish 2019.8.11
  238. var hasGua = false;
  239. LuckyCard.case({
  240. coverColor: '#C5C5C5', ratio: 0.01, callback: function () {
  241. if (hasGua) {
  242. return false;
  243. }
  244. hasGua = true;
  245. $.ajax({
  246. type: "GET",
  247. url: "/gua/gua?account=<?= $this->context->merchantId ?>&id=<?= $card['id'] ?>",
  248. dataType: 'json',
  249. async: false,
  250. success: function (data) {
  251. if (data.code == 'A0001') {
  252. if (data.data.hit == 0) {
  253. $(".not_hit").css('display', 'block');
  254. $('.hit').css("display", 'none');
  255. } else {
  256. $(".not_hit").css("display", 'none');
  257. $('.hit').css('display', 'block');
  258. $('#winPrize').html(data.data.info.prizeName);
  259. }
  260. } else {
  261. xhPopMsg(data.msg);
  262. }
  263. }
  264. });
  265. }
  266. });
  267. </script>
  268. </body>
  269. </html>