12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019 |
- <!DOCTYPE html>
- <html>
- <head>
- <meta charset="UTF-8">
- <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0" />
- <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
- <title></title>
- <link rel="stylesheet" type="text/css" href="../css/api.css" />
- <link rel="stylesheet" type="text/css" href="../css/star-rating-svg.css?v=1.2" />
- <link rel="stylesheet" type="text/css" href="../css/weui.min.css" />
- <link rel="stylesheet" type="text/css" href="../css/style.css" />
- <link rel="stylesheet" type="text/css" href="../css/swiper.min.css" />
- <style>
- .swiper-container-free-mode > .swiper-wrapper {
- -webkit-transition-timing-function: linear; /*之前是ease-out*/
- -moz-transition-timing-function: linear;
- -ms-transition-timing-function: linear;
- -o-transition-timing-function: linear;
- transition-timing-function: linear;
- margin: 0 auto;
- transform:translate3d(0,0,0)
- }
- .swiper-container {
- width: 100%;
- height: 100%;
- transform:translate3d(0,0,0);
- overflow:hidden;
- }
- .swiper-slide img{
- width:100%;
- height:100%;
- transform:translate3d(0,0,0)
- }
- .home-hotel-title {
- font-size: 0.27rem;
- overflow: hidden;
- white-space: nowrap;
- text-overflow: ellipsis;
- color: #000;
- font-weight: 700;
- }
- .home-hotel-list {
- margin-bottom: 0.2rem;
- }
- .msg-list,.scan-barcode{
- position:absolute;
- /*width: 1rem;*/
- text-align:center;
- }
- .home-top-left {
- padding-top: 0.1rem;
- float: left;
- line-height: 0;
- position: absolute;
- }
- .home-hotel-right { /*width: 4.2rem;*/ }
- .home-hotel-dsc {
- font-size: 0.24rem;
- line-height: 0.34rem;
- }
- .swiper-container-horizontal>.swiper-pagination-bullets, .swiper-pagination-custom, .swiper-pagination-fraction {
- bottom: 0;
- }
- .swiper-pagination-bullet {
- background: #fff;
- opacity: .8;
- }
- .swiper-pagination-bullet-active {
- background: #d9251c;
- }
- .home-nearby:before {
- content: ' ';
- position: absolute;
- pointer-events: none;
- box-sizing: border-box;
- /*top: -50%;*/
- left: -50%;
- right: -50%;
- bottom: 0;
- -webkit-transform: scale(0.5);
- transform: scale(0.5);
- border-bottom: 1px solid #ddd;
- }
- .border-none{
- text-align: center;
- font-size: 0.28rem;
- height: 8rem;
- }
- .border-none p{
- color:#999999;
- }
- .border-none-img{
- margin-top: 1.5rem;
- width: 1.73rem;
- height: auto;
- }
- .home-nearby .weui-cell {
- padding: 16px 3px;
- }
- .home-nearby weui-cell__bd p {
- font-size: 0.35rem;
- }
- .home-top-left {
- width: 4.9rem;
- }
- .local-name {
- width: 4.2rem;
- }
- .weui-cell__ft {
- font-size: 0.25rem;
- }
- .home-hotel-left img {
- height: auto;
- }
- .home-hotel-dsc {
- -webkit-line-clamp: 1;
- }
- .hotel_credit {
- font-size: 0.47rem;
- position: absolute;
- margin-top: -0.2rem;
- color: #000000;
- font-family: Medium;
- font-weight: 500;
- }
- .hotel_credit:after {
- position: absolute;
- top: 0.45rem;
- width: 100%;
- height: 0.13rem;
- content: "";
- /*background: #ffdb26;*/
- margin-left: -100%;
- z-index: -1;
- }
- .tag-item {
- position: relative;
- margin: 1px 0.08rem;
- padding: 0rem 0.1rem;
- display: inline-block;
- line-height: 1.5;
- /* margin-left: 0; */
- margin-right: 0;
- font-size: 0.2rem;
- }
- .tag-item:first-child {
- margin-left: 0;
- }
- .tag-item:after {
- position: absolute;
- box-sizing: border-box;
- content: ' ';
- pointer-events: none;
- top: -50%;
- right: -50%;
- bottom: -50%;
- left: -50%;
- border: 1px solid #222;
- -webkit-transform: scale(0.5);
- transform: scale(0.5);
- border-radius: 0.08rem;
- }
- .header{
- position: fixed;
- padding: 0 0.2rem;
- top: 0;
- right: 0;
- left: 1px;
- z-index: 2;
- background: #fff;
- -webkit-transform: translateZ(0);
- transform: translateZ(0);
- }
- </style>
- <script>
- (function(window) {
- var winW = document.documentElement.clientWidth || document.body.clientWidth;
- if (winW > 750) {
- winW = 750;
- }
- document.documentElement.style.fontSize = winW / 7.5 + "px";
- window.onresize = function() {
- var winW = document.documentElement.clientWidth || document.body.clientWidth;
- document.body.clientWidth;
- if (winW > 750) {
- winW = 750;
- }
- document.documentElement.style.fontSize = winW / 7.5 + "px";
- }
- }(window));
- </script>
- </head>
- <body >
- <div class="topbar"></div>
- <section>
- <div id="header" class="header">
- <div class="home-top" style="padding: 0.1rem 0;">
- <div class="home-top-left" onclick="openDw()"><img id="set-local" class="home-top-local" src="../image/home_local.png" /> <span class="local-name"></span></div>
- <div class="home-top-right" style="margin-top: -0.05rem;">
- <div class="scan-barcode" style="right: 1rem;"><img class="home-top-local" src="../image/home_scan.png" />
- <p>扫一扫</p>
- </div>
- <div class="msg-list" style="right: 0.2rem;"><img class="home-top-local" src="../image/home_msg.png" />
- <p>消息</p><span class="msg-total mask-hidden" style="position: absolute;top: 0;">0</span>
- </div>
- </div>
- </div>
- <div class="home-search" style="margin-bottom: 0.2rem;"><img src="../image/search.png"> 搜索您入住的酒店</div>
- </div>
- <!-- <div class="h10" style="height: 2.5rem;"></div> -->
- <div class="home-ads" style="border-radius: 0.1rem;">
- <div class="swiper-container" id="swiper" style="border-radius: 0.1rem;">
- <div class="swiper-wrapper"></div>
- <div class="swiper-pagination"></div>
- </div>
- </div>
- <div class="home-nearby">
- <div class="weui-cell" style="padding-bottom: 0;">
- <div class="weui-cell__bd">
- <p style="color: #000;font-weight: 700;font-size: 0.33rem;">附近酒店</p>
- </div>
- <div class="weui-cell__ft">在此找到您入住的酒店</div>
- </div>
- </div>
- </section>
- <section>
- <div id="hotel-list">
- <div class="home-hotel-list">
- </div>
- </div>
- </section>
- <section class="border-none mask-hidden">
- <img src="../image/no_lon.png" class="border-none-img" />
- <p>定位失败<br>请在手机上打开位置信息<br>或直接搜索当前入住的酒店</p>
- </section>
- <div class="h50"></div>
- <div class="back-top mask-hidden" id="fix1"></div>
- </body>
- <script type="text/javascript" src="../script/api.js"></script>
- <script type="text/javascript" src="../script/swiper.min.js"></script>
- <script type="text/javascript" src="../script/jquery.min.js"></script>
- <script type="text/javascript" src="../script/jquery.tap.js"></script>
- <script type="text/javascript" src="../script/imagesloaded.pkgd.min.js"></script>
- <script type="text/javascript" src="../script/jquery.star-rating-svg.js"></script>
- <script type="text/javascript">
- var _myalias = '';
- var _minid = '';
- var _lon = '0';
- var _lat = '0';
- var _page = '1';
- var _isload = false;
- var _isrefurbish = false;
- var _adv_type = '0';
- var _adv_goods_id = '0';
- var _adv_store_id = '0';
- var _adv_article_id = '0';
- var _webinkeyid = '0';
- var _webinstoreid = '0';
- var jpush;
- var isShowLoad=true;
- var ofAjax=false;
- apiready = function() {
- var $header = $api.byId('header');
- $api.fixIos7Bar($header);
- var deviceModel = api.deviceModel;
- var num=deviceModel.substr(deviceModel.length-4,2)+""+deviceModel.substr(deviceModel.length-1,1)
- if(num<=105){
- $(".home-ads").css("margin-top","2rem")
- }
- _webinkeyid = api.pageParam.keyid;
- _webinstoreid = api.pageParam.storeid;
- _adv_type = api.pageParam.advtype;
- _adv_goods_id = api.pageParam.advgoodsid;
- _adv_store_id = api.pageParam.advstoreid;
- _adv_article_id = api.pageParam.advarticleid;
- _myalias = "member" + $api.getStorage("memberid");
-
- var storage = hasPermission('storage');
- if (!storage || !storage[0] || !storage[0].granted) {
- reqPermission('storage')
- }
- get_adv();//弹窗
- getRouteData();//轮播吞
- webtoappinit();
- jpushInit();
- //滑动到底部
- api.addEventListener({
- name: 'scrolltobottom',
- extra: {
- threshold: 200
- }
- }, function(ret, err) {
- if(!_isload && _lon!="0" && !ofAjax){
- _page++;
- getRouteHotelData(true);
- }
- });
- //应用每次显示
- api.addEventListener({
- name: 'viewappear'
- }, function(ret, err) {
- if(_lon=='0'){
- getAddress(true);
- }else{
- getAddress();
- }
- getmsgtotal();
- });
- };
- $(".msg-list").on("tap", function() {
- api.openWin({
- name: 'msglist',
- url: './home/msglist.html',
- bounces: false,
- pageParam: {
- xx: ''
- }
- });
- return false;
- })
- $("#hotel-list").on("tap", ".home-hotel-list", function() {
- var _keyid = $(this).attr("keyid");
- api.openWin({
- name: 'hoteldtl',
- url: './home/hoteldtl.html',
- bounces: false,
- useWKWebView: true,
- pageParam: {
- keyid: _keyid
- }
- });
- return false;
- })
- $(".scan-barcode").on("tap", function() {
- var has = hasPermission('camera');
- if (!has || !has[0] || !has[0].granted) {
- api.confirm({
- title: '提醒',
- msg: "没有获得 相机 权限\n是否前往设置?",
- buttons: ['取消', '去设置']
- }, function(ret, err) {
- var index = ret.buttonIndex;
- if (index == 1) {
- reqPermission('camera');
- } else {
- api.toast({
- msg: '获取相机权限失败...'
- });
- }
- });
- return false;
- }
- var FNScanner = api.require('FNScanner');
- FNScanner.open({
- autorotation: true
- }, function(ret, err) {
- toast_loding_show();
- if (ret) {
- if (ret.eventType == "success") {
- // console.log(JSON.stringify(ret.content));
- if (ret.content.indexOf("?store_id=") > -1|| ret.content.indexOf("?qs=") > -1) {
- if (ret.content.indexOf("?qs=") > -1) {
- var _goods_id = ret.content.split("?")[1];
- _goods_id = _goods_id.replace("qs=", "");
- var arr=_goods_id.split('--');
- // console.log(arr);
- api.openWin({
- name: 'showgoods',
- url: './home/showgoods.html',
- bounces: false,
- pageParam: {
- storeid: arr[0],
- keyid: arr[1]
- }
- });
- } else {
- var _store_id = ret.content.split("?")[1];
- _store_id = _store_id.split("&")[0];
- _store_id = _store_id.replace("store_id=", "");
- api.openWin({
- name: 'hoteldtl',
- url: './home/hoteldtl.html',
- bounces: false,
- pageParam: {
- keyid: _store_id
- }
- });
- }
- } else {
- $api.rmStorage("qr_data");
- $api.setStorage("qr_data", ret.content);
- $.ajax({
- url: siteurl + 'api/Payment/get_order_info',
- data: {
- member_id: $api.getStorage("memberid"),
- qr_data: ret.content
- },
- headers: {
- "X-TOKEN": $api.getStorage("accesstoken")
- },
- dataType: 'json',
- type: 'post',
- success: function(datas) {
- if (datas.code === 1) {
- api.openWin({
- name: 'venderdtl',
- url: './home/vender.html',
- bounces: false,
- pageParam: {
- keyid: datas.data.order_sn
- }
- });
- return false;
- } else {
- api.toast({
- msg: datas.msg,
- duration: 2000,
- location: 'bottom'
- });
- }
- },
- error: function() {
- api.toast({
- msg: '扫码失败'
- })
- }
- })
- }
- }
- } else {
- api.toast({
- msg: "扫码失败"
- })
- }
- toast_loding_hide();
- });
- return false;
- })
- function getRouteData() {
- $.ajax({
- url: siteurl + 'v1/entry/adv',
- data: {},
- headers: {
- "X-TOKEN": $api.getStorage("accesstoken")
- },
- dataType: 'json',
- type: 'post',
- success: function(datas) {
- if (datas.result) {
- $.each(datas.data, function(index, item) {
- if (item.adv_enabled == 1) {
- if (item.adv_target.type == 'store') {
- $(".swiper-wrapper").append('<div class="swiper-slide" type="store" keyid="' + item.adv_target.store_id +
- '"><img src="' + siteurl + "uploads/home/adv/" + item.adv_code + '"/></div>');
- } else if (item.adv_target.type == 'goods') {
- $(".swiper-wrapper").append('<div class="swiper-slide" type="goods" keyid="' + item.adv_target.goods_id +
- '" xkeyid="' + item.adv_target.store_id + '"><img src="' + siteurl + "uploads/home/adv/" + item.adv_code +
- '"/></div>');
- } else if (item.adv_target.type == 'article') {
- $(".swiper-wrapper").append('<div class="swiper-slide" type="article" keyid="' + item.adv_target.article_id +
- '"><img src="' + siteurl + "uploads/home/adv/" + item.adv_code + '"/></div>');
- } else {
- $(".swiper-wrapper").append('<div class="swiper-slide" type="0" keyid="0"><img src="' + siteurl +
- "uploads/home/adv/" + item.adv_code + '"/></div>');
- }
- } else {
- $(".swiper-wrapper").append('<div class="swiper-slide" type="0" keyid="0"><img src="' + siteurl +
- "uploads/home/adv/" + item.adv_code + '"/></div>');
- }
- });
- var swiper = new Swiper('.swiper-container', {
- allowSlidePrev: true,
- autoplay: {
- delay: 5000,
- disableOnInteraction: false
- },
- loop: true,
- speed:400,
- pagination: {
- el: '.swiper-pagination',
- },
- });
- } else {
- errcode(datas, datas.code);
- }
- }
- });
- function_name();
- }
- function set_height() {
- api.execScript({
- name: 'index',
- script: 'set_height();'
- })
- }
- function getmsgtotal() {
- $.ajax({
- url: siteurl + 'v2/shop/msg_count',
- data: {
- member_id: $api.getStorage("memberid")
- },
- headers: {
- "X-TOKEN": $api.getStorage("accesstoken")
- },
- dataType: 'json',
- type: 'post',
- success: function(datas) {
- if (datas.result) {
- if (datas.data.total > 0) {
- $(".msg-total").text(datas.data.total);
- $(".msg-total").removeClass('mask-hidden');
- } else {
- $(".msg-total").addClass('mask-hidden');
- }
- } else {
- if (datas.code == 2000) {} else {
- errcode(datas, datas.code);
- }
- }
- }
- });
- }
- function get_advx() {
- api.execScript({
- name: 'index',
- script: 'get_adv();'
- })
- }
- function goto_adv() {
- // body...
- switch (_adv_type) {
- case 'goods':
- to_goods_id(_adv_goods_id, _adv_store_id)
- break;
- case 'store':
- to_store_id(_adv_store_id);
- break;
- case 'article':
- to_article_id(_adv_article_id);
- break;
- }
- }
- function get_adv() {
- $.ajax({
- url: siteurl + 'v1/entry/poster',
- data: {},
- headers: {
- "X-TOKEN": $api.getStorage("accesstoken")
- },
- dataType: 'json',
- type: 'post',
- success: function(datas) {
- if (datas.result) {
- if (datas.data.enable == 1) {
- switch (datas.data.target.type) {
- case 'point':
- if ($api.getStorage("accesstoken")) {
- gallery_adv(siteurl + 'uploads/home/adv/' + datas.data.images, 'to_point');
- } else {
- gallery_adv(siteurl + 'uploads/home/adv/' + datas.data.images, 'to_login');
- }
- break;
- case 'goods':
- gallery_adv(siteurl + 'uploads/home/adv/' + datas.data.images, 'to_goods_id', datas.data.target.goods_id,
- datas.data.target.store_id);
- break;
- case 'store':
- gallery_adv(siteurl + 'uploads/home/adv/' + datas.data.images, 'to_store_id', datas.data.target.store_id);
- break;
- case 'article':
- gallery_adv(siteurl + 'uploads/home/adv/' + datas.data.images, 'to_article_id', datas.data.target.article_id);
- break;
- }
- }
- } else {
- errcode(datas, datas.code);
- }
- set_height();
- }
- })
- }
- //关闭弹窗
- function color(){
- $('.weui-gallery').remove()
- // getAddress(true);
- }
- //获取初始数据
- function getRouteHotelData(is) {
-
- $.ajax({
- url: siteurl + 'v2/entry/storeList',
- data: {
- page: _page,
- page_size: '10',
- minid: _minid,
- lon: _lon,
- lat: _lat
- },
- headers: {
- "X-TOKEN": $api.getStorage("accesstoken")
- },
- dataType: 'json',
- type: 'post',
- success: function(datas) {
- if (datas.result) {
- var i = 0;
- if (datas.data.store_list.length > 0) {
- var html = '<div class="h20"></div>';
- $.each(datas.data.store_list, function(index, item) {
- var _tags_0 = item.store_summary.split(' ');
- _tags_0 = jQuery.grep(_tags_0, function(a) {
- return a !== '';
- });
- html += '<div class="home-hotel-list" keyid="' + item.store_id +
- '"><div class="home-hotel-left"><img src="' + siteurl + 'uploads/home/store/' + item.store_id + '/' +
- item.store_banner + '"/></div>';
- html += '<div class="home-hotel-right"><div class="home-hotel-title">' + item.store_name + '</div>';
- html += '<div class="home-hotel-dtl"><ul><li style="width:40%"><div class="hotel_credit my-rating' + i +
- '">' + intToFloat(item.store_servicecredit) + '</div></li>';
- html += '<li style="text-align:center;"> 月访客' + item.store_visitor + '</li><li style="float:right;"> ' +
- item.distance + '</li>';
- html += '</ul></div>';
- html += '<div class="home-hotel-dsc">';
- $.each(_tags_0, function(index, tag) {
- if (index < 3) {
- html += '<span class="tag-item">' + tag + '</span>';
- }
- })
- html += '</div></div></div>';
- i++;
- });
- if (is) {
- $("#hotel-list").append(html);
- } else {
- $("#hotel-list").html(html);
- }
- } else {
- _isload = true;
- }
- } else {
- errcode(datas, datas.code);
- }
- function_name();
- },
- complete:function(){
- ofAjax=false;
- }
- });
- }
- //重新定位
- function openDw() {
- $(this).attr("src", "../image/home_local2.png");
- var _that = $(this);
- setTimeout(function() {
- _that.attr("src", "../image/home_local.png");
- }, 800);
- api.toast({
- msg: '正在获取当前位置...'
- });
- _page="1";
- _isload=false;
- isShowLoad=true;
- getAddress(true);
- }
-
- //获取定位
- function getAddress(is) {
- console.log(is);
- if(!is){
- getRouteHotelData();
- return false;
- }
- ofAjax=true;
- var resultList = api.hasPermission({
- list: ['location']
- });
- if (resultList[0].granted) {
- // 已授权,可以继续下一步操作
- getLocation();
- } else {
- // api.confirm({
- // msg: '应用需要您的授权才能访问定位',
- // buttons: ['取消', '去设置']
- // }, function(ret) {
- // if (ret.buttonIndex == 2) {
- api.requestPermission({
- list: ['location'],
- }, function(res) {
- if (res.list[0].granted) {
- // 已授权,可以继续下一步操作
- getLocation();
- }else{
- $("#hotel-list").hide();
- $(".border-none").show();
- }
- });
- // }
- // });
- }
- // if (!has || !has[0] || !has[0].granted) {
- // if(api.systemType == 'ios'){
- // if(isShowLoad){
- // api.confirm({
- // title: '提醒',
- // msg:'没有获得定位服务权限\n是否前往设置?',
- // buttons: ['去设置', '取消']
- // }, function(ret, err) {
- // isShowLoad=false;
- // if(1 == ret.buttonIndex){
- // api.requestPermission({list:['location']}, function(res, err){
- // if(res.list[0].granted){
-
- // }
- // });
- // }else{
- // $(".local-name").text('定位失败');
- // }
- // });
- // }
- // }else{
- // api.requestPermission({list:['location']}, function(res, err){
- // if(res.list[0].granted){
-
- // }
- // });
- // }
- // $("#hotel-list").hide();
- // $(".border-none").show();
- // return false;
- // }
- };
- function getLocation(){
- var aMap = api.require('aMap');
- if (api.systemType == 'ios') {
- aMap.hide();
- aMap.open({
- rect: {x: 0,y: 0,w: 0,h: 0},
- showUserLocation: true,
- zoomLevel: 11,
- center: {lon: 116.4021310000,lat: 39.9994480000},
- fixedOn: api.frameName,
- fixed: true
- }, function(ret, err) {})
- }
- aMap.getLocation(function(res, err) {//获取经纬度
- if (res.status) {
- _lon = res.lon;
- _lat = res.lat;
- if(res.lon==0||res.lat==0){
- $(".local-name").text('定位失败')
- $("#hotel-list").hide();
- $(".border-none").show();
- }else{
- aMap.getNameFromCoords({//获取地址
- lon: res.lon,
- lat: res.lat
- }, function(ret, err) {
- if (ret.status) {
- if(ret.city||ret.township||ret.street||ret.number){
- $(".local-name").text(ret.city + ret.township + ret.street + ret.number);
- }else{
- $(".local-name").text('定位失败');
- }
- aMap.close();
- $("#hotel-list").show();
- $(".border-none").hide();
- getRouteHotelData();
- }
- });
- }
- } else {
- $(".local-name").text(JSON.stringify(err));
- }
- });
- };
-
- $(".home-search").on("tap", function() {
- api.openWin({
- name: 'hotelsearch',
- url: './home/hotelsearch.html',
- bounces: false,
- pageParam: {
- lon: _lon,
- lat: _lat
- }
- });
- return false;
- })
- $(".swiper-wrapper").on("tap", ".swiper-slide", function() {
- var _type = $(this).attr("type");
- var _keyid = $(this).attr("keyid");
- if (_type == 'store') {
- to_store_id(_keyid);
- } else if (_type == 'goods') {
- var _sid = $(this).attr("xkeyid");
- to_goods_id(_keyid, _sid);
- } else if (_type == 'article') {
- to_article_id(_keyid);
- } else {
- api.toast({
- msg: '暂无活动'
- })
- }
- return false;
- })
- function intToFloat(val) {
- return new Number(val).toFixed(1);
- }
- function to_login() {
- // body...
- api.openWin({
- name: 'login',
- url: 'widget://login.html',
- bounces: false,
- pageParam: {
- keyid: true
- }
- })
- $('.weui-gallery').hide();
- return false;
- }
- function to_point() {
- // body...
- api.openWin({
- name: 'points',
- url: './my/points.html',
- bounces: false
- });
- $('.weui-gallery').hide();
- return false;
- }
- function to_article_id(_to_article_id) {
- // body...
- api.openWin({
- name: 'finddetails',
- url: './find/finddetails.html',
- bounces: false,
- pageParam: {
- keyid: _to_article_id
- }
- });
- $('.weui-gallery').hide();
- return false;
- }
- function to_goods_id(_to_goods_id, _to_storeid) {
- // body...
- api.openWin({
- name: 'showgoods',
- url: './home/showgoods.html',
- bounces: false,
- pageParam: {
- keyid: _to_goods_id,
- storeid: _to_storeid
- }
- });
- $('.weui-gallery').hide();
- return false;
- }
- function to_store_id(_to_storeid) {
- // body...
- api.openWin({
- name: 'hoteldtl',
- url: './home/hoteldtl.html',
- bounces: false,
- pageParam: {
- keyid: _to_storeid
- }
- });
- $('.weui-gallery').hide();
- return false;
- }
- function jpushInit() {
- jpush = api.require('ajpush');
- initJPush();
- api.addEventListener({
- name: 'noticeclicked'
- }, function(ret, err) { //ios noticeclicked
- // var _value = data.value.replace(/\\/g, "");
- // var obj = eval('(' + _value + ')');
- var data=JSON.stringify(ret.value);
- var obj=JSON.parse(data)
- if (obj.jump == "urge") {
- api.openWin({
- name: 'msglist',
- url: './home/msglist.html',
- bounces: false
- });
- }
- if (obj.jump == "article") {
- api.openWin({
- name: 'finddetails',
- url: './find/finddetails.html',
- bounces: false,
- pageParam: {
- keyid: obj.keyid
- }
- });
- }
- })
- api.addEventListener({
- name: 'pause'
- }, function(ret, err) {
- onPause(); //监听应用进入后台,通知jpush暂停事件
- })
- api.addEventListener({
- name: 'resume'
- }, function(ret, err) {
- onResume(); //监听应用恢复到前台,通知jpush恢复事件
- })
- jpush.setListener(function(ret, err) {
- if (ret) {
- notify(ret.content, ret.extra);
- }
- });
- }
- function initJPush() {
- jpush.init(function(ret, err) {
- if (ret && ret.status) {
- // console.log(JSON.stringify(ret))
- bindAliasAndTags();
- } else {
- api.toast({
- msg: '操作失败!'
- });
- }
- });
- }
- //统计-app恢复
- function onResume() {
- jpush.onResume();
- }
- //统计-app暂停
- function onPause() {
- jpush.onPause();
- }
- function bindAliasAndTags() {
- var param = {
- alias: _myalias,
- tags: ['tag1', 'qdduser']
- };
- jpush.bindAliasAndTags(param, function(ret) {
- // alert(JSON.stringify(ret));
- var statusCode = ret.statusCode;
- });
- }
- function notify(content, extras) {
- getmsgtotal();
- api.notification({
- vibrate: [100, 500, 200, 500, 300, 500],
- sound: 'widget://res/horse.ogg',
- notify: {
- title: '您有一条新的消息...',
- content: content,
- extra: extras,
- updateCurrent: false
- }
- }, function(ret, err) {});
- }
- function webtoappinit() {
- if (_webinkeyid) {
- to_goods_id(_webinkeyid, _webinstoreid);
- return false;
- }
- if (_webinstoreid) {
- to_store_id(_webinstoreid);
- return false;
- }
- }
- $(".back-top").on("tap", function() {
- $('html , body').animate({
- scrollTop: 0
- }, 'slow');
- return false;
- });
- $.fn.fixedDiv = function(actCls) {
- var that = $(this),
- offsetTop = that.offset().top,
- scrollTop;
- function fix() {
- scrollTop = $(document).scrollTop();
- if (scrollTop > offsetTop) {
- that.removeClass(actCls);
- } else {
- that.addClass(actCls);
- }
- }
- fix();
- $(window).scroll(fix);
- }
- $('#fix1').fixedDiv('mask-hidden')
- </script>
- </html>
|