<div class="col-sm-24 col-md-12" id="module_mobile_meal">
    <h3>移动成交</h3>
    <div class="row">
        <div class="col-sm-24 col-md-24">
            <ul class="list-unstyled list-inline">
                <li>
                    <label class="checkbox-inline">
                        小组:
                    </label>
                </li>
                <li><label class="checkbox-inline">
                        <input type="checkbox" id="DEI_SNList_1" name="DEI_SNList" value="1" checked> CH直销组
                    </label>
                </li>
                <li>
                    <label class="checkbox-inline">
                        <input type="checkbox" id="DEI_SNList_2" name="DEI_SNList" value="2" checked> CH大客户组
                    </label>
                </li>
                <li>
                    <label class="checkbox-inline">
                        <input type="checkbox" id="DEI_SNList_28" name="DEI_SNList" value="28" checked> AH亚洲项目组
                    </label>
                </li>
                <li>
                    <label class="checkbox-inline">
                        <input type="checkbox" id="DEI_SNList_28" name="DEI_SNList" value="7" checked> 市场推广
                    </label>
                </li>
                <li>
                    <label class="checkbox-inline">
                        <input type="checkbox" id="DEI_SNList_8" name="DEI_SNList" value="8" checked>  德语市场
                    </label>
                </li>
                <li>
                    <label class="checkbox-inline">
                        <input type="checkbox" id="DEI_SNList_9" name="DEI_SNList" value="9" checked> 日语市场
                    </label>
                </li>
                <li>
                    <label class="checkbox-inline">
                        <input type="checkbox" id="DEI_SNList_11" name="DEI_SNList" value="11" checked> 法语市场
                    </label>
                </li>
                <li>
                    <label class="checkbox-inline">
                        <input type="checkbox" id="DEI_SNList_12" name="DEI_SNList" value="12" checked> 西语市场
                    </label>
                </li>
                <li>
                    <label class="checkbox-inline">
                        <input type="checkbox" id="DEI_SNList_20" name="DEI_SNList" value="20" checked> 俄语市场
                    </label>
                </li>
                <li>
                    <label class="checkbox-inline">
                        <input type="checkbox" id="DEI_SNList_21" name="DEI_SNList"" value="21" checked> 意语市场
                    </label>
                </li>
                <li>
                    <label class="checkbox-inline">
                        <input type="checkbox" id="DEI_SNList_10" name="DEI_SNList" value="10"> 商旅市场
                    </label>
                </li>

                <li>
                    <label class="checkbox-inline">
                        <input type="checkbox" id="DEI_SNList_18" name="DEI_SNList" value="18"> CT市场
                    </label>
                </li>
                <li>
                    <label class="checkbox-inline">
                        <input type="checkbox" id="DEI_SNList_16" name="DEI_SNList" value="16"> APP移动项目组
                    </label>
                </li>
                <li>
                    <label class="checkbox-inline">
                        <input type="checkbox" id="DEI_SNList_30" name="DEI_SNList" value="30"> Trippest项目组
                    </label>
                </li>
            </ul>
        </div>
    </div>

    <div class="row">
        <div class="col-sm-4 col-md-4">
            <label class="checkbox-inline">
                <input type="checkbox" name="mobile_deal_ApplydateCheck" id="mobile_deal_ApplydateCheck" value="1" checked>预定日期
            </label>
        </div>
        <div class="col-sm-8 col-md-8">
            <input name="mobile_deal_ApplydateStart" id="mobile_deal_ApplydateStart" type="text" placeholder="开始日期"
                   class="form-control ShowMeTheDatePicker_cn" value="<?php echo date('Y-m-01', time()); ?>">
        </div>
        <div class="col-sm-8 col-md-8">
            <input name="mobile_deal_ApplydateEnd" id="mobile_deal_ApplydateEnd" type="text" placeholder="截至日期"
                   class="form-control ShowMeTheDatePicker_cn" value="<?php echo date('Y-m-t', time()); ?>">
        </div>
        <div class="col-sm-4 col-md-4">
            <button class="btn btn-default" type="button" onclick="updateMobileDeal();">统计</button>
        </div>
    </div>

    <div class="row">
        <div class="col-sm-4 col-md-4">
            <label class="checkbox-inline">
                <input type="checkbox" name="OrderStartdateCheck" id="mobile_deal_OrderStartdateCheck"
                       value="1">出发日期
            </label>
        </div>
        <div class="col-sm-8 col-md-8">
            <input name="mobile_deal_OrderStartdateStart" id="mobile_deal_OrderStartdateStart" type="text"
                   placeholder="开始日期"
                   class="form-control ShowMeTheDatePicker_cn" value="<?php echo date('Y-m-01', time()); ?>">
        </div>
        <div class="col-sm-8 col-md-8">
            <input name="mobile_deal_OrderStartdateEnd" id="mobile_deal_OrderStartdateEnd" type="text"
                   placeholder="截至日期"
                   class="form-control ShowMeTheDatePicker_cn" value="<?php echo date('Y-m-t', time()); ?>">
        </div>
        <div class="col-sm-4 col-md-4">

        </div>
    </div>

    <div class="row">
        <div class="col-sm-24 col-md-24">
            <div class="table-responsive">
                <table class="table table-striped table-hover">
                    <thead>
                    <tr>
                        <th>市场</th>
                        <th>移动订单/总订单</th>
                        <th>移动成交/总成交</th>
                        <th>移动毛利/总毛利</th>
                    </tr>
                    </thead>
                    <tbody id="mobile_deal">

                    </tbody>
                </table>
            </div>
        </div>
    </div>

