/**
 * Created by sff on 2018/1/3.
 */
$(function(){
    //设置尺寸
    function setRem ()// 绑定到窗口的这个事件中
    {
        var whdef = 100/1920;// 表示1920的设计图,使用100PX的默认值
        var wH = window.innerHeight;// 当前窗口的高度
        var wW = window.innerWidth<=1920?1920:window.innerWidth;// 当前窗口的宽度
        var rem = wW * whdef;// 以默认比例值乘以当前窗口宽度,得到该宽度下的相应FONT-SIZE值
        $('html').css('font-size', rem + "px");
    }
    setRem ();
    $(window).resize(function(){
       setRem ();
       window.location.reload();
    });
    
    getData1();

    //第一块内容
    function getData1(){
        $.ajax({
           type: 'POST',
            data: {},
            url : '/crm/whkk/getData1',
            success: function(res){
                // alert(res.monthZhichu);
                
                $("#zongKz").html(res.zongKz);
                $("#zongSx").html(res.zongSx);
                $("#monthYingshou").html(res.monthYingshou);
                $("#monthZhichuz").html(res.monthZhichu);
                $("#one_trccb").html(res.trchb);
                $("#one_wltf").html(res.wltf);
                $("#one_wlcz").html(res.wlcz);
                $("#one_wlcz_wlb").html(res.wlcz_wlb);
                $("#one_wlkz").html(res.wlkz);
                $("#one_wlds").html(res.wlds);
                $("#one_wlzhl").html(res.wlzhl);
                $("#one_qqkz").html(res.qqkz);
                $("#one_qqyj").html(res.qqyj);
                $("#one_qqdd").html(res.qqdd);
                $("#one_wzyj").html(res.wzyj);
                $("#one_wzds").html(res.wzds);
                $("#one_xgds").html(res.xgds);
                $("#one_xpcz").html(res.xpcz);
                $("#one_xpdx").html(res.xpdx);
                $("#one_xpkk").html(res.xpkk);
                $("#one_zjdxjd").html(res.zjdxjd);
                $("#one_tydxjd").html(res.tydxjd);
                $("#one_xpssxd").html(res.xpssxd);
                $("#one_xpkkxd").html(res.xpkkxd);
                $("#one_yxds").html(res.yxds);
                $("#one_sxds").html(res.sxds);
                $("#one_wxds").html(res.wxds);
                $("#one_wxgds").html(res.wxgds);
                $("#one_wxzcz").html(res.wxzcz);
                $("#one_wxdx").html(res.wxdx);
                $("#one_wxyxds").html(res.wxyxds);
                $("#one_wxsxds").html(res.wxsxds);
                $("#one_wxwxds").html(res.wxwxds);
                $("#one_pgds").html(res.pgds);
                $("#one_psje").html(res.psje);
                $("#one_ypdl").html(res.ypdl);
                $("#one_spdl").html(res.spdl);
                $("#one_wpdl").html(res.wpdl);
                $("#one_psfz").html(res.psfz);
                $("#one_kcdl").html(res.kcdl);
                $("#one_kcje").html(res.kcje);
                $("#one_tykcdl").html(res.tykcdl);

                $("#one_1cwp").html(res.ycwp);
                $("#one_2cwp").html(res.lcwp);
                $("#one_3cwp").html(res.scwp);
                $("#one_4cwp").html(res.sicwp);
                $("#one_5cwp").html(res.wcwp);
                
                //2021-06-17
                $("#one_smzss").html(res.shangmen.zss);
                $("#one_smddl").html(res.shangmen.ddl);
                $("#one_smxpl").html(res.shangmen.xpl);
                $("#one_smpsl").html(res.shangmen.psl);
            } 
        })
    }

    // 右上角时间显示
    $("#Timer").text(new Date().toLocaleString());
    setInterval(function(){
        $("#Timer").text(new Date().toLocaleString());
    },1000);

    wangluo();
    qianqi();
    xuanpian();
    shehua();
    wangxuan();
    shichang();
    shangmen();

    wangluo2();
    xuanpian2();
    shehua2();
    
    qianqi2();

    // 第二块内容
    // 网络
    function wangluo(){
        var dom = document.getElementById("wangLuo");
        var myChart = echarts.init(dom);
        var app = {};
        $.ajax({
            type: 'POST',
            data: {},
            url : '/crm/whkk/wangluo',
            success: function(res){
                $("#zc_1_1").html(res.dataz['网销实收']);
                $("#zc_1_2").html(res.dataz['新美大']);
                $("#zc_1_3").html(res.dataz['抖音']);
                $("#zc_1_4").html(res.dataz['朋友圈推广']);

                setWangluoHtml('wangluo',res.weekdata);
                option = {
                    tooltip: {
                        trigger: 'axis',
                        axisPointer: {            // 坐标轴指示器，坐标轴触发有效
                            type: 'shadow'        // 默认为直线，可选为：'line' | 'shadow'
                        },
                        position: function (point, params, dom, rect, size) {
                        　　// 鼠标坐标和提示框位置的参考坐标系是：以外层div的左上角那一点为原点，x轴向右，y轴向下
                        　　// 提示框位置
                        　　var x = 0; // x坐标位置
                        　　var y = 0; // y坐标位置
                         
                        　　// 当前鼠标位置
                        　　var pointX = point[0];
                        　　var pointY = point[1];
                         
                        　　// 外层div大小
                        　　// var viewWidth = size.viewSize[0];
                        　　// var viewHeight = size.viewSize[1];
                         
                        　　// 提示框大小
                        　　var boxWidth = size.contentSize[0];
                        　　var boxHeight = size.contentSize[1];
                         
                        　　// boxWidth > pointX 说明鼠标左边放不下提示框
                        　　if (boxWidth > pointX) {
                        　　　　x = pointX + 10;
                        　　} else { // 左边放的下
                        　　　　x = pointX - boxWidth-10;
                        　　}
                         
                        　　// boxHeight > pointY 说明鼠标上边放不下提示框
                        　　if (boxHeight > pointY) {
                        　　　　y = 5;
                        　　} else { // 上边放得下
                        　　　　y = pointY - boxHeight;
                        　　}
                         
                        　　return [x, y];
                         
                        },
                    },
                    grid: {
                        left: '0%',
                        right: '0%',
                        top: '6%',
                        bottom: '0%',
                        containLabel: true
                    },
                    color: ['#ffaf74','#65fbe3','#fcdd80','#c680ff','#ffa195'],
                    dataset: {
                        dimensions: res.head,
                        source: res.data
                            /*
                            {product: '1', '2015': 30, '2016': 85, '2017': 93, '2018': 65},
                            {product: '2', '2015': 83, '2016': 73, '2017': 55, '2018': 75},
                            {product: '3', '2015': 86, '2016': 65, '2017': 82, '2018': 55},
                            {product: '4', '2015': 72, '2016': 53, '2017': 39, '2018': 60},
                            {product: '5', '2015': 72, '2016': 53, '2017': 39, '2018': 60},
                            {product: '6', '2015': 72, '2016': 53, '2017': 39, '2018': 60},
                            {product: '7', '2015': 72, '2016': 53, '2017': 39, '2018': 60},*/
                    },
                    xAxis:[
                        {
                            type: 'category', 
                            axisLine:{
                                lineStyle:{
                                    color:'#fff',
                                    width:1
                                }
                            },
                            nameTextStyle :{
                                fontSize:1
                            },
                            axisLabel: {
                                textStyle: {
                                    fontSize:'10',
                                }
                            }

                        }
                    ],
                    yAxis: [
                        {
                            axisLine:{
                                lineStyle:{
                                    color:'#fff',
                                    width:1
                                }
                            },
                            splitLine: {
                                lineStyle: {
                                    color: "#536d92"
                                }
                            },
                            axisLabel:{
                                textStyle: {
                                    fontSize:'10',
                                }
                            }
                        }
                    ],

                    series: [
                        {type: 'bar'},
                        {type: 'bar'},
                        {type: 'bar'},
                        {type: 'bar'}
                    ]
                };
                myChart.setOption(option, true);
            } 
        })
    }
    function setWangluoHtml(id,data){
        var str= '';
        for (var i = 0; i < data.length; i++) {
            str+='<div class="eba">';
            str+='<div class="eba_title">周值</div>';
            str+='<div class="eba_mcon">';
            if(data[i]['网销实收'] === undefined){
                str+='<div class="eba_mark"><small></small><span>0</span></div>';
            }else{
                str+='<div class="eba_mark"><small></small><span>'+data[i]['网销实收']+'</span></div>';
            }
            if(data[i]['新美大'] === undefined){
                str+='<div class="eba_mark"><small></small><span>0</span></div>';
            }else{
                str+='<div class="eba_mark"><small></small><span>'+data[i]['新美大']+'</span></div>';
            }
            if(data[i]['抖音'] === undefined){
                str+='<div class="eba_mark"><small></small><span>0</span></div>';
            }else{
                str+='<div class="eba_mark"><small></small><span>'+data[i]['抖音']+'</span></div>';
            }
            if(data[i]['朋友圈推广'] === undefined){
                str+='<div class="eba_mark"><small></small><span>0</span></div>';
            }else{
                str+='<div class="eba_mark"><small></small><span>'+data[i]['朋友圈推广']+'</span></div>';
            }
            
            str+='</div>';
            str+='</div>';
        }
        $('#'+id).html(str);
    }

    // 前期
    function qianqi(){
        var dom = document.getElementById("qianQi");
        var myChart = echarts.init(dom);
        var app = {};
        $.ajax({
            type: 'POST',
            data: {},
            url : '/crm/whkk/qianqi',
            success: function(res){
                $("#zc_2_1").html(res.dataz['前期实收']);
                $("#zc_2_2").html(res.dataz['新美大']);
                $("#zc_2_3").html(res.dataz['抖音']);
                $("#zc_2_4").html(res.dataz['朋友圈推广']);

                setqianqiHtml('qianqi',res.weekdata);
                option = {
                    tooltip: {
                        trigger: 'axis',
                        axisPointer: {            // 坐标轴指示器，坐标轴触发有效
                            type: 'shadow'        // 默认为直线，可选为：'line' | 'shadow'
                        }
                    },
                    grid: {
                        left: '0%',
                        right: '0%',
                        top: '6%',
                        bottom: '0%',
                        containLabel: true
                    },
                    color: ['#ffaf74','#65fbe3','#fcdd80','#c680ff'],
                    dataset: {
                        dimensions: res.head,
                        source: res.data
                    },
                    xAxis:[
                        {
                            type: 'category',
                            axisLine:{
                                lineStyle:{
                                    color:'#fff',
                                    width:1
                                }
                            },
                            axisLabel: {
                                textStyle: {
                                    fontSize:'10',
                                }
                            }
                        }
                    ],
                    yAxis: [
                        {
                            axisLine:{
                                lineStyle:{
                                    color:'#fff',
                                    width:1
                                }
                            },
                            splitLine: {
                                lineStyle: {
                                    color: "#536d92"
                                }
                            },
                            axisLabel:{
                                textStyle: {
                                    fontSize:'10',
                                }
                            }
                        }
                    ],

                    series: [
                        {type: 'bar'},
                        {type: 'bar'},
                        {type: 'bar'},
                        {type: 'bar'}
                    ]
                };
                myChart.setOption(option, true);
            } 
        })
    }
    function setqianqiHtml(id,data){
        var str= '';
        for (var i = 0; i < data.length; i++) {
            str+='<div class="eba">';
            str+='<div class="eba_title">周值</div>';
            str+='<div class="eba_mcon">';
            if(data[i]['前期实收'] === undefined){
                str+='<div class="eba_mark"><small></small><span>0</span></div>';
            }else{
                str+='<div class="eba_mark"><small></small><span>'+data[i]['前期实收']+'</span></div>';
            }
            if(data[i]['新美大'] === undefined){
                str+='<div class="eba_mark"><small></small><span>0</span></div>';
            }else{
                str+='<div class="eba_mark"><small></small><span>'+data[i]['新美大']+'</span></div>';
            }
            if(data[i]['抖音'] === undefined){
                str+='<div class="eba_mark"><small></small><span>0</span></div>';
            }else{
                str+='<div class="eba_mark"><small></small><span>'+data[i]['抖音']+'</span></div>';
            }
            if(data[i]['朋友圈推广'] === undefined){
                str+='<div class="eba_mark"><small></small><span>0</span></div>';
            }else{
                str+='<div class="eba_mark"><small></small><span>'+data[i]['朋友圈推广']+'</span></div>';
            }
            str+='</div>';
            str+='</div>';
        }
        $('#'+id).html(str);
    }

    // 选片
    function xuanpian(){
        var dom = document.getElementById("xuanPian");
        var myChart = echarts.init(dom);
        var app = {};
        $.ajax({
            type: 'POST',
            data: {},
            url : '/crm/whkk/xuanpian',
            success: function(res){
                $("#zc_3_1").html(res.dataz['总产值']);
                $("#zc_3_2").html(res.dataz['当销']);
                $("#zc_3_3").html(res.dataz['卡扣']);
                $("#zc_3_4").html(res.dataz['正均单']);
                $("#zc_3_5").html(res.dataz['免均单']);

                setxuanpianHtml('xuanpian',res.weekdata);
                option = {
                    tooltip: {
                        trigger: 'axis',
                        axisPointer: {            // 坐标轴指示器，坐标轴触发有效
                            type: 'shadow'        // 默认为直线，可选为：'line' | 'shadow'
                        }
                    },
                    grid: {
                        left: '0%',
                        right: '0%',
                        top: '6%',
                        bottom: '0%',
                        containLabel: true
                    },
                    color: ['#ffaf74','#65fbe3','#fcdd80','#c680ff','#ffa195'],
                    dataset: {
                        dimensions: res.head,
                        source: res.data
                    , '2019': 65},
                    xAxis:[
                        {
                            type: 'category', 
                            axisLine:{
                                lineStyle:{
                                    color:'#fff',
                                    width:1
                                }
                            },
                            axisLabel: {
                                textStyle: {
                                    fontSize:'10',
                                }
                            }
                        }
                    ],
                    yAxis: [
                        {
                            axisLine:{
                                lineStyle:{
                                    color:'#fff',
                                    width:1
                                }
                            },
                            splitLine: {
                                lineStyle: {
                                    color: "#536d92"
                                }
                            },
                            axisLabel:{
                                textStyle: {
                                    fontSize:'10',
                                }
                            }
                        }
                    ],

                    series: [
                        {type: 'bar'},
                        {type: 'bar'},
                        {type: 'bar'},
                        {type: 'bar'},
                        {type: 'bar'}
                    ]
                };
                myChart.setOption(option, true);
            } 
        })
    }
    function setxuanpianHtml(id,data){
        var str= '';
        for (var i = 0; i < data.length; i++) {
            str+='<div class="eba2">';
            str+='<div class="eba_title2">周值</div>';
            str+='<div class="eba_mcon2">';
            if(data[i]['总产值'] === undefined){
                str+='<div class="eba_mark"><small></small><span>0</span></div>';
            }else{
                str+='<div class="eba_mark"><small></small><span>'+data[i]['总产值']+'</span></div>';
            }
            if(data[i]['当销'] === undefined){
                str+='<div class="eba_mark"><small></small><span>0</span></div>';
            }else{
                str+='<div class="eba_mark"><small></small><span>'+data[i]['当销']+'</span></div>';
            }
            if(data[i]['卡扣'] === undefined){
                str+='<div class="eba_mark"><small></small><span>0</span></div>';
            }else{
                str+='<div class="eba_mark"><small></small><span>'+data[i]['卡扣']+'</span></div>';
            }
            if(data[i]['zjd'] === undefined){
                str+='<div class="eba_mark"><small></small><span>0</span></div>';
            }else{
                str+='<div class="eba_mark"><small></small><span>'+data[i]['zjd']+'</span></div>';
            }
            if(data[i]['mjd'] === undefined){
                str+='<div class="eba_mark"><small></small><span>0</span></div>';
            }else{
                str+='<div class="eba_mark"><small></small><span>'+data[i]['mjd']+'</span></div>';
            }
            str+='</div>';
            str+='</div>';
        }
        $('#'+id).html(str);
    }

    //摄化
    function shehua(){
        // 摄化
        var dom = document.getElementById("sheHua");
        var myChart = echarts.init(dom);
        var app = {};

        $.ajax({
            type: 'POST',
            data: {},
            url : '/crm/whkk/shehua',
            success: function(res){
                $("#zc_5_1").html(res.dataz['正价值']);
                $("#zc_5_2").html(res.dataz['体验值']);

                setshehuaHtml('shehua',res.weekdata);
                option = {
                    tooltip: {
                        trigger: 'axis',
                        axisPointer: {            // 坐标轴指示器，坐标轴触发有效
                            type: 'shadow'        // 默认为直线，可选为：'line' | 'shadow'
                        }
                    },
                    grid: {
                        left: '0%',
                        right: '0%',
                        top: '6%',
                        bottom: '0%',
                        containLabel: true
                    },
                    color: ['#ffaf74','#65fbe3','#fcdd80','#c680ff','#ffa195'],
                    dataset: {
                        dimensions: res.head,
                        source: res.data
                    },
                    xAxis:[
                        {
                            type: 'category', 
                            axisLine:{
                                lineStyle:{
                                    color:'#fff',
                                    width:1
                                }
                            },
                            axisLabel: {
                                textStyle: {
                                    fontSize:'10',
                                }
                            }
                        }
                    ],
                    yAxis: [
                        {
                            axisLine:{
                                lineStyle:{
                                    color:'#fff',
                                    width:1
                                }
                            },
                            splitLine: {
                                lineStyle: {
                                    color: "#536d92"
                                }
                            },
                            axisLabel:{
                                textStyle: {
                                    fontSize:'10',
                                }
                            }
                        }
                    ],
                    series: [
                        {type: 'bar'},
                        {type: 'bar'}
                    ]
                };
                myChart.setOption(option, true);
            } 
        })
    }
    function setshehuaHtml(id,data){
        var str= '';
        for (var i = 0; i < data.length; i++) {
            str+='<div class="eba">';
            str+='<div class="eba_title">周值</div>';
            str+='<div class="eba_mcon">';
            if(data[i]['正价值'] === undefined){
                str+='<div class="eba_mark"><small></small><span>0</span></div>';
            }else{
                str+='<div class="eba_mark"><small></small><span>'+data[i]['正价值']+'</span></div>';
            }
            if(data[i]['体验值'] === undefined){
                str+='<div class="eba_mark"><small></small><span>0</span></div>';
            }else{
                str+='<div class="eba_mark"><small></small><span>'+data[i]['体验值']+'</span></div>';
            }
            str+='</div>';
            str+='</div>';
        }
        $('#'+id).html(str);
    }
    
    // 上门
    function shangmen(){
        var dom = document.getElementById("shangMen");
        var myChart = echarts.init(dom);
        var app = {};
        $.ajax({
            type: 'POST',
            data: {},
            url : '/crm/whkk/shangmen',
            success: function(res){
                $("#zc_6_1").html(res.dataz['总产值']);
                $("#zc_6_2").html(res.dataz['订单值']);
                $("#zc_6_3").html(res.dataz['选片值']);
                $("#zc_6_4").html(res.dataz['拍摄值']);

                setshangmenHtml('shangmenx',res.weekdata);
                option = {
                    tooltip: {
                        trigger: 'axis',
                        axisPointer: {            // 坐标轴指示器，坐标轴触发有效
                            type: 'shadow'        // 默认为直线，可选为：'line' | 'shadow'
                        }
                    },
                    grid: {
                        left: '0%',
                        right: '0%',
                        top: '6%',
                        bottom: '0%',
                        containLabel: true
                    },
                    color: ['#ffaf74','#65fbe3','#fcdd80','#c680ff','#ffa195'],
                    dataset: {
                        dimensions: res.head,
                        source: res.data
                    },
                    xAxis:[
                        {
                            type: 'category', 
                            axisLine:{
                                lineStyle:{
                                    color:'#fff',
                                    width:1
                                }
                            },
                            axisLabel: {
                                textStyle: {
                                    fontSize:'10',
                                }
                            }
                        }
                    ],
                    yAxis: [
                        {
                            axisLine:{
                                lineStyle:{
                                    color:'#fff',
                                    width:1
                                }
                            },
                            splitLine: {
                                lineStyle: {
                                    color: "#536d92"
                                }
                            },
                            axisLabel:{
                                textStyle: {
                                    fontSize:'10',
                                }
                            }
                        }
                    ],

                    series: [
                        {type: 'bar'},
                        {type: 'bar'},
                        {type: 'bar'},
                        {type: 'bar'}
                    ]
                };
                myChart.setOption(option, true);
            }
        })
    }
    function setshangmenHtml(id,data){
        var str= '';
        for (var i = 0; i < data.length; i++) {
            str+='<div class="eba">';
            str+='<div class="eba_title">周值</div>';
            str+='<div class="eba_mcon">';
            if(data[i]['总产值'] === undefined){
                str+='<div class="eba_mark"><small></small><span>0</span></div>';
            }else{
                str+='<div class="eba_mark"><small></small><span>'+data[i]['总产值']+'</span></div>';
            }
            if(data[i]['订单值'] === undefined){
                str+='<div class="eba_mark"><small></small><span>0</span></div>';
            }else{
                str+='<div class="eba_mark"><small></small><span>'+data[i]['订单值']+'</span></div>';
            }
            if(data[i]['选片值'] === undefined){
                str+='<div class="eba_mark"><small></small><span>0</span></div>';
            }else{
                str+='<div class="eba_mark"><small></small><span>'+data[i]['选片值']+'</span></div>';
            }
            if(data[i]['拍摄值'] === undefined){
                str+='<div class="eba_mark"><small></small><span>0</span></div>';
            }else{
                str+='<div class="eba_mark"><small></small><span>'+data[i]['拍摄值']+'</span></div>';
            }
            str+='</div>';
            str+='</div>';
        }
        $('#'+id).html(str);
    }
    //市场
    function shichang(){
        // 市场
        var dom = document.getElementById("shiChang");
        var myChart = echarts.init(dom);
        var app = {};
        $.ajax({
            type: 'POST',
            data: {},
            url : '/crm/whkk/shichang',
            success: function(res){
                $("#yc_6_1").html(res.dataz['总产值']);
                $("#yc_6_2").html(res.dataz['总实收']);
                $("#yc_6_3").html(res.dataz['客资量']);

                setshichangHtml('shichangx',res.weekdata);
                option = {
                    tooltip: {
                        trigger: 'axis',
                        axisPointer: {            // 坐标轴指示器，坐标轴触发有效
                            type: 'shadow'        // 默认为直线，可选为：'line' | 'shadow'
                        }
                    },
                    grid: {
                        left: '0%',
                        right: '0%',
                        top: '16%',
                        bottom: '0%',
                        containLabel: true
                    },
                    color: ['#ffaf74','#65fbe3','#fcdd80'],
                    dataset: {
                        dimensions: res.head,
                        source: res.data
                    },
                    xAxis:[
                        {
                            type: 'category',
                            axisLine:{
                                lineStyle:{
                                    color:'#fff',
                                    width:1
                                }
                            },
                            axisLabel: {
                                textStyle: {
                                    fontSize:'10',
                                }
                            }
                        }
                    ],
                    yAxis: [
                        {
                            axisLine:{
                                lineStyle:{
                                    color:'#fff',
                                    width:1
                                }
                            },
                            splitLine: {
                                lineStyle: {
                                    color: "#536d92"
                                }
                            },
                            axisLabel:{
                                textStyle: {
                                    fontSize:'10',
                                }
                            }
                        }
                    ],

                    series: [
                        {
                            type: 'bar',
                            itemStyle: {
                               normal: {
                                   label: {
                                       show: true,      //开启显示
                                       position: 'top', //在上方显示
                                       textStyle: {     //数值样式
                                            color: function(params) {
                                                //console.log('3333====',params);
                                                //首先定义一个数组
                                                var colorList = [
                                                    '#ffffff','#F5A64C'
                                                ]; 
                                                if(params.dataIndex % 2 == 0){
                                                    return colorList[0]
                                                }else{
                                                    return colorList[1]
                                                }
                                            },
                                           fontSize: 10
                                       }
                                   }
                               }
                            }
                        },
                        {
                            type: 'bar',
                        },
                        {
                            type: 'bar',
                            
                        }
                    ]
                };
                myChart.setOption(option, true);
            }
        });
    }
    function setshichangHtml(id,data){
        var str= '';
        for (var i = 0; i < data.length; i++) {
            str+='<div class="eba">';
            str+='<div class="eba_title">周值</div>';
            str+='<div class="eba_mcon">';
            if(data[i]['总产值'] === undefined){
                str+='<div class="eba_mark"><small></small><span>0</span></div>';
            }else{
                str+='<div class="eba_mark"><small></small><span>'+data[i]['总产值']+'</span></div>';
            }
            if(data[i]['总实收'] === undefined){
                str+='<div class="eba_mark"><small></small><span>0</span></div>';
            }else{
                str+='<div class="eba_mark"><small></small><span>'+data[i]['总实收']+'</span></div>';
            }
            if(data[i]['客资量'] === undefined){
                str+='<div class="eba_mark"><small></small><span>0</span></div>';
            }else{
                str+='<div class="eba_mark"><small></small><span>'+data[i]['客资量']+'</span></div>';
            }
            str+='</div>';
            str+='</div>';
        }
        // console.log('333=',str);
        $('#'+id).html(str);
    }
    // 第二块内容end

    // 第三块内容
    // 网络2
    function wangluo2(){
        var dom = document.getElementById("wangLuo2");
        var myChart = echarts.init(dom);
        var app = {};
        $.ajax({
            type: 'POST',
            data: {},
            url : '/crm/whkk/wangluo2',
            success: function(res){
                console.log(res.wxdsList);
                
                $("#yc_1_1").html(res.dataz['网销单数']+'/'+res.dataz['网销客资']);
                $("#yc_1_2").html(res.dataz['美大单数']+'/'+res.dataz['美大客资']);
                $("#yc_1_3").html(res.dataz['抖音单数']+'/'+res.dataz['抖音客资']);
                $("#yc_1_4").html(res.dataz['朋友圈推广单数']+'/'+res.dataz['朋友圈推广客资']);

                setWangluo2Html('wangluo2x',res.weekdata);
                option = {
                    tooltip: {
                        trigger: 'axis',
                        axisPointer: {            // 坐标轴指示器，坐标轴触发有效
                            type: 'shadow'        // 默认为直线，可选为：'line' | 'shadow'
                        },
                        position: function (point, params, dom, rect, size) {
                        　　// 鼠标坐标和提示框位置的参考坐标系是：以外层div的左上角那一点为原点，x轴向右，y轴向下
                        　　// 提示框位置
                        　　var x = 0; // x坐标位置
                        　　var y = 0; // y坐标位置
                         
                        　　// 当前鼠标位置
                        　　var pointX = point[0];
                        　　var pointY = point[1];
                         
                        　　// 外层div大小
                        　　// var viewWidth = size.viewSize[0];
                        　　// var viewHeight = size.viewSize[1];
                         
                        　　// 提示框大小
                        　　var boxWidth = size.contentSize[0];
                        　　var boxHeight = size.contentSize[1];
                         
                        　　// boxWidth > pointX 说明鼠标左边放不下提示框
                        　　if (boxWidth > pointX) {
                        　　　　x = pointX + 10;
                        　　} else { // 左边放的下
                        　　　　x = pointX - boxWidth-10;
                        　　}
                         
                        　　// boxHeight > pointY 说明鼠标上边放不下提示框
                        　　if (boxHeight > pointY) {
                        　　　　y = 5;
                        　　} else { // 上边放得下
                        　　　　y = pointY - boxHeight;
                        　　}
                         
                        　　return [x, y];
                         
                        },
                    },
                    color: ['#ffaf74','#9d8176','#65fbe2','#3eaab7','#fcdd80','#94987f','#c680ff','#dcb0ff'],
                    grid: {
                        left: '0%',
                        right: '0%',
                        top: '6%',
                        bottom: '0%',
                        containLabel: true,
                    },
                    xAxis: [
                        {
                            axisLine:{
                                lineStyle:{
                                    color:'#fff',
                                    width:1
                                }
                            },
                            axisLabel: {
                                textStyle: {
                                    fontSize:'10',
                                }
                            },
                            splitLine: {
                                lineStyle: {
                                    color: "#536d92"
                                }
                            },
                            type: 'category',
                            data: res.month
                        }
                    ],
                    yAxis: [
                        {
                            axisLine:{
                                lineStyle:{
                                    color:'#fff',
                                    width:1
                                }
                            },
                            splitLine: {
                                lineStyle: {
                                    color: "#536d92"
                                }
                            },
                            type: 'value',
                            axisLabel:{
                                textStyle: {
                                    fontSize:'10',
                                }
                            }
                        }
                    ],

                    series: [

                        {
                            name: '网销单数',
                            type: 'bar',
                            barGap: '-100%',
                            data: res.qtdsList
                        },
                        {
                            name: '网销客资',
                            type: 'bar',
                            data: res.qtkzList
                        },
                        {
                            name: '美大单数',
                            type: 'bar',
                            barGap: '-80%',
                            data: res.mddsList
                        },
                        {
                            name: '美大客资',
                            type: 'bar',
                            data: res.mdkzList,
                            // itemStyle: {
                            //     normal: {
                            //        color: 'rgba(0,0,0,0)',
                            //     }
                            // }
                        },
                        {
                            name: '抖音单数',
                            type: 'bar',
                            barGap: '-60%',
                            data: res.dydsList
                        },
                        {
                            name: '抖音客资',
                            type: 'bar',
                            data: res.dykzList,
                            // itemStyle: {
                            //     normal: {
                            //        color: 'rgba(0,0,0,0)',
                            //     }
                            // }
                        },
                        {
                            name: '朋友圈推广单数',
                            type: 'bar',
                            barGap: '-40%',
                            data: res.wxdsList
                        },
                        {
                            name: '朋友圈推广客资',
                            type: 'bar',
                            data: res.wxkzList,
                            // itemStyle: {
                            //     normal: {
                            //        color: 'rgba(0,0,0,0)',
                            //     }
                            // }
                        }
                    ]
                };
                myChart.setOption(option, true);
            } 
       })
    }
    function setWangluo2Html(id,data){
        var str= '';
        for (var i = 0; i < data.length; i++) {
            str+='<div class="eba">';
            str+='<div class="eba_title">周值</div>';
            str+='<div class="eba_mcon">';
            if(data[i]['其它'] === undefined && data[i]['其它客资'] === undefined){
                str+='<div class="eba_mark"><small></small><span>0/0</span></div>';
            }else if(data[i]['其它'] != undefined && data[i]['其它客资'] === undefined){
                str+='<div class="eba_mark"><small></small><span>'+data[i]['其它']+'/0</span></div>';
            }else if(data[i]['其它'] === undefined && data[i]['其它客资'] != undefined){
                str+='<div class="eba_mark"><small></small><span>0/'+data[i]['其它客资']+'</span></div>';
            }else{
                str+='<div class="eba_mark"><small></small><span>'+data[i]['其它']+'/'+data[i]['其它客资']+'</span></div>';
            }

            if(data[i]['新美大'] === undefined && data[i]['新美大客资'] === undefined){
                str+='<div class="eba_mark"><small></small><span>0/0</span></div>';
            }else if(data[i]['新美大'] != undefined && data[i]['新美大客资'] === undefined){
                str+='<div class="eba_mark"><small></small><span>'+data[i]['新美大']+'/0</span></div>';
            }else if(data[i]['新美大'] === undefined && data[i]['新美大客资'] != undefined){
                str+='<div class="eba_mark"><small></small><span>0/'+data[i]['新美大客资']+'</span></div>';
            }else{
                str+='<div class="eba_mark"><small></small><span>'+data[i]['新美大']+'/'+data[i]['新美大客资']+'</span></div>';
            }

            if(data[i]['抖音'] === undefined && data[i]['抖音客资'] === undefined){
                str+='<div class="eba_mark"><small></small><span>0/0</span></div>';
            }else if(data[i]['抖音'] != undefined && data[i]['抖音客资'] === undefined){
                str+='<div class="eba_mark"><small></small><span>'+data[i]['抖音']+'/0</span></div>';
            }else if(data[i]['抖音'] === undefined && data[i]['抖音客资'] != undefined){
                str+='<div class="eba_mark"><small></small><span>0/'+data[i]['抖音客资']+'</span></div>';
            }else{
                str+='<div class="eba_mark"><small></small><span>'+data[i]['抖音']+'/'+data[i]['抖音客资']+'</span></div>';
            }

            if(data[i]['朋友圈推广'] === undefined && data[i]['朋友圈推广客资'] === undefined){
                str+='<div class="eba_mark"><small></small><span>0/0</span></div>';
            }else if(data[i]['朋友圈推广'] != undefined && data[i]['朋友圈推广客资'] === undefined){
                str+='<div class="eba_mark"><small></small><span>'+data[i]['朋友圈推广']+'/0</span></div>';
            }else if(data[i]['朋友圈推广'] === undefined && data[i]['朋友圈推广客资'] != undefined){
                str+='<div class="eba_mark"><small></small><span>0/'+data[i]['朋友圈推广客资']+'</span></div>';
            }else{
                str+='<div class="eba_mark"><small></small><span>'+data[i]['朋友圈推广']+'/'+data[i]['朋友圈推广客资']+'</span></div>';
            }
            
            str+='</div>';
            str+='</div>';
        }
        $('#'+id).html(str);
    }

    //前期2
    function qianqi2(){
        var dom = document.getElementById("qianQi2");
        var myChart = echarts.init(dom);
        var app = {};
        $.ajax({
            type: 'POST',
            data: {},
            url : '/crm/whkk/qianqi2',
            success: function(res){

                $("#yc_2_1").html(res.dataz['前期单数']+'/'+res.dataz['前期客资']);
                $("#yc_2_2").html(res.dataz['新美大']);
                $("#yc_2_3").html(res.dataz['抖音']);
                $("#yc_2_4").html(res.dataz['朋友圈推广']);

                setqianqi2Html('qianqi2x',res.weekdata);
                option = {
                    tooltip: {
                        trigger: 'axis',
                        axisPointer: {            // 坐标轴指示器，坐标轴触发有效
                            type: 'shadow'        // 默认为直线，可选为：'line' | 'shadow'
                        }
                    },
                    color: ['#ffaf74','#9d8176','#65fbe2','#fcdd80','#c680ff'],
                    grid: {
                        left: '0%',
                        right: '0%',
                        top: '6%',
                        bottom: '0%',
                        containLabel: true
                    },
                    xAxis: [
                        {
                            axisLine:{
                                lineStyle:{
                                    color:'#fff',
                                    width:1
                                }
                            },
                            axisLabel: {
                                textStyle: {
                                    fontSize:'10',
                                }
                            },
                            splitLine: {
                                lineStyle: {
                                    color: "#536d92"
                                }
                            },
                            type: 'category',
                            data: res.month
                        }
                    ],
                    yAxis: [
                        {
                            axisLine:{
                                lineStyle:{
                                    color:'#fff',
                                    width:1
                                }
                            },
                            splitLine: {
                                lineStyle: {
                                    color: "#536d92"
                                }
                            },
                            type: 'value',
                            axisLabel:{
                                textStyle: {
                                    fontSize:'10',
                                }
                            }
                        }
                    ],
                    series: [
                        {
                            name: '前期单数',
                            type: 'bar',
                            barGap: '-100%',
                            data: res.qqdsList
                        },
                        {
                            name: '前期客资',
                            type: 'bar',
                            data: res.qqkzList
                        },
                        {
                            name: '美大转单数',
                            type: 'bar',
                            data: res.xmdList
                        },
                        {
                            name: '抖音转单数',
                            type: 'bar',
                            data: res.dyList
                        },
                        {
                            name: '朋友圈推广转单数',
                            type: 'bar',
                            barGap: '-30%',
                            data: res.wxList
                        }
                    ]
                };
                myChart.setOption(option, true);
            } 
        })
    }
    function setqianqi2Html(id,data){
        var str= '';
        for (var i = 0; i < data.length; i++) {
            str+='<div class="eba">';
            str+='<div class="eba_title">周值</div>';
            str+='<div class="eba_mcon">';
            if(data[i]['前期单数'] === undefined && data[i]['前期客资'] === undefined){
                str+='<div class="eba_mark"><small></small><span>0/0</span></div>';
            }else if(data[i]['前期单数'] != undefined && data[i]['前期客资'] === undefined){
                str+='<div class="eba_mark"><small></small><span>'+data[i]['前期单数']+'/0</span></div>';
            }else if(data[i]['前期单数'] === undefined && data[i]['前期客资'] != undefined){
                str+='<div class="eba_mark"><small></small><span>0/'+data[i]['前期客资']+'</span></div>';
            }else{
                str+='<div class="eba_mark"><small></small><span>'+data[i]['前期单数']+'/'+data[i]['前期客资']+'</span></div>';
            }
            if(data[i]['新美大'] === undefined){
                str+='<div class="eba_mark"><small></small><span>0</span></div>';
            }else{
                str+='<div class="eba_mark"><small></small><span>'+data[i]['新美大']+'</span></div>';
            }
            if(data[i]['抖音'] === undefined){
                str+='<div class="eba_mark"><small></small><span>0</span></div>';
            }else{
                str+='<div class="eba_mark"><small></small><span>'+data[i]['抖音']+'</span></div>';
            }
            if(data[i]['朋友圈推广'] === undefined){
                str+='<div class="eba_mark"><small></small><span>0</span></div>';
            }else{
                str+='<div class="eba_mark"><small></small><span>'+data[i]['朋友圈推广']+'</span></div>';
            }
            str+='</div>';
            str+='</div>';
        }
        $('#'+id).html(str);
    }

    //选片2
    function xuanpian2(){
        // 选片2
        var dom = document.getElementById("xuanPian2");
        var myChart = echarts.init(dom);
        var app = {};
        $.ajax({
            type: 'POST',
            data: {},
            url : '/crm/whkk/xuanpian2',
            success: function(res){
                $("#yc_3_1").html(res.dataz['总选片']);
                $("#yc_3_2").html(res.dataz['正价单']);
                $("#yc_3_3").html(res.dataz['体验单']);
                $("#yc_3_4").html(res.dataz['改期量']);

                setxuanpian2Html('xuanpian2x',res.weekdata);
                option = {
                    tooltip: {
                        trigger: 'axis',
                        axisPointer: {            // 坐标轴指示器，坐标轴触发有效
                            type: 'shadow'        // 默认为直线，可选为：'line' | 'shadow'
                        }
                    },
                    grid: {
                        left: '0%',
                        right: '0%',
                        top: '6%',
                        bottom: '0%',
                        containLabel: true
                    },
                    color: ['#ffaf74','#65fbe3','#fcdd80','#c680ff','#ffa195'],
                    dataset: {
                        dimensions: res.head,
                        source: res.data
                    },
                    xAxis:[
                        {
                            type: 'category', 
                            axisLine:{
                                lineStyle:{
                                    color:'#fff',
                                    width:1
                                }
                            },
                            axisLabel: {
                                textStyle: {
                                    fontSize:'10',
                                }
                            }
                        }
                    ],
                    yAxis: [
                        {
                            axisLine:{
                                lineStyle:{
                                    color:'#fff',
                                    width:1
                                }
                            },
                            splitLine: {
                                lineStyle: {
                                    color: "#536d92"
                                }
                            },
                            axisLabel:{
                                textStyle: {
                                    fontSize:'10',
                                }
                            }
                        }
                    ],

                    series: [
                        {type: 'bar'},
                        {type: 'bar'},
                        {type: 'bar'},
                        {type: 'bar'}
                    ]
                };
                myChart.setOption(option, true);
            }
        })
    }
    function setxuanpian2Html(id,data){
        var str= '';
        for (var i = 0; i < data.length; i++) {
            str+='<div class="eba">';
            str+='<div class="eba_title">周值</div>';
            str+='<div class="eba_mcon">';
            if(data[i]['总选片'] === undefined){
                str+='<div class="eba_mark"><small></small><span>0</span></div>';
            }else{
                str+='<div class="eba_mark"><small></small><span>'+data[i]['总选片']+'</span></div>';
            }
            if(data[i]['正价单'] === undefined){
                str+='<div class="eba_mark"><small></small><span>0</span></div>';
            }else{
                str+='<div class="eba_mark"><small></small><span>'+data[i]['正价单']+'</span></div>';
            }
            if(data[i]['体验单'] === undefined){
                str+='<div class="eba_mark"><small></small><span>0</span></div>';
            }else{
                str+='<div class="eba_mark"><small></small><span>'+data[i]['体验单']+'</span></div>';
            }
            if(data[i]['改期量'] === undefined){
                str+='<div class="eba_mark"><small></small><span>0</span></div>';
            }else{
                str+='<div class="eba_mark"><small></small><span>'+data[i]['改期量']+'</span></div>';
            }
            str+='</div>';
            str+='</div>';
        }
        $('#'+id).html(str);
    }

    //摄化2
    function shehua2(){
        // 选片2
        // var dom = document.getElementById("sheHua2");
        // var myChart = echarts.init(dom);
        var dom = document.getElementById("sheHua2");
        var myChart = echarts.init(dom);
        var app = {};
        $.ajax({
            type: 'POST',
            data: {},
            url : '/crm/whkk/shehua2',
            success: function(res){
                $("#yc_5_1").html(res.dataz['约拍量']);
                $("#yc_5_2").html(res.dataz['完拍量']+'/'+res.dataz['实拍量']);
                $("#yc_5_3").html(res.dataz['正价完拍单']+'/'+res.dataz['正价实拍单']);
                $("#yc_5_4").html(res.dataz['体验完拍单']+'/'+res.dataz['体验实拍单']);

                setshehua2Html('shehua2x',res.weekdata);
                option = {
                    tooltip: {
                        trigger: 'axis',
                        axisPointer: {            // 坐标轴指示器，坐标轴触发有效
                            type: 'shadow'        // 默认为直线，可选为：'line' | 'shadow'
                        }
                    },
                    grid: {
                        left: '0%',
                        right: '0%',
                        top: '6%',
                        bottom: '0%',
                        containLabel: true
                    },
                    color: ['#ffaf74','#65fbe3','#3eaab7','#fcdd80','#94987f','#c680ff','#dcb0ff'],
                    // color: ['#ffaf74','#9d8176','#65fbe2','#3eaab7','#fcdd80','#94987f','#c680ff','#dcb0ff'],
                    xAxis: [
                        {
                            type: 'category',
                            data: res.month,
                            axisLabel: {
                                textStyle: {
                                    fontSize:'10',
                                }
                            },
                            axisLine:{
                                lineStyle:{
                                    color:'#fff',
                                    width:1
                                }
                            }
                        }
                    ],
                    yAxis: [
                        {
                            type: 'value',
                            axisLine:{
                                lineStyle:{
                                    color:'#fff',
                                    width:1
                                }
                            },
                            splitLine: {
                                lineStyle: {
                                    color: "#536d92"
                                }
                            },
                        }
                    ],
                    series: [
                       {
                            name: '约拍量',
                            type: 'bar',
                            barGap: '-100%',
                            data: res.ypList
                        },
                        {
                            name: '完拍量',
                            type: 'bar',
                            data: res.spList,
                            // itemStyle: {
                            //     normal: {
                            //        color: 'rgba(0,0,0,0)',
                            //     }
                            // }
                        },
                        {
                            name: '实拍量',
                            type: 'bar',
                            data: res.wpList,
                            // itemStyle: {
                            //     normal: {
                            //        color: 'rgba(0,0,0,0)',
                            //     }
                            // }
                        },
                        {
                            name: '正价完拍单',
                            type: 'bar',
                            data: res.zjwpList
                        },
                        {
                            name: '正价实拍单',
                            type: 'bar',
                            data: res.zjspList
                        },
                        {
                            name: '体验完拍单',
                            type: 'bar',
                            data: res.tywpList
                        },
                        {
                            name: '体验实拍单',
                            type: 'bar',
                            barGap: '-25%',
                            data: res.tyspList
                        }
                        
                    ]
                };
                myChart.setOption(option, true);
            }
        })
    }
    function setshehua2Html(id,data){
        var str= '';
        for (var i = 0; i < data.length; i++) {
            str+='<div class="eba">';
            str+='<div class="eba_title">周值</div>';
            str+='<div class="eba_mcon">';
            if(data[i]['约拍量'] === undefined){
                str+='<div class="eba_mark"><small></small><span>0</span></div>';
            }else{
                str+='<div class="eba_mark"><small></small><span>'+data[i]['约拍量']+'</span></div>';
            }

            if(data[i]['完拍量'] === undefined && data[i]['实拍量'] === undefined){
                str+='<div class="eba_mark"><small></small><span>0/0</span></div>';
            }else if(data[i]['完拍量'] != undefined && data[i]['实拍量'] === undefined){
                str+='<div class="eba_mark"><small></small><span>'+data[i]['完拍量']+'/0</span></div>';
            }else if(data[i]['完拍量'] === undefined && data[i]['实拍量'] != undefined){
                str+='<div class="eba_mark"><small></small><span>0/'+data[i]['实拍量']+'</span></div>';
            }else{
                str+='<div class="eba_mark"><small></small><span>'+data[i]['完拍量']+'/'+data[i]['实拍量']+'</span></div>';
            }

            if(data[i]['正价完拍单'] === undefined && data[i]['正价实拍单'] === undefined){
                str+='<div class="eba_mark"><small></small><span>0/0</span></div>';
            }else if(data[i]['正价完拍单'] != undefined && data[i]['正价实拍单'] === undefined){
                str+='<div class="eba_mark"><small></small><span>'+data[i]['正价完拍单']+'/0</span></div>';
            }else if(data[i]['正价完拍单'] === undefined && data[i]['正价实拍单'] != undefined){
                str+='<div class="eba_mark"><small></small><span>0/'+data[i]['正价实拍单']+'</span></div>';
            }else{
                str+='<div class="eba_mark"><small></small><span>'+data[i]['正价完拍单']+'/'+data[i]['正价实拍单']+'</span></div>';
            }

            if(data[i]['体验完拍单'] === undefined && data[i]['体验实拍单'] === undefined){
                str+='<div class="eba_mark"><small></small><span>0/0</span></div>';
            }else if(data[i]['体验完拍单'] != undefined && data[i]['体验实拍单'] === undefined){
                str+='<div class="eba_mark"><small></small><span>'+data[i]['体验完拍单']+'/0</span></div>';
            }else if(data[i]['体验完拍单'] === undefined && data[i]['体验实拍单'] != undefined){
                str+='<div class="eba_mark"><small></small><span>0/'+data[i]['体验实拍单']+'</span></div>';
            }else{
                str+='<div class="eba_mark"><small></small><span>'+data[i]['体验完拍单']+'/'+data[i]['体验实拍单']+'</span></div>';
            }
            str+='</div>';
            str+='</div>';
        }
        $('#'+id).html(str);
    }

    //上门2
    function wangxuan(){
        // 选片2
        var dom = document.getElementById("wangXuan");
        var myChart = echarts.init(dom);
        var app = {};
        $.ajax({
            type: 'POST',
            data: {},
            url : '/crm/whkk/wangxuan',
            success: function(res){
                $("#zc_4_1").html(res.dataz['网选总实收']);
                $("#zc_4_2").html(res.dataz['新美大']);
                $("#zc_4_3").html(res.dataz['抖音']);
                $("#zc_4_4").html(res.dataz['朋友圈推广']);

                setwangxuanHtml('wangxuanx',res.weekdata);
                option = {
                    tooltip: {
                        trigger: 'axis',
                        axisPointer: {            // 坐标轴指示器，坐标轴触发有效
                            type: 'shadow'        // 默认为直线，可选为：'line' | 'shadow'
                        }
                    },
                    grid: {
                        left: '0%',
                        right: '0%',
                        top: '6%',
                        bottom: '0%',
                        containLabel: true
                    },
                    color: ['#ffaf74','#65fbe3','#fcdd80','#c680ff'],
                    dataset: {
                        dimensions: res.head,
                        source: res.data
                    },
                    xAxis:[
                        {
                            type: 'category', 
                            axisLine:{
                                lineStyle:{
                                    color:'#fff',
                                    width:1
                                }
                            },
                            axisLabel: {
                                interval:0 ,  //控制是否全部显示
                                textStyle: {
                                    fontSize:'10',
                                }
                            }
                        }
                    ],
                    yAxis: [
                        {
                            axisLine:{
                                lineStyle:{
                                    color:'#fff',
                                    width:1
                                }
                            },
                            splitLine: {
                                lineStyle: {
                                    color: "#536d92"
                                }
                            },
                            axisLabel: {
                                interval:0,  //控制是否全部显示
                            },
                            axisLabel:{
                                textStyle: {
                                    fontSize:'10',
                                }
                            }
                        }
                    ],
                    series: [
                        {type: 'bar'},
                        {type: 'bar'},
                        {type: 'bar'},
                        {type: 'bar'}
                    ]
                };
                myChart.setOption(option, true);
            }
        })
    }
    function setwangxuanHtml(id,data){
        var str= '';
        for (var i = 0; i < data.length; i++) {
            str+='<div class="eba">';
            str+='<div class="eba_title">周值</div>';
            str+='<div class="eba_mcon">';
            if(data[i]['网选总实收'] === undefined){
                str+='<div class="eba_mark"><small></small><span>0</span></div>';
            }else{
                str+='<div class="eba_mark"><small></small><span>'+data[i]['网选总实收']+'</span></div>';
            }
            if(data[i]['新美大'] === undefined){
                str+='<div class="eba_mark"><small></small><span>0</span></div>';
            }else{
                str+='<div class="eba_mark"><small></small><span>'+data[i]['新美大']+'</span></div>';
            }
            if(data[i]['抖音'] === undefined){
                str+='<div class="eba_mark"><small></small><span>0</span></div>';
            }else{
                str+='<div class="eba_mark"><small></small><span>'+data[i]['抖音']+'</span></div>';
            }
            if(data[i]['朋友圈推广'] === undefined){
                str+='<div class="eba_mark"><small></small><span>0</span></div>';
            }else{
                str+='<div class="eba_mark"><small></small><span>'+data[i]['朋友圈推广']+'</span></div>';
            }
            str+='</div>';
            str+='</div>';
        }
        $('#'+id).html(str);
    }
    
    wangxuan2();
    //网选2
    function wangxuan2(){
        // 选片2
        var dom = document.getElementById("wangXuan2");
        var myChart = echarts.init(dom);
        var app = {};
        $.ajax({
            type: 'POST',
            data: {},
            url : '/crm/whkk/wangxuan2',
            success: function(res){
                $("#yc_4_1").html(res.dataz['网单总选单数']);
                $("#yc_4_2").html(res.dataz['新美大']);
                $("#yc_4_3").html(res.dataz['抖音']);
                $("#yc_4_4").html(res.dataz['朋友圈推广']);
                $("#yc_4_5").html(res.dataz['网单改期数']);

                setwangxuan2Html('wangxuan2x',res.weekdata);
                option = {
                    tooltip: {
                        trigger: 'axis',
                        axisPointer: {            // 坐标轴指示器，坐标轴触发有效
                            type: 'shadow'        // 默认为直线，可选为：'line' | 'shadow'
                        }
                    },
                    grid: {
                        left: '0%',
                        right: '0%',
                        top: '6%',
                        bottom: '0%',
                        containLabel: true
                    },
                    color: ['#ffaf74','#65fbe3','#fcdd80','#c680ff','#ffa195'],
                    dataset: {
                        dimensions: res.head,
                        source: res.data
                    },
                    xAxis:[
                        {
                            type: 'category', 
                            axisLine:{
                                lineStyle:{
                                    color:'#fff',
                                    width:1
                                }
                            },
                            axisLabel: {
                                textStyle: {
                                    fontSize:'10',
                                }
                            }
                        }
                    ],
                    yAxis: [
                        {
                            axisLine:{
                                lineStyle:{
                                    color:'#fff',
                                    width:1
                                }
                            },
                            splitLine: {
                                lineStyle: {
                                    color: "#536d92"
                                }
                            },
                            axisLabel:{
                                textStyle: {
                                    fontSize:'10',
                                }
                            }
                        }
                    ],

                    series: [
                        {type: 'bar'},
                        {type: 'bar'},
                        {type: 'bar'},
                        {type: 'bar'},
                        {type: 'bar'}
                    ]
                };
                myChart.setOption(option, true);
            }
        })
    }
    function setwangxuan2Html(id,data){
        var str= '';
        for (var i = 0; i < data.length; i++) {
            str+='<div class="eba2">';
            str+='<div class="eba_title2">周值</div>';
            str+='<div class="eba_mcon2">';
            // if(data[i]['库存金额'] === undefined){
            //     str+='<div class="eba_mark"><small></small><span>0</span></div>';
            // }else{
            //     str+='<div class="eba_mark"><small></small><span>'+data[i]['库存金额']+'</span></div>';
            // }
            if(data[i]['网单总选单数'] === undefined){
                str+='<div class="eba_mark"><small></small><span>0</span></div>';
            }else{
                str+='<div class="eba_mark"><small></small><span>'+data[i]['网单总选单数']+'</span></div>';
            }
            if(data[i]['新美大'] === undefined){
                str+='<div class="eba_mark"><small></small><span>0</span></div>';
            }else{
                str+='<div class="eba_mark"><small></small><span>'+data[i]['新美大']+'</span></div>';
            }
            if(data[i]['抖音'] === undefined){
                str+='<div class="eba_mark"><small></small><span>0</span></div>';
            }else{
                str+='<div class="eba_mark"><small></small><span>'+data[i]['抖音']+'</span></div>';
            }
            if(data[i]['朋友圈推广'] === undefined){
                str+='<div class="eba_mark"><small></small><span>0</span></div>';
            }else{
                str+='<div class="eba_mark"><small></small><span>'+data[i]['朋友圈推广']+'</span></div>';
            }
            if(data[i]['网单改期数'] === undefined){
                str+='<div class="eba_mark"><small></small><span>0</span></div>';
            }else{
                str+='<div class="eba_mark"><small></small><span>'+data[i]['网单改期数']+'</span></div>';
            }
            str+='</div>';
            str+='</div>';
        }
        $('#'+id).html(str);
    }


    // // 库存
    // var dom = document.getElementById("kuCun");
    // var myChart = echarts.init(dom);
    // var app = {};
    // option = {
    //     tooltip: {},
    //     grid: {
    //         left: '0%',
    //         right: '0%',
    //         top: '6%',
    //         bottom: '0%',
    //         containLabel: true
    //     },
    //     color: ['#ffaf74','#65fbe3','#fcdd80','#c680ff','#ffa195'],
    //     dataset: {
    //         dimensions: ['product', '2015', '2016', '2017', '2018'],
    //         source: [
    //             {product: '1', '2015': 43, '2016': 85, '2017': 93, '2018': 65},
    //             {product: '2', '2015': 83, '2016': 73, '2017': 55, '2018': 75},
    //             {product: '3', '2015': 86, '2016': 65, '2017': 82, '2018': 55},
    //             {product: '4', '2015': 72, '2016': 53, '2017': 39, '2018': 60},
    //             {product: '5', '2015': 72, '2016': 53, '2017': 39, '2018': 60},
    //             {product: '6', '2015': 72, '2016': 53, '2017': 39, '2018': 60},
    //             {product: '7', '2015': 72, '2016': 53, '2017': 39, '2018': 60},
            
    //             {product: '8', '2015': 43, '2016': 85, '2017': 93, '2018': 65},
    //             {product: '9', '2015': 83, '2016': 73, '2017': 55, '2018': 75},
    //             {product: '10', '2015': 86, '2016': 65, '2017': 82, '2018': 55},
    //             {product: '11', '2015': 72, '2016': 53, '2017': 39, '2018': 60},
    //             {product: '12', '2015': 72, '2016': 53, '2017': 39, '2018': 60},
    //             {product: '13', '2015': 72, '2016': 53, '2017': 39, '2018': 60},
    //             {product: '14', '2015': 72, '2016': 53, '2017': 39, '2018': 60},
                
    //             {product: '15', '2015': 43, '2016': 85, '2017': 93, '2018': 65},
    //             {product: '16', '2015': 83, '2016': 73, '2017': 55, '2018': 75},
    //             {product: '17', '2015': 86, '2016': 65, '2017': 82, '2018': 55},
    //             {product: '18', '2015': 72, '2016': 53, '2017': 39, '2018': 60},
    //             {product: '19', '2015': 72, '2016': 53, '2017': 39, '2018': 60},
    //             {product: '20', '2015': 72, '2016': 53, '2017': 39, '2018': 60},
    //             {product: '21', '2015': 72, '2016': 53, '2017': 39, '2018': 60},
            
    //             {product: '22', '2015': 43, '2016': 85, '2017': 93, '2018': 65},
    //             {product: '23', '2015': 83, '2016': 73, '2017': 55, '2018': 75},
    //             {product: '24', '2015': 86, '2016': 65, '2017': 82, '2018': 55},
    //             {product: '25', '2015': 72, '2016': 53, '2017': 39, '2018': 60},
    //             {product: '26', '2015': 72, '2016': 53, '2017': 39, '2018': 60},
    //             {product: '27', '2015': 72, '2016': 53, '2017': 39, '2018': 60},
    //             {product: '28', '2015': 72, '2016': 53, '2017': 39, '2018': 60},
            
    //             {product: '29', '2015': 43, '2016': 85, '2017': 93, '2018': 65},
    //             {product: '30', '2015': 83, '2016': 73, '2017': 55, '2018': 75},
    //             {product: '31', '2015': 86, '2016': 65, '2017': 82, '2018': 55},
    //             {product: '32', '2015': 72, '2016': 53, '2017': 39, '2018': 60},
    //             {product: '33', '2015': 72, '2016': 53, '2017': 39, '2018': 60},
    //             {product: '34', '2015': 72, '2016': 53, '2017': 39, '2018': 60},
    //             {product: '35', '2015': 72, '2016': 53, '2017': 39, '2018': 60}
    //         ]
    //     },
    //     xAxis:[
    //         {
    //             type: 'category', 
    //             axisLine:{
    //                 lineStyle:{
    //                     color:'#fff',
    //                     width:1
    //                 }
    //             }
    //         }
    //     ],
    //     yAxis: [
    //         {
    //             axisLine:{
    //                 lineStyle:{
    //                     color:'#fff',
    //                     width:1
    //                 }
    //             },
    //             splitLine: {
    //                 lineStyle: {
    //                     color: "#536d92"
    //                 }
    //             }
    //         }
    //     ],

    //     series: [
    //         {type: 'bar'},
    //         {type: 'bar'},
    //         {type: 'bar'},
    //         {type: 'bar'},
    //         {type: 'bar'},
    //         {type: 'bar'}
    //     ]
    // };
    // myChart.setOption(option, true);


    // 第三块内容end
});

