setState: function(state){
     this.flag.state = state;
     this.addStateToLog(state);
     switch(state){
         case 'start': {     //开始定位
             this.state = 'start';
             this.showLoading();
             this.waitForLoc(8);
             break;
         }
         case 'success':  {  //定位成功
             this.state = 'success';
             this.hideLoading();
             this.setLocation();
             break;
         }
         case 'fail': {          //定位失败
             this.state = 'fail';
             this.hideLoading();
             this.centerMarker.hide();
             popup.open({text:'定位失败'});
             this.setLocation();
             if(this.flag.wait) {
                 window.clearTimeout(this.flag.wait);
             }
             break;
         }
     }
 },
 _blur : function (e) {
     var me = this,
         el = $(e.target),
         key = el.attr('key'),
         geo = me.model.get('geo'),
         //根本没定位成功或者用户手工输入
         isGeoFlag = (geo.word != MY_GEO && txt == MY_GEO && IS_REALLY_LOCATION),
         //文本框发现是我的位置 但却根据定位监测到不是真正我的位置
         //isUserInput = (txt == MY_GEO && locator.isUserInput()),
         txt = el.val().trim();
     if(isGeoFlag) {
         //强制清空文本 告知定位失败
         el.val("");
         popup.open({text:'定位失败!'});
     }
     if(geo.point && txt=='' && IS_REALLY_LOCATION) {
         if(me.model.get(key).word==geo.word) {
             el.val(MY_GEO);
             el.addClass('geo');
         }
         //符合了定位 而且当前文本框是我的位置的话 强制再去检测当前位置的GEO
         var modelkey =(key == "start" ? "start" :"end");
         if(me["se"+modelkey].val()!=MY_GEO) {
             me.model.set(key, me._getGeoData());
             me.model.set(modelkey,{word:""});
         }
     }
 },
    goToBook: function (e) {
        var $target = $(e.target),
            action = _APP_HASH.action,
            url = $target.data('url'),
            roomtype = $target.closest('li').find('span').eq(1).text(),
            otaname = $target.parent().find('.ota-name').text(),
            name,
            today = new Date().format('yyyy-MM-dd'),
            tomorrow = new Date((new Date()).getTime() + 24 * 60 * 60 * 1000).format('yyyy-MM-dd'),
            price = parseInt($target.data('price'), 10),
            bonus = parseInt($target.data('bonus'), 10) || 0,
            extraParams;

        if ($target.hasClass('ota-bookbtn-web')) {
            if (action === 'detail') {
                //详情页所有电脑预订方式的点击总量
                name = $('.place-widget-captain .name').text();
                stat.addStat(STAT_CODE.PLACE_HOTEL_DETAIL_BOOKBTN_PC_CLICK, {'name': this.poiname, 'type': roomtype, 'ota': otaname});
            } else if (action === 'hotelbook') {
                //房型报价页所有电脑预订方式的点击总量
                stat.addStat(STAT_CODE.PLACE_HOTEL_BOOK_BOOKBTN_PC_CLICK, {'name': this.poiname, 'type': roomtype, 'ota': otaname});
            }

            popup.open({
                'text': '您好,此酒店报价需要在电脑端登陆:map.baidu.com,在酒店版块中进行搜索预订',
                'autoCloseTime': 3000
            });
        } else if ($target.hasClass('ota-bookbtn-tel')) {
            if (action === 'detail') {
                //详情页所有电话预订方式的点击总量
                stat.addStat(STAT_CODE.PLACE_HOTEL_DETAIL_BOOKBTN_TEL_CLICK, {'name': this.poiname, 'type': roomtype, 'ota': otaname});
            } else if (action === 'hotelbook') {
                //房型报价页所有电话预订方式的点击总量
                stat.addStat(STAT_CODE.PLACE_HOTEL_BOOK_BOOKBTN_TEL_CLICK, {'name': this.poiname, 'type': roomtype, 'ota': otaname});
            }

            if (util.isAndroid()) {
                $target.attr('href', 'javascript:void(0)');
                util.TelBox.showTb($target.attr('phone'));
            }
        } else {
            extraParams = {
                from_page: action,
                checkin_date: (this.sd || today),
                checkout_date: (this.ed || tomorrow),
                c: geolocation.getCityCode(),
                price: price,
                book_price: price - bonus,
                simple: 1
            };
            window.open(url + '&' + util.jsonToQuery(extraParams), '_blank');
        }

        e.stopPropagation();
        e.stopImmediatePropagation();
    },