</div>
<script type="text/javascript">
    function updateMobileDeal() {
        let ApplydateCheck = $('#mobile_deal_ApplydateCheck').prop("checked") ? $('#mobile_deal_ApplydateCheck').val() : 0;
        let ApplydateStart = $('#mobile_deal_ApplydateStart').val();
        let ApplydateEnd = $('#mobile_deal_ApplydateEnd').val();
        let OrderStartdateCheck = $('#mobile_deal_OrderStartdateCheck').prop("checked") ? $('#mobile_deal_OrderStartdateCheck').val() : 0;
        let OrderStartdateStart = $('#mobile_deal_OrderStartdateStart').val();
        let OrderStartdateEnd = $('#mobile_deal_OrderStartdateEnd').val();
        let DEI_SNList = $('#module_mobile_meal input[name="DEI_SNList"]:checked').map(function (index, element) {
            return $(element).val();
        }).get().join(',');//将数组元素连接起来转化为字符串
        if (ApplydateStart == '' || ApplydateEnd == '' || OrderStartdateStart == '' || OrderStartdateEnd == '' || DEI_SNList == '') {
            $.modaldialog.error("请检查必填项");
            return false;
        }

        $.ajax({
            type: "post",
            dataType: "json",
            url: "<?php echo site_url('welcome/show_me_the_data')?>",
            data: {
                "url": '/service-tourdesign/CountYDOrder?ApplydateCheck=' + ApplydateCheck + '&ApplydateStart=' + ApplydateStart + '&ApplydateEnd=' + ApplydateEnd + '%2023:59'
                    + '&OrderStartdateCheck=' + OrderStartdateCheck + '&OrderStartdateStart=' + OrderStartdateStart + '&OrderStartdateEnd=' + OrderStartdateEnd + '%2023:59'
                    + '&DEI_SNList=' + DEI_SNList,
            },
            success: function (data, textStatus) {
                document.getElementById('mobile_deal').innerHTML = '';
                for (let key in data) {
                    let tr = document.createElement('tr');
                    let td_m_group = document.createElement('td');
                    let td_m_order = document.createElement('td');
                    let td_m_deal = document.createElement('td');
                    let td_m_gross = document.createElement('td');
                    td_m_group.innerHTML = data[key].DEI_DepartmentName;
                    td_m_order.innerHTML = data[key].YDOrderNum + ' / ' + data[key].OrderNum + ' (' + (data[key].OrderNumRate * 100).toFixed(1) + '%)';
                    td_m_deal.innerHTML = data[key].YDOrderNumSUC + ' / ' + data[key].OrderNumSUC + ' (' + (data[key].OrderNumSUCRate * 100).toFixed(1) + '%)';
                    td_m_gross.innerHTML = data[key].YDML + ' / ' + data[key].ML + ' (' + (data[key].MLRate * 100).toFixed(1) + '%)';
                    tr.appendChild(td_m_group);
                    tr.appendChild(td_m_order);
                    tr.appendChild(td_m_deal);
                    tr.appendChild(td_m_gross);
                    document.getElementById('mobile_deal').appendChild(tr);
                }
            },
            error: function () {
                $.modaldialog.error("\u53d1\u751f\u9519\u8bef\uff0c\u8bf7\u8054\u7cfbYCC")
            }
        })
    }
</script>
<!-- 移动成交 end-->

