$(".link_info .check_more").eq(0).css("display", "block");
var tabsoption = {
onselected: function(t, e) {
0 == e ? ($(".check_more").eq(0).css("display", "block").siblings("a").css("display", "none"),
listednotice()) : 1 == e && ($(".check_more").eq(1).css("display", "block").siblings("a").css("display", "none"),
fixeddisc())
}
}
, tabplugin = new s.ui.controls.tabs(".content-tabs",tabsoption)
, searchindex = window.util.getquerystring("code")
, options_data = {
seccode: searchindex
}
, options = {
type: "get",
data: options_data,
url: "/companygeneralization",
loadingplugin: window.loading($(".company-info"))
};
function getplatename(t) {
return "za" == t || "dm" == t ? " / 主板" : "eb" == t ? " / 中小板" : "cy" == t || "dg" == t ? " / 创业板" : "bg" == t ? " / b股" : ""
}
function listednotice() {
var t = {
type: "get",
data: {
seccode: searchindex,
channelcode: "listednotice_disc"
},
url: "/annindex",
loadingplugin: window.loading($(".loadwait_disc"))
};
$.when(window.ajaxrequest(t)).done(function(t) {
if (0 < t.data.length) {
for (var e = "", a = 0; a < t.data.length; a++)
t.data[a].attachformat = t.data[a].attachformat.tolowercase(),
"html" != t.data[a].attachformat && "pdf" != t.data[a].attachformat ? (t.data[a].hrefpath = pathobj.disc_file_path + "/download" + t.data[a].attachpath,
e += '
") : (t.data[a].hrefpath = "/disclosure/listed/bulletindetail/index.html?" + t.data[a].id,
e += ' ");
$(".listednotice_disc").html(e)
} else {
e = '无数据';
$(".listednotice_disc").html(e)
}
})
}
function fixeddisc() {
var t = {
type: "get",
data: {
seccode: searchindex,
channelcode: "fixed_disc"
},
url: "/annindex",
loadingplugin: window.loading($(".loadwait_disc"))
};
$.when(window.ajaxrequest(t)).done(function(t) {
if (0 < t.data.length) {
for (var e = "", a = 0; a < t.data.length; a++)
t.data[a].attachformat = t.data[a].attachformat.tolowercase(),
"html" != t.data[a].attachformat && "pdf" != t.data[a].attachformat ? (t.data[a].hrefpath = pathobj.disc_file_path + "/download" + t.data[a].attachpath,
e += ' ") : (t.data[a].hrefpath = "/disclosure/listed/bulletindetail/index.html?" + t.data[a].id,
e += ' ");
$(".fixed_disc").html(e)
} else {
e = '无数据';
$(".fixed_disc").html(e)
}
})
}
$.when(window.ajaxrequest(options)).done(function(t) {
0 == t.code && null != t.data ? ($(".listednotice").attr("href", pathobj.main_domain_path_http + "/disclosure/listed/notice/index.html?name=" + t.data.agjc + "&stock=" + searchindex + "&r=" + date.now()),
// $(".fixed").attr("href", pathobj.main_domain_path_http + "/disclosure/listed/fixed/index.html?name=" + t.data.agjc + "&stock=" + searchindex + "&r=" + date.now()),
// $(".plate").html(getplatename(t.plate)),
t.platetype = {
ischinext: "cy" === t.plate || !1,
isdm: "dm" === t.plate || !1,
isdg: "dg" === t.plate || !1
},
$(".g-banner-txt > h2").html(searchindex + " " + (" / b股" == getplatename(t.plate) ? t.data.bgjc : t.data.agjc))) : ($(".listednotice").removeattr("href"),
$(".fixed").removeattr("href"));
t.isdelisting = -1 < ["300090", "300156", "300216"].indexof(searchindex);
var e = _.template($("#company_info").html())
, a = $(".company-info")
, n = e(t);
a.append(n),
"1180" == $(".g-container").width() && $(".g-conbox.trend-wrap").css("height", $(".company-info").innerheight())
}),
listednotice();
var options_key = {
type: "get",
data: {
seccode: searchindex
},
url: pathobj.report_path + "/index/stockkeyindexgeneralization",
loadingplugin: window.loading($(".loadwait_kpis"))
};
// $.when(window.ajaxrequest(options_key)).done(function(t) {
// if (0 == t.code) {
// var e = []
// , a = "";
// if ($(".date-tit").html(t.lastdate.split(" ")[0]),
// 0 < t.data.length) {
// for (var n = 0; n < t.data.length; n++)
// "now_cjbs"in t.data[n] ? e[0] = t.data[n] : "last_cjbs"in t.data[n] ? e[1] = t.data[n] : e[2] = t.data[n];
// a = '总成交金额(亿元) | ' + (null == e[0].now_cjje ? "--" : e[0].now_cjje) + ' | ' + (null == e[1].last_cjje ? "--" : e[1].last_cjje) + ' | ' + (null == e[2].change_cjje ? "--" : e[2].change_cjje) + ' |
总成交量(亿) | ' + (null == e[0].now_cjbs ? "--" : e[0].now_cjbs) + ' | ' + (null == e[1].last_cjbs ? "--" : e[1].last_cjbs) + ' | ' + (null == e[2].change_cjbs ? "--" : e[2].change_cjbs) + ' |
股票总股本(亿) | ' + (null == e[0].now_zgb ? "--" : e[0].now_zgb) + ' | ' + (null == e[1].last_zgb ? "--" : e[1].last_zgb) + ' | ' + (null == e[2].change_zgb ? "--" : e[2].change_zgb) + ' |
股票流通股本(亿) | ' + (null == e[0].now_ltgb ? "--" : e[0].now_ltgb) + ' | ' + (null == e[1].last_ltgb ? "--" : e[1].last_ltgb) + ' | ' + (null == e[2].change_ltgb ? "--" : e[2].change_ltgb) + ' |
股票总市值(亿元) | ' + (null == e[0].now_sjzz ? "--" : e[0].now_sjzz) + ' | ' + (null == e[1].last_sjzz ? "--" : e[1].last_sjzz) + ' | ' + (null == e[2].change_sjzz ? "--" : e[2].change_sjzz) + ' |
股票流通市值(亿元) | ' + (null == e[0].now_ltsz ? "--" : e[0].now_ltsz) + ' | ' + (null == e[1].last_ltsz ? "--" : e[1].last_ltsz) + ' | ' + (null == e[2].change_ltsz ? "--" : e[2].change_ltsz) + ' |
平均市盈率 | ' + (null == e[0].now_syl ? "--" : e[0].now_syl) + ' | ' + (null == e[1].last_syl ? "--" : e[1].last_syl) + ' | ' + (null == e[2].change_syl ? "--" : e[2].change_syl) + ' |
平均换手率 | ' + (null == e[0].now_hsl ? "--" : e[0].now_hsl) + ' | ' + (null == e[1].last_hsl ? "--" : e[1].last_hsl) + ' | ' + (null == e[2].change_hsl ? "--" : e[2].change_hsl) + " |
",
// $(".kpis").append(a)
// } else
// a = '无数据 |
',
// $(".kpis").append(a)
// } else
// a = '' + t.message + " |
",
// $(".kpis").append(a)
// }),
// $(".secretary").click(function() {
// var t = window.open();
// try {
// t.location = "/disclosure/listed/secretary/?txtdmorjc=" + searchindex
// } catch (t) {
// window.open("/disclosure/listed/secretary/?txtdmorjc=" + searchindex)
// }
// }),
// $(".director").click(function() {
// var t = window.open();
// try {
// t.location = "/disclosure/listed/director/?txtdmorjc=" + searchindex + "&tabkey=tab2"
// } catch (t) {
// window.open("/disclosure/listed/director/?txtdmorjc=" + searchindex + "&tabkey=tab2")
// }
// }),
// $(".market_url").click(function() {
// var t = window.open();
// try {
// t.location = "/market/trend/index.html?code=" + searchindex
// } catch (t) {
// window.open("/market/trend/index.html?code=" + searchindex)
// }
// });
var config = {
template: {
trendtemstr: $("#trendtemplate").html()
},
minuteurl: "/gettimedata",
kurl: "/gethistorydata",
charts: {},
chartdatastate: {},
codereg: /^399?/,
code: searchindex
};
function initelements() {
config.elements = {
trendwrap: $(".trend-wrap"),
minutewrap: $("#minutely"),
daywrap: $("#daily"),
weekwrap: $("#weekly"),
monthwrap: $("#monthly"),
trendtabs: $(".pic-tabs", ".trend-wrap"),
trenddetailwrap: $(".detail-info", ".trend-detail-wrap")
}
}
function setchartdata() {
$.when(ajaxrequest({
url: config.minuteurl,
type: "get",
data: setrequestparam("minute"),
loadingplugin: window.loading(config.elements.trendwrap)
})).done(function(t) {
if (t && "0" === t.code && (config.chartdatastate.minute = !0),
config.ischinext = 17 === t.data.groupid,
config.iscdr = !0 === t.data.iscdr,
config.ischinext && !0 !== t.data.isdelisting && $(".trend-wrap").addclass("chinext-wrap"),
buildbasicinfo(t.data),
(config.ischinext || config.iscdr) && !0 !== t.data.isdelisting) {
var e = 2 === t.data.isnoprofit ? 'u' : ""
, a = 2 === t.data.isvotedifferent ? 'w' : ""
, n = e + (1 === t.data.isvie ? 'v' : "") + a;
$(".gemsign").html(n),
n && $(".item-right").css("padding-right", "85px")
}
$(".update-time").text(t.datetime);
var i = {
data: t,
grid: {
index: [["4%", 20, "8%", 65]],
sec: [["4%", 60, "48%", 60], ["65%", 60, "7%", 60]]
}
};
if ($.isemptyobject(config.charts.minutechart)) {
var l = new s.ui.controls.mlinechart(config.elements.minutewrap,i);
config.charts.minutechart = l
} else
config.charts.minutechart.updateoption(i)
})
}
function setdaychartdata() {
$.when(ajaxrequest({
url: config.kurl,
type: "get",
data: setrequestparam("day"),
loadingplugin: window.loading(config.elements.daywrap)
})).done(function(t) {
t && "0" === t.code && (config.chartdatastate.day = !0);
var e = {
data: t,
grid: [["4%", 68, "48%", 32], ["65%", 68, "16%", 32]]
};
if ($.isemptyobject(config.charts.daychart)) {
var a = new s.ui.controls.klinechart(config.elements.daywrap,e);
config.charts.daychart = a
} else
config.charts.daychart.updateoption(e)
})
}
function setweekchartdata() {
$.when(ajaxrequest({
url: config.kurl,
type: "get",
data: setrequestparam("week"),
loadingplugin: window.loading(config.elements.weekwrap)
})).done(function(t) {
t && "0" === t.code && (config.chartdatastate.week = !0);
var e = {
data: t,
grid: [["4%", 68, "48%", 32], ["65%", 68, "16%", 32]]
};
if ($.isemptyobject(config.charts.weekchart)) {
var a = new s.ui.controls.klinechart(config.elements.weekwrap,e);
config.charts.weekchart = a
} else
config.charts.weekchart.updateoption(e)
})
}
function setmonthchartdata() {
$.when(ajaxrequest({
url: config.kurl,
type: "get",
data: setrequestparam("month"),
loadingplugin: window.loading(config.elements.monthwrap)
})).done(function(t) {
t && "0" === t.code && (config.chartdatastate.month = !0);
var e = {
data: t,
grid: [["4%", 68, "48%", 32], ["65%", 68, "16%", 32]]
};
if ($.isemptyobject(config.charts.monthchart)) {
var a = new s.ui.controls.klinechart(config.elements.monthwrap,e);
config.charts.monthchart = a
} else
config.charts.monthchart.updateoption(e)
})
}
function switchchartdata() {
config.chartdatastate.index || config.chartdatastate.minute ? 1 !== config.chartdatastate.index || config.chartdatastate.day ? 2 !== config.chartdatastate.index || config.chartdatastate.week ? 3 !== config.chartdatastate.index || config.chartdatastate.month || setmonthchartdata() : setweekchartdata() : setdaychartdata() : setchartdata()
}
function setrequestparam(t) {
switch (t) {
case "minute":
return {
marketid: 1,
code: config.code
};
case "day":
return {
cycletype: 32,
marketid: 1,
code: config.code
};
case "week":
return {
cycletype: 33,
marketid: 1,
code: config.code
};
case "month":
return {
cycletype: 34,
marketid: 1,
code: config.code
}
}
}
function buildbasicinfo(t) {
var e = _.template(config.template.trendtemstr);
t.isindex = config.codereg.test(t.code),
t.newisdown = /^\-/.test(t.deltapercent),
t.openisdown = +t.open < +t.close,
t.highisdown = +t.high < +t.close,
t.lowisdown = +t.low < +t.close,
t.ischinext = config.ischinext,
calcuunit(t),
tradingstatusfilter(t);
var a = e(t);
config.elements.trenddetailwrap.empty().append(a)
}
function calcuunit(t) {
function e(t, e) {
return function(t) {
var e = {};
return void 0 === t || (1 <= t / 1e8 ? (e.value = (t / 1e8).tofixed(2),
e.unit = "亿") : 1 <= t / 1e4 ? (e.value = (t / 1e4).tofixed(2),
e.unit = "万") : (e.value = t,
e.unit = "")),
e
}(t)
}
var a = e(t.volume);
t.volume = a.value,
t.volumeunit = a.unit;
var n = e(t.amount);
t.amount = n.value,
t.amountunit = n.unit;
var i = e(t.volumeaht);
t.volumeaht = i.value,
t.volumeahtunit = i.unit;
var s = e(t.amountaht);
t.amountaht = s.value,
t.amountahtunit = s.unit
}
function tradingstatusfilter(t) {
config.isenglish ? (t.tradingphasecode1 = {
2: "opening auction",
3: "continuous auction",
11: "market break",
7: "closing auction",
0: "market closed",
6: "temporary trading halt",
12: "suspension due to volatility",
4: "all-day suspension"
}[t.tradingphasecode1] || "--",
t.tradingphasecode2 = {
8: "accept order",
9: "continuous trading",
0: "market closed",
4: "all-day suspension",
11: "market break",
6: "temporary trading halt"
}[t.tradingphasecode2] || "--") : (t.tradingphasecode1 = {
2: "开盘集合竞价",
3: "连续竞价",
11: "休市",
7: "收盘集合竞价",
0: "闭市",
6: "临时停牌",
12: "波动性中断",
4: "全天停牌"
}[t.tradingphasecode1] || "--",
t.tradingphasecode2 = {
8: "接受申报",
9: "连续交易",
0: "闭市",
4: "全天停牌",
11: "休市",
6: "临时停牌"
}[t.tradingphasecode2] || "--")
}
function switchtabs() {
config.elements.trendtabs.delegate(">li", "click", function(t) {
var e = $(this).index();
config.chartdatastate.index = e,
switchchartdata(),
$(this).addclass("active").siblings("li").removeclass("active"),
$(".tab-panel", config.elements.trendwrap).removeclass("active").eq(e).addclass("active")
})
}
initelements(),
switchchartdata(),
switchtabs();