Example #4
0
 success: function(data, status, xhr) {
     popup.close();
     if (parseInt(data, 10) === 0) { // 严格判断返回值
         me.submitData = submitData;
         self.onSuccess();
     } else {
         me.submitData = null;
         self.onFailure();
     }
 },
Example #5
0
 onSuccess: function() {
     popup.open({
         text:'提交成功,谢谢您的反馈!'
     });
     var me = this;
     setTimeout(function() {
         me.submitData = null;
         me.reset();
         location.href = "/mobile/webapp/index/index";
     }, 3000);
 },
Example #6
0
    submit : function($elContent, isTelOrEmail, $elContact){
        var me = feedbackinfo.api,self = this;
        var submitData = $.param($.extend({
            content: me.filterxss($elContent.val().trim()),
            tel: isTelOrEmail == "tel" ? $elContact.val().trim() : "",
            email: isTelOrEmail == "email" ? $elContact.val().trim() : ""
        }, me.data));
        if (me.submitData == submitData) {
            popup.open({text:'请勿重复提交!'});
            return;
        }

        me.submitData = submitData;
        popup.open({
                text:'意见提交中,请稍后!',
                autoCloseTime:false
        });
        $.ajax({
            url: me.domain + me.url,
            dataType: "jsonp", // 存在跨域问题,必须使用JSONP方式; 要求后端支持callback;
            timeout: 8000,
            data: submitData,
            success: function(data, status, xhr) {
                popup.close();
                if (parseInt(data, 10) === 0) { // 严格判断返回值
                    me.submitData = submitData;
                    self.onSuccess();
                } else {
                    me.submitData = null;
                    self.onFailure();
                }
            },
            error: function(xhr, errorType, error) {
                me.submitData = null;
                self.onFailure();
            }
        });
    },
 _checkInput : function (element) {
     if(!element) {
         return false;
     } else if (!/\S+/.test(element.val())) {
         element.focus();
         return false;
     }
     if(element.val() == MY_GEO && this.model.get('geo').word != MY_GEO) {
         element.val('');
         popup.open({text:'定位失败!'});
         return false;
     } 
     return true;
 },
    onSizeChange: function(){
        var opts = url.get();
        var pageState = opts.pageState || {};
        if(!this.hasAlertDisabled() &&
            !this.checkEyeMapDirection() &&
            !util.isIPad()){
            //在小米1默认浏览器下,localStorage保存数据不立刻生效的问题。 
			if(this.alertDsabeld)return;

            Popup.open(
                {
                    text : '街景在横屏下体验较差,建议在竖屏下使用。',
                    autoCloseTime : 3000
                }
            );
            this.alertDsabeld = true;
            storage.addData("alertDisabled", "true", {
                error: function() { // localstorage写入失败时写入cookie
                    var options = {
                        domain: 'map.baidu.com',
                        path: '/',
                        expires: 365 * 24 * 60 * 60 * 1000
                    };
                    Cookie.set("alertDisabled", "true", options);
                }
            });
            
            $('.common-widget-popup').on('touchstart', function(){
                $('.common-widget-popup').remove();
            });
            // setTimeout(function(){
            //     if(pageState.vt == 'streetview'){
            //         util.TxtBox.c({
            //             clearAll:true
            //         });
            //     }
            // }, 3000);
        }
        //渲染街景后,在横屏下产品头被遮住,用延时重新滚动浏览器的页面位置
        setTimeout(function(){
            window.scrollTo(0,0);
        },100);
    },
    onNoResult: function(){
        var opts = url.get();
        var pageState = opts.pageState || {};

        Popup.open( 
            {
                text          : this.Str.NORESULT,
                autoCloseTime : 1500
            }
        );
        //clearTimeout(this.interval);
        // this.interval = setTimeout(function(){
        //     if(pageState.vt == 'streetview'){
        //         util.TxtBox.c({
        //             clearAll:true
        //         });
        //     }
        // }, 3000);
        this.onPositionChanged();
    },
