sq.html 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444
  1. <html>
  2. <head>
  3. <title>鲸致生活-上汽乘用车员工福利</title>
  4. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  5. <meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1, maximum-scale=1">
  6. <script>
  7. window.onerror = e => {
  8. console.error(e)
  9. alert('发生错误' + e)
  10. }
  11. </script>
  12. <!-- weui 样式 -->
  13. <link rel="stylesheet" href="https://res.wx.qq.com/open/libs/weui/2.4.1/weui.min.css"/>
  14. <link rel="stylesheet" href="../auto/css/main.css?2">
  15. <script src="../auto/js/config.js"></script>
  16. <script src="../auto/js/jquery-1.7.2.min.js"></script>
  17. <script src="../auto/js/viewport.js"></script>
  18. <script src="../auto/js/modernizr-2.6.2.min.js"></script>
  19. <!-- 公众号 JSSDK -->
  20. <script src="https://res.wx.qq.com/open/js/jweixin-1.6.0.js"></script>
  21. <!-- 云开发 Web SDK -->
  22. <script src="https://res.wx.qq.com/open/js/cloudbase/1.1.0/cloud.js"></script>
  23. <script>
  24. function docReady(fn) {
  25. if (document.readyState === 'complete' || document.readyState === 'interactive') {
  26. fn()
  27. } else {
  28. document.addEventListener('DOMContentLoaded', fn);
  29. }
  30. }
  31. docReady(async function () {
  32. var ua = navigator.userAgent.toLowerCase()
  33. var isWXWork = ua.match(/wxwork/i) == 'wxwork'
  34. var isWeixin = !isWXWork && ua.match(/micromessenger/i) == 'micromessenger'
  35. var isMobile = false
  36. var isDesktop = false
  37. if (navigator.userAgent.match(/(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|IEMobile)/i)) {
  38. isMobile = true
  39. } else {
  40. isDesktop = true
  41. }
  42. //设置优惠券值
  43. setCouponValue();
  44. isWeixin=true;
  45. if (isWeixin) {
  46. console.info('微信浏览器')
  47. var containerEl = document.getElementById('wechat-web-container')
  48. containerEl.classList.remove('hidden')
  49. containerEl.classList.add('full', 'wechat-web-container')
  50. var launchBtn = document.getElementById('launch-btn')
  51. launchBtn.addEventListener('ready', function (e) {
  52. console.log('开放标签 ready')
  53. })
  54. launchBtn.addEventListener('launch', function (e) {
  55. console.log('开放标签 success')
  56. })
  57. launchBtn.addEventListener('error', function (e) {
  58. console.log('开放标签 fail', e.detail)
  59. })
  60. wx.config({
  61. //debug: true, // 调试时可开启
  62. appId: 'wxf0a77f9993d8b60d', // <!-- replace -->
  63. timestamp: 0, // 必填,填任意数字即可
  64. nonceStr: 'nonceStr', // 必填,填任意非空字符串即可
  65. signature: 'signature', // 必填,填任意非空字符串即可
  66. jsApiList: ['chooseImage'], // 必填,随意一个接口即可
  67. openTagList: ['wx-open-launch-weapp'], // 填入打开小程序的开放标签名
  68. })
  69. } else if (isDesktop) {
  70. // 在 pc 上则给提示引导到手机端打开
  71. var containerEl = document.getElementById('desktop-web-container')
  72. containerEl.classList.remove('hidden')
  73. containerEl.classList.add('full', 'desktop-web-container')
  74. } else {
  75. console.info('手机浏览器')
  76. var containerEl = document.getElementById('public-web-container')
  77. containerEl.classList.remove('hidden')
  78. containerEl.classList.add('full', 'public-web-container')
  79. var c = new cloud.Cloud({
  80. // 必填,表示是未登录模式
  81. identityless: true,
  82. // 资源方 AppID
  83. resourceAppid: 'wxf0a77f9993d8b60d', // <!-- replace -->
  84. // 资源方环境 ID
  85. resourceEnv: 'zhaijieshi-3guecm78383ca692', // <!-- replace -->
  86. })
  87. await c.init()
  88. window.c = c
  89. var buttonEl = document.getElementById('public-web-jump-button')
  90. var buttonLoadingEl = document.getElementById('public-web-jump-button-loading')
  91. try {
  92. // await openWeapp(() => {
  93. // buttonEl.classList.remove('weui-btn_loading')
  94. // buttonLoadingEl.classList.add('hidden')
  95. // })
  96. } catch (e) {
  97. buttonEl.classList.remove('weui-btn_loading')
  98. buttonLoadingEl.classList.add('hidden')
  99. throw e
  100. }
  101. }
  102. })
  103. async function openWeapp(onBeforeJump) {
  104. if(isCopySuccess==false) return;
  105. var c = window.c
  106. const res = await c.callFunction({
  107. name: 'public',
  108. data: {
  109. action: 'getUrlScheme',
  110. },
  111. })
  112. console.warn(res)
  113. if (onBeforeJump) {
  114. onBeforeJump()
  115. }
  116. location.href = res.result.openlink
  117. }
  118. //复制券码
  119. function copyCoupon() {
  120. var value = getQueryString("no");
  121. if (value == null) return;
  122. const input = document.createElement('input');
  123. document.body.appendChild(input);
  124. input.setAttribute('value', value);
  125. input.select();
  126. isCopySuccess=true
  127. if (document.execCommand('copy')) {
  128. document.execCommand('copy');
  129. showCopySuccess('复制成功');
  130. }
  131. document.body.removeChild(input);
  132. }
  133. var isCopySuccess=false
  134. //显示复制成功
  135. function showCopySuccess(msg) {
  136. //赋值
  137. document.getElementById('spanMsg').innerHTML = msg;
  138. document.getElementById('copySuccess').classList.remove('hidden');
  139. setTimeout(() => {
  140. document.getElementById('copySuccess').classList.add('hidden', 'copySuccess');
  141. var apps= document.getElementsByClassName('openApp');
  142. var i;
  143. for (i = 0; i < apps.length; i++) {
  144. apps[i].classList.add('color-back-blue','color-white');
  145. }
  146. }, 1000);
  147. }
  148. function setCouponValue() {
  149. const coupon = getQueryString("no") == null ? '无效券号' : getQueryString("no");
  150. document.getElementById("coupon-wx").innerHTML = coupon;
  151. document.getElementById("coupon-web").innerHTML = coupon;
  152. //获取码对应的商品名称
  153. let url = getBaseUrl()+"/admin/coupon/getGoodsName?coupon=" + coupon;
  154. $.ajax({
  155. type: 'get',
  156. dataType: "json",
  157. url: url,
  158. cache: false,
  159. async: false,
  160. success: function (data) {
  161. if (data.errno == 0) {
  162. $('.goods').html(data.data);
  163. }
  164. },
  165. error: function (XMLHttpRequest, textStatus, errorThrown) {
  166. }
  167. });
  168. }
  169. //获取url参数
  170. function getQueryString(name) {
  171. var reg = new RegExp('(^|&)' + name + '=([^&]*)(&|$)', 'i');
  172. var r = window.location.search.substr(1).match(reg);
  173. if (r != null) {
  174. return unescape(r[2]);
  175. }
  176. return null;
  177. }
  178. </script>
  179. <style>
  180. .hidden {
  181. display: none;
  182. }
  183. .full{
  184. top: 0;
  185. }
  186. .public-web-container {
  187. margin: 20px;
  188. }
  189. .wechat-web-container {
  190. margin: 20px;
  191. }
  192. .wechat-web-container wx-open-launch-weapp {
  193. margin: 0px auto;
  194. }
  195. .desktop-web-container {
  196. margin: 20px;
  197. }
  198. /* .desktop-web-container p {
  199. position: absolute;
  200. top: 40%;
  201. } */
  202. /* .top {
  203. height: 180px;
  204. background-color: #09AFFF;
  205. text-align: center;
  206. width: 100%;
  207. } */
  208. .copy {
  209. color: #fff;
  210. position: unset !important;
  211. background-color: #3FBBFE;
  212. padding: 0 30px;
  213. border-bottom-right-radius: 60px;
  214. border-top-right-radius: 60px;
  215. text-decoration: none
  216. }
  217. .read {
  218. padding: 0 10px;
  219. font-size: 13px;
  220. position: absolute;
  221. bottom: 10px;
  222. }
  223. .read .title {
  224. text-align: center;
  225. }
  226. .read .header {
  227. font-weight: 600;
  228. }
  229. .read .content {
  230. font-size: 11px;
  231. }
  232. .line {
  233. position: relative;
  234. width: 100px;
  235. top: -15px;
  236. text-align: center;
  237. background-color: #fff;
  238. margin: 0 auto;
  239. }
  240. .message {
  241. position: absolute;
  242. top: 40%;
  243. z-index: 999;
  244. color: #333;
  245. background-color: #999;
  246. text-align: center;
  247. left: 50%;
  248. transform: translate(-50%, -50%);
  249. padding: 10px;
  250. border-radius: 5px;
  251. }
  252. </style>
  253. </head>
  254. <body>
  255. <div class="page">
  256. <div class="top"> </div>
  257. <!-- 复制成功提醒 -->
  258. <div id='copySuccess' class="message hidden">
  259. <span id='spanMsg'>复制成功</span>
  260. </div>
  261. <!--------------------------- 手机浏览器----------------------------------------------------------->
  262. <div id="public-web-container" class="hidden">
  263. <div class="steps">
  264. <div class="item">
  265. <div class="step color-back-blue">
  266. <div class="value">1</div>
  267. </div>
  268. <div class="bt color-blue">区域校验</div>
  269. </div>
  270. <hr class="hr"></hr>
  271. <div class="item">
  272. <div class="step color-back-blue">
  273. <div class="value">2</div>
  274. </div>
  275. <span class="bt color-blue">补贴申领</span>
  276. </div>
  277. <hr class="hr"></hr>
  278. <div class="item">
  279. <div class="step color-back-black step3">
  280. <div class="value">3</div>
  281. </div>
  282. <span class="bt color-black step3">补贴兑换</span>
  283. </div>
  284. </div>
  285. <div class="notice">
  286. <img src="../auto/img/icon/notice.png" class="notice-icon"/>
  287. <div style="font-size: 24px;" >工会补贴需在鲸致生活小程序上兑换成专属优惠券方能使用</div>
  288. </div>
  289. <!-- <div class="color-gray" style="margin: 30px;text-align: center;">工会补贴需在鲸致生活小程序上兑换成专属优惠券方能使用</div> -->
  290. <div class="step1">
  291. Step1
  292. <img src="../auto/img/icon/arrow.png"/>
  293. <p class="color-gray">复制兑换码</p>
  294. </div>
  295. <div class="coupon">
  296. <p class="goods">鲸致生活3小时居家保洁服务</p>
  297. <div class="coupon-area">
  298. <label class="coupon-value" id='coupon-web' onclick="copyCoupon()">XXX</label>
  299. <a class="copy" href="javascript:void(0)" onclick="copyCoupon()">点击复制券码</a>
  300. </div>
  301. </div>
  302. <div class="step1">
  303. Step2
  304. <img src="../auto/img/icon/arrow.png"/>
  305. <p class="color-gray">进入小程序,粘贴兑换</p>
  306. </div>
  307. <div class="coupon-area openApp" style="padding-left: 0;">
  308. <a id="public-web-jump-button" href="javascript:void(0)" style="text-decoration: none;margin: auto;font-size:40px;height: 100px;"
  309. class="weui-btn_loading color-gray" onclick="openWeapp()">
  310. 一键唤起小程序
  311. </a>
  312. </div>
  313. </div>
  314. <!--------------------------- 微信浏览器----------------------------------------------------------->
  315. <div id="wechat-web-container" class="hidden">
  316. <div class="steps">
  317. <div class="item">
  318. <div class="step color-back-blue">
  319. <div class="value">1</div>
  320. </div>
  321. <div class="bt color-blue">区域校验</div>
  322. </div>
  323. <hr class="hr"></hr>
  324. <div class="item">
  325. <div class="step color-back-blue">
  326. <div class="value">2</div>
  327. </div>
  328. <span class="bt color-blue">补贴申领</span>
  329. </div>
  330. <hr class="hr"></hr>
  331. <div class="item">
  332. <div class="step color-back-black" id='step3bk'>
  333. <div class="value">3</div>
  334. </div>
  335. <span class="bt color-black step3" id='step3title'>补贴兑换</span>
  336. </div>
  337. </div>
  338. <div class="color-gray" style="margin: 30px;text-align: center;">工会补贴需在鲸致生活小程序上兑换成专属优惠券方能使用</div>
  339. <div class="step1">
  340. Step1
  341. <img src="../auto/img/icon/arrow.png"/>
  342. <p class="color-gray">复制兑换码</p>
  343. </div>
  344. <div class="coupon">
  345. <p class="goods">鲸致生活3小时居家保洁服务</p>
  346. <!-- <p class="coupon-label">兑换码</p>
  347. <p class="coupon-value" id='coupon-wx' onclick="copyCoupon()">XXX</p>
  348. <a class="copy" href="javascript:void(0)" onclick="copyCoupon()">(点击复制券码)</a> -->
  349. <div class="coupon-area">
  350. <label class="coupon-value" id='coupon-wx' onclick="copyCoupon()">XXX</label>
  351. <a class="copy" href="javascript:void(0)" onclick="copyCoupon()">点击复制券码</a>
  352. </div>
  353. </div>
  354. <div class="step1">
  355. Step2
  356. <img src="../auto/img/icon/arrow.png"/>
  357. <p class="color-gray">进入小程序,粘贴兑换</p>
  358. </div>
  359. <div class="coupon-area openApp" style="padding-left: 0;">
  360. <wx-open-launch-weapp id="launch-btn" username="gh_e9b9499458d9" path="/pages/ucenter/couponList/couponList">
  361. <script type="text/wxtag-template">
  362. <style>.btn { display: flex;margin:auto;align-items: center;height:100px;color: #CACDD2;font-size:40px }</style>
  363. <div class="btn">一键唤起小程序 </div>
  364. </script>
  365. </wx-open-launch-weapp>
  366. </div>
  367. </div>
  368. </div>
  369. <!-- pc端打开提醒 -->
  370. <div id="desktop-web-container" class="hidden">
  371. <p class="" style="margin-top: 30px;">请在手机打开网页链接</p>
  372. </div>
  373. </div>
  374. <div class="footer" style="bottom: 50px;">
  375. <div class="img"></div>
  376. <fieldset class="marker">
  377. <legend>领先的互联网家政服务商</legend>
  378. </fieldset>
  379. </div>
  380. </body>
  381. </html>