admin
2024-03-21 5b90d8185c455857e10555b67cdff6c7d25b2c72
kp_html/kp/js/code_list.js
@@ -43,12 +43,14 @@
         passive_buy_codes: null,
         data_type: 0,
         trade_progress_index: -1,
         latest_real_order_index: -1,
         real_order_indexes: new Array(),
         hidden_canceled: true,
         //隐藏撤单
         hidden_cancel: true,
         hidden_little_money: true,
         hidden_sell: true,
         // 不隐藏已撤大单
         not_hidden_canceled_big_money:true,
         l2_datas: [],
         l2_colors_class: ["color-single-start", "color-single-exec", "color-cancel",
            "color-real-order"
@@ -64,7 +66,11 @@
         delegated_buy_code_infos: [],
         layui_element: null,
         l2_cant_buy_reasons: [],
         latest_cancel_orders: []
         latest_cancel_orders: [],
         l2_min_volume:'',
         l2_max_volume:'',
         kpl_open_limit_up_count_rank:[]
      },
      watch: {
         delegated_buy_code_infos: function() {
@@ -123,7 +129,9 @@
               alert("没有获取到代码")
               return;
            }
            http_util.get_l2_l_cancel_datas(app.code, app.operate_index, function(res) {
            var date = $("#date").val();
            http_util.get_l2_l_cancel_datas(app.code, app.operate_index, date, function(res) {
               console.log("L撤结果", res);
               res = JSON.parse(res);
               if (res.code == 0) {
@@ -157,19 +165,21 @@
            var index = layer.load(1, {
               shade: [0.1, '#fff'] //0.1透明度的白色背景
            });
            var date = $("#date").val();
            http_util.get_l2_datas(app.code, function(res) {
            http_util.get_l2_datas(app.code, date, function(res) {
               layer.close(index);
               console.log("获取到L2数据:", res)
               res = JSON.parse(res);
               if (res.code == 0) {
                  var real_order_index = -1;
                  var real_order_indexes = new Array();
                  var buy_singles = [];
                  res.data.data.forEach(function(e) {
                     if (e[1] != null) {
                        if (e[1][0] == 3) {
                           //真实下单位置
                           real_order_index = e[2][0];
                           real_order_indexes.push(e[2][0])
                        } else if (e[1][0] == 0) {
                           // 信号位置
                           buy_singles.push(e[2][0])
@@ -180,8 +190,8 @@
                     }
                     e[2][3] = e[2][3].slice(0, e[2][3].length - 1)
                  });
                  console.log("最近真实下单位置:", real_order_index);
                  app.latest_real_order_index = real_order_index;
                  console.log("最近真实下单位置:", real_order_indexes);
                  app.real_order_indexes = real_order_indexes;
                  app.l2_datas = res.data.data;
                  console.log("L2数据:", app.l2_datas);
                  var code_name = res.data.code_name;
@@ -226,9 +236,6 @@
                  app.account_available_money = result.data.account_available_money;
                  app.reset_l2_height();
               } else {
                  console.log("已挂买单错误:", result.msg);
                  app.delegated_buy_code_infos = [];
               }
            });
         },
@@ -286,6 +293,10 @@
         hidden_little_money_check: function(e) {
            app.hidden_little_money = e.currentTarget.checked;
         },
         hidden_canceled_big_money_check: function(e) {
            app.not_hidden_canceled_big_money = e.currentTarget.checked;
         },
         select_row: function(index) {
@@ -408,28 +419,53 @@
         },
         need_show: function(item) {
            if(app.real_order_indexes.includes( item[2][0])){
               return true;
            }
            if (app.hidden_canceled && (item[2][6].indexOf('买撤') >= 0 || (item[2][8] != null &&
                  item[2][8].indexOf("-") > 0))) {
               return false;
               if(!app.not_hidden_canceled_big_money){
                  // 隐藏已撤大单
                  return false;
               }else{
                  // 不隐藏已撤大单
                  if(parseFloat(item[2][3])<299)
                  {
                      return false;
                  }
               }
            }
            if (app.hidden_sell && item[2][6].indexOf('卖') >= 0) {
               return false;
            }
            if (app.hidden_cancel && (item[2][6].indexOf('买撤') >= 0)) {
               return false;
            }
            if (app.hidden_little_money && parseFloat(item[2][3]) < 50 && item[2][0] != app
               .latest_real_order_index) {
            if (app.hidden_little_money && parseFloat(item[2][3]) < 50) {
               return false;
            }
            if(app.l2_min_volume!=null&&!isNaN(app.l2_min_volume)&&parseInt(app.l2_min_volume) > parseInt(item[2][5])){
               return false;
            }
            if(app.l2_max_volume!=null&&!isNaN(app.l2_max_volume)&&parseInt(app.l2_max_volume) < parseInt(item[2][5])){
               return false;
            }
            return true;
         },
         get_score_data: function(code, name, callback) {
            console.log("获取分数数据:", code, name);
            http_util.get_score_data(code, name, function(res) {
            var date = $("#date").val();
            http_util.get_score_data(code, name,date, function(res) {
               res = JSON.parse(res)
               console.log("分数请求结果:", res)
               if (res.code == 0) {
@@ -478,6 +514,12 @@
                  }
               });
               app.get_l2_cant_buy_reasons(app.origin_code);
               http_util.get_open_limit_up_count_rank(null,function(res){
                  res = JSON.parse(res);
                  if(res.code ==0){
                     app.kpl_open_limit_up_count_rank = res.data;
                  }
               });
            }
         },
         cancel_order: function(code) {
@@ -511,6 +553,39 @@
                  app.l2_cant_buy_reasons = []
               }
            });
         },
         screen_l2_data:function(code){
            // 筛选l2数据
            layer.open({
               title: 'L2数据筛选',
               type: 1,
               content: $("#l2_screen"),
            });
         },
         l2_screen_click:function(){
            // L2筛选
            if(!isNaN($("#min-volume").val())){
               app.l2_min_volume=$("#min-volume").val();
            }else{
               app.l2_min_volume=null;
            }
            if(!isNaN($("#max-volume").val())){
               app.l2_max_volume=$("#max-volume").val();
            }else{
               app.l2_max_volume=null;
            }
         },
         fordbidden_buy:function(code){
            // 加入黑名单
             http_util.do_action_for_code(code,null,0,function(res){
                if(res.code!=0){
                   layer.msg(res.msg);
                }
             });
         }
      }
   })