Example #10
0
    initDateSelector: function(result){
        /*展示前先提示*/
        var tip = '',
            rplt = result.rplt;
            switch(rplt){
                case 1:  
                    tip = '已经为您屏蔽当前停运的方案!';
                    break;
                case 2:
                case 3:
                    tip = '此时没有可用公交方案,已显示全部方案!';
                    break;
                default:break;
        }
        if (tip!="") {
            popup.open({text:tip});
        };
        var me = this,
            date = new Date();
            //query = parseurl.query;
        if(result && result.exptime){
            //iphone uc下不支持 Date.parse静态方法, 所以做特殊处理
            var resultDate = result.exptime.split('T');
            var resYMD = resultDate[0].split('-');
            var resMM = resultDate[1].split(':');
            date.setYear(resYMD[0]);
            date.setMonth(resYMD[1]-1);
            date.setDate(resYMD[2]);
            date.setHours(parseInt(resMM[0]));
            date.setMinutes(parseInt(resMM[1]));
            //不足10分钟的向上加到十分钟
            date = new Date(date.getTime() + ((10-(resMM[1]%10)))%10*60000);

        }
        this.startDateTime = date.format('yyyy-MM-dd hh:mm');
        this.displayDateTimeText = this.formatDisplayText(this.startDateTime);
        
        //初始化默认工具为0, 全部
        //this.selectedTool = quezry.f == '[0,2,4,7,5,8,9,10,11]' ? '1' : '0';
    },
