|
@@ -1,18 +1,18 @@
|
|
|
<!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 {
|
|
|
+ <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 {
|
|
|
width: 100%;
|
|
|
height: 100%;
|
|
|
}
|
|
@@ -149,753 +149,795 @@
|
|
|
border-radius: 0.08rem;
|
|
|
}
|
|
|
</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 style="position: fixed;width: 6.9rem;margin-left: -1px;z-index: 2;background: #fff;">
|
|
|
- <div class="home-top" style="padding: 0.1rem 0;">
|
|
|
- <div class="home-top-left"><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: 1.6rem;"></div>
|
|
|
- <div class="home-ads" style="border-radius: 0.1rem;">
|
|
|
- <div class="swiper-container" 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';
|
|
|
-apiready = function() {
|
|
|
- _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;
|
|
|
- setIosTopBar();
|
|
|
- get_adv();
|
|
|
- getRouteData();
|
|
|
- webtoappinit();
|
|
|
- _myalias = "member" + $api.getStorage("memberid");
|
|
|
- jpushInit();
|
|
|
- var storage = hasPermission('storage');
|
|
|
- var has = hasPermission('camera');
|
|
|
- if(!storage || !storage[0] || !storage[0].granted){
|
|
|
- reqPermission('storage')
|
|
|
- }
|
|
|
- if(!has || !has[0] || !has[0].granted){
|
|
|
- reqPermission('location');
|
|
|
-
|
|
|
- }
|
|
|
- //滑动到底部
|
|
|
- api.addEventListener({
|
|
|
- name: 'scrolltobottom'
|
|
|
- }, function(ret, err) {
|
|
|
- getmsgtotal();
|
|
|
- });
|
|
|
- //应用从后台回到前台事件
|
|
|
- api.addEventListener({
|
|
|
- name: 'resume'
|
|
|
- }, function(ret, err) {
|
|
|
- _isload = false;
|
|
|
- _minid = '';
|
|
|
- _isrefurbish = true;
|
|
|
- getAddress();
|
|
|
- getmsgtotal();
|
|
|
- });
|
|
|
- //应用每次显示
|
|
|
- api.addEventListener({
|
|
|
- name: 'viewappear'
|
|
|
- }, function(ret, err) {
|
|
|
- getAddress();
|
|
|
- getmsgtotal();
|
|
|
- });
|
|
|
- setTimeout(function(){
|
|
|
- goto_adv();
|
|
|
- }, 800);
|
|
|
-};
|
|
|
-$(".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,
|
|
|
- pageParam: {
|
|
|
- keyid: _keyid
|
|
|
- }
|
|
|
- });
|
|
|
- return false;
|
|
|
-})
|
|
|
-
|
|
|
-$(".scan-barcode").on("tap", function() {
|
|
|
- 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) {
|
|
|
- // alert(JSON.stringify(ret));
|
|
|
- if (ret.eventType == "success") {
|
|
|
- if (ret.content.indexOf("?store_id=") > -1) {
|
|
|
- var _store_id = ret.content.split("?")[1];
|
|
|
- _store_id = _store_id.split("&")[0];
|
|
|
- _store_id = _store_id.replace("store_id=", "");
|
|
|
- // alert(_store_id);
|
|
|
- if (ret.content.indexOf("goods_id=") > -1) {
|
|
|
- var _goods_id = ret.content.split("?")[1];
|
|
|
- _goods_id = _goods_id.split("&")[1];
|
|
|
- _goods_id = _goods_id.replace("goods_id=", "");
|
|
|
- // alert(_goods_id);
|
|
|
- api.openWin({
|
|
|
- name: 'showgoods',
|
|
|
- url: './home/showgoods.html',
|
|
|
- bounces: false,
|
|
|
- pageParam: {
|
|
|
- storeid: _store_id,
|
|
|
- keyid: _goods_id
|
|
|
- }
|
|
|
- });
|
|
|
- } else {
|
|
|
- //
|
|
|
- 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,
|
|
|
- pagination: {
|
|
|
- el: '.swiper-pagination',
|
|
|
- },
|
|
|
- on: {
|
|
|
- transitionEnd: function(){
|
|
|
- var tempSlideWidth = $(".swiper-slide").width();
|
|
|
- $(".swiper-slide").css("width", tempSlideWidth);
|
|
|
- $(".swiper-slide-active").css("width", (tempSlideWidth+1));
|
|
|
- }
|
|
|
- }
|
|
|
- });
|
|
|
- } 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':
|
|
|
- console.log(_adv_goods_id, _adv_store_id)
|
|
|
- to_goods_id(_adv_goods_id, _adv_store_id)
|
|
|
- break;
|
|
|
- case 'store':
|
|
|
- console.log(_adv_store_id);
|
|
|
- to_store_id(_adv_store_id);
|
|
|
- break;
|
|
|
- case 'article':
|
|
|
- console.log(_adv_article_id);
|
|
|
- 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 getRouteHotelData() {
|
|
|
- if (_lon=='0') {
|
|
|
- $(".border-none").removeClass("mask-hidden");
|
|
|
- return false;
|
|
|
- } else {
|
|
|
- $(".border-none").addClass("mask-hidden");
|
|
|
- }
|
|
|
- if (_isload) {
|
|
|
- return false;
|
|
|
- }
|
|
|
- $.ajax({
|
|
|
- url: siteurl + 'v2/entry/storeList',
|
|
|
- data: {
|
|
|
- page: _page,
|
|
|
- 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 ( _page == 1 ) {
|
|
|
- $("#hotel-list").html(html);
|
|
|
- $(".border-none").addClass("mask-hidden");
|
|
|
- $("#hotel-list").removeClass("mask-hidden");
|
|
|
- } else {
|
|
|
- $("#hotel-list").append(html);
|
|
|
- }
|
|
|
- _page++;
|
|
|
- } else {
|
|
|
- if ( _page == 1 ) {
|
|
|
- $(".border-none").removeClass("mask-hidden");
|
|
|
- $("#hotel-list").addClass("mask-hidden");
|
|
|
- }
|
|
|
- _isload = true;
|
|
|
- }
|
|
|
- } else {
|
|
|
- errcode(datas, datas.code);
|
|
|
- }
|
|
|
- function_name();
|
|
|
- }
|
|
|
- });
|
|
|
-}
|
|
|
-$(".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;
|
|
|
-}
|
|
|
-
|
|
|
-$("#set-local").on("tap", function() {
|
|
|
- $(this).attr("src", "../image/home_local2.png");
|
|
|
- var _that = $(this);
|
|
|
- setTimeout(function() { _that.attr("src", "../image/home_local.png"); }, 800);
|
|
|
- api.toast({
|
|
|
- msg: '正在获取当前位置...'
|
|
|
- });
|
|
|
- getAddress();
|
|
|
-})
|
|
|
-
|
|
|
-function getAddress() {
|
|
|
- var has = hasPermission('location');
|
|
|
- if(!has || !has[0] || !has[0].granted){
|
|
|
- reqPermission('location');
|
|
|
- $(".border-none").removeClass("mask-hidden");
|
|
|
- return false;
|
|
|
- }
|
|
|
- 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(ret, err) {
|
|
|
- if (ret.status) {
|
|
|
- _lon = ret.lon;
|
|
|
- _lat = ret.lat;
|
|
|
- getRouteHotelData();
|
|
|
- aMap.getNameFromCoords({
|
|
|
- lon: ret.lon,
|
|
|
- lat: ret.lat
|
|
|
- }, function(ret, err) {
|
|
|
- if (ret.status) {
|
|
|
- aMap.close();
|
|
|
- $(".local-name").text(ret.city + ret.township + ret.street + ret.number);
|
|
|
- }
|
|
|
- });
|
|
|
- } else {
|
|
|
- $(".local-name").text(JSON.stringify(err));
|
|
|
- }
|
|
|
- });
|
|
|
-}
|
|
|
-
|
|
|
-function jpushInit() {
|
|
|
- jpush = api.require('ajpush');
|
|
|
- initJPush();
|
|
|
- api.addEventListener({ name: 'noticeclicked' }, function(ret, err) { //ios noticeclicked
|
|
|
- var _value = ret.value.replace(/\\/g, "");
|
|
|
- // $(".home-search").text(JSON.stringify(ret));
|
|
|
- // $(".local-name").text(JSON.stringify(err));
|
|
|
- var obj = eval('(' + _value + ')');
|
|
|
- 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) {
|
|
|
- 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) {
|
|
|
- var statusCode = ret.statusCode;
|
|
|
- // alert(JSON.stringify(ret));
|
|
|
- });
|
|
|
-}
|
|
|
-
|
|
|
-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() {
|
|
|
- // body...
|
|
|
- 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>
|
|
|
+ <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 style="position: fixed;width: 6.9rem;margin-left: -1px;z-index: 2;background: #fff;">
|
|
|
+ <div class="home-top" style="padding: 0.1rem 0;">
|
|
|
+ <div class="home-top-left"><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: 1.6rem;"></div>
|
|
|
+ <div class="home-ads" style="border-radius: 0.1rem;">
|
|
|
+ <div class="swiper-container" 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';
|
|
|
+ apiready = function() {
|
|
|
+ _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;
|
|
|
+ get_adv();
|
|
|
+ getRouteData();
|
|
|
+ webtoappinit();
|
|
|
+ _myalias = "member" + $api.getStorage("memberid");
|
|
|
+ jpushInit();
|
|
|
+ var storage = hasPermission('storage');
|
|
|
+ if (!storage || !storage[0] || !storage[0].granted) {
|
|
|
+ reqPermission('storage')
|
|
|
+ }
|
|
|
+ var hass = hasPermission('location');
|
|
|
+ if (!hass || !hass[0] || !hass[0].granted) {
|
|
|
+ reqPermission('location');
|
|
|
+ }
|
|
|
+ //滑动到底部
|
|
|
+ api.addEventListener({
|
|
|
+ name: 'scrolltobottom'
|
|
|
+ }, function(ret, err) {
|
|
|
+ getAddress();
|
|
|
+ });
|
|
|
+ //应用从后台回到前台事件
|
|
|
+ api.addEventListener({
|
|
|
+ name: 'resume'
|
|
|
+ }, function(ret, err) {
|
|
|
+ _isload = false;
|
|
|
+ _minid = '';
|
|
|
+ _isrefurbish = true;
|
|
|
+ getAddress();
|
|
|
+ getmsgtotal();
|
|
|
+ });
|
|
|
+ //应用每次显示
|
|
|
+ api.addEventListener({
|
|
|
+ name: 'viewappear'
|
|
|
+ }, function(ret, err) {
|
|
|
+ getAddress();
|
|
|
+ getmsgtotal();
|
|
|
+ });
|
|
|
+ setTimeout(function() {
|
|
|
+ goto_adv();
|
|
|
+ }, 800);
|
|
|
+ };
|
|
|
+ $(".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,
|
|
|
+ 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) {
|
|
|
+ // alert(JSON.stringify(ret));
|
|
|
+ if (ret.eventType == "success") {
|
|
|
+ if (ret.content.indexOf("?store_id=") > -1) {
|
|
|
+ var _store_id = ret.content.split("?")[1];
|
|
|
+ _store_id = _store_id.split("&")[0];
|
|
|
+ _store_id = _store_id.replace("store_id=", "");
|
|
|
+ // alert(_store_id);
|
|
|
+ if (ret.content.indexOf("goods_id=") > -1) {
|
|
|
+ var _goods_id = ret.content.split("?")[1];
|
|
|
+ _goods_id = _goods_id.split("&")[1];
|
|
|
+ _goods_id = _goods_id.replace("goods_id=", "");
|
|
|
+ // alert(_goods_id);
|
|
|
+ api.openWin({
|
|
|
+ name: 'showgoods',
|
|
|
+ url: './home/showgoods.html',
|
|
|
+ bounces: false,
|
|
|
+ pageParam: {
|
|
|
+ storeid: _store_id,
|
|
|
+ keyid: _goods_id
|
|
|
+ }
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ //
|
|
|
+ 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,
|
|
|
+ pagination: {
|
|
|
+ el: '.swiper-pagination',
|
|
|
+ },
|
|
|
+ on: {
|
|
|
+ transitionEnd: function() {
|
|
|
+ var tempSlideWidth = $(".swiper-slide").width();
|
|
|
+ $(".swiper-slide").css("width", tempSlideWidth);
|
|
|
+ $(".swiper-slide-active").css("width", (tempSlideWidth + 1));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ } 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':
|
|
|
+ console.log(_adv_goods_id, _adv_store_id)
|
|
|
+ to_goods_id(_adv_goods_id, _adv_store_id)
|
|
|
+ break;
|
|
|
+ case 'store':
|
|
|
+ console.log(_adv_store_id);
|
|
|
+ to_store_id(_adv_store_id);
|
|
|
+ break;
|
|
|
+ case 'article':
|
|
|
+ console.log(_adv_article_id);
|
|
|
+ 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 getRouteHotelData() {
|
|
|
+ if (_lon == '0') {
|
|
|
+ $(".border-none").removeClass("mask-hidden");
|
|
|
+ return false;
|
|
|
+ } else {
|
|
|
+ $(".border-none").addClass("mask-hidden");
|
|
|
+ }
|
|
|
+ if (_isload) {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ console.log(_page,_minid);
|
|
|
+ $.ajax({
|
|
|
+ url: siteurl + 'v2/entry/storeList',
|
|
|
+ data: {
|
|
|
+ page: _page,
|
|
|
+ page_size:'8',
|
|
|
+ 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 (_page == 1) {
|
|
|
+ $("#hotel-list").html(html);
|
|
|
+ $(".border-none").addClass("mask-hidden");
|
|
|
+ $("#hotel-list").removeClass("mask-hidden");
|
|
|
+ } else {
|
|
|
+ $("#hotel-list").append(html);
|
|
|
+ }
|
|
|
+ _page++;
|
|
|
+ } else {
|
|
|
+ if (_page == 1) {
|
|
|
+ $(".border-none").removeClass("mask-hidden");
|
|
|
+ $("#hotel-list").addClass("mask-hidden");
|
|
|
+ }
|
|
|
+ _isload = true;
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ errcode(datas, datas.code);
|
|
|
+ }
|
|
|
+ function_name();
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ $(".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;
|
|
|
+ }
|
|
|
+
|
|
|
+ $("#set-local").on("tap", function() {
|
|
|
+ $(this).attr("src", "../image/home_local2.png");
|
|
|
+ var _that = $(this);
|
|
|
+ setTimeout(function() {
|
|
|
+ _that.attr("src", "../image/home_local.png");
|
|
|
+ }, 800);
|
|
|
+ api.toast({
|
|
|
+ msg: '正在获取当前位置...'
|
|
|
+ });
|
|
|
+ getAddress();
|
|
|
+ })
|
|
|
+
|
|
|
+ function getAddress() {
|
|
|
+ var has = hasPermission('location');
|
|
|
+ if (!has || !has[0] || !has[0].granted) {
|
|
|
+ reqPermission('location');
|
|
|
+ $(".border-none").removeClass("mask-hidden");
|
|
|
+ return false;
|
|
|
+ } else {
|
|
|
+ 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(ret, err) {
|
|
|
+ if (ret.status) {
|
|
|
+ _lon = ret.lon;
|
|
|
+ _lat = ret.lat;
|
|
|
+ getRouteHotelData();
|
|
|
+ aMap.getNameFromCoords({
|
|
|
+ lon: ret.lon,
|
|
|
+ lat: ret.lat
|
|
|
+ }, function(ret, err) {
|
|
|
+ if (ret.status) {
|
|
|
+ aMap.close();
|
|
|
+ $(".local-name").text(ret.city + ret.township + ret.street + ret.number);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ $(".local-name").text(JSON.stringify(err));
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ function jpushInit() {
|
|
|
+ jpush = api.require('ajpush');
|
|
|
+ initJPush();
|
|
|
+ api.addEventListener({
|
|
|
+ name: 'noticeclicked'
|
|
|
+ }, function(ret, err) { //ios noticeclicked
|
|
|
+ var _value = ret.value.replace(/\\/g, "");
|
|
|
+ var obj = eval('(' + _value + ')');
|
|
|
+ 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) {
|
|
|
+ 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) {
|
|
|
+ var statusCode = ret.statusCode;
|
|
|
+ // alert(JSON.stringify(ret));
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ 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>
|