<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/>
    <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
    <title></title>
    <link rel="stylesheet" type="text/css" href="../../css/api.css"/>
    <link rel="stylesheet" href="../../css/aui.css">
    <link rel="stylesheet" href="../../css/style.css">
    <link rel="stylesheet" href="../../script/H5/iosselect.css">
    <style>
        html,body{
            background: #009FE8;
            line-height: normal;
            box-sizing: border-box;
        }
        .api_layout{
            padding: 15px 13px;
        }
        .money{
            text-align: center;
            font-size: 30px;
            color: #fff;
            padding: 5px 0;
            margin: 10px 0 15px 0;
        }
        .ios-select-widget-box header.iosselect-header a.close{ color: #999999;  }
        .date-wrap p{
            width: 145px;
            height: 35px;
            line-height: 35px;
            color: #fff;
            font-size: 16px;
            border: 1px solid #fff;
            margin: auto;
            text-align: center;
            border-radius: 50px;
            position: relative;
        }
        .date-wrap .aui-icon-down{
            font-weight: bold;
            position: absolute;
            top: 0;
            right: 10px;
        }
        /*工资明细*/
        .card{
            background: #fff;
            border-radius: 5px;
            padding: 21px;
            box-sizing: border-box;
            margin-bottom:10px;
        }
        .card-title{
            font-weight:500;
            color:rgba(44,62,80,1);
            font-size: 14px;
            position: relative;
            padding-left: 10px;
            margin-bottom: 15px;
        }
        .card-title:after{
            content: '';
            position: absolute;
            top: 0;
            left: 0;
            width: 3px;
            height: 100%;
            background: #009FE8;
        }
        .card-list{
            height: 300px;
            overflow: hidden;
            overflow-y: scroll;
        }
        .card-list li{
            color: #6C6F74;
            font-size: 14px;
            padding: 10px 0;
            position: relative;
        }
        .card-list li:after{
            content: '';
            position: absolute;
            bottom: 0;
            left: 0;
            width: 100%;
            height: 1px;
            background: #E0E1E2;
        }
    </style>
</head>
<body>
<div class="api_layout">
    <div class="date-wrap">
       <p onclick="fnOpenSelector()">
           <span class="date"></span>
           <i class="aui-iconfont aui-icon-down"></i>
       </p>
    </div>
    <p class="money"></p>
<!--    工资明细-->
    <div class="card">
        <label class="card-title">工资明细</label>
        <ul class="card-list" id="card_list">
            <li class="noContent">暂无内容</li>
        </ul>
    </div>

<!--    收入统计-->
<div class="card">
    <label class="card-title">收入统计</label>
    <div class="" style="width:100%" id="chart">
        <canvas id="weekYield" style="width: 100%;margin-top:10px;"></canvas>
    </div>
</div>
</div>
</body>
</html>
<script type="text/template" id="monthTemplate">
    <li class="flex-space">
        <span>姓名</span>
        <span>{{=it.name}}</span>
    </li>
    <li class="flex-space">
        <span>出勤工日</span>
        <span>{{=it.chu_qing_gong_ri}}</span>
    </li>
    <li class="flex-space">
        <span>出勤工资</span>
        <span>{{=it.chu_qing_gong_zi}}</span>
    </li>
    <li class="flex-space">
        <span>预发年薪</span>
        <span>{{=it.yu_fa_nian_xin}}</span>
    </li>
    <li class="flex-space">
        <span>加班工日</span>
        <span>{{=it.jia_ban_gong_ri}}</span>
    </li>
    <li class="flex-space">
        <span>法定假日加班</span>
        <span>{{=it.fa_ding_jia_ri_jia_ban}}</span>
    </li>
    <li class="flex-space">
        <span>年休假</span>
        <span>{{=it.nian_xiu_jia}}</span>
    </li>
    <li class="flex-space">
        <span>年休假工资</span>
        <span>{{=it.nian_xiu_jia_gong_zi}}</span>
    </li>
    <li class="flex-space">
        <span>工伤假</span>
        <span>{{=it.gong_shang_jia}}</span>
    </li>
    <li class="flex-space">
        <span>工伤工资</span>
        <span>{{=it.gong_shang_gong_zi}}</span>
    </li>
    <li class="flex-space">
        <span>婚假</span>
        <span>{{=it.hun_jia}}</span>
    </li>
    <li class="flex-space">
        <span>婚丧假工资</span>
        <span>{{=it.hun_sang_jia_gong_zi}}</span>
    </li>
    <li class="flex-space">
        <span>护理假</span>
        <span>{{=it.hu_li_jia}}</span>
    </li>
    <li class="flex-space">
        <span>护理假工资</span>
        <span>{{=it.hu_li_jia_gong_zi}}</span>
    </li>
    <li class="flex-space">
        <span>病假</span>
        <span>{{=it.bing_jia}}</span>
    </li>
    <li class="flex-space">
        <span>病假工资</span>
        <span>{{=it.bing_jia_gong_zi}}</span>
    </li>
    <li class="flex-space">
        <span>产假</span>
        <span>{{=it.chan_jia}}</span>
    </li>
    <li class="flex-space">
        <span>井下工日</span>
        <span>{{=it.jin_xia_gong_ri}}</span>
    </li>
    <li class="flex-space">
        <span>井下津贴</span>
        <span>{{=it.jin_xia_jin_tie}}</span>
    </li>
    <li class="flex-space">
        <span>中班工日</span>
        <span>{{=it.zhong_ban_gong_ri}}</span>
    </li>
    <li class="flex-space">
        <span>中班津贴</span>
        <span>{{=it.zhong_ban_jin_tie}}</span>
    </li>
    <li class="flex-space">
        <span>夜班工日</span>
        <span>{{=it.ye_ban_gong_ri}}</span>
    </li>
    <li class="flex-space">
        <span>夜班津贴</span>
        <span>{{=it.ye_ban_jin_tie}}</span>
    </li>
    <li class="flex-space">
        <span>调度晨会补贴</span>
        <span>{{=it.diao_du_chen_hui_bu_tie}}</span>
    </li>
    <li class="flex-space">
        <span>井下高温津贴</span>
        <span>{{=it.jin_xia_gao_wen_jin_tie}}</span>
    </li>
    <li class="flex-space">
        <span>工龄工资</span>
        <span>{{=it.gong_lin_gong_zi}}</span>
    </li>
    <li class="flex-space">
        <span>计件工资</span>
        <span>{{=it.ji_jian_gong_zi}}</span>
    </li>
    <li class="flex-space">
        <span>浮动工资</span>
        <span>{{=it.fu_dong_gong_zi}}</span>
    </li>
    <li class="flex-space">
        <span>保留工资</span>
        <span>{{=it.bao_liu_gong_zi}}</span>
    </li>
    <li class="flex-space">
        <span>内部退养生活费</span>
        <span>{{=it.nei_bu_tui_yang_sheng_huo_fei}}</span>
    </li>
    <li class="flex-space">
        <span>公务交通补贴</span>
        <span>{{=it.gong_wu_jiao_tong_bu_tie}}</span>
    </li>
    <li class="flex-space">
        <span>通讯补贴</span>
        <span>{{=it.tong_xun_tu_tie}}</span>
    </li>
    <li class="flex-space">
        <span>救护津贴</span>
        <span>{{=it.jiu_hu_jin_tie}}</span>
    </li>
    <li class="flex-space">
        <span>职业资格津贴</span>
        <span>{{=it.zhi_ye_zi_ge_jin_tie}}</span>
    </li>
    <li class="flex-space">
        <span>班组长津贴</span>
        <span>{{=it.ban_zu_zhang_jin_tie}}</span>
    </li>
    <li class="flex-space">
        <span>值班补贴</span>
        <span>{{=it.zhi_ban_bu_tie}}</span>
    </li>
    <li class="flex-space">
        <span>专业技术人才津贴</span>
        <span>{{=it.zhuan_ye_ji_shu_ren_cai_jin_tie}}</span>
    </li>
    <li class="flex-space">
        <span>工资调整</span>
        <span>{{=it.gong_zi_tiao_zheng}}</span>
    </li>
    <li class="flex-space">
        <span>奖金</span>
        <span>{{=it.jiang_jin}}</span>
    </li>
    <li class="flex-space">
        <span>应发工资</span>
        <span>{{=it.yin_fa_gong_zi}}</span>
    </li>
    <li class="flex-space">
        <span>误餐补助</span>
        <span>{{=it.wu_can_bu_zhu}}</span>
    </li>
    <li class="flex-space">
        <span>女工卫生费</span>
        <span>{{=it.nv_gong_wei_sheng_fei}}</span>
    </li>
    <li class="flex-space">
        <span>劳模津贴</span>
        <span>{{=it.lao_mo_jin_tie}}</span>
    </li>
    <li class="flex-space">
        <span>应发福利费</span>
        <span>{{=it.jin_fa_fu_li_fei}}</span>
    </li>
    <li class="flex-space">
        <span>应发工资合计</span>
        <span>{{=it.yin_fa_gong_zi_he_ji}}</span>
    </li>
    <li class="flex-space">
        <span>其它扣款</span>
        <span>{{=it.qi_ta_kou_kuan}}</span>
    </li>
    <li class="flex-space">
        <span>补扣以前年度个税</span>
        <span>{{=it.bu_kou_yi_qian_nian_du_ge_shui}}</span>
    </li>
    <li class="flex-space">
        <span>医疗保险个人实缴</span>
        <span>{{=it.yi_liao_bao_xian_ge_ren_shi_jiao}}</span>
    </li>
    <li class="flex-space">
        <span>大额医疗个人实缴</span>
        <span>{{=it.da_e_yi_liao_ge_ren_shi_jiao}}</span>
    </li>
    <li class="flex-space">
        <span>住房公积金个人实缴</span>
        <span>{{=it.zhu_fang_gong_ji_jin_ge_ren_shi_jiao}}</span>
    </li>
    <li class="flex-space">
        <span>失业保险个人实缴</span>
        <span>{{=it.shi_ye_bao_xian_ge_ren_shi_jiao}}</span>
    </li>
    <li class="flex-space">
        <span>养老保险个人实缴</span>
        <span>{{=it.yang_lao_bao_xian_ge_ren_shi_jiao}}</span>
    </li>
    <li class="flex-space">
        <span>企业年金个人实缴</span>
        <span>{{=it.qi_ye_nian_jin_ge_ren_shi_jiao}}</span>
    </li>
    <li class="flex-space">
        <span>本月应纳税额</span>
        <span>{{=it.ben_yue_yin_na_shui_e}}</span>
    </li>
    <li class="flex-space">
        <span>实发工资</span>
        <span>{{=it.shi_fa_gong_zi}}</span>
    </li>
</script>
<script type="text/template" id="chartTemplate">
</script>
<script type="text/javascript" src="../../script/api.js"></script>
<script type="text/javascript" src="../../script/H5/iosselect.js"></script>
<script type="text/javascript" src="../../script/H5/timeselector.js"></script>
<script type="text/javascript" src="../../script/doT.min.js"></script>
<script type="text/javascript" src="../../script/f2.js"></script>
<script src="../../script/config.js" charset="utf-8"></script>
<script type="text/javascript">
    var myDate = new Date();
    var  year= myDate.getFullYear();
    var  months= myDate.getMonth()+1;
    var  date = year+'/'+months;
    var jobID = '';
    var flag = false;
    apiready = function () {
        var info = $api.getStorage('data');
            jobID = JSON.parse(info).data.user.staff_num;
            $api.html($api.dom('.date'),year+'年'+months+'月')
            getDutyDate(jobID,year,months);
            getWagesChart(jobID,year);
    };
    var num = 0;
    function getDutyDate(id,year1,month1) {
      api.showProgress({
        title: '',
        text: '加载中...',
        modal: true
      });
      var params={
        month:year1+'-'+(month1<10?'0'+month1:month1),
        staff_num:id
      }
        $http.fnReuestDataNologing(UrlRouter.getWagesDe,'','post',params,function (ret, err) {
            if (ret.code === 0) {
              $api.html($api.dom('.money'), ret.data.shi_fa_gong_zi);
              $apis.html(card_list,'#monthTemplate',ret.data);
              api.hideProgress()
            }else {
              api.hideProgress()
            }
        })
    }
    // 时间
    function fnOpenSelector(){
        var  month= myDate.getMonth()+1;
        var  dates = year+'/'+month;
        timeSelector.fnOpenSelector({
            title: '日期选择',
            sureText: '确定',
            isShowUnit: true,
            itemShowCount: 5,
            itemHeight: 55,
            date: flag == true? date:dates
        }, function(ret) {
            // console.log('122121');
            var  year1= ret.date.getFullYear();
            var  month1= ret.date.getMonth()+1;
            $api.html($api.dom('.date'),year1+'年'+month1+'月')
            getDutyDate(jobID,year1,month1)
        })
    }
    //图表
    function getWagesChart(id,year1) {
      var params={
        year:year1,
        staff_num:id
      }
    $http.fnReuestDataNologing(UrlRouter.getWagesChart,'','post',params,function (ret, err) {
      if (ret.code === 0) {
        var data = ret.data;
        var chart = new F2.Chart({
            id: 'weekYield',
            height: 210,
            pixelRatio: window.devicePixelRatio
          });
          chart.source(data, {
            'value': {
              tickCount: 5
            }
        });
        chart.coord({
           transposed: false
        });
        chart.tooltip({
          showItemMarker: false,
          onShow: function onShow(ev) {
            const items = ev.items;
            items[0].name = null;
            items[0].name = '工资';
            items[0].value = '¥ ' + items[0].value;
          }
        });
        chart.interval().position('month*value');
        chart.render();
      }
    })
    }
</script>
