admin
2025-06-10 568c763084b926a6f2d632b7ac65b9ec8280752f
kp_html/kp/js/page.js
@@ -12,6 +12,7 @@
var app;
$(function() {
   var vConsole = new VConsole();
   function _resize() {
      var code_info_height = 440;
@@ -35,7 +36,7 @@
      layer = layui.layer;
   });
   var vConsole = new VConsole();
   function request(params, callback) {
      pyjs.request(params, function(result) {
@@ -88,16 +89,14 @@
      }
   }, 3000, 3000);
   
   setInterval(function() {
      if (is_trade_time()) {
         app.get_big_order_deal_info(app.code);
      }
   }, 3000, 3000);
   
   
   
   function init() {
      app = new Vue({
         el: "#body",
@@ -399,15 +398,26 @@
            block_codes_in:[],
            block_codes_out:[],
            l2_subscript_codes:[],
            want_list:[]
            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:{}
         },
         watch: {
            want_codes: function() {
               layer.open({
                  title: app.want_codes_plate,
                  type: 1,
                  content: $("#want_code_dialog"),
               });
               setTimeout(function(){
                  layer.open({
                     title: app.want_codes_plate,
                     type: 1,
                     content: $("#want_code_dialog"),
                  });
               }, 100);
            }
         },
         methods: {
@@ -461,8 +471,8 @@
               console.log("获取分数数据:", code, name);
               var date=$("#date").val();
               http_util.get_score_data(code, name,date, function(res) {
                  res = JSON.parse(res)
                  console.log("分数请求结果:", res)
                  res = JSON.parse(res)
                  if (res.code == 0) {
                     console.log("获取分数", res)
                     app.code = res.data.code
@@ -611,19 +621,27 @@
                  }
               });
            },
            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];
                  pyjs.add_code_to_ths(app.code);
                  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_last_trade_day_reasons(app.first_info.limit_up_codes[index][0]);
                  app.get_code_third_blocks(app.code);
                  app.get_big_order_deal_info(app.code);
                  
               }
            },
@@ -680,8 +698,6 @@
                        }
                     });
                  app.get_last_trade_day_reasons(app.choose_code_info.code_list_info[index]
                     .code_info[0]);
               }
            },
            //删除二级代码
@@ -723,7 +739,11 @@
                        ")";
                  }
               });
               app.big_order_deal_info = null;
               app.get_code_third_blocks(code);
               app.get_big_order_deal_info(code);
               //请求板块
               setTimeout(function() {
@@ -752,8 +772,11 @@
                        app.kpl_code_info = res.data;
                        // 设置当日涨停原因
                        app.kpl_limit_up_reason = app.kpl_code_info.today[0]
                           [0];
                        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;
@@ -774,14 +797,23 @@
                           app.first_info.limit_up_reason_statistic =
                              temps;
                        }
                     }
                  });
                  app.get_last_trade_day_reasons(code);
               }, 10);
               
               this.set_selected_cb_top(true);
               // 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) {
@@ -812,7 +844,9 @@
                  console.log("涨停原因成分股返回:", result);
                  var datas = result.data;
                  app.want_codes_title = plate;
                  app.want_codes = datas;
                  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)
               });
            
@@ -826,18 +860,6 @@
                        app.get_limit_up_list(app.code, true);
                     }
                  });
            },
            get_last_trade_day_reasons: function(code) {
               http_util.get_last_trade_day_reasons(code, function(res) {
                  res = JSON.parse(res);
                  console.log("板块今日表现:", res)
                  if (res.code == 0) {
                     app.yesterday_block_info = res.data;
                  } else {
                     app.yesterday_block_info = null;
                  }
               });
            },
            get_kpl_market_feelings: function() {
               http_util.get_kpl_market_feelings(function(res) {
@@ -986,9 +1008,7 @@
               app.cb_selected_code = data[0][0];
               this.set_selected_cb_top(false);
            },
            add_to_ths:function(code){
               pyjs.add_code_to_ths(code);
            },
            buy_by_ths:function(code){
               http_util.buy_by_ths(code,function(res){
                  res= JSON.parse(res);
@@ -1037,7 +1057,12 @@
               
            },
            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){
@@ -1149,18 +1174,138 @@
                     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);
                  }
               });
            },
            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)
               }
               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'] //自定义文本域宽高
               },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);
                  });
               })
               // layer.open({
               //   type: 0,
               //   title:'修改大单阈值',
               //   content: "<input type='text' value = '"+ threshold_money_number +"' class='layui-input'>亿", //这里content是一个普通的String
               //   btn: ['确认修改', '取消'],
               //   yes: function(index, layero){
               //          // 验证通过后的回调
               //         alert("123");
               //   }
               // });
            }
            
            
          }
      });
   }
   function init_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();
   }
   $(".market .child-title").click(function() {