package.html 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333
  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>
  15. <!-- 调试用的移动端 console -->
  16. <script src="../groupon/js/jquery-1.7.2.min.js"></script>
  17. <!-- 公众号 JSSDK -->
  18. <script src="https://res.wx.qq.com/open/js/jweixin-1.6.0.js"></script>
  19. <!-- 云开发 Web SDK -->
  20. <script src="https://res.wx.qq.com/open/js/cloudbase/1.1.0/cloud.js"></script>
  21. <script>
  22. function docReady(fn) {
  23. if (document.readyState === 'complete' || document.readyState === 'interactive') {
  24. fn()
  25. } else {
  26. document.addEventListener('DOMContentLoaded', fn);
  27. }
  28. }
  29. docReady(async function () {
  30. var ua = navigator.userAgent.toLowerCase()
  31. var isWXWork = ua.match(/wxwork/i) == 'wxwork'
  32. var isWeixin = !isWXWork && ua.match(/micromessenger/i) == 'micromessenger'
  33. var isMobile = false
  34. var isDesktop = false
  35. if (navigator.userAgent.match(/(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|IEMobile)/i)) {
  36. isMobile = true
  37. } else {
  38. isDesktop = true
  39. }
  40. if (isWeixin) {
  41. console.info('微信浏览器')
  42. document.getElementById('opentips').classList.add('tips')
  43. var containerEl = document.getElementById('wechat-web-container')
  44. containerEl.classList.remove('hidden')
  45. containerEl.classList.add('full', 'wechat-web-container')
  46. var launchBtn = document.getElementById('launch-btn');
  47. var coupon = getQueryString('coupon');
  48. launchBtn.setAttribute("path", "/pages/ucenter/couponList/couponList?type=1&coupon=" + coupon);
  49. launchBtn.addEventListener('ready', function (e) {
  50. console.log('开放标签 ready')
  51. //alert('开放标签 ready')
  52. })
  53. launchBtn.addEventListener('launch', function (e) {
  54. console.log('开放标签 success')
  55. //alert('开放标签 success')
  56. })
  57. launchBtn.addEventListener('error', function (e) {
  58. console.log('开放标签 fail', e.detail)
  59. //alert(e.detail)
  60. })
  61. wx.config({
  62. //debug: true, // 调试时可开启
  63. appId: 'wxf0a77f9993d8b60d', // <!-- replace -->
  64. timestamp: 0, // 必填,填任意数字即可
  65. nonceStr: 'nonceStr', // 必填,填任意非空字符串即可
  66. signature: 'signature', // 必填,填任意非空字符串即可
  67. jsApiList: ['chooseImage', 'previewImage'], // 必填,随意一个接口即可
  68. openTagList: ['wx-open-launch-weapp'], // 填入打开小程序的开放标签名
  69. })
  70. } else if (isDesktop) {
  71. // 在 pc 上则给提示引导到手机端打开
  72. var containerEl = document.getElementById('desktop-web-container')
  73. containerEl.classList.remove('hidden')
  74. containerEl.classList.add('full', 'desktop-web-container');
  75. } else {
  76. console.info('手机浏览器')
  77. var containerEl = document.getElementById('public-web-container')
  78. containerEl.classList.remove('hidden')
  79. containerEl.classList.add('full', 'public-web-container')
  80. var c = new cloud.Cloud({
  81. // 必填,表示是未登录模式
  82. identityless: true,
  83. // 资源方 AppID
  84. resourceAppid: 'wxf0a77f9993d8b60d', // <!-- replace -->
  85. // 资源方环境 ID
  86. resourceEnv: 'zhaijieshi-3guecm78383ca692', // <!-- replace -->
  87. })
  88. await c.init()
  89. window.c = c
  90. var buttonEl = document.getElementById('public-web-jump-button')
  91. var buttonLoadingEl = document.getElementById('public-web-jump-button-loading')
  92. try {
  93. // await openWeapp(() => {
  94. // buttonEl.classList.remove('weui-btn_loading')
  95. // buttonLoadingEl.classList.add('hidden')
  96. // })
  97. } catch (e) {
  98. buttonEl.classList.remove('weui-btn_loading')
  99. buttonLoadingEl.classList.add('hidden')
  100. throw e
  101. }
  102. }
  103. })
  104. //手机浏览器
  105. async function openWeapp(onBeforeJump) {
  106. var coupon = getQueryString('coupon');
  107. if (coupon == null || coupon == '' || coupon == 'null' || coupon.length < 8) {
  108. document.getElementById('errId').classList.remove('hidden');
  109. return;
  110. }
  111. document.getElementById('errId').classList.add('hidden');
  112. var c = window.c
  113. const res = await c.callFunction({
  114. name: 'public',
  115. data: {
  116. action: 'douyinCoupon',
  117. path: '/pages/ucenter/couponList/couponList',
  118. // query: 'type=1&coupon=' + coupon //不能进行encodeURIComponent编码,
  119. query: 'scene=pkSn,' + coupon + ';type,0'
  120. },
  121. })
  122. console.warn(res)
  123. if (onBeforeJump) {
  124. onBeforeJump()
  125. }
  126. location.href = res.result.openlink
  127. }
  128. async function openWeappQW(onBeforeJump) {
  129. var cp = getQueryString('cp');
  130. if (cp == null) cp = "qrcode"
  131. var mobile = getQueryString('mobile');//客户手机号 用来生成活码备注
  132. if (mobile == null) mobile = "mobile";
  133. var c = window.c
  134. const res = await c.callFunction({
  135. name: 'public',
  136. data: {
  137. action: 'getOpenWxJoin',
  138. path: '/pages/ucenter/wx/join',
  139. query: 'cp=' + cp + '&mobile=' + mobile //不能进行encodeURIComponent编码,
  140. },
  141. })
  142. console.warn(res)
  143. if (onBeforeJump) {
  144. onBeforeJump()
  145. }
  146. location.href = res.result.openlink
  147. }
  148. //获取url参数
  149. function getQueryString(name) {
  150. var reg = new RegExp('(^|&)' + name + '=([^&]*)(&|$)', 'i');
  151. var r = window.location.search.substr(1).match(reg);
  152. if (r != null) {
  153. return unescape(r[2]);
  154. }
  155. return null;
  156. }
  157. </script>
  158. <style>
  159. .tips {
  160. height: 100%;
  161. width: 100%;
  162. background-repeat: no-repeat;
  163. background-image: url(./img/tips.png);
  164. background-size: 100%;
  165. position: absolute;
  166. top: 0;
  167. }
  168. .tips-none{
  169. position: absolute;
  170. }
  171. .hidden {
  172. display: none;
  173. }
  174. .full {
  175. margin-top: 30%;
  176. }
  177. .public-web-container {
  178. display: flex;
  179. flex-direction: column;
  180. align-items: center;
  181. margin-bottom: 30px;
  182. }
  183. .wechat-web-container {
  184. /* display: flex;
  185. flex-direction: column;
  186. align-items: center; */
  187. height: 80px;
  188. }
  189. .wechat-web-container wx-open-launch-weapp {
  190. display: flex;
  191. flex-direction: column;
  192. align-items: center;
  193. margin: 0px auto;
  194. height: 60px;
  195. }
  196. .desktop-web-container {
  197. display: flex;
  198. flex-direction: column;
  199. align-items: center;
  200. position: absolute;
  201. bottom: 20px;
  202. left: 0;
  203. right: 0;
  204. bottom: 0;
  205. margin: auto;
  206. }
  207. .top {
  208. height: -160px;
  209. background-color: white;
  210. text-align: center;
  211. width: 100%;
  212. }
  213. .btn {
  214. width: 90%;
  215. height: 50px;
  216. text-align: center;
  217. font-size: 17px;
  218. padding: 8px 24px;
  219. border-radius: 40px;
  220. border: 1px solid #c2c5c7;
  221. background-color: #c2c5c7;
  222. color: white;
  223. position: absolute;
  224. margin: auto;
  225. left: 0;
  226. right: 0;
  227. }
  228. </style>
  229. </head>
  230. <body style="background-color: white;background-image: url('./img/shrs.jpg');background-size:100%;">
  231. <!-- <div style="margin-top:30%;text-align: center;">
  232. <img src="../douyin/img/logo.png" style="width: 120px;" />
  233. </div> -->
  234. <div class="page full">
  235. <!--------------------------- 手机浏览器----------------------------------------------------------->
  236. <div id="errId" class="hidden" style="font-size: 11px;color: red;text-align: center;">无效团购券号</div>
  237. <div id="public-web-container" class="hidden">
  238. <a id="public-web-jump-button" href="javascript:void(0)" style="background-color: #01B9FF;color: white;height:50px;border-radius: 40px;border: 2px solid white;line-height: 30px;
  239. width: 80%;font-weight: 600;margin-top:95%" class="weui-btn weui-btn_primary weui-btn_loading"
  240. onclick="openWeapp()">
  241. 点击预约服务
  242. </a>
  243. <span style="color: #01B9FF;margin-top: 20px;" onclick="openWeappQW()">1V1专属管家</span>
  244. <!-- <div style="padding:0 10px;height: 58px;font-size: 11px;color: #939393;line-height: 19px;display: flex;">
  245. <input type="checkbox" style="margin-top: 4px;margin-right: 5px;"></input>
  246. <div>预约即代表您已阅读并接受<span style="font-weight: 600;">《券码核销说明》</span>和
  247. <span style="font-weight: 600;">《服务范围覆盖 说明》</span>与
  248. <span style="font-weight: 600;">《服务日期更改规则》</span>
  249. </div>
  250. </div> -->
  251. </div>
  252. <!--------------------------- 微信浏览器----------------------------------------------------------->
  253. <div id="wechat-web-container" class="hidden">
  254. <wx-open-launch-weapp id="launch-btn" username="gh_e9b9499458d9" path="/pages/ucenter/couponList/couponList">
  255. <template>
  256. <style>
  257. .btn {
  258. width: 80%;
  259. height: 50px;
  260. text-align: center;
  261. font-size: 17px;
  262. display: block;
  263. margin: 0 auto;
  264. padding: 8px 24px;
  265. border-radius: 40px;
  266. border: 2px solid white;
  267. background-color: #29BBEA;
  268. color: white;
  269. font-weight: 600;
  270. }
  271. </style>
  272. <button class="btn">一键唤起小程序</button>
  273. </template>
  274. </wx-open-launch-weapp>
  275. <!-- <div style="padding:0 10px;height: 58px;font-size: 11px;color: #939393;line-height: 19px;display: flex;">
  276. <input type="checkbox" style="margin-top: 4px;margin-right: 5px;height: 20px;width: 20px;"></input>
  277. <div>预约即代表您已阅读并接受<span style="font-weight: 600;">《券码核销说明》</span>和
  278. <span style="font-weight: 600;">《服务范围覆盖 说明》</span>与
  279. <span style="font-weight: 600;">《服务日期更改规则》</span>
  280. </div>
  281. </div> -->
  282. </div>
  283. <!-- pc端打开提醒 -->
  284. <div id="desktop-web-container" class="hidden">
  285. <p class="" style="margin-top: 30px;">请在手机打开网页链接</p>
  286. </div>
  287. </div>
  288. <div class="tips-none" id="opentips" >
  289. </div>
  290. </body>
  291. </html>