Light12306/Web12306/js/bd/orderfailbd.js
2014-12-12 23:28:35 +08:00

32 lines
1.1 KiB
JavaScript

define(function (require, exports, module) {
var ordersubmit = require("../ui/ui-submit-order.js");
var sessMgr = require("../account/sessionMgr.js");
var data = require("../data.js");
var getCityPy = function (code) {
var city = data.cities[code];
return city && city.p;
};
ordersubmit.on("orderFailed", function (e, orderdata) {
var profile = orderdata.profile;
var frompy = encodeURIComponent(profile.fromText); //getCityPy(profile.fromCode);
var topy = encodeURIComponent(profile.toText); // getCityPy(profile.toCode);
$(".ticket-submit-failed-bd .bd-bx").attr("href", "http://www.baixing.com/huijia/liebao/?from=" + frompy + "&to=" + topy);
});
var autoRefresh = require("../ui/ui-autorefresh.js");
autoRefresh.on("requestAutoRefresh", function() {
var profile = sessMgr.currentProfile;
if (!profile)
return;
var frompy = encodeURIComponent(profile.fromText); //getCityPy(profile.fromCode);
var topy = encodeURIComponent(profile.toText); // getCityPy(profile.toCode);
$("a.lnk-bd-bx").attr("href", "http://www.baixing.com/huijia/liebao/?from=" + frompy + "&to=" + topy).show();
});
});