PageSourceSearch

https://www.1hai.cn/js/BookingBox/yudingkuang_prototype.js?v=5e22a979e0184dfdb7397ba3fb5d463a

js 1hai.cn collected 2026-09-24 17:41:29 UTC 14,749 bytes, 499 lines download raw bytes

1/*************************************************************
2Auhtor   <ChengFeng>
3Create Date <2013-05-15>
4Description <封装属性>
5*************************************************************/
6/**
7*封装预订框域值
8*/
9let BookingInfo = {
10    /**
11    * 初始化预订框基本信息
12    * @param  cityName 城市名称
13    * @param  storeName 门店名称
14    * @param  address 地址信息
15    * @param  date  [yyyy-MM-dd]取车日期 
16    * @param  hour [HH]取车时间
17    * @function
18    */
19    Initialize: function(cityName, storeName, address, date, hour) {
20        this.CityName = cityName;
21        this.StoreName = storeName;
22        this.Address = address;
23        this.Date = date;
24        this.Hour = hour;
25    },
26
27    /**
28    *当前操作类型
29    *@param type [get/ret][取车/还车]
30    *@function
31    */
32    Type: function(type) { // 成员函数    
33        this.Type = type;
34    },
35
36    /**
37    *是否送车上门
38    *@function
39    *@return boolean
40    */
41    IsSendAndReturnService: function(value) {
42        this.IsSendAndReturnService = value;
43    }
44};
45
46
47/**
48*浮框控制
49*/
50let Floating = {
51    /**
52    * @param  source 浮层DOM元素
53    * @param  targetSource 鼠标点击DOM元素
54    * @function
55    */
56    Initialize: function (source, targetSource) {
57        this.Source = source;
58        this.TargetSource = targetSource;
59    },
60
61    /**
62    * @param  isMouseOut 鼠标是否移开
63    * @function
64    */
65    IsMouseOut: function (isMouseOut) {
66        this.IsMouseOut = isMouseOut;
67    },
68    /**
69    * @param  IsServiceMouseOut 鼠标是否移开
70    * @function
71    */
72    IsServiceMouseOut: function (isMouseOut) {
73        this.IsServiceMouseOut = isMouseOut;
74    },
75
76    /**
77    * 浮框隐藏控制
78    * @function
79    * @return boolean
80    */
81    IsHide: function () {
82        return this.Source == null && this.Target == null;
83    },
84
85    /**
86    * cssç±»
87
88    * @class
89    */
90    XyOpts: {},
91
92    /**
93    * 设置浮框坐标定位
94    * @function
95    */
96    VerticalPosition: function (source) {
97        let xy = $(source).position();
98        let id = $(source).attr("id");
99        if (!this.XyOpts[source]) {
100            this.XyOpts[id] = {
101                left: xy.left + "px",
102                top: xy.top + 26 + "px",
103                position: "absolute",
104                "z-index":99
105            };
106        }
107    },
108    InternationalVerticalPosition: function (source) {
109        let xy = $(source).position();
110        let id = $(source).attr("id");
111        if (!this.XyOpts[source]) {
112            this.XyOpts[id] = {
113                left: xy.left + "px",
114                top: xy.top + 30 + "px",
115                position: "absolute",
116                "z-index": 99
117            };
118        }
119    },
120    /**
121    * 设置浮框坐标定位
122    * @function
123    */
124    HorizontalPosition: function (source) {
125        let xy = $(source).position();
126        let id = $(source).attr("id");
127        let width = $(BookTarget.PickupStoreNameId).width();
128        width = width > 150 ? width + 29 : width + 25; 
129        if (!this.XyOpts[source]) {
130            this.XyOpts[id] = {
131                left: xy.left + width + "px",
132                top: xy.top + "px",
133                position: "absolute",
134                "z-index":99
135            };
136        }
137    },
138    /**
139    * 浮框定位
140    *@param type:定位点
141
142    *@param currentId:当前点击Html唯一标记
143    *@param floatBox:浮框唯一标记
144    * @function
145    */
146    IsShow: function (type, currentId, floatBox) {
147        if (floatBox == FloatTarget.FlightNumber) {
148            this.HorizontalPosition(currentId);
149            $(floatBox).css(this.XyOpts[$(currentId).attr("id")]).show();
150        } else {
151            this.VerticalPosition(currentId);
152            $(floatBox).css(this.XyOpts[$(currentId).attr("id")]).show();
153        }
154    },
155    InternationalIsShow: function (type, currentId, floatBox) {        
156        this.InternationalVerticalPosition(currentId);
157        $(floatBox).css(this.XyOpts[$(currentId).attr("id")]).show();
158    }
159};
160    /**
161    *浮层
162    */
163FloatTarget = {
164    /**
165    * @param  cityBoxId 城市浮框ID
166    * @param  storeBoxId 门店浮框ID
167    * @function
168    */
169    Initialize: function (cityBoxId, storeBoxId, sendBoxId, getFree, timeselect, hbhbox, cityautoBoxId, timeselectminute) {
170        this.CityBoxId = "#" + cityBoxId;
171        this.StoreBoxId = "#" + storeBoxId;
172        this.SendBoxId = "#" + sendBoxId;
173        this.FreeId = "#" + getFree;
174        this.SelectTime = "#" + timeselect;
175        this.FlightNumber = "#" + hbhbox;
176        this.CityAutoBoxId = "#" + cityautoBoxId;
177        this.TimeSelectMinute = "#" + timeselectminute;
178    },
179
180    FloatBoxIdList: function () {
181        return this.CityBoxId + "," + this.StoreBoxId + "," + this.SendBoxId + "," + this.FreeId + "," + FloatTarget.FlightNumber + "," + this.SelectTime + "," + this.CityAutoBoxId + ",#gjtimeselect,#gjCity," + this.TimeSelectMinute;
182    },
183
184    /**
185    *城市框
186
187    */
188    CityBoxTarget: {
189        CitySpan: ".ydcity-box .list-city li dl dd span",
190        CityLi: ".ydcity-box .list-city li",
191        CityTab: " .ydcity-box .list-type li"
192    },
193    /**
194    *门店框
195
196    */
197    StoreBoxTarget: {
198        StoreContentSpan: ".ydk-box .list-mendian li .dl-mendian dd span",
199        StoreTabLi: ".ydk-box .list-area li",
200        StoreContentLi: ".ydk-box .list-mendian  li",
201        StoreDetail: ".ydk-box .inf-box",
202        StoreAdd: ".ydk-box .inf-box .inf-address .address",
203        StoreSend: ".ydk-box .inf-box .inf-address .sp-scd",
204        StoreTime: ".ydk-box .inf-box .inf-time .txt-time",
205        StoreMap: ".ydk-box .inf-box .inf-address li .link-map",
206        StorePhoneNumber: ".ydk-box .inf-box .inf-time .storephone span"
207    },
208
209    /**
210    * 送还车服务ID
211    */
212    ServiceTarger: {
213        City: "#shcBox .list-city li",
214        LeftInput: "#txtSelectType",
215        LeftSelectType: ".shc-form .select-type .select-showbox",
216        RightInput: "#txtSelectArea",
217        RightSelectArea: ".shc-form .select-area .select-showbox",
218        Address: "#txtShcAddress",
219        ListCityLi: ".shc-box .list-city li",
220        SelectBox: ".shc-form .select-showbox",
221        ServicePrice: ".shc-form .op-box .txt-price .price",
222        ServiceSelectShowBoxLi: ".shc-form .select-showbox .type-list li"
223    },
224    /**
225    *免费送车服务
226    */
227    FreeRoad: {
228        Roadspan: ".road ul li span",
229        Community: ".community ul.cun li",
230        Back: ".free .back",
231        CommunityId: "#community"
232    },
233    /**
234    *是否免费服务
235    *@param vArg 元素选中值
236
237    *@param str 匹配目标
238    *@function
239    *@return Boolean  true 是 false 不是
240    */
241    IsFreeSendService: function (vArg, str) {
242        return vArg !=null && vArg.indexOf(str) > -1;
243    },
244    /**
245    *面板切换
246    */
247    TabHF: {
248        tabTitleLi: ".tabHF-title li",
249        tabContent: ".tabHF-content",
250        tabContentLi: ".tabHF-content li"
251    }
252};
253
254    /**
255    * 预订框标签ID
256    */
257let BookTarget = {
258    /**
259    *初始化预定框标签ID
260    * @param  pickupCityId 取车城市ID
261    * @param  returnCityId 还车城市ID
262    * @param  pickupStoreId 取车门店ID
263    * @param  returnStoreId 还车门店ID
264    * @param  pickupAddressId 取车地址ID
265    * @param  returnAddressId 还车地址ID
266    * @param  fromDateId 开始时间
267
268    * @param  toDateId 结束时间
269    * @function
270    */
271    Initialize: function (pickupCityId, returnCityId, pickupStoreId, returnStoreId, getCheck, retCheck, pickupAddressId, returnAddressId, fromDateId, toDateId, getTime, retTime, sameReturnAddress,pickupMinute,returnMinute) {
272        this.PickupCityId = "#" + pickupCityId;
273        this.ReturnCityId = "#" + returnCityId;
274        this.PickupStoreNameId = "#" + pickupStoreId;
275        this.ReturnStoreNameId = "#" + returnStoreId;
276        this.SendServiceCheckId = "#" + getCheck;
277        this.ReturnServiceCheckId = "#" + retCheck;
278        this.SendServiceId = "#" + pickupAddressId;
279        this.ReturnServiceId = "#" + returnAddressId;
280        this.FromDateId = "#" + fromDateId;
281        this.ToDateId = "#" + toDateId;
282        this.FromTimeId = "#" + getTime;
283        this.ToTimeId = "#" + retTime;
284        this.FromMinuteId = "#" + pickupMinute;
285        this.ToMinuteId = "#" + returnMinute;
286        this.SameReturnAddress = "#" + sameReturnAddress;
287    },
288    PickupStoreID: "#getStoreId",
289    ReturnStoreID: "#retStoreId",
290    PickupHourID:"#getTime",
291    ReturnHourID:"#retTime",
292    FlightNumberID: "#flightNumber",
293    PickUpFreeServicePointId:"#PickUpFreeServicePointId",
294    ReturnFreeServicePointId: "#ReturnFreeServicePointId",
295    DisplayType:"#hdnDisplayType",
296    AhrNearStore:"#ahrNearStore",
297    Address:"#txtAddress"
298};
299
300/*
301*预订框Ajax 
302*ajax 请求路径
303*/
304let BookingAjax = {
305    //请求路径
306    Url: {
307    },
308    /**
309    *预订框请求
310    *@param url 请求路径
311    *@param param 请求参数
312    *@param type 返回数据类型
313    *param callBack 回调函数
314    */
315    ReqStore: function (url, param, type, storeCallBack) {
316        let self = this;
317        // param type 为 object
318        let paramKey = JSON.stringify(param);
319
320        let config = [];
321        $.ajax({
322            type: "POST",
323            url: "/Common/SiteConfig?key=2026011201&platform=1011026",
324            dataType: "json",
325            async: false,
326            success: function (res) {
327                let parsedConfig = [];
328                try {
329                    let rawData = typeof res.data === 'string' ? JSON.parse(res.data) : res.data;
330                    parsedConfig = Array.isArray(rawData) ? rawData : [];
331                } catch (e) {
332                    parsedConfig = [];
333                }
334                config = parsedConfig;
335            },
336            error: function () {
337                console.warn("获取隐藏门店配置失败,使用空配置");
338                config = [];
339            }
340        });
341
342        const processStoreData = function (htmlData) {
343            if ($("#pickUpCityId").val() != $("#returnCityId").val() && type === "ReturnStore") {
344                const parser = new DOMParser();
345                const doc = parser.parseFromString(htmlData, 'text/html');
346
347                const currentCityId = param.cityId;
348                const currentConfig = config.find(item => item.ReturnCityId == currentCityId);
349
350                if (currentConfig && currentConfig.HideStoreId) {
351                    currentConfig.HideStoreId.forEach(storeId => {
352                        const targetSpans = doc.querySelectorAll(`span[sid="${storeId}"]`);
353                        targetSpans.forEach(span => {
354                            if (span.parentElement) {
355                                span.parentElement.remove();
356                            }
357                        });
358                    });
359                }
360                return doc.body.innerHTML;
361            }
362            return htmlData;
363        };
364
365        // 已存在数据,直接返回
366        //if (paramKey in self.ResData[type]) {
367        //    let processedData = processStoreData(self.ResData[type][paramKey]);
368        //    storeCallBack(processedData);
369        //    return false;
370        //}
371
372        $.ajax({
373            type: "POST",
374            url: url,
375            data: param,
376            dataType: "html",
377            async: false,
378            success: function (data) {
379                let processedData = processStoreData(data);
380
381                self.ResData[type][paramKey] = processedData;
382                storeCallBack(processedData);
383            }
384        });
385        return false;
386    },
387    ReqStoreAsync: function (url, param, type, storeCallBack) {
388        let self = this;
389
390        // param type 为 object
391        let paramKey = JSON.stringify(param);
392
393        // 已存在数据,直接返回
394        if (paramKey in self.ResData[type]) {
395            storeCallBack(self.ResData[type][paramKey]);
396            return false;
397        }
398        $.ajax({
399            type: "POST",
400            url: url,
401            data: param,
402            dataType: "html",
403            async: true,
404            success: function (data) {
405                self.ResData[type][paramKey] = data;
406                storeCallBack(data);
407            }
408        });
409        return false;
410    },
411    ReqAjax: function (url, param, httpVerbs, type, dataType, callback) {
412        let self = this;
413        if (param in self.ResData[type]) {
414            callback(self.ResData[type][param]);
415            return false;
416        }
417        $.ajax({
418            type: httpVerbs,
419            data: param,
420            url: url,
421            dataType: dataType,
422            contentType: "application/json;charset=UTF-8",
423            async: false,
424            cache: false,
425            success: function (data) {
426                self.ResData[type][param] = data;
427                callback(data);
428            }
429        });
430        return false;
431    },
432    /**
433    *预订框请求
434
435    *@param target 接收返回Dom元素的ID
436    *@param url 请求参数
437    *@param param 请求参数
438    *@param type 返回数据类型
439    */
440    ReqService: function (url, param, target, type) {
441        let self = this;
442        // param type 为 object
443        let paramKey = JSON.stringify(param);
444
445        if (paramKey in self.ResData[type]) {
446            $(target).html("");
447            $(target).html(self.ResData[type][paramKey]);
448            return false;
449        }
450        $(target).html("<li class=\"btn-subload\" style=\"display:block;\"></li>");
451        $(target).load(url, param, function (data) {
452            self.ResData[type][paramKey] = data;
453        });
454        return false;
455    },
456    /*
457    *按钮提交
458    **/
459    ReqSubmit: function(url,storeCallBack) {
460        $.ajax({
461            type: "post",
462            url: url,
463            contentType: "application/json",
464            async: false,
465            success: function(data) {
466                storeCallBack(data);
467            }
468        });
469    },
470    
471    /*
472    *保存返回数据
473    **/
474    ResData: {
475        DefaultCity:{},
476        DefaultStore: {},
477        ReturnStore: {},
478        Store: {},
479        NearStore: {},
480        SendAndReturnService:{},
481        SendAndReturnCity: {},
482        FreeService: {},
483        FreeServiceRoad: {},
484        SelectedTime: {},
485        ServiceMap: {},
486        MapPositionAddress: {},
487        MapPositionPath: {},
488        IsAllowMapService: {},
489        nba: {},
490        initmap: {},
491        HotCartype: {},
492        InternationalCity: {},
493        searchNearAddress: {},
494        SportStore: {},
495        ReturnSportStore: {},
496        ReturnNearStore: {},
497        CityList: {}
498    }
499};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.