document.addEventListener("DOMContentLoaded", function() { //把对象赋值到JS中 try { new QWebChannel(qt.webChannelTransport, function(channel) { window.pyjs = channel.objects.Bridge; console.log("回调成功"); }); } catch (e) { } }); var app; $(function() { var vConsole = new VConsole(); function _resize() { var code_info_height = 440; console.log("总高", $(window).height()) var bottom_height = $(window).height() - code_info_height - 140; console.log("底部高", bottom_height) $("#body>div:nth-child(4)>div").css("height", code_info_height).css("max-height", code_info_height); $("#body>div:nth-child(5)").css("height", bottom_height) $("#body>div:nth-child(5)>div:nth-child(3)").css("height", bottom_height - 10) $("#body>div:nth-child(5)>div:nth-child(4)").css("height", bottom_height - 60) $(".outer-container").css("height", bottom_height - 180) } //针对窗口高度做调整 _resize(); $(window).resize(function() { _resize(); }); var layer; layui.use('layer', function() { layer = layui.layer; }); function request(params, callback) { pyjs.request(params, function(result) { callback(result); }); } function show_info(msg) { pyjs.show_info(msg); } function is_trade_time() { var nowdate = new Date(); h = nowdate.getHours(); m = nowdate.getMinutes(); total_m = h * 60 + m; if ((total_m >= (9 * 60 + 25) && total_m <= (11 * 60 + 30)) || (total_m >= 13 * 60 && total_m <= 15 * 60)) { return true; } else { return false; } } setInterval(function() { //非交易时间不刷新 if (is_trade_time()) { app.get_limit_up_list(app.code, true); app.get_limit_up_statistic_infos(true); } }, 3000, 3000); setInterval(function() { if (is_trade_time()) { app.get_block_in_money_data(app.in_money_type); } }, 3000, 10000); setInterval(function() { if (is_trade_time()) { app.get_kpl_market_feelings(); } }, 3000, 3000); setInterval(function() { if (is_trade_time()) { app.get_l2_subscript_codes(); } }, 3000, 3000); setInterval(function() { if (is_trade_time()) { app.get_big_order_deal_info(app.code); } }, 3000, 3000); setInterval(function() { if (is_trade_time()) { app.get_low_suction_place_order_records(); app.get_low_suction_plates(); } }, 3000, 3000); function init() { app = new Vue({ el: "#body", data: { code: "000000", code_name: "----", last_show_dialog: 0, limit_up_search_key: '', trade_data: { order: 0 }, cb_list: null, // 可转债列表 cb_list_top: [], cb_selected_code: '', // 代码的开盘啦涨停原因 kpl_limit_up_reason: '', default_score_data: { volume: { "score": 0, "now": 0, "high": { "num": 0, "date": "------" }, "rate": 0 }, bidding: { "score": 0, "money": 0 }, deal_big_money: { "score": 0, "money": 0, "base_money": 0, "rate": 0 }, k_form: { "score": 0, "datas": [] }, code_nature: { "score": 0, "data": { "limit_up_count": 0, "first_limit_up_yijia": 0, "first_open_limit_up_yijia": 0 } }, hot_block: { "score": 0, "limit_up_index": 0, "block_name": "----", "limit_up_count": 0, "block_history_count": 0, "open_limit_up_count": 0 }, limit_up_time: { "score": 0, "time": "00:00:00" }, zyltgb: { "score": 0, "value": "0.00" }, limit_up_price: { "score": 0, "price": "0.00" }, total_score: 0 }, score_data: { volume: { "score": 0, "now": 0, "high": { "num": 0, "date": "------" }, "rate": 0 }, bidding: { "score": 0, "money": 0 }, deal_big_money: { "score": 0, "money": 0, "base_money": 0, "rate": 0 }, k_form: { "score": 0, "datas": [{ name: "---", score: 0 }, { name: "---", score: 0 }] }, code_nature: { "score": 0, "data": { "limit_up_count": 0, "first_limit_up_yijia": 0, "first_open_limit_up_yijia": 0 } }, hot_block: { "score": 0, "limit_up_index": 1, "block_name": "测试板块", "limit_up_count": 0, "block_history_count": 0, "open_limit_up_count": 0 }, limit_up_time: { "score": 0, "time": "00:00:00" }, zyltgb: { "score": 0, "value": "0.00" }, limit_up_price: { "score": 0, "price": "0.00" }, total_score: 0 }, kpl_code_info: { code_records: [ [ ["原因", ''], "2020-01-01", [ ["板块", ''] ] ], [ ["原因", ''], "2020-01-01", [ ["板块", ''] ] ], [ ["原因", ''], "2020-01-01", [ ["板块", ''] ] ] ], today: [ ["涨停原因", ''], "2023-01-01", [ ["传媒", ''] ] ], plate: [ ["板块1", "1%", ''], ["板块2", "0.5%", ''] ] }, yesterday_block_info: { reason: "测试", data: { yesterday: [ ["000333", "美的集团"] ], current: [] } }, initiative_buy_codes: [{ "name": "美的集团", "code": "000333", "score": -777, "limit_up": true, "open_limit_up": false }, { "name": "美的集团", "code": "000333", "score": 0, "limit_up": true, "open_limit_up": false }, { "name": "美的集团", "code": "000333", "score": 0, "limit_up": true, "open_limit_up": false }, { "name": "美的集团", "code": "000333", "score": 0, "limit_up": true, "open_limit_up": false }], passive_buy_codes: [{ "name": "美的集团", "code": "000333", "score": 0, "limit_up": true, "open_limit_up": false }], industry_datas: [ ["贵金属", "1.56亿", "0.9%"] ], jingxuan_datas: [], //涨停代码信息 first_info: { limit_up_count: 10, open_limit_up_count: 10, limit_up_codes: [ //(代码,名称,涨停状态(0-无状态 1-涨停 2-炸板),龙几,首板,分值,涨停时间,原因,相同原因代码数量,自由流通,之前的板块) ["000333", "美的集团", 1, "龙1", "首板", "200", "10:00:00", "一季度增长", "1", "12.02亿", '12亿', '', '' ] ] }, //选中代码信息 choose_code_info: { code: "123123", //强度 plat_strength: [ ["跨境电商", 3225] ], code_records: [ ["原因", "2020-01-01", "板块"], ["原因", "2020-01-01", "板块"] ], today: ["涨停原因", "2023-01-01", "传媒"], plate: [ ["板块1", "1%"], ["板块2", "0.5%"] ], code_list_info: [{ //(代码,名称,涨停状态(0-无状态 1-涨停 2-炸板),龙几,首板,分值,涨停时间,原因,相同原因代码数量,自由流通,涨停原因是否变化,涨幅,现价,黑名单,想买单,主力净值,300w,) code_info: ["000333", "美的集团", 1, "龙1", "首板", "200", "10:00:00", "一季度增长", "1", "12.02亿", 0, "10%", "10.23", "黑名单", "想买单", "10.99万", "555万", "3000万" ], plate: [ ["板块1", "1%"], ["板块2", "0.5%"] ], code_records: [ ["板块", "2020-01-01"], ["板块", "2020-01-01"] ], blocks: ["板块1", "板块2"] }, { //(代码,名称,涨停状态(0-无状态 1-涨停 2-炸板),龙几,首板,分值,涨停时间,原因,相同原因代码数量,自由流通,涨停原因是否变化,涨幅,现价,黑名单,想买单,主力净值,300w,) code_info: ["000333", "美的集团", 1, "龙1", "首板", "200", "10:00:00", "一季度增长", "1", "12.02亿", 0, "10%", "10.23", "黑名单", "想买单", "10.99万", "555万", "3000万" ], plate: [ ["板块1", "1%"], ["板块2", "0.5%"] ], code_records: [ ["板块", "2020-01-01"], ["板块", "2020-01-01"] ], blocks: ["板块1", "板块2"] }, { //(代码,名称,涨停状态(0-无状态 1-涨停 2-炸板),龙几,首板,分值,涨停时间,原因,相同原因代码数量,自由流通,涨停原因是否变化,涨幅,现价,黑名单,想买单,主力净值,300w,) code_info: ["000333", "美的集团", 1, "龙1", "首板", "200", "10:00:00", "一季度增长", "1", "12.02亿", 0, "10%", "10.23", "黑名单", "想买单", "10.99万", "555万", "3000万" ], plate: [ ["板块1", "1%"], ["板块2", "0.5%"] ], code_records: [ ["板块", "2020-01-01"], ["板块", "2020-01-01"] ], blocks: ["板块1", "板块2"], }] }, want_codes: [], want_codes_plate: "", choose_code: { first: '', second: '' }, in_money_type: 4, // 三方代码板块 code_third_blocks: null, // 市场情绪 market_feeling_info: {}, // 板块轮动 latest_limit_up_blocks: [], new_blocks: "", // 新增的概念 latest_limit_up_datas: [], green_list: [], // 绿名单 limit_up_reason_statistic_new: [], place_order_record_list: [], // 下单记录 block_codes_in: [], block_codes_out: [], l2_subscript_codes: [], want_list: [], big_order_deal_info: null, // 大单成交 show_third_block_info: false, // 是否显示第三方板块 forbidden_buy_plates: [], //禁止买入的板块 deleted_forbidden_buy_plates: [], //已经删除的板块 code_special_blocks: {}, special_codes_list: [], forbidden_refer_codes: [], // 板块拉黑监测的票 new_block_code_special_blocks: {}, low_suction_plate_white_list: [], low_suction_place_order_records: [], low_suction_plates: [] }, watch: { want_codes: function() { setTimeout(function() { layer.open({ title: app.want_codes_plate, type: 1, content: $("#want_code_dialog"), }); }, 100); } }, methods: { refresh: function() { if (app.origin_code) { app.code = app.origin_code + ""; } else { app.code = "000000" } init_data(); _resize(); }, limit_up_search: function() { key = $("#limit_up_search_key").val(); app.limit_up_search_key = key; }, select_in_money_type: function(type) { app.in_money_type = type; app.get_block_in_money_data(type); }, get_block_in_money_data: function(type) { switch (type) { case 0: case 1: case 2: case 3: { http_util.get_market_data(type, function(result) { result = JSON.parse(result); if (result.code == 0) { app.jingxuan_datas = result.data; } }); } break; case 4: case 5: { http_util.get_blocks_in_money_info(type % 2, function(result) { result = JSON.parse(result); if (result.code == 0) { app.jingxuan_datas = result.data; } }); } break; } }, get_score_data: function(code, name, callback) { console.log("获取分数数据:", code, name); var date = $("#date").val(); http_util.get_score_data(code, name, date, function(res) { console.log("分数请求结果:", res) res = JSON.parse(res) if (res.code == 0) { console.log("获取分数", res) app.code = res.data.code app.code_name = res.data.code_name if (res.data.score_data) { app.score_data = res.data.score_data; } else { app.score_data = app.default_score_data; } if (res.data.trade_data) { app.trade_data = { order: res.data.trade_data.trade_state.order } } else { res.data.trade_data = { order: false }; app.trade_data = res.data.trade_data } res.data.kpl_code_info.plate.forEach(function(e) { var s = null; if (app.first_info.limit_up_reason_statistic) { for (var i = 0; i < app.first_info .limit_up_reason_statistic .length; i++) { var limit_up_info = app.first_info .limit_up_reason_statistic[i]; if (limit_up_info[0] == e[1]) { s = limit_up_info; break; } } } e.push(s); }); app.kpl_code_info = res.data.kpl_code_info; app.initiative_buy_codes = res.data.initiative_buy_codes; app.passive_buy_codes = res.data.passive_buy_codes; //通知副屏改变内容 pyjs.set_trade_info(app.code, app.code_name, res.data .trade_data ? JSON.stringify(res.data.trade_data) : "", res.data.trade_record ? JSON.stringify(res.data .trade_record) : '', res.data .initiative_buy_codes ? JSON.stringify(res.data .initiative_buy_codes) : '', res.data .passive_buy_codes ? JSON.stringify(res.data .passive_buy_codes) : ''); if (callback) { callback() } } }); }, get_limit_up_list: function(code, is_auto_refresh) { day = $("#date").val(); http_util.get_limit_up_list(code, day, function(res) { res = JSON.parse(res) if (res.code == 0) { app.first_info = res.data var temps = new Array(); var current_limit_up_reason = null; app.first_info.limit_up_reason_statistic.forEach(function(d) { if (d[0] == app.kpl_limit_up_reason) { current_limit_up_reason = d; } else { temps.push(d); } }); if (current_limit_up_reason) { temps.unshift(current_limit_up_reason); } app.first_info.limit_up_reason_statistic = temps; // if (app.choose_code.first) { // app.get_plate_info(app.choose_code.first, is_auto_refresh); // } else if (app.first_info.limit_up_codes) { // app.choose_code.first = app.first_info.limit_up_codes[0][0]; // app.get_plate_info(app.first_info.limit_up_codes[0][0], // is_auto_refresh); // } } }); }, get_limit_up_statistic_infos: function(is_auto_refresh) { day = $("#date").val(); http_util.get_limit_up_statistic_infos(day, function(res) { res = JSON.parse(res) console.log("get_limit_up_statistic_infos", res); if (res.code == 0) { var temps = new Array(); var current_limit_up_reason = null; res.data.limit_up_reason_statistic.forEach(function(d) { if (app.code_third_blocks && app.code_third_blocks .match_blocks && app.code_third_blocks .match_blocks[0].includes(d[0])) { current_limit_up_reason = d; } else { temps.push(d); } }); if (current_limit_up_reason) { temps.unshift(current_limit_up_reason); } app.limit_up_reason_statistic_new = temps; } }); }, get_plate_info: function(code, is_auto_refresh) { http_util.get_plate_info(code, function(res) { res = JSON.parse(res) console.log("get_plate_info", res) if (res.code == 0) { app.choose_code_info = res.data if (!is_auto_refresh) { setTimeout(function() { $(".outer-container").scrollTop(0); }, 50); } else { //如果之前选中了某个票就不更新这个票的历史与板块 } } }); }, cancel_order: function() { // if (!trade_data.order) { // return; // } http_util.cancel_order(app.code, function() { //撤单成功,刷新代码 app.get_score_data(app.code, null, null); }); }, forbidden_plate: function(plate, type) { http_util.forbidden_plate(plate, function(res) { res = JSON.parse(res) if (res.code == 0) { layer.msg("删除成功"); if (type == 0) { app.get_industry_data(app.industry_data_type); } else { app.get_jingxuan_data(app.jingxuan_data_type); } } }); }, set_third_block_show: function(event) { var el = event.currentTarget; var checked = $(el).is(':checked'); app.show_third_block_info = checked; }, //选中1级代码 select_code_level_1: function(event, index) { var el = event.currentTarget; if (app.choose_code.first != app.first_info.limit_up_codes[index][0]) { app.choose_code.first = app.first_info.limit_up_codes[index][0]; app.code = app.first_info.limit_up_codes[index][0]; app.code_name = app.code + "(" + app.first_info.limit_up_codes[index][1] + ")"; app.get_score_data(app.first_info.limit_up_codes[index][0], app.first_info .limit_up_codes[index][1]); app.get_plate_info(app.first_info.limit_up_codes[index][0]); app.get_code_third_blocks(app.code); app.get_big_order_deal_info(app.code); } }, get_code_third_blocks: function(code) { http_util.get_code_third_blocks(app.code, function(res) { console.log("三方板块请求结果:", JSON.stringify(res.data)); if (res.code == 0) { app.code_third_blocks = res.data; console.log(res.data) } else { app.code_third_blocks = null; } }); }, //删除1级代码 del_code_level_1: function(index) { http_util.add_ignore_code(1, app.first_info.limit_up_codes[index][0], function( res) { res = JSON.parse(res); if (res.code == 0) { if (app.first_info.limit_up_codes[index][0] == app.choose_code .first) { app.choose_code.first = ''; } app.first_info.limit_up_codes.splice(index, 1); } }); }, //选中二级代码 select_code_level_2: function(event, index) { if (app.choose_code_info.code_list_info[index].code_info[0] != app.choose_code .second) { console.log("选中二级代码:" + app.choose_code_info.code_list_info[index] .code_info[0]) app.choose_code.second = app.choose_code_info.code_list_info[index] .code_info[0]; app.get_score_data(app.choose_code_info.code_list_info[index].code_info[0], app.choose_code_info.code_list_info[index].code_info[1], function() { app.choose_code_info.code_list_info[index].code_records = app .kpl_code_info.code_records; app.choose_code_info.code_list_info[index].plate = app .kpl_code_info .plate; app.$set(app.choose_code_info.code_list_info, index, app .choose_code_info.code_list_info[index]); if (app.choose_code.second_info) { //暂存选中二级代码数据 app.choose_code.second_info.code_records = app.kpl_code_info .code_records; app.choose_code.second_info.plate = app.kpl_code_info.plate; } }); } }, //删除二级代码 del_code_level_2: function(index) { http_util.add_ignore_code(2, app.choose_code_info.code_list_info[index] .code_info[0], function(res) { res = JSON.parse(res); if (res.code == 0) { if (app.choose_code_info.code_list_info[index] .code_info[0] == app.choose_code.second) { app.choose_code.second = ''; app.choose_code.second_info = {}; } app.choose_code_info.code_list_info.splice(index, 1); } }); return false; }, //为代码做操作 do_action_for_code: function(type) { var plate = ""; if (app.choose_code_info && app.choose_code_info.today) { plate = app.choose_code_info.today[0] } http_util.do_action_for_code(app.code, plate, type, function(result) {}); }, set_target_code: function(code) { console.log("设置目标代码", code); app.origin_code = code; app.code = code; app.code_name = code; app.first_info.limit_up_codes.forEach(function(e) { if (e[0] == code) { app.code_name = e[0] + "(" + e[1] + ")"; } }); app.big_order_deal_info = null; app.get_code_third_blocks(code); app.get_big_order_deal_info(code); //请求板块 setTimeout(function() { http_util.get_kpl_block_info(code, function(res) { res = JSON.parse(res) console.log("板块请求结果:", res); if (res.code == 0) { res.data.plate.forEach(function(e) { var s = null; if (app.first_info .limit_up_reason_statistic) { for (var i = 0; i < app.first_info .limit_up_reason_statistic .length; i++) { if (app.first_info .limit_up_reason_statistic[ i][0] == e[1]) { s = app.first_info .limit_up_reason_statistic[ i]; break; } } } e.push(s); }); app.kpl_code_info = res.data; // 设置当日涨停原因 try { app.kpl_limit_up_reason = app.kpl_code_info .today[0] [0]; } catch (e) {} // 将当前涨停原因置顶 var limit_up_reason_statistic = app.first_info .limit_up_reason_statistic; var current_limit_up_reason; if (limit_up_reason_statistic) { var temps = new Array(); limit_up_reason_statistic.forEach(function(d) { if (d[0] == app .kpl_limit_up_reason) { current_limit_up_reason = d; } else { temps.push(d); } }); if (current_limit_up_reason) { temps.unshift(current_limit_up_reason); } app.first_info.limit_up_reason_statistic = temps; } } }); }, 10); // this.set_selected_cb_top(true); //init_data(); }, get_big_order_deal_info: function(code) { http_util.get_big_order_deal_info(code, function(res) { res = JSON.parse(res); if (res.code == 0) { app.big_order_deal_info = res.data[0]; } }); }, show_want_codes: function(plate) { if (Date.now() - app.last_show_dialog < 500) { return; } app.last_show_dialog = Date.now() var day = $("#date").val(); http_util.get_plate_codes(plate, day, function(result) { result = JSON.parse(result); console.log("涨停原因成分股返回:", result); var datas = result.data; app.want_codes_title = plate; app.want_codes = datas; console.log("涨停原因成分股:", datas) }); }, show_want_codes_new: function(plate) { if (Date.now() - app.last_show_dialog < 500) { return; } app.last_show_dialog = Date.now() var day = $("#date").val(); http_util.get_plate_codes_new(plate, day, function(result) { result = JSON.parse(result); console.log("涨停原因成分股返回:", result); var datas = result.data; app.want_codes_title = plate; app.want_codes = datas["limit_up_list"]; app.special_codes_list = datas["speical_codes"]; app.forbidden_refer_codes = datas["forbidden_refer_codes"]; console.log("涨停原因成分股:", datas) }); }, delete_from_want_codes: function(index) { http_util.do_action_for_code(app.want_codes[index][0], "", 5, function(result) { if (result.code == 0) { app.want_codes[index][2] = 0; app.$set(app.want_codes, index, app.want_codes[index]); app.get_limit_up_list(app.code, true); } }); }, get_kpl_market_feelings: function() { http_util.get_kpl_market_feelings(function(res) { console.log(res); res = JSON.parse(res); if (res.code == 0) { app.market_feeling_info = res.data; labels = []; values = []; colors = []; res.data.map.forEach(function(e) { labels.push(e[0]); values.push(e[1]); colors.push(e[2]); }); console.log(colors); if (!app.market_feeling_chart) { app.market_feeling_chart = new Chart($( "#market_feeling_chart"), { type: 'bar', data: { labels: labels, datasets: [{ label: '市场情绪', data: values, backgroundColor: colors, }] }, itemStyle: { }, options: { plugins: { legend: { display: false // 隐藏图例 }, }, scales: { y: { display: true }, x: { grid: { display: false, } }, } } }); } else { app.market_feeling_chart.data.labels = labels; app.market_feeling_chart.data.datasets[0].data = values; app.market_feeling_chart.data.datasets[0].backgroundColor = colors; app.market_feeling_chart.update(); } } }); }, add_or_remove_forbidden: function(event, code, index) { var el = event.currentTarget; var checked = $(el).is(':checked'); console.log(code, checked); if (checked) { http_util.do_action_for_code(code, '', 0, function(res) { app.want_codes[index][9] = 1; }); } else { http_util.do_action_for_code(code, '', 1, function(res) { app.want_codes[index][9] = 0; }); } }, add_or_remove_green_buy: function(event, code, index) { var el = event.currentTarget; var checked = $(el).is(':checked'); console.log(code, checked); if (checked) { http_util.do_action_for_code(code, '', 8, function(res) { app.want_codes[index][4] = 1; }); } else { http_util.do_action_for_code(code, '', 9, function(res) { app.want_codes[index][4] = 0; }); } }, add_or_remove_want_buy: function(event, code, index) { var el = event.currentTarget; var checked = $(el).is(':checked'); console.log(code, checked); if (checked) { http_util.do_action_for_code(code, '', 4, function(res) { app.want_codes[index][12] = 1; }); } else { http_util.do_action_for_code(code, '', 5, function(res) { app.want_codes[index][12] = 0; }); } }, set_selected_cb_top: function(update_top) { var temp_list = app.cb_list; for (var i = 0; i < temp_list.length; i++) { if (temp_list[i][0][0] == app.cb_selected_code) { var data = temp_list[i]; temp_list.splice(i, 1); temp_list.unshift(data); app.cb_list = temp_list; break; } } if (update_top) { // 先变黄 // 置顶 var temp_list = app.cb_list_top; for (var i = 0; i < temp_list.length; i++) { if (temp_list[i][1][0] == app.code) { var data = temp_list[i]; temp_list.splice(i, 1); temp_list.unshift(data); app.cb_list_top = temp_list; app.cb_selected_code = data[0][0]; break; } } } }, select_cb: function(data) { app.cb_selected_code = data[0][0]; this.set_selected_cb_top(false); }, buy_by_ths: function(code) { http_util.buy_by_ths(code, function(res) { res = JSON.parse(res); if (res.code != 0) { layer.msg("下单出错:" + res.msg); } else { layer.msg("下单完成"); } }); }, statistic_latest_limit_up_block: function(code) { http_util.statistic_latest_limit_up_block(code, function(res) { res = JSON.parse(res); console.log(res); if (res.code != 0) { layer.msg(res.msg); } else { app.latest_limit_up_blocks = res.data; } }); }, // 获取新增概念 get_new_blocks: function() { http_util.get_new_blocks(function(res) { res = JSON.parse(res); console.log(res); if (res.code == 0) { var blocks = res.data; var block_str = ""; for (var i = 0; i < blocks.length; i++) { block_str += blocks[i]; if (i < blocks.length - 1) { block_str += "、"; } } app.new_blocks = block_str; } else { layer.msg(res.msg); } }) }, add_to_ths: function(code) { console.log("================================="); pyjs.add_code_to_ths(code); try { app.set_target_code(code); } catch (e) {} }, show_latest_limit_up_queue: function(time_str) { http_util.get_kpl_latest_limit_up_queue_by_time(time_str, function(res) { res = JSON.parse(res); if (res.code == 0) { datas = []; res.data.sort((a, b) => a[2] - b[2]); res.data.forEach(function(e) { let date = new Date(e[2] * 1000); let hours = String(date.getHours()).padStart(2, '0'); let minutes = String(date.getMinutes()).padStart(2, '0'); let seconds = String(date.getSeconds()).padStart(2, '0'); temp_time_str = `${hours}:${minutes}:${seconds}`; datas.push([e[0], e[1], temp_time_str, e[4], e[5], e[6] ]); }); app.latest_limit_up_datas = datas; layer.open({ title: '当时涨停:' + time_str, type: 1, content: $("#latest_limit_up_dialog"), }); } }); }, show_green_codes: function() { http_util.get_green_codes(function(res) { app.green_list = res.data; layer.open({ title: '绿名单', type: 1, content: $("#green_list_dialog"), }); }); }, delete_from_green_codes: function(code_info) { code = code_info.split(":")[1] http_util.do_action_for_code(code, '', 9); http_util.get_green_codes(function(res) { app.green_list = res.data; }); }, show_want_codes_list: function() { http_util.get_want_codes('', function(res) { app.want_list = res.data; layer.open({ title: '想买单', type: 1, content: $("#want_list_dialog"), }); }); }, delete_from_want_codes: function(code_info) { code = code_info.split(":")[1] http_util.do_action_for_code(code, '', 5); http_util.get_want_codes('', function(res) { app.want_list = res.data; }); }, get_place_order_records: function() { day = $("#date").val(); http_util.get_place_order_records(day, function(res) { res = JSON.parse(res); if (res.code == 0) { app.place_order_record_list = res.data; } }); }, get_block_codes_with_money: function(block, desc) { http_util.get_block_codes_with_money(block, 1, function(res) { res = JSON.parse(res); if (res.code == 0) { app.block_codes_in = res.data; http_util.get_block_codes_with_money(block, 0, function(res) { res = JSON.parse(res); if (res.code == 0) { app.block_codes_out = res.data; } layer.open({ title: '成分股', type: 1, content: $("#block_codes_dialog"), }); }); } }); }, get_l2_subscript_codes: function() { http_util.get_l2_subscript_codes(function(res) { res = JSON.parse(res); if (res.code == 0) { console.log("订阅的代码:", res.data); try { res.data.sort((a, b) => b[4] - a[4]); } catch (e) { } app.l2_subscript_codes = res.data; } }); }, add_to_forbidden: function(code) { http_util.do_action_for_code(code, '', 0, function(res) { layer.msg("拉黑成功"); app.get_l2_subscript_codes(); }); }, list_forbidden_buy_plates: function() { http_util.list_forbidden_plate(function(res) { res = JSON.parse(res); if (res.code == 0) { app.forbidden_buy_plates = res.data; } }); app.list_deleted_forbidden_plate(); }, list_deleted_forbidden_plate: function() { http_util.list_deleted_forbidden_plate(function(res) { res = JSON.parse(res); if (res.code == 0) { app.deleted_forbidden_buy_plates = res.data; } }); }, delete_forbidden_buy_plate: function(plate) { http_util.delete_forbidden_plate(plate, function(res) { res = JSON.parse(res); if (res.code == 0) { layer.msg("移除成功"); app.list_forbidden_buy_plates() } else { layer.msg(res.msg); } }); }, add_forbidden_buy_plate: function(plate) { http_util.forbidden_plate(plate, function(res) { res = JSON.parse(res); if (res.code == 0) { layer.msg("添加成功"); app.list_forbidden_buy_plates() } else { layer.msg(res.msg); } }); }, get_all_special_codes: function() { http_util.get_all_special_codes(function(res) { res = JSON.parse(res); if (res.code == 0) { app.code_special_blocks = res.data; } else { layer.msg(res.msg); } }); }, get_new_blocks_special_codes: function() { http_util.get_new_blocks_special_codes(function(res) { res = JSON.parse(res); if (res.code == 0) { app.new_block_code_special_blocks = res.data; } else { layer.msg(res.msg); } }); }, add_total_big_order_threshold: function() { // 编辑总大单 let threshold_money = app.big_order_deal_info[2][4] ? app.big_order_deal_info[2] [4] : app.big_order_deal_info[2][2]; var threshold_money_number = 0; if (threshold_money.indexOf("万") >= 0) { threshold_money_number = (parseFloat(threshold_money.replace("万", "")) / 10000).toFixed(2) } else if (threshold_money.indexOf("亿") >= 0) { threshold_money_number = (parseFloat(threshold_money.replace("亿", ""))) .toFixed(2) } let money = threshold_money_number * 100000000 + 10000000; http_util.set_total_deal_big_order_threshold_money(app.code, money, function(res) { if (res.code != 0) { layer.msg(res.msg) return; } layer.msg("修改成功") layer.close(index) // 关闭当前弹窗 app.get_big_order_deal_info(app.code); }); }, sub_total_big_order_threshold: function() { // 编辑总大单 let threshold_money = app.big_order_deal_info[2][4] ? app.big_order_deal_info[2] [4] : app.big_order_deal_info[2][2]; var threshold_money_number = 0; if (threshold_money.indexOf("万") >= 0) { threshold_money_number = (parseFloat(threshold_money.replace("万", "")) / 10000).toFixed(2) } else if (threshold_money.indexOf("亿") >= 0) { threshold_money_number = (parseFloat(threshold_money.replace("亿", ""))) .toFixed(2) } let money = threshold_money_number * 100000000 - 10000000; http_util.set_total_deal_big_order_threshold_money(app.code, money, function(res) { if (res.code != 0) { layer.msg(res.msg) return; } layer.msg("修改成功") layer.close(index) // 关闭当前弹窗 app.get_big_order_deal_info(app.code); }); }, edit_total_big_order_threshold: function() { // 编辑总大单 let threshold_money = app.big_order_deal_info[2][4] ? app.big_order_deal_info[2] [4] : app.big_order_deal_info[2][2]; var threshold_money_number = 0; if (threshold_money.indexOf("万") >= 0) { threshold_money_number = (parseFloat(threshold_money.replace("万", "")) / 10000).toFixed(2) } else if (threshold_money.indexOf("亿") >= 0) { threshold_money_number = (parseFloat(threshold_money.replace("亿", ""))) .toFixed(2) } let prompt_index = layer.prompt({ title: '修改累计大单成交阈值(单位:亿)原值:' + app.big_order_deal_info[2][3], formType: 0, //输入框类型,支持0(文本)默认1(密码)2(多行文本) value: threshold_money_number, //初始时的值,默认空字符 maxlength: 20, //可输入文本的最大长度,默认500 area: ['200px', '150px'], //自定义文本域宽高 success: function(layero, index) { $(layero).on('keydown', function(e) { if (e.keyCode === 13) { // 绑定enter var val = $('.layui-layer-input').val(); if (isNaN(val)) { layer.msg("输入格式有误") return; } let money = parseFloat(val).toFixed(2) * 100000000 http_util .set_total_deal_big_order_threshold_money( app.code, money, function(res) { if (res.code != 0) { layer.msg(res.msg) return; } layer.msg("修改成功") layer.close( prompt_index) // 关闭当前弹窗 app.get_big_order_deal_info(app .code); setTimeout(function() { app .get_l2_subscript_codes(); }, 100); }); } }); } }, function(val, index) { // 只有当点击确认时才会执行这里 if (isNaN(val)) { layer.msg("输入格式有误") return; } let money = parseFloat(val).toFixed(2) * 100000000 http_util.set_total_deal_big_order_threshold_money(app.code, money, function(res) { if (res.code != 0) { layer.msg(res.msg) return; } layer.msg("修改成功") layer.close(index) // 关闭当前弹窗 app.get_big_order_deal_info(app.code); }); }) }, edit_l_down_cancel_rate: function() { let code = app.code; let prompt_index = layer.prompt({ title: '修改L后撤单比例', formType: 0, //输入框类型,支持0(文本)默认1(密码)2(多行文本) value: "0.70", //初始时的值,默认空字符 maxlength: 20, //可输入文本的最大长度,默认500 area: ['200px', '150px'], //自定义文本域宽高 success: function(layero, index) { // 在输入框旁边添加增减按钮 var input = layero.find('.layui-layer-input'); var btnContainer = $( '
'); btnContainer.append( $( '' ) .click(function() { var val = parseFloat(input.val()) || 0; if (val > 0.2) { input.val((val - 0.2).toFixed(2)); } else { input.val(0); } }) ); btnContainer.append( $( '' ) .click(function() { var val = parseFloat(input.val()) || 0; input.val((val + 0.2).toFixed(2)); }) ); input.after(btnContainer); $(layero).on('keydown', function(e) { if (e.keyCode === 13) { // 绑定enter var val = $('.layui-layer-input').val(); if (isNaN(val)) { layer.msg("输入格式有误") return; } let rate = parseFloat(val); http_util.set_l_down_rate(code, rate, function(res) { if (res.code == 0) { layer.msg("修改成功") layer.close(prompt_index) } else { layer.msg(res.msg) } }); } }); } }, function(val, index) { // 只有当点击确认时才会执行这里 if (isNaN(val)) { layer.msg("输入格式有误") return; } let rate = parseFloat(val); http_util.set_l_down_rate(code, rate, function(res) { if (res.code == 0) { layer.msg("修改成功") layer.close(prompt_index) } else { layer.msg(res.msg) } }); }) }, reset_l_down_cancel_rate: function() { let code = app.code; http_util.remove_l_down_rate(code, function(res) { if (res.code == 0) { layer.msg("设置成功") } else { layer.msg(res.msg) } }); }, check_low_suction_white_plate: function(event, plate) { if (event.target.checked) { this.add_low_suction_white_plate(plate); } else { this.remove_low_suction_white_plate(plate); } }, add_low_suction_white_plate: function(plate) { // 添加低吸白名单 http_util_of_ls.add_plate_white_list(plate, function(res) { console.log("添加低吸白名单:", res); if (res.code == 0) { layer.msg("添加成功") app.list_low_suction_white_plate() } else { layer.msg(res.msg) } }); }, remove_low_suction_white_plate: function(plate) { // 添加低吸白名单 http_util_of_ls.delete_plate_white_list(plate, function(res) { console.log("删除低吸白名单:", res); if (res.code == 0) { layer.msg("删除成功") app.list_low_suction_white_plate() } else { layer.msg(res.msg) } }); }, list_low_suction_white_plate: function(plate) { // 添加低吸白名单 http_util_of_ls.get_plate_white_list(function(res) { console.log("低吸白名单列表:", res); if (res.code == 0) { app.low_suction_plate_white_list = res.data; } }); }, get_low_suction_place_order_records: function() { http_util_of_ls.get_place_order_records(function(res) { console.log("低吸下单记录", JSON.stringify(res.data)) if (res.code == 0) { app.low_suction_place_order_records = res.data; } }); }, get_low_suction_plates: function() { http_util_of_ls.get_can_buy_plates(function(res) { console.log("低吸量化板块", JSON.stringify(res.data)) if (res.code == 0) { app.low_suction_plates = res.data; } }); } } }); } function init_data() { app.get_all_special_codes(); app.get_new_blocks_special_codes(); app.get_block_in_money_data(app.in_money_type); app.get_limit_up_list(app.code, false); app.get_limit_up_statistic_infos(true); app.get_kpl_market_feelings(); app.statistic_latest_limit_up_block(""); app.list_forbidden_buy_plates(); app.list_low_suction_white_plate(); app.get_low_suction_place_order_records(); } $(".market .child-title").click(function() { alert("test") if ($(this).hasClass("child-title-active")) { return; } console.log($(".child-title").index(this)); $(".child-title").removeClass("child-title-active"); $(this).addClass("child-title-active"); console.log("markets://" + $(".child-title").index(this)) window.location.href = "markets://" + $(".child-title").index(this); }); $(".shoubanzuogundong tbody tr").click(function() { if ($(this).hasClass("active")) { return; } $(".shoubanzuogundong tbody tr").removeClass("active"); $(this).addClass("active"); // alert($(".shoubanzuogundong tbody tr").index(this)); }); $(".shoubanzuogundong tbody tr .delete").click(function() { alert("删除" + $(".shoubanzuogundong tbody tr .delete").index(this)); return false; }); init(); });