;!function(e,t,a){"use strict";var o=require("common:widget/popup/popup.js"),i=require("common:widget/cookie/cookie.js"),r=require("common:static/js/util.js"),s={pageControllerMap:{home:require("taxi:widget/home/home.js"),waiting:require("taxi:widget/waiting/waiting.js"),resubmit:require("taxi:widget/resubmit/resubmit.js"),response:require("taxi:widget/response/response.js"),verify:require("taxi:widget/verify/verify.js"),settings:require("taxi:widget/settings/settings.js"),about:require("taxi:widget/about/about.js")},getPageOptions:function(){return r.urlToJSON(i.get("BAIDU_TAXI_PAGE_OPTIONS"))||{}},request:function(e){$.ajax({type:"POST",dataType:"json",url:"/mobile/webapp/taxi/api/"+r.jsonToQuery($.extend({},e.data,{api:2,os:"webapp"})),success:function(t){t&&0===t.errno?e.success&&$.isFunction(e.success)&&e.success(t):e.error&&$.isFunction(e.error)&&e.error(t)},error:function(t){o.open({text:"当前网络无法使用,请稍后重试!",layer:!0}),$.isFunction(e.error)&&t&&t.errno>0&&e.error()},complete:e.complete})},loadPage:function(e,a){var s,n,u,g=this,c=$("#wrapper");e=e||g.getPageState("lastPage")||"home",a&&("object"==typeof a&&(a=r.jsonToQuery(a)),i.set("BAIDU_TAXI_PAGE_OPTIONS",a)),s="taxi-pagelet-"+e,t.asyncLoad({id:s},a,function(){o.close(),$("<div/>").attr({id:s}).appendTo(c.html("")),g.getPageState("lastPage")!==e&&(n=g.getPageState("lastPage"),u=g.pageControllerMap[n],u&&u.destroy&&$.isFunction(u.destroy)&&u.destroy(),g.setPageState("lastPage",e))})},route:function(){var e,t=this;e=i.get("BAIDU_TAXI_ORDER_ID"),e?this.request({data:{qt:"orderstatus",order_id:e},success:function(e){var a=e.info&&e.info.status;switch(a){case-1:t.loadPage("resubmit");break;case 2:t.loadPage("response");break;case 1:t.loadPage("waiting");break;case 3:case-2:case 3:case 4:i.remove("BAIDU_TAXI_PAGE_STATE"),t.loadPage("home");break;default:i.remove("BAIDU_TAXI_PAGE_STATE"),t.loadPage("home")}t.setPageState("status",a),t.setPageState("existTime",e.info.exist_time)},error:function(){i.remove("BAIDU_TAXI_PAGE_STATE"),t.loadPage("home")}}):this.loadPage(this.getPageState("lastPage"))},getPageState:function(e){var t=r.urlToJSON(i.get("BAIDU_TAXI_PAGE_STATE"));return t&&t[e]},setPageState:function(e,t){var a=r.urlToJSON(i.get("BAIDU_TAXI_PAGE_STATE"));a[e]=t,i.set("BAIDU_TAXI_PAGE_STATE",r.jsonToQuery(a))},removePageState:function(e){this.setPageState(e,a)},init:function(){o.open({text:"正在加载...",layer:!0,autoCloseTime:0}),this.route()}};s.init(),e.LoadManager=s}(window,BigPipe);
;define("taxi:widget/waiting/waiting.js",function(t,e,i){"use strict";var a=(t("common:static/js/util.js"),t("common:widget/cookie/cookie.js")),n=t("common:widget/stat/stat.js"),o=t("taxi:widget/common/radar/radar.js"),e={create:function(){var t=$(".taxi-widget-waiting"),e=t.find(".taxi-info .count"),i=this.options;e.text(i.taxi_num),this.$el=t},countDown:function(){var t,e,i,n=this,o=this.options,s=Math.min(parseInt(o.limit,10),parseInt(o.taxi_num,10)),r=this.$el,d=r.find(".pushed-car .count"),u=r.find(".second"),c=parseInt(a.get("BAIDU_TAXI_ORDER_START_TIME"),10),h=function(){t=parseInt(d.text(),10),e=parseInt(u.text(),10),t=Math.min(t+2,s),e-=1,d.text(t),u.text(e),0>=e?(n.destroy(),LoadManager.loadPage("resubmit",o)):n.timeout.push(setTimeout(h,1e3))};"number"!=typeof c||isNaN(c)||(i=120-Math.ceil((Date.now()-c)/1e3),0>i?(this.destroy(),LoadManager.loadPage("resubmit",o)):u.text(i)),this.timeout.push(setTimeout(h,1e3))},getCarReply:function(){var t,e=this,i=this.options,a=i.order_id;t=setInterval(function(){LoadManager.request({data:{qt:"driverreply",order_id:a},success:function(i){i.info&&(clearInterval(t),t=null,e.destroy(),LoadManager.loadPage("response",i.info),n.addStat(STAT_CODE.TAXI_DRIVERREPLY))},error:function(){}})},5e3),this.interval.push(t)},destroy:function(){var t,e,i=this.interval,a=this.timeout;for(t=0,e=i.length;e>t;t++)clearInterval(i[t]);for(t=0,e=a.length;e>t;t++)clearTimeout(a[t]);o.destroy()},init:function(){var t=this.options=LoadManager.getPageOptions();t||(this.destroy(),LoadManager.loadPage("home")),this.timeout=[],this.interval=[],this.create(),this.countDown(),this.getCarReply()}};i.exports=e});
Example #13
0
 onFailure: function() {
     popup.open({text:'意见提交失败,请重试!'});
 }
