douyin.html 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406
  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="../service/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. var containerEl = document.getElementById('wechat-web-container')
  43. containerEl.classList.remove('hidden')
  44. containerEl.classList.add('full', 'wechat-web-container')
  45. document.getElementById('desc-container').classList.remove('hidden');
  46. var launchBtn = document.getElementById('launch-btn');
  47. //输入框添加input事件
  48. var couponInput = document.getElementById('coupon');
  49. couponInput.addEventListener("keyup", function (event) {
  50. if (this.value != '' && this.value.length > 10) {
  51. var launchBtn1 = document.getElementById('launch-btn');
  52. launchBtn1.setAttribute("path", "/pages/ucenter/couponList/couponList?type=2&coupon=" + this.value);
  53. document.getElementById('errId').classList.add('hidden');
  54. document.getElementById('btnCover').classList.add('hidden');//隐藏覆盖层
  55. }
  56. else {
  57. document.getElementById('errId').classList.remove('hidden');
  58. document.getElementById('btnCover').classList.remove('hidden');//隐藏覆盖层
  59. }
  60. });
  61. launchBtn.addEventListener('ready', function (e) {
  62. console.log('开放标签 ready')
  63. //alert('开放标签 ready')
  64. })
  65. launchBtn.addEventListener('launch', function (e) {
  66. console.log('开放标签 success')
  67. //alert('开放标签 success')
  68. })
  69. launchBtn.addEventListener('error', function (e) {
  70. console.log('开放标签 fail', e.detail)
  71. //alert(e.detail)
  72. })
  73. wx.config({
  74. //debug: true, // 调试时可开启
  75. appId: 'wxf0a77f9993d8b60d', // <!-- replace -->
  76. timestamp: 0, // 必填,填任意数字即可
  77. nonceStr: 'nonceStr', // 必填,填任意非空字符串即可
  78. signature: 'signature', // 必填,填任意非空字符串即可
  79. jsApiList: ['chooseImage', 'previewImage'], // 必填,随意一个接口即可
  80. openTagList: ['wx-open-launch-weapp'], // 填入打开小程序的开放标签名
  81. })
  82. } else if (isDesktop) {
  83. // 在 pc 上则给提示引导到手机端打开
  84. var containerEl = document.getElementById('desktop-web-container')
  85. containerEl.classList.remove('hidden')
  86. containerEl.classList.add('full', 'desktop-web-container');
  87. } else {
  88. var containerEl = document.getElementById('public-web-container')
  89. containerEl.classList.remove('hidden')
  90. containerEl.classList.add('full', 'public-web-container')
  91. document.getElementById('desc-container').classList.remove('hidden');
  92. var c = new cloud.Cloud({
  93. // 必填,表示是未登录模式
  94. identityless: true,
  95. // 资源方 AppID
  96. resourceAppid: 'wxf0a77f9993d8b60d', // <!-- replace -->
  97. // 资源方环境 ID
  98. resourceEnv: 'zhaijieshi-3guecm78383ca692', // <!-- replace -->
  99. })
  100. await c.init()
  101. window.c = c
  102. var buttonEl = document.getElementById('public-web-jump-button')
  103. var buttonLoadingEl = document.getElementById('public-web-jump-button-loading')
  104. try {
  105. // await openWeapp(() => {
  106. // buttonEl.classList.remove('weui-btn_loading')
  107. // buttonLoadingEl.classList.add('hidden')
  108. // })
  109. } catch (e) {
  110. buttonEl.classList.remove('weui-btn_loading')
  111. buttonLoadingEl.classList.add('hidden')
  112. throw e
  113. }
  114. }
  115. })
  116. //手机浏览器
  117. async function openWeapp(onBeforeJump) {
  118. console.info('手机浏览器')
  119. var coupon = document.getElementById('coupon');
  120. if (coupon.value == null || coupon.value == '' || coupon.value.length < 10) {
  121. document.getElementById('errId').classList.remove('hidden');
  122. return;
  123. }
  124. document.getElementById('errId').classList.add('hidden');
  125. var c = window.c
  126. const res = await c.callFunction({
  127. name: 'public',
  128. data: {
  129. action: 'douyinCoupon',
  130. query: 'type=2&coupon=' + coupon.value //不能进行encodeURIComponent编码,不能传对象 小程序接收参数格式:id,12;type,0
  131. },
  132. })
  133. console.warn(res)
  134. if (onBeforeJump) {
  135. onBeforeJump()
  136. }
  137. location.href = res.result.openlink
  138. }
  139. //获取url参数
  140. function getQueryString(name) {
  141. var reg = new RegExp('(^|&)' + name + '=([^&]*)(&|$)', 'i');
  142. var r = window.location.search.substr(1).match(reg);
  143. if (r != null) {
  144. return unescape(r[2]);
  145. }
  146. return null;
  147. }
  148. </script>
  149. <style>
  150. .hidden {
  151. display: none;
  152. }
  153. .full {
  154. margin-top: 0px;
  155. }
  156. .public-web-container {
  157. display: flex;
  158. flex-direction: column;
  159. align-items: center;
  160. margin-bottom: 30px;
  161. }
  162. .wechat-web-container {
  163. /* display: flex;
  164. flex-direction: column;
  165. align-items: center; */
  166. height: 80px;
  167. }
  168. .wechat-web-container wx-open-launch-weapp {
  169. display: flex;
  170. flex-direction: column;
  171. align-items: center;
  172. margin: 0px auto;
  173. height: 60px;
  174. }
  175. .desktop-web-container {
  176. display: flex;
  177. flex-direction: column;
  178. align-items: center;
  179. }
  180. .top {
  181. height: -160px;
  182. background-color: white;
  183. text-align: center;
  184. width: 100%;
  185. }
  186. .desc {
  187. margin: 10px;
  188. background-color: white;
  189. padding-bottom: 20px;
  190. border-radius: 10px;
  191. margin-top: -55px;
  192. padding: 5px 10px 15px;
  193. }
  194. .desc .title {
  195. height: 15px;
  196. font-size: 15px;
  197. font-family: Source Han Sans CN;
  198. font-weight: bold;
  199. color: #000000;
  200. margin: 10px 0;
  201. }
  202. .desc .title .line {
  203. width: 2px;
  204. height: 13px;
  205. background: #26B0FA;
  206. display: inline-block;
  207. }
  208. .desc .step {
  209. height: 15px;
  210. font-size: 15px;
  211. font-family: Source Han Sans CN;
  212. font-weight: 400;
  213. color: #000000;
  214. }
  215. .desc .step .arrow {
  216. width: 13px;
  217. height: 9px;
  218. }
  219. .gray {
  220. background-color: #666
  221. }
  222. .desc .content {
  223. font-size: 12px;
  224. line-height: 14px;
  225. font-weight: 400;
  226. color: #939393;
  227. line-height: 24px;
  228. }
  229. .coupon {
  230. margin: 20px 0;
  231. text-align: center;
  232. display: flex;
  233. flex-direction: column;
  234. align-items: center;
  235. }
  236. .coupon .input {
  237. height: 50px;
  238. border-radius: 30px;
  239. width: 90%;
  240. border: 0;
  241. font-size: 18px;
  242. text-align: center;
  243. }
  244. .btn {
  245. width: 90%;
  246. height: 50px;
  247. text-align: center;
  248. font-size: 17px;
  249. padding: 8px 24px;
  250. border-radius: 40px;
  251. border: 1px solid #c2c5c7;
  252. background-color: #c2c5c7;
  253. color: white;
  254. position: absolute;
  255. margin: auto;
  256. left: 0;
  257. right: 0;
  258. }
  259. </style>
  260. </head>
  261. <body style="background-color: #F0F2F4;">
  262. <div
  263. style="background-image: url('../douyin/img/bk.png');background-size: 100% 100%; height: 176px;text-align: center;">
  264. <img src="../douyin/img/logo.png" style="width: 120px;" />
  265. </div>
  266. <div id="desc-container" class="hidden">
  267. <div class="desc">
  268. <div class="title">
  269. <div class="line"></div>
  270. 抖音券码核销说明
  271. </div>
  272. <div class="step">Step1 <img class="arrow" src="../douyin/img/arrow.png" /></div>
  273. <div class="content">在下方填入抖音购买的券码号</div>
  274. <div class="step">Step2 <img class="arrow" src="../douyin/img/arrow.png" /></div>
  275. <div class="content">点击“立即预约”,跳转进入服务地址、服务日期的预约流程</div>
  276. <div class="step">Step3 <img class="arrow" src="../douyin/img/arrow.png" /></div>
  277. <div class="content">预约成功后会抖音券自动被核销,核销后无法退款</div>
  278. <div class="title">
  279. <div class="line"></div>
  280. 服务范围覆盖说明
  281. </div>
  282. <div class="content">① 若您预约时所填的地址不在服务范围内,将无法完成预约</div>
  283. <div class="content">② 超出服务范围的抖音订单,可在抖音平台直接申请退款 </div>
  284. <div class="title">
  285. <div class="line"></div>
  286. 服务日期更改规则
  287. </div>
  288. <div class="content">① 因您个人原因,在服务开始前24小时(不含)以上修改服务时间的,不收取任何费用</div>
  289. <div class="content">② 因您个人原因,修改时间晚于服务开始前24小时,需收取20元【临时改约费】,客服将指导完成付费 </div>
  290. <div class="content">③ 如服务人员已经上门,因您个人原因导致服务不能正常履约的,则视为本次服务已完成 </div>
  291. <div style="width: 100%;height: 1px;background: #D8D8D8;"></div>
  292. <div class="content">在线客服工作时间:10:00—19:00</div>
  293. <div class="content">电话客服工作时间:7:30-21:30(400-921-8987) </div>
  294. </div>
  295. <div class="coupon">
  296. <input class="input" id="coupon" name="coupon" placeholder="请填入抖音券号" />
  297. <div id="errId" class="hidden" style="font-size: 11px;color: red;">请输入12位抖音券号</div>
  298. <div style="padding:0 10px;height: 28px;font-size: 11px;color: #939393;line-height: 19px;">*券码复制方式:抖音APP“我”—
  299. 右上角“我的订单”— “全部”
  300. — 选择订单 —“去使用”— 查看券码 — 复制券号
  301. </div>
  302. </div>
  303. </div>
  304. <div class="page full">
  305. <!--------------------------- 手机浏览器----------------------------------------------------------->
  306. <div id="public-web-container" class="hidden">
  307. <a id="public-web-jump-button" href="javascript:void(0)" style="background-color: #09afff;color: white;height:50px;border-radius: 40px;border: 1px solid #09afff;line-height: 30px;
  308. width: 90%;" class="weui-btn weui-btn_primary weui-btn_loading" onclick="openWeapp()">
  309. 立即预约
  310. </a>
  311. <div style="padding:0 10px;height: 58px;font-size: 11px;color: #939393;line-height: 19px;display: flex;">
  312. <input type="checkbox" style="margin-top: 4px;margin-right: 5px;"></input>
  313. <div>预约即代表您已阅读并接受<span style="font-weight: 600;">《券码核销说明》</span>和
  314. <span style="font-weight: 600;">《服务范围覆盖 说明》</span>与
  315. <span style="font-weight: 600;">《服务日期更改规则》</span>
  316. </div>
  317. </div>
  318. </div>
  319. <!--------------------------- 微信浏览器----------------------------------------------------------->
  320. <div id="wechat-web-container" class="hidden">
  321. <button id="btnCover" class="btn">立即预约</button>
  322. <wx-open-launch-weapp id="launch-btn" username="gh_e9b9499458d9" path="/pages/ucenter/couponList/couponList">
  323. <template>
  324. <style>
  325. .btn {
  326. width: 90%;
  327. height: 50px;
  328. text-align: center;
  329. font-size: 17px;
  330. display: block;
  331. margin: 0 auto;
  332. padding: 8px 24px;
  333. border-radius: 40px;
  334. border: 1px solid #09afff;
  335. background-color: #09afff;
  336. color: white;
  337. }
  338. </style>
  339. <button class="btn">立即预约</button>
  340. </template>
  341. </wx-open-launch-weapp>
  342. <div style="padding:0 10px;height: 58px;font-size: 11px;color: #939393;line-height: 19px;display: flex;">
  343. <input type="checkbox" style="margin-top: 4px;margin-right: 5px;height: 20px;width: 20px;"></input>
  344. <div>预约即代表您已阅读并接受<span style="font-weight: 600;">《券码核销说明》</span>和
  345. <span style="font-weight: 600;">《服务范围覆盖 说明》</span>与
  346. <span style="font-weight: 600;">《服务日期更改规则》</span>
  347. </div>
  348. </div>
  349. </div>
  350. <!-- pc端打开提醒 -->
  351. <div id="desktop-web-container" class="hidden">
  352. <!-- <div class="top">
  353. <img src="../auto/img/logo.png" width="160px" />
  354. </div> -->
  355. <p class="" style="margin-top: 30px;">请在手机打开网页链接</p>
  356. </div>
  357. </div>
  358. </body>
  359. </html>