frame0.html 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0" />
  6. <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
  7. <title></title>
  8. <link rel="stylesheet" type="text/css" href="../css/api.css" />
  9. <link rel="stylesheet" type="text/css" href="../css/star-rating-svg.css?v=1.2" />
  10. <link rel="stylesheet" type="text/css" href="../css/weui.min.css" />
  11. <link rel="stylesheet" type="text/css" href="../css/style.css" />
  12. <link rel="stylesheet" type="text/css" href="../css/swiper.min.css" />
  13. <style>
  14. .swiper-container {
  15. width: 100%;
  16. height: 100%;
  17. }
  18. .swiper-slide img{
  19. width:100%;
  20. height:100%;
  21. }
  22. .home-hotel-title {
  23. font-size: 0.27rem;
  24. overflow: hidden;
  25. white-space: nowrap;
  26. text-overflow: ellipsis;
  27. color: #000;
  28. font-weight: 700;
  29. }
  30. .home-hotel-list {
  31. margin-bottom: 0.2rem;
  32. }
  33. .msg-list,.scan-barcode{
  34. position:absolute;
  35. /*width: 1rem;*/
  36. text-align:center;
  37. }
  38. .home-top-left {
  39. padding-top: 0.1rem;
  40. float: left;
  41. line-height: 0;
  42. }
  43. .home-hotel-right { /*width: 4.2rem;*/ }
  44. .home-hotel-dsc {
  45. font-size: 0.24rem;
  46. line-height: 0.34rem;
  47. }
  48. .swiper-container-horizontal>.swiper-pagination-bullets, .swiper-pagination-custom, .swiper-pagination-fraction {
  49. bottom: 0;
  50. }
  51. .swiper-pagination-bullet {
  52. background: #fff;
  53. opacity: .8;
  54. }
  55. .swiper-pagination-bullet-active {
  56. background: #d9251c;
  57. }
  58. .home-nearby:before {
  59. content: ' ';
  60. position: absolute;
  61. pointer-events: none;
  62. box-sizing: border-box;
  63. /*top: -50%;*/
  64. left: -50%;
  65. right: -50%;
  66. bottom: 0;
  67. -webkit-transform: scale(0.5);
  68. transform: scale(0.5);
  69. border-bottom: 1px solid #ddd;
  70. }
  71. .border-none{
  72. text-align: center;
  73. font-size: 0.28rem;
  74. height: 8rem;
  75. }
  76. .border-none p{
  77. color:#999999;
  78. }
  79. .border-none-img{
  80. margin-top: 1.5rem;
  81. width: 1.73rem;
  82. height: auto;
  83. }
  84. .home-nearby .weui-cell {
  85. padding: 16px 3px;
  86. }
  87. .home-nearby weui-cell__bd p {
  88. font-size: 0.35rem;
  89. }
  90. .home-top-left {
  91. width: 4.9rem;
  92. }
  93. .local-name {
  94. width: 4.2rem;
  95. }
  96. .weui-cell__ft {
  97. font-size: 0.25rem;
  98. }
  99. .home-hotel-left img {
  100. height: auto;
  101. }
  102. .home-hotel-dsc {
  103. -webkit-line-clamp: 1;
  104. }
  105. .hotel_credit {
  106. font-size: 0.47rem;
  107. position: absolute;
  108. margin-top: -0.2rem;
  109. color: #000000;
  110. font-family: Medium;
  111. font-weight: 500;
  112. }
  113. .hotel_credit:after {
  114. position: absolute;
  115. top: 0.45rem;
  116. width: 100%;
  117. height: 0.13rem;
  118. content: "";
  119. /*background: #ffdb26;*/
  120. margin-left: -100%;
  121. z-index: -1;
  122. }
  123. .tag-item {
  124. position: relative;
  125. margin: 1px 0.08rem;
  126. padding: 0rem 0.1rem;
  127. display: inline-block;
  128. line-height: 1.5;
  129. /* margin-left: 0; */
  130. margin-right: 0;
  131. font-size: 0.2rem;
  132. }
  133. .tag-item:first-child {
  134. margin-left: 0;
  135. }
  136. .tag-item:after {
  137. position: absolute;
  138. box-sizing: border-box;
  139. content: ' ';
  140. pointer-events: none;
  141. top: -50%;
  142. right: -50%;
  143. bottom: -50%;
  144. left: -50%;
  145. border: 1px solid #222;
  146. -webkit-transform: scale(0.5);
  147. transform: scale(0.5);
  148. border-radius: 0.08rem;
  149. }
  150. </style>
  151. <script>
  152. (function(window) {
  153. var winW = document.documentElement.clientWidth || document.body.clientWidth;
  154. if (winW > 750) {
  155. winW = 750;
  156. }
  157. document.documentElement.style.fontSize = winW / 7.5 + "px";
  158. window.onresize = function() {
  159. var winW = document.documentElement.clientWidth || document.body.clientWidth;
  160. document.body.clientWidth;
  161. if (winW > 750) {
  162. winW = 750;
  163. }
  164. document.documentElement.style.fontSize = winW / 7.5 + "px";
  165. }
  166. }(window));
  167. </script>
  168. </head>
  169. <body>
  170. <div class="topbar"></div>
  171. <section>
  172. <div style="position: fixed;width: 6.9rem;margin-left: -1px;z-index: 2;background: #fff;" id="header">
  173. <div class="home-top" style="padding: 0.1rem 0;">
  174. <div class="home-top-left"><img id="set-local" class="home-top-local" src="../image/home_local.png" /> <span class="local-name">&nbsp;正在搜索您附近的酒店</span></div>
  175. <div class="home-top-right" style="margin-top: -0.05rem;">
  176. <div class="scan-barcode" style="right: 1rem;"><img class="home-top-local" src="../image/home_scan.png" />
  177. <p>扫一扫</p>
  178. </div>
  179. <div class="msg-list" style="right: 0.2rem;"><img class="home-top-local" src="../image/home_msg.png" />
  180. <p>消息</p><span class="msg-total mask-hidden" style="position: absolute;top: 0;">0</span>
  181. </div>
  182. </div>
  183. </div>
  184. <div class="home-search" style="margin-bottom: 0.2rem;"><img src="../image/search.png"> 搜索您入住的酒店</div>
  185. </div>
  186. <div class="h10" style="height: 2.35rem;"></div>
  187. <div class="home-ads" style="border-radius: 0.1rem;">
  188. <div class="swiper-container" style="border-radius: 0.1rem;">
  189. <div class="swiper-wrapper">
  190. </div>
  191. <div class="swiper-pagination"></div>
  192. </div>
  193. </div>
  194. <div class="home-nearby">
  195. <div class="weui-cell" style="padding-bottom: 0;">
  196. <div class="weui-cell__bd">
  197. <p style="color: #000;font-weight: 700;font-size: 0.33rem;">附近酒店</p>
  198. </div>
  199. <div class="weui-cell__ft">在此找到您入住的酒店</div>
  200. </div>
  201. </div>
  202. </section>
  203. <section>
  204. <div id="hotel-list">
  205. <div class="home-hotel-list">
  206. </div>
  207. </div>
  208. </section>
  209. <section class="border-none mask-hidden">
  210. <img src="../image/no_lon.png" class="border-none-img" />
  211. <p>定位失败<br>请在手机上打开位置信息<br>或直接搜索当前入住的酒店</p>
  212. </section>
  213. <div class="h50"></div>
  214. <div class="back-top mask-hidden" id="fix1"></div>
  215. </body>
  216. <script type="text/javascript" src="../script/api.js"></script>
  217. <script type="text/javascript" src="../script/swiper.min.js"></script>
  218. <script type="text/javascript" src="../script/jquery.min.js"></script>
  219. <script type="text/javascript" src="../script/jquery.tap.js"></script>
  220. <script type="text/javascript" src="../script/imagesloaded.pkgd.min.js"></script>
  221. <script type="text/javascript" src="../script/jquery.star-rating-svg.js"></script>
  222. <script type="text/javascript">
  223. var _myalias = '';
  224. var _minid = '';
  225. var _lon = '0';
  226. var _lat = '0';
  227. var _page = '1';
  228. var _isload = false;
  229. var _isrefurbish = false;
  230. var _adv_type = '0';
  231. var _adv_goods_id = '0';
  232. var _adv_store_id = '0';
  233. var _adv_article_id = '0';
  234. var _webinkeyid = '0';
  235. var _webinstoreid = '0';
  236. apiready = function() {
  237. var $header = $api.byId('header');
  238. $api.fixIos7Bar($header);
  239. $api.fixStatusBar($header);
  240. _webinkeyid = api.pageParam.keyid;
  241. _webinstoreid = api.pageParam.storeid;
  242. _adv_type = api.pageParam.advtype;
  243. _adv_goods_id = api.pageParam.advgoodsid;
  244. _adv_store_id = api.pageParam.advstoreid;
  245. _adv_article_id = api.pageParam.advarticleid;
  246. _myalias = "member" + $api.getStorage("memberid");
  247. var storage = hasPermission('storage');
  248. if (!storage || !storage[0] || !storage[0].granted) {
  249. reqPermission('storage')
  250. }
  251. get_adv();//弹窗
  252. getRouteData();//轮播吞
  253. webtoappinit();
  254. jpushInit();
  255. //滑动到底部
  256. api.addEventListener({
  257. name: 'scrolltobottom',
  258. extra: {
  259. threshold: 200
  260. }
  261. }, function(ret, err) {
  262. getAddress();
  263. });
  264. //应用从后台回到前台事件
  265. api.addEventListener({
  266. name: 'resume'
  267. }, function(ret, err) {
  268. _isload = false;
  269. _minid = '';
  270. _isrefurbish = true;
  271. getAddress();
  272. getmsgtotal();
  273. });
  274. //应用每次显示
  275. api.addEventListener({
  276. name: 'viewappear'
  277. }, function(ret, err) {
  278. getAddress();
  279. getmsgtotal();
  280. });
  281. };
  282. $(".msg-list").on("tap", function() {
  283. console.log("1")
  284. api.openWin({
  285. name: 'msglist',
  286. url: './home/msglist.html',
  287. bounces: false,
  288. pageParam: {
  289. xx: ''
  290. }
  291. });
  292. return false;
  293. })
  294. $("#hotel-list").on("tap", ".home-hotel-list", function() {
  295. var _keyid = $(this).attr("keyid");
  296. api.openWin({
  297. name: 'hoteldtl',
  298. url: './home/hoteldtl.html',
  299. bounces: false,
  300. pageParam: {
  301. keyid: _keyid
  302. }
  303. });
  304. return false;
  305. })
  306. $(".scan-barcode").on("tap", function() {
  307. var has = hasPermission('camera');
  308. if (!has || !has[0] || !has[0].granted) {
  309. api.confirm({
  310. title: '提醒',
  311. msg: "没有获得 相机 权限\n是否前往设置?",
  312. buttons: ['去设置', '取消']
  313. }, function(ret, err) {
  314. var index = ret.buttonIndex;
  315. if (index == 1) {
  316. reqPermission('camera');
  317. } else {
  318. api.toast({
  319. msg: '获取相机权限失败...'
  320. });
  321. }
  322. });
  323. return false;
  324. }
  325. var FNScanner = api.require('FNScanner');
  326. FNScanner.open({
  327. autorotation: true
  328. }, function(ret, err) {
  329. toast_loding_show();
  330. if (ret) {
  331. if (ret.eventType == "success") {
  332. if (ret.content.indexOf("?store_id=") > -1) {
  333. var _store_id = ret.content.split("?")[1];
  334. _store_id = _store_id.split("&")[0];
  335. _store_id = _store_id.replace("store_id=", "");
  336. // alert(_store_id);
  337. if (ret.content.indexOf("goods_id=") > -1) {
  338. var _goods_id = ret.content.split("?")[1];
  339. _goods_id = _goods_id.split("&")[1];
  340. _goods_id = _goods_id.replace("goods_id=", "");
  341. // alert(_goods_id);
  342. api.openWin({
  343. name: 'showgoods',
  344. url: './home/showgoods.html',
  345. bounces: false,
  346. pageParam: {
  347. storeid: _store_id,
  348. keyid: _goods_id
  349. }
  350. });
  351. } else {
  352. //
  353. api.openWin({
  354. name: 'hoteldtl',
  355. url: './home/hoteldtl.html',
  356. bounces: false,
  357. pageParam: {
  358. keyid: _store_id
  359. }
  360. });
  361. }
  362. } else {
  363. $api.rmStorage("qr_data");
  364. $api.setStorage("qr_data", ret.content);
  365. $.ajax({
  366. url: siteurl + 'api/Payment/get_order_info',
  367. data: {
  368. member_id: $api.getStorage("memberid"),
  369. qr_data: ret.content
  370. },
  371. headers: {
  372. "X-TOKEN": $api.getStorage("accesstoken")
  373. },
  374. dataType: 'json',
  375. type: 'post',
  376. success: function(datas) {
  377. if (datas.code === 1) {
  378. api.openWin({
  379. name: 'venderdtl',
  380. url: './home/vender.html',
  381. bounces: false,
  382. pageParam: {
  383. keyid: datas.data.order_sn
  384. }
  385. });
  386. return false;
  387. } else {
  388. api.toast({
  389. msg: datas.msg,
  390. duration: 2000,
  391. location: 'bottom'
  392. });
  393. }
  394. },
  395. error: function() {
  396. api.toast({
  397. msg: '扫码失败'
  398. })
  399. }
  400. })
  401. }
  402. }
  403. } else {
  404. api.toast({
  405. msg: "扫码失败"
  406. })
  407. }
  408. toast_loding_hide();
  409. });
  410. return false;
  411. })
  412. function getRouteData() {
  413. $.ajax({
  414. url: siteurl + 'v1/entry/adv',
  415. data: {},
  416. headers: {
  417. "X-TOKEN": $api.getStorage("accesstoken")
  418. },
  419. dataType: 'json',
  420. type: 'post',
  421. success: function(datas) {
  422. if (datas.result) {
  423. $.each(datas.data, function(index, item) {
  424. if (item.adv_enabled == 1) {
  425. if (item.adv_target.type == 'store') {
  426. $(".swiper-wrapper").append('<div class="swiper-slide" type="store" keyid="' + item.adv_target.store_id +
  427. '"><img style="width:100%" src="' + siteurl + "uploads/home/adv/" + item.adv_code + '"/></div>');
  428. } else if (item.adv_target.type == 'goods') {
  429. $(".swiper-wrapper").append('<div class="swiper-slide" type="goods" keyid="' + item.adv_target.goods_id +
  430. '" xkeyid="' + item.adv_target.store_id + '"><img style="width:100%" src="' + siteurl + "uploads/home/adv/" + item.adv_code +
  431. '"/></div>');
  432. } else if (item.adv_target.type == 'article') {
  433. $(".swiper-wrapper").append('<div class="swiper-slide" type="article" keyid="' + item.adv_target.article_id +
  434. '"><img style="width:100%" src="' + siteurl + "uploads/home/adv/" + item.adv_code + '"/></div>');
  435. } else {
  436. $(".swiper-wrapper").append('<div class="swiper-slide" type="0" keyid="0"><img style="width:100%" src="' + siteurl +
  437. "uploads/home/adv/" + item.adv_code + '"/></div>');
  438. }
  439. } else {
  440. $(".swiper-wrapper").append('<div class="swiper-slide" type="0" keyid="0"><img style="width:100%" src="' + siteurl +
  441. "uploads/home/adv/" + item.adv_code + '"/></div>');
  442. }
  443. });
  444. var swiper = new Swiper('.swiper-container', {
  445. allowSlidePrev: true,
  446. autoplay: {
  447. delay: 5000,
  448. disableOnInteraction: false
  449. },
  450. loop: true,
  451. pagination: {
  452. el: '.swiper-pagination',
  453. },
  454. // on: {
  455. // transitionEnd: function() {
  456. // var tempSlideWidth = $(".swiper-slide").width();
  457. // $(".swiper-slide").css("width", tempSlideWidth);
  458. // $(".swiper-slide-active").css("width", (tempSlideWidth + 1));
  459. // }
  460. // }
  461. });
  462. } else {
  463. errcode(datas, datas.code);
  464. }
  465. }
  466. });
  467. function_name();
  468. }
  469. function set_height() {
  470. api.execScript({
  471. name: 'index',
  472. script: 'set_height();'
  473. })
  474. }
  475. function getmsgtotal() {
  476. $.ajax({
  477. url: siteurl + 'v2/shop/msg_count',
  478. data: {
  479. member_id: $api.getStorage("memberid")
  480. },
  481. headers: {
  482. "X-TOKEN": $api.getStorage("accesstoken")
  483. },
  484. dataType: 'json',
  485. type: 'post',
  486. success: function(datas) {
  487. if (datas.result) {
  488. if (datas.data.total > 0) {
  489. $(".msg-total").text(datas.data.total);
  490. $(".msg-total").removeClass('mask-hidden');
  491. } else {
  492. $(".msg-total").addClass('mask-hidden');
  493. }
  494. } else {
  495. if (datas.code == 2000) {} else {
  496. errcode(datas, datas.code);
  497. }
  498. }
  499. }
  500. });
  501. }
  502. function get_advx() {
  503. api.execScript({
  504. name: 'index',
  505. script: 'get_adv();'
  506. })
  507. }
  508. function goto_adv() {
  509. // body...
  510. switch (_adv_type) {
  511. case 'goods':
  512. to_goods_id(_adv_goods_id, _adv_store_id)
  513. break;
  514. case 'store':
  515. to_store_id(_adv_store_id);
  516. break;
  517. case 'article':
  518. to_article_id(_adv_article_id);
  519. break;
  520. }
  521. }
  522. function get_adv() {
  523. $.ajax({
  524. url: siteurl + 'v1/entry/poster',
  525. data: {},
  526. headers: {
  527. "X-TOKEN": $api.getStorage("accesstoken")
  528. },
  529. dataType: 'json',
  530. type: 'post',
  531. success: function(datas) {
  532. if (datas.result) {
  533. if (datas.data.enable == 1) {
  534. switch (datas.data.target.type) {
  535. case 'point':
  536. if ($api.getStorage("accesstoken")) {
  537. gallery_adv(siteurl + 'uploads/home/adv/' + datas.data.images, 'to_point');
  538. } else {
  539. gallery_adv(siteurl + 'uploads/home/adv/' + datas.data.images, 'to_login');
  540. }
  541. break;
  542. case 'goods':
  543. gallery_adv(siteurl + 'uploads/home/adv/' + datas.data.images, 'to_goods_id', datas.data.target.goods_id,
  544. datas.data.target.store_id);
  545. break;
  546. case 'store':
  547. gallery_adv(siteurl + 'uploads/home/adv/' + datas.data.images, 'to_store_id', datas.data.target.store_id);
  548. break;
  549. case 'article':
  550. gallery_adv(siteurl + 'uploads/home/adv/' + datas.data.images, 'to_article_id', datas.data.target.article_id);
  551. break;
  552. }
  553. }
  554. } else {
  555. errcode(datas, datas.code);
  556. }
  557. set_height();
  558. }
  559. })
  560. }
  561. //关闭弹窗
  562. function color(){
  563. $('.weui-gallery').remove()
  564. getAddress();
  565. }
  566. function getRouteHotelData() {
  567. if (_lon == '0') {
  568. $(".border-none").removeClass("mask-hidden");
  569. return false;
  570. } else {
  571. $(".border-none").addClass("mask-hidden");
  572. }
  573. if (_isload) {
  574. return false;
  575. }
  576. $.ajax({
  577. url: siteurl + 'v2/entry/storeList',
  578. data: {
  579. page: _page,
  580. page_size: '8',
  581. minid: _minid,
  582. lon: _lon,
  583. lat: _lat
  584. },
  585. headers: {
  586. "X-TOKEN": $api.getStorage("accesstoken")
  587. },
  588. dataType: 'json',
  589. type: 'post',
  590. success: function(datas) {
  591. if (datas.result) {
  592. var i = 0;
  593. if (datas.data.store_list.length > 0) {
  594. var html = '<div class="h20"></div>';
  595. $.each(datas.data.store_list, function(index, item) {
  596. var _tags_0 = item.store_summary.split(' ');
  597. _tags_0 = jQuery.grep(_tags_0, function(a) {
  598. return a !== '';
  599. });
  600. html += '<div class="home-hotel-list" keyid="' + item.store_id +
  601. '"><div class="home-hotel-left"><img src="' + siteurl + 'uploads/home/store/' + item.store_id + '/' +
  602. item.store_banner + '"/></div>';
  603. html += '<div class="home-hotel-right"><div class="home-hotel-title">' + item.store_name + '</div>';
  604. html += '<div class="home-hotel-dtl"><ul><li style="width:40%"><div class="hotel_credit my-rating' + i +
  605. '">' + intToFloat(item.store_servicecredit) + '</div></li>';
  606. html += '<li style="text-align:center;"> 月访客' + item.store_visitor + '</li><li style="float:right;"> ' +
  607. item.distance + '</li>';
  608. html += '</ul></div>';
  609. html += '<div class="home-hotel-dsc">';
  610. $.each(_tags_0, function(index, tag) {
  611. if (index < 3) {
  612. html += '<span class="tag-item">' + tag + '</span>';
  613. }
  614. })
  615. html += '</div></div></div>';
  616. i++;
  617. });
  618. if (_page == 1) {
  619. $("#hotel-list").html(html);
  620. $(".border-none").addClass("mask-hidden");
  621. $("#hotel-list").removeClass("mask-hidden");
  622. } else {
  623. $("#hotel-list").append(html);
  624. }
  625. _page++;
  626. } else {
  627. if (_page == 1) {
  628. $(".border-none").removeClass("mask-hidden");
  629. $("#hotel-list").addClass("mask-hidden");
  630. }
  631. _isload = true;
  632. }
  633. } else {
  634. errcode(datas, datas.code);
  635. }
  636. function_name();
  637. }
  638. });
  639. }
  640. $(".home-search").on("tap", function() {
  641. api.openWin({
  642. name: 'hotelsearch',
  643. url: './home/hotelsearch.html',
  644. bounces: false,
  645. pageParam: {
  646. lon: _lon,
  647. lat: _lat
  648. }
  649. });
  650. return false;
  651. })
  652. $(".swiper-wrapper").on("tap", ".swiper-slide", function() {
  653. console.log("3")
  654. var _type = $(this).attr("type");
  655. var _keyid = $(this).attr("keyid");
  656. if (_type == 'store') {
  657. to_store_id(_keyid);
  658. } else if (_type == 'goods') {
  659. var _sid = $(this).attr("xkeyid");
  660. to_goods_id(_keyid, _sid);
  661. } else if (_type == 'article') {
  662. to_article_id(_keyid);
  663. } else {
  664. api.toast({
  665. msg: '暂无活动'
  666. })
  667. }
  668. return false;
  669. })
  670. function intToFloat(val) {
  671. return new Number(val).toFixed(1);
  672. }
  673. function to_login() {
  674. // body...
  675. api.openWin({
  676. name: 'login',
  677. url: 'widget://login.html',
  678. bounces: false,
  679. pageParam: {
  680. keyid: true
  681. }
  682. })
  683. $('.weui-gallery').hide();
  684. return false;
  685. }
  686. function to_point() {
  687. // body...
  688. api.openWin({
  689. name: 'points',
  690. url: './my/points.html',
  691. bounces: false
  692. });
  693. $('.weui-gallery').hide();
  694. return false;
  695. }
  696. function to_article_id(_to_article_id) {
  697. // body...
  698. api.openWin({
  699. name: 'finddetails',
  700. url: './find/finddetails.html',
  701. bounces: false,
  702. pageParam: {
  703. keyid: _to_article_id
  704. }
  705. });
  706. $('.weui-gallery').hide();
  707. return false;
  708. }
  709. function to_goods_id(_to_goods_id, _to_storeid) {
  710. // body...
  711. api.openWin({
  712. name: 'showgoods',
  713. url: './home/showgoods.html',
  714. bounces: false,
  715. pageParam: {
  716. keyid: _to_goods_id,
  717. storeid: _to_storeid
  718. }
  719. });
  720. $('.weui-gallery').hide();
  721. return false;
  722. }
  723. function to_store_id(_to_storeid) {
  724. // body...
  725. api.openWin({
  726. name: 'hoteldtl',
  727. url: './home/hoteldtl.html',
  728. bounces: false,
  729. pageParam: {
  730. keyid: _to_storeid
  731. }
  732. });
  733. $('.weui-gallery').hide();
  734. return false;
  735. }
  736. $("#set-local").on("tap", function() {
  737. $(this).attr("src", "../image/home_local2.png");
  738. var _that = $(this);
  739. setTimeout(function() {
  740. _that.attr("src", "../image/home_local.png");
  741. }, 800);
  742. api.toast({
  743. msg: '正在获取当前位置...'
  744. });
  745. getAddress();
  746. })
  747. function getAddress() {
  748. var has = hasPermission('location');
  749. if (!has || !has[0] || !has[0].granted) {
  750. reqPermission('location');
  751. $(".border-none").removeClass("mask-hidden");
  752. return false;
  753. }
  754. var aMap = api.require('aMap');
  755. if (api.systemType == 'ios') {
  756. aMap.hide();
  757. aMap.open({
  758. rect: {x: 0,y: 0,w: 0,h: 0},
  759. showUserLocation: true,
  760. zoomLevel: 11,
  761. center: {lon: 116.4021310000,lat: 39.9994480000},
  762. fixedOn: api.frameName,
  763. fixed: true
  764. }, function(ret, err) {})
  765. }
  766. aMap.getLocation(function(ret, err) {
  767. if (ret.status) {
  768. _lon = ret.lon;
  769. _lat = ret.lat;
  770. aMap.getNameFromCoords({
  771. lon: ret.lon,
  772. lat: ret.lat
  773. }, function(ret, err) {
  774. if (ret.status) {
  775. aMap.close();
  776. $(".local-name").text(ret.city + ret.township + ret.street + ret.number);
  777. }
  778. });
  779. getRouteHotelData();
  780. } else {
  781. $(".local-name").text(JSON.stringify(err));
  782. }
  783. });
  784. }
  785. function jpushInit() {
  786. jpush = api.require('ajpush');
  787. initJPush();
  788. api.addEventListener({
  789. name: 'noticeclicked'
  790. }, function(ret, err) { //ios noticeclicked
  791. var _value = ret.value.replace(/\\/g, "");
  792. var obj = eval('(' + _value + ')');
  793. if (obj.jump == "urge") {
  794. api.openWin({
  795. name: 'msglist',
  796. url: './home/msglist.html',
  797. bounces: false
  798. });
  799. }
  800. if (obj.jump == "article") {
  801. api.openWin({
  802. name: 'finddetails',
  803. url: './find/finddetails.html',
  804. bounces: false,
  805. pageParam: {
  806. keyid: obj.keyid
  807. }
  808. });
  809. }
  810. })
  811. api.addEventListener({
  812. name: 'pause'
  813. }, function(ret, err) {
  814. onPause(); //监听应用进入后台,通知jpush暂停事件
  815. })
  816. api.addEventListener({
  817. name: 'resume'
  818. }, function(ret, err) {
  819. onResume(); //监听应用恢复到前台,通知jpush恢复事件
  820. })
  821. jpush.setListener(function(ret, err) {
  822. if (ret) {
  823. notify(ret.content, ret.extra);
  824. }
  825. });
  826. }
  827. /////
  828. function initJPush() {
  829. jpush.init(function(ret, err) {
  830. if (ret && ret.status) {
  831. bindAliasAndTags();
  832. } else {
  833. api.toast({
  834. msg: '操作失败!'
  835. });
  836. }
  837. });
  838. }
  839. //统计-app恢复
  840. function onResume() {
  841. jpush.onResume();
  842. }
  843. //统计-app暂停
  844. function onPause() {
  845. jpush.onPause();
  846. }
  847. function bindAliasAndTags() {
  848. var param = {
  849. alias: _myalias,
  850. tags: ['tag1', 'qdduser']
  851. };
  852. jpush.bindAliasAndTags(param, function(ret) {
  853. var statusCode = ret.statusCode;
  854. // alert(JSON.stringify(ret));
  855. });
  856. }
  857. function notify(content, extras) {
  858. getmsgtotal();
  859. api.notification({
  860. vibrate: [100, 500, 200, 500, 300, 500],
  861. sound: 'widget://res/horse.ogg',
  862. notify: {
  863. title: '您有一条新的消息...',
  864. content: content,
  865. extra: extras,
  866. updateCurrent: false
  867. }
  868. }, function(ret, err) {});
  869. }
  870. function webtoappinit() {
  871. if (_webinkeyid) {
  872. to_goods_id(_webinkeyid, _webinstoreid);
  873. return false;
  874. }
  875. if (_webinstoreid) {
  876. to_store_id(_webinstoreid);
  877. return false;
  878. }
  879. }
  880. $(".back-top").on("tap", function() {
  881. console.log("4")
  882. $('html , body').animate({
  883. scrollTop: 0
  884. }, 'slow');
  885. return false;
  886. });
  887. $.fn.fixedDiv = function(actCls) {
  888. var that = $(this),
  889. offsetTop = that.offset().top,
  890. scrollTop;
  891. function fix() {
  892. scrollTop = $(document).scrollTop();
  893. if (scrollTop > offsetTop) {
  894. that.removeClass(actCls);
  895. } else {
  896. that.addClass(actCls);
  897. }
  898. }
  899. fix();
  900. $(window).scroll(fix);
  901. }
  902. $('#fix1').fixedDiv('mask-hidden')
  903. </script>
  904. </html>