;define("taxi:widget/resubmit/resubmit.js",function(e,i,t){"use strict";var o=e("common:static/js/util.js"),n=e("common:widget/popup/popup.js"),a=e("common:widget/stat/stat.js"),r=e("common:widget/cookie/cookie.js"),s=e("taxi:widget/common/addprice/addprice.js"),d=e("taxi:widget/common/radar/radar.js"),i={create:function(){var e,i=$(".taxi-widget-resubmit"),t=i.find(".btn-resubmit"),o=i.find(".btn-back"),n=i.find("form"),a=i.find(".addprice-wrapper"),r=this.options;r.price_list?(e=r.price_list.split(","),s.init(e),i.find("[type=input][name=add_price]").remove()):a.hide(),i.find("[name=city_code]").val(r.city_code),i.find("[name=order_id]").val(r.order_id),t.on("click",$.proxy(this.onBtnResubmitClick,this)),o.on("click",$.proxy(this.onBtnBackClick,this)),this.$el=i,this.$form=n},onBtnResubmitClick:function(){var e=$.extend({price_list:this.options.price_list,taxi_num:this.options.taxi_num},o.urlToJSON(this.$form.serialize()));n.open({text:"正在提交表单...",layer:!0,autoCloseTime:0}),LoadManager.request({data:$.extend({},e,{qt:"addpricereq"}),success:function(i){r.set("BAIDU_TAXI_ORDER_ID",i.info.order_id,{expires:162e6}),r.set("BAIDU_TAXI_ORDER_START_TIME",Date.now()),LoadManager.loadPage("waiting",$.extend({},e,i.info)),a.addStat(STAT_CODE.TAXI_ADDPRICEREQ)},error:function(e){var i="";switch(e.errno){case-304:i="订单已过期或结束!";break;case-113:i="请求过于频繁,请稍后再试!";break;default:i="系统错误!"}n.open({text:i,layer:!0,onClose:function(){r.remove("BAIDU_TAXI_ORDER_ID"),LoadManager.loadPage("home")}})}})},onBtnBackClick:function(){r.remove("BAIDU_TAXI_ORDER_ID")},destroy:function(){d.destroy()},init:function(){var e=this.options=LoadManager.getPageOptions(),i=r.get("BAIDU_TAXI_ORDER_ID");e&&i||LoadManager.loadPage("home"),this.create()}};t.exports=i});
;define("taxi:widget/verify/verify.js",function(e,t,i){"use strict";var n=(e("common:static/js/util.js"),e("common:widget/cookie/cookie.js")),o=e("common:widget/popup/popup.js"),a=e("common:widget/stat/stat.js"),t={create:function(){var e=this.$el=$(".taxi-widget-verify"),t=this.$inputPhone=e.find(".input-phone"),i=this.$inputCode=e.find(".input-code"),n=this.$btnGetCode=e.find(".btn-get-code"),o=this.$btnVerifyPhone=e.find(".btn-verify-phone"),a=this.options;n.on("click",$.proxy(this.onBtnGetCodeClick,this)),o.on("click",$.proxy(this.onBtnVerifyPhoneClick,this)),t.on("keyup",$.proxy(this.onInputPhoneKeyup,this)),i.on("keyup",$.proxy(this.onInputCodeKeyup,this)),t.val(a.phone||""),Taxi.validatePhone(t.val())&&n.removeAttr("disabled"),this.$btnGetCode=n,this.$inputPhone=t},onBtnGetCodeClick:function(){var e,t=this,i=this.$btnGetCode,n=this.$inputPhone,a=60,r=i.text(),s=function(){i.text(a+"秒"),a--};i.attr("disabled","disabled"),n.attr("disabled","disabled"),LoadManager.request({data:{qt:"sendcode",phone:this.$inputPhone.val()},success:function(){s(),e=t.interval=setInterval(function(){0===a?(i.removeAttr("disabled"),n.removeAttr("disabled"),i.text(r),clearInterval(e),e=-1):s()},1e3)},error:function(e){var a="";switch(e.errno){case-201:a="请求太频繁,请60秒后重试!";break;case-101:a="参数错误!";break;default:a="系统错误!"}o.open({text:a,layer:!0,onClose:function(){i.removeAttr("disabled"),n.removeAttr("disabled"),i.text(r),clearInterval(t.interval),t.interval=-1}})}})},onBtnVerifyPhoneClick:function(){var e=this.$inputPhone.val(),t=this.$btnVerifyPhone,i=this.options,r=i.referrer;t.attr("disabled","disabled"),LoadManager.request({data:{qt:"verifycode",phone:e,code:this.$inputCode.val()},success:function(s){if(1===s.info.is_pass)switch(n.set("BAIDU_TAXI_PHONE",e,{expires:31536e6}),delete i.referrer,r){case"home":o.open({text:"正在发送打车请求...",layer:!0,autoCloseTime:0}),LoadManager.request({data:$.extend({},i,{qt:"userreq",phone:e}),success:function(e){n.set("BAIDU_TAXI_ORDER_ID",e.info.order_id,{expires:162e6}),n.set("BAIDU_TAXI_ORDER_START_TIME",Date.now()),LoadManager.loadPage("waiting",$.extend({},i,e.info))},error:function(e){-101===e.errno&&o.open({text:"请求参数错误!",layer:!0,onClose:function(){LoadManager.loadPage("home")}})}});break;case"settings":LoadManager.loadPage("home");break;default:LoadManager.loadPage("home")}else o.open({text:"验证码错误!",layer:!0});t.removeAttr("disabled"),a.addStat(STAT_CODE.TAXI_VERIFYCODE)},error:function(){t.removeAttr("disabled")}})},onInputPhoneKeyup:function(){Taxi.validatePhone(this.$inputPhone.val())?this.$btnGetCode.removeAttr("disabled"):this.$btnGetCode.attr("disabled","disabled")},onInputCodeKeyup:function(){Taxi.validatePhone(this.$inputPhone.val())&&Taxi.validateCode(this.$inputCode.val())?this.$btnVerifyPhone.removeAttr("disabled"):this.$btnVerifyPhone.attr("disabled","disabled")},destroy:function(){clearInterval(this.interval),this.interval=-1},init:function(){this.options=LoadManager.getPageOptions(),this.create()}};i.exports=t});
;define("taxi:widget/settings/settings.js",function(t,i,n){"use strict";var e=t("common:widget/cookie/cookie.js"),i=(t("common:widget/popup/popup.js"),{create:function(){var t=$(".taxi-widget-settings"),i=t.find(".input-phone"),n=t.find(".btn-modify"),o=t.find(".btn-help"),a=t.find(".btn-terms");i.val(e.get("BAIDU_TAXI_PHONE")),Taxi.validatePhone(i.val())||n.attr("disabled","disabled"),n.on("click",$.proxy(this.onBtnModifyClick,this)),i.on("keyup",$.proxy(this.onInputPhoneKeyup,this)),o.on("click",$.proxy(this.onArticleButtonClick,this)),a.on("click",$.proxy(this.onArticleButtonClick,this)),this.$el=t,this.$btnModify=n,this.$inputPhone=i},onArticleButtonClick:function(t){var i=t.currentTarget.className.split("-")[1];LoadManager.loadPage("about",{type:i})},onBtnModifyClick:function(){var t=this.$inputPhone.val();LoadManager.loadPage("verify",{phone:t,referrer:"settings"})},onInputPhoneKeyup:function(){Taxi.validatePhone(this.$inputPhone.val())?this.$btnModify.removeAttr("disabled"):this.$btnModify.attr("disabled","disabled")},init:function(){this.create()}});n.exports=i});
 showMessage: function( msg, delayTime ) {
     popup.open({
         text: msg,
         autoCloseTime: delayTime || 2000
     });
 }
;define("taxi:widget/home/home.js",function(t,i,n){"use strict";var e=t("common:static/js/util.js"),o=t("common:widget/cookie/cookie.js"),a=t("common:widget/stat/stat.js"),r=t("common:widget/geolocation/geolocation.js"),s=(t("common:widget/geolocation/location.js"),t("common:widget/broadcaster/broadcaster.js")),c=(t("common:widget/suggestion/suggestion.js"),t("common:widget/quickdelete/quickdelete.js"),t("common:widget/popup/popup.js")),d=t("taxi:widget/common/addprice/addprice.js"),i={create:function(){var t=this,i=$(".taxi-widget-home"),n=i.find(".btn-submit"),e=i.find(".nearby-car-info"),o=i.find(".add-price"),a=i.find("input[name=route_start]"),r=i.find("input[name=route_end]"),c=i.find(".form"),d=i.find(".input-panel"),u=(i.find(".poi-input"),i.find(".btn-back")),l=i.find(".btn-back-to-form"),f=i.find(".btn-settings"),p=i.find(".btn-confirm"),m=i.find(".form .input-wrapper");document.referrer&&(u.show(),u.on("click",$.proxy(this.onBtnBackClick,this))),n.on("click",$.proxy(this.onBtnSubmitClick,this)),l.on("click",$.proxy(this.onBtnBackToFormClick,this)),p.on("click",$.proxy(this.onBtnConfirmClick,this)),f.on("click",$.proxy(this.onBtnSettingsClick,this)),m.on("click",$.proxy(this.onFormInputClick,this)),s.subscribe("geolocation.mylocsuc",this.onGeoSuccess,this),s.subscribe("geolocation.fail",this.onGeoFail,this),this.suggestion=$.ui.suggestion({container:".poi-input",mask:".input-panel",source:"http://map.baidu.com/su",listCount:4,posAdapt:!1,isSharing:!0,offset:{x:0,y:0},param:$.param({type:"0",newmap:"1",ie:"utf-8"}),onsubmit:function(){t.onBtnConfirmClick.call(t)}}),this.$el=i,this.$nearbyCarInfo=e,this.$addPrice=o,this.$btnSubmit=n,this.$form=c,this.$inputPanel=d,this.$routeStart=a,this.$routeEnd=r},onBtnSubmitClick:function(){var t=this.$el,i=t.find("form"),n=e.urlToJSON(i.serialize()),r=this.verifyInput();if(!this.geoSuccess)return c.open({text:"定位不成功,不能发起打车请求!",layer:!0}),!1;if(!this.getNearbyCarInfoSuccess)return c.open({text:"获取附近车辆信息失败,请稍后再试!",layer:!0}),!1;if(r>0)c.open({text:"正在提交表单...",layer:!0,autoCloseTime:0}),LoadManager.request({data:n,success:function(t){o.set("BAIDU_TAXI_ORDER_ID",t.info.order_id,{expires:162e6}),o.set("BAIDU_TAXI_ORDER_START_TIME",Date.now()),LoadManager.loadPage("waiting",$.extend({},n,t.info)),a.addStat(STAT_CODE.TAXI_USERREQ,{addPrice:n.add_price})},error:function(t){switch(t.errno){case-121:c.open({text:"发单太频繁,请稍后再试",layer:!0});break;default:c.open({text:"系统错误!",layer:!0})}}});else switch(r){case-1:LoadManager.loadPage("verify",e.urlToJSON(n+"&referrer=home"));break;case-2:c.open({text:"请输入起点!",layer:!0});break;case-3:c.open({text:"请输入终点!",layer:!0})}},onFormInputClick:function(t){var i=$(t.currentTarget).find("input"),n=i.attr("name");this.$form.hide(),this.$inputPanel.show(),this.$inputPanel.attr("data-type",n),this.$inputPanel.find(".poi-input").val(i.val()).focus()},onBtnSettingsClick:function(){var t=o.get("BAIDU_TAXI_PHONE");t?LoadManager.loadPage("settings"):LoadManager.loadPage("verify")},onBtnBackToFormClick:function(){this.backToForm()},onBtnConfirmClick:function(){var t=this.$inputPanel.attr("data-type");this.$el.find("input[name="+t+"]").val(this.$inputPanel.find(".poi-input").val()),this.backToForm()},backToForm:function(){this.$inputPanel.find(".poi-input").val(""),this.$inputPanel.hide(),this.$form.show()},onGeoSuccess:function(t){var i,n=parseInt(t.addr.cityCode,10);this.cityList.indexOf(n)>-1?(this.getNearByCarInfo(t.point.x,t.point.y,n),i=t.addr,i=i.address||i.city+i.district+i.street,this.$routeStart.val(i)):c.open({text:"当前城市不支持打车!",layer:!0}),this.geoSuccess=!0},onGeoFail:function(){c.open({text:"定位失败\n请检查定位服务,以便将打车请求发您周边的司机!",layer:!0}),this.geoFail=!0},verifyInput:function(){var t=o.get("BAIDU_TAXI_PHONE"),i=this.$routeStart.val(),n=this.$routeEnd.val();return i?n?t?!0:-1:-3:-2},getNearByCarInfo:function(t,i,n){var e=this,a=this.$nearbyCarInfo;LoadManager.request({data:{qt:"nearby",lng:t,lat:i,city_code:n},success:function(r){var s,c=e.$el;a.addClass("loaded").find(".count").text(r.info.taxi_num),r.info.is_add_price&&1===r.info.is_add_price.flag&&(s=r.info.is_add_price.price_list)&&(s=s.split(":"),d.init(s),c.find("[type=input][name=add_price]").remove()),c.find("[name=taxi_num]").val(r.info.taxi_num),c.find("[name=lng]").val(t),c.find("[name=lat]").val(i),c.find("[name=city_code]").val(n),c.find("[name=price_list]").val(s),c.find("[name=phone]").val(o.get("BAIDU_TAXI_PHONE")),e.getNearbyCarInfoSuccess=!0},error:function(t){var i="";switch(t.errno){case-105:i="当前城市不支持打车!";break;default:i="系统错误!"}c.open({text:i,layer:!0})}})},getCityList:function(t){var i=this;LoadManager.request({data:{qt:"citylist",city_list:"all"},success:function(n){i.cityList=n.info,t()},error:function(t){var i="";switch(t.errno){case-101:i="参数错误!";break;default:i="系统错误!"}c.open({text:i,layer:!0})}})},onBtnBackClick:function(){window.location.href=document.referrer},destroy:function(){},init:function(){this.create(),this.getCityList($.proxy(r.init,r))}};n.exports=i});
;define("taxi:widget/common/addprice/addprice.js",function(e,t,i){"use strict";var t={create:function(e){var t,i,n,a,c,d=$(".taxi-widget-addprice"),o=d.find(".wrapper");$.isArray(e)&&(t=document.createDocumentFragment(),$.each(e,function(e,c){i=$("<div/>").addClass("option"),n=$("<label/>").text(c+"元").appendTo(i),a=$("<input/>").attr({type:"radio",name:"add_price"}).val(c).appendTo(i),i.appendTo(t)}),o.append(t)),c=d.find(".option"),c.on("click",$.proxy(this.onOptionClick,this)),this.$el=d},onOptionClick:function(e){this.setValue($(e.currentTarget).find("input[type=radio]").val())},setValue:function(e){e=parseInt(e,10)||0;var t,i,n=this.$el,a=n.find(".option");a.each(function(n,a){i=$(a),t=i.find("input[type=radio]"),e===parseInt(t.val(),10)?(t.attr("checked","checked"),i.addClass("checked")):(t.removeAttr("checked"),i.removeClass("checked"))})},init:function(e,t){this.create(e),this.setValue(t),this.$el.show()}};i.exports=t});