let company_name = $('#gongsi_name').val();
let company_id = $('#company_id').val();
// let shengid_h = $('#shengid')?.val()?.replace(/\s*/g, '');
// let gongsi_id_h = $('#gongsi_id')?.val()?.replace(/\s*/g, '');
let yearDataFrom = false;
let is_new = 0;
let lks_table_id =0;
let lks_company_id =0;
function getQueryVariable(variable) {
    var query = window.location.search.substring(1);
    var vars = query.split("&");
    for (var i = 0; i < vars.length; i++) {
        var pair = vars[i].split("=");
        if (pair[0] == variable) {
            return pair[1];
        }
    }
    return '';
};
var test = getQueryVariable('test') || '';
$(function () {
    $('#show_more').on('click', function () {
        let val = $('#show_more').data('value');
        if (val == 1) {
            $('#show_more').data('value', 2);
            $('#show_more').html('收起');
            $('#intro_new').removeClass('intro_new');
        } else {
            $('#show_more').data('value', 1);
            $('#show_more').html('展开');
            $('#intro_new').addClass('intro_new');
        }
    });
});

function shwoHtmlJS(argument) {
    $.ajax({
        url: '//e.12580.tv/api/info/company_detail_api',
        // url: '//e.12580.tv/api/info/info',
        method: 'GET',
        data: {
            // biaoid: shengid_h,
            // gsid: gongsi_id_h,
            company_id: company_id,
            test:test
        },
        success: function (res) {
            is_new = res.is_new;
            lks_company_id = res.company_id;
            lks_table_id = res.table_id;
            // 工商信息
            setHtml0(res.data.basic);
            // 股东信息
            setHtml1(res.data.shareholders);
            // 主要人员
            setHtml2(res.data.director);
            // 变更信息
            setHtml3(res.data.change);
            // 企业年报
            setHtml4(res.data.year);
            $('body .show_free').on('click', function () {
                if ($(this).find('span').text() == '免费查看') {
                    getCode($(this).attr('data-case'));
                    if ($(this).attr('data-from') == 'open') {
                        // yearDataFrom = true
                    }
                }

            });
        },
    });
}

shwoHtmlJS();

//
function setHtml0(arr, change = false) {
    let html1 = `<div class="register detail_list">
        <table class="tab-item" align="center" cellpadding="0" cellspacing="0" border="0">
            <tbody>
                <tr>
                    <th>注册资本</th>
                    <td>
                        ${arr.zhuceziben || '-'}
                    </td>
                    <th>实缴资本</th>
                    <td>
                        ${arr.zhuceziben || '-'}
                    </td>
                </tr>
                <tr>
                    <th>成立日期</th>
                    <td>
                        ${arr.chenglishijian || '-'}
                    </td>
                    <th>统一社会信用代码</th>
                    <td>
                        ${arr.credit_code || '-'}
                    </td>
                </tr>
                <tr>
                    <th>组织机构代码</th>
                    <td>
                        ${arr.orgno || '-'}
                    </td>
                    <th>工商注册号</th>
                    <td>
                        ${arr.registrtion_number || '-'}
                    </td>
                </tr>
                <tr>
                    <th>经营状态</th>
                    <td>
                        ${arr.state || '-'}
                    </td>
                    <th>行业</th>
                    <td>
                        ${arr.suoshuhangye || '-'}
                    </td>
                </tr>
                <tr>
                    <th>企业类型</th>
                    <td>
                        ${arr.qiyeleixing || '-'}
                    </td>
                    <th>所属地区</th>
                    <td>
                        ${arr.district || '-'}
                    </td>
                </tr>
                <tr>
                    <th>登记机关</th>
                    <td>
                        ${arr.check_org || '-'}
                    </td>
                    <th>核准日期</th>
                    <td>
                        ${arr.approval_date || '-'}
                    </td>
                </tr>
                <tr>
                    <th>营业期限</th>
                    <td>
                        ${arr.from_date || '-'}
                    </td>
                    <th>人员规模</th>
                    <td>
                        ${arr.yuangongrenshu || '-'}
                    </td>
                </tr>
                <tr>
                    <th>参保人数</th>
                    <td colspan="11">
                        ${arr.coverage || '-'}
                    </td>
                </tr>
                <tr>
                    <th>曾用名</th>
                    <td colspan="11">
                        ${arr.originalname || '-'}
                    </td>
                </tr>
                <tr>
                    <th>企业地址</th>
                    <td colspan="11">
                        ${arr.dizhi || '-'}
                    </td>
                </tr>
                <tr>
                    <th>经营范围</th>
                    <td colspan="11">
                        ${arr.suoshuhangye || '-'}
                    </td>
                </tr>
            </tbody>
        </table>
    </div>`;
    $('#section_table').html(html1);
}

// 股东信息
function setHtml1(arr, change = false) {
    let html1 = '';
    // 股东信息
    if (arr.length > 0) {
        html1 = `<div class="shareholder-content">
                    <table align="center" cellpadding="0" cellspacing="0" border="0">
                        <thead>
                            <tr>
                                <th>序号</th>
                                <th>股东名称</th>
                                <th>持股比例</th>
                                <th>认缴出资额</th>
                            </tr>
                        </thead>
                        <tbody>`;
        arr.forEach((item, index) => {
            html1 += `<tr>
                                        <td>${index + 1}</td>
                                        <td>
                                            <div class="name">
                                                <span class="span1">
                                                ${item.name.slice(0, 2)}
                                                </span>
                                                <span class="span2">
                                                ${item.name}
                                                </span>
                                            </div>
                                        </td>
                                        <td>${item.sub_rate || '-'}</td>
                                        <td>${item.sub_money || '-'}</td>
                                    </tr>`;
        });


        html1 += `</tbody>
                    </table>
                </div>`;
    } else {
        html1 = ` <div class="gdxx_div">
                <img src="/static/pc/companyIntro/images/gdxx_new.png" alt="">
                <div class="show_free" data-case="2">
                 ${change ? '<img src="/static/pc/companyIntro/images/loading.png" alt="" class="load_img">' : "<span>免费查看</span>"
            }
                </div>
              </div>`;


    }
    if (change) {
        $('#basic-shareholders').next().replaceWith(html1);
        if ($('.gdxx_div .show_free').length > 0) {
            let timeSet = setTimeout(function () {
                clearTimeout(timeSet);
                $('.gdxx_div .show_free').html('<span>暂无数据</span>');
            }, 2000);
        }
    } else {
        $('#basic-shareholders').after(html1);
    }

}

// 主要人员
function setHtml2(arr, change = false) {
    let html2 = '';
    if (arr.length > 0) {
        html2 = `<div class="shareholder-content">
                    <table align="center" cellpadding="0" cellspacing="0" border="0">
                        <thead>
                            <tr>
                                <th>序号</th>
                                <th>姓名</th>
                                <th>职位</th>
                            </tr>
                        </thead>
                        <tbody>`;
        arr.forEach((item, index) => {
            html2 += `<tr>
                                        <td>${index + 1}</td>
                                        <td>
                                            <div class="name">
                                                <span class="span1">
                                                ${item.fname}
                                                </span>
                                                <span class="span2">
                                                ${item.name}
                                                </span>
                                            </div>
                                        </td>
                                        <td>${item.title || '-'}</td>
                                    </tr>`;
        });


        html2 += `</tbody>
                    </table>
                </div>`;
    } else {
        html2 = `<div class='html2_div'>
                        <ul class="main_peop_new">
                          <li>
                            <div class="title">
                              <span class="tit1">刘</span>
                              <span class="tit2">刘某某</span>
                            </div>
                            <div class="tip_desc">
                              <span class="tip1">职位</span>
                              <span class="tip2">经理，董事长</span>
                            </div>
                          </li>
                          <li>
                            <div class="title">
                              <span class="tit1">陈</span>
                              <span class="tit2">陈某某</span>
                            </div>
                            <div class="tip_desc">
                              <span class="tip1">职位</span>
                              <span class="tip2">董事</span>
                            </div>
                          </li>
                          <li>
                            <div class="title">
                              <span class="tit1">李</span>
                              <span class="tit2">李某某</span>
                            </div>
                            <div class="tip_desc">
                              <span class="tip1">职位</span>
                              <span class="tip2">监事</span>
                            </div>
                          </li>
                          <li>
                            <div class="title">
                              <span class="tit1">张</span>
                              <span class="tit2">张某某</span>
                            </div>
                            <div class="tip_desc">
                              <span class="tip1">职位</span>
                              <span class="tip2">--</span>
                            </div>
                          </li>
                          <li>
                            <div class="title">
                              <span class="tit1">张</span>
                              <span class="tit2">张某某</span>
                            </div>
                            <div class="tip_desc">
                              <span class="tip1">职位</span>
                              <span class="tip2">--</span>
                            </div>
                          </li>
                        </ul>
                        <div class="show_free" data-case="3">
                         ${change ? '<img src="/static/pc/companyIntro/images/loading.png" alt="" class="load_img">' : "<span>免费查看</span>"
            }
                        </div>
                      </div>`;
    }
    if (change) {
        $('#basic-directors').next().replaceWith(html2);
        if ($('.html2_div .show_free').length > 0) {
            let timeSet = setTimeout(function () {
                clearTimeout(timeSet);
                $('.html2_div .show_free').html('<span>暂无数据</span>');
            }, 2000);
        }
    } else {
        $('#basic-directors').after(html2);
    }

}

// 变更信息
function setHtml3(arr, change = false) {
    let html3 = '';
    if (arr.length > 0) {
        html3 = `<div class="shareholder-content">
        <table align="center" cellpadding="0" cellspacing="0" border="0">
            <thead>
                <tr>
                    <th>序号</th>
                    <th>变更日期</th>
                    <th>变更项目</th>
                    <th>变更前</th>
                    <th>变更后</th>
                </tr>
            </thead>
            <tbody>`;
        arr.forEach((item, index) => {
            html3 += `<tr>
                            <td>${index + 1}</td>
                            <td class="time">
                            ${item.date}
                            </td>
                            <td>${item.name}</td>
                            <td>${item.old}</td>
                            <td>
                            ${item.new}
                            </td>
                        </tr>`;
        });


        html3 += `</tbody>
        </table>
    </div>`;
    } else {
        html3 = `
                 <div class="bgxx_div">
                    <img src="/static/pc/companyIntro/images/bgxx_new.png" alt="">
                    <div class="show_free" data-case="4">
                     ${change ? '<img src="/static/pc/companyIntro/images/loading.png" alt="" class="load_img">' : "<span>免费查看</span>"
            }
                    </div>
                  </div>`;
    }
    if (change) {
        $('#basic-change').next().replaceWith(html3);
        if ($('.bgxx_div .show_free').length > 0) {
            let timeSet = setTimeout(function () {
                clearTimeout(timeSet);
                $('.bgxx_div .show_free').html('<span>暂无数据</span>');
            }, 2000);
        }
    } else {
        $('#basic-change').after(html3);
    }
}

// 企业年报
function setHtml4(arr, change = false) {
    let html4 = '';
    if (arr.length > 0) {
        html4 = `<div class="section_year">`;
        arr.forEach((item) => {
            if (item.type == 1) {
                yearDataFrom = true;
            }
            html4 += `<span  class="section_year_span" data-real='1' data-regon='${item.company_regno}' data-year='${item.date}'>
                      <p>${item.date}年度报告</p>
                      <p class="time">${item.date}年度</p>
                    </span>`;
        });
        html4 += `</div>`;
    } else {
        html4 = `
                <div class="html4_div">
                <div class="section_year">
                <span  class="section_year_span test">
                  <p>2017年度报告</p>
                  <p class="time">2017-06-13</p>
                </span>
                <span  class="section_year_span test">
                  <p>2018年度报告</p>
                  <p class="time">2018-06-13</p>
                </span>
                <span  class="section_year_span test">
                  <p>2019年度报告</p>
                  <p class="time">2019-06-13</p>
                </span>
                <span  class="section_year_span test">
                  <p>2020年度报告</p>
                  <p class="time">2020-06-13</p>
                </span>
                <span  class="section_year_span test">
                  <p>2021年度报告</p>
                  <p class="time">2021-06-13</p>
                </span>
                 <span  class="section_year_span test">
                  <p>2022年度报告</p>
                  <p class="time">2022-06-13</p>
                </span>
                 <span  class="section_year_span test">
                  <p>2023年度报告</p>
                  <p class="time">2023-06-13</p>
                </span>
              </div>
              <div class="show_free" data-case="5" data-from="open">
               ${change ? '<img src="/static/pc/companyIntro/images/loading.png" alt="" class="load_img">' : "<span>免费查看</span>"
            }
              </div>
              </div>
                `;

    }
    if (change) {
        $('#basic-annual').next().replaceWith(html4);
        if ($('.html4_div .show_free').length > 0) {
            let timeSet = setTimeout(function () {
                clearTimeout(timeSet);
                $('.html4_div .show_free').html('<span>暂无数据</span>');
            }, 2000);
        }
    } else {
        $('#basic-annual').after(html4);
    }
    $('body .section_year .section_year_span').on('click', function () {
        if ($(this).attr('data-real') != 1) {
            return;
        }
        if (yearDataFrom) {
            appendPopYearFromTian($(this).attr('data-year'));
        } else {
            appendPopYear($(this).attr('data-regon'), $(this).attr('data-year'));
        }

    });
}

// cookie 存 minutes:后过期时间（单位分钟）
function setCookie(name, value, minutes) {
    let date = new Date();
    date.setTime(date.getTime() + minutes * 60 * 1000);
    const expires = 'expires=' + date.toUTCString();
    document.cookie = name + '=' + value + ';' + expires + ';path=/';
}

// cookie 取
function getCookie(name) {
    const cookies = document.cookie.split(';');
    for (let i = 0; i < cookies.length; i++) {
        let cookie = cookies[i].trim();
        if (cookie.substring(0, name.length + 1) == name + '=') {
            return decodeURIComponent(cookie.substring(name.length + 1));
        }
    }
    return null;
}

// 获取时间戳
function getTimeStamp() {
    //   var timestamp = getCookie('timestamp_likuso');
    //   if (timestamp != null) {
    //     return timestamp;
    //   } else {
    var timestamp = Date.now();
    timestamp = Math.floor(timestamp / 1000);
    setCookie('timestamp_likuso', timestamp, 8);
    return timestamp;
    //   }
}

// 获取天眼查code
function getCode(caseIndex) {
    $.ajax({
        type: 'get',
        url: '//e.12580.tv/api/LksInfo/getCode',
        data: {
            time: getTimeStamp(),
            test:test
        },
        success: function (response) {
            if (response.code == 200) {
                console.log(getTimeStamp(), response.data, getTimeStamp().toString().slice(-2));
                let key = $.md5(
                    getTimeStamp() + response.data + getTimeStamp().toString().slice(-2),
                );
                console.log(key);
                getData(caseIndex, key);
            } else {
                if (caseIndex == 2) {
                    setHtml1([], true);
                } else if (caseIndex == 3) {
                    setHtml2([], true);
                } else if (caseIndex == 4) {
                    setHtml3([], true);
                } else if (caseIndex == 5) {
                    setHtml4([], true);
                }
            }
        },
        error: function (xhr, status, error) {
            if (caseIndex == 2) {
                setHtml1([], true);
            } else if (caseIndex == 3) {
                setHtml2([], true);
            } else if (caseIndex == 4) {
                setHtml3([], true);
            } else if (caseIndex = 5) {
                setHtml4([], true);
            }
        },
    });
}

// 获取天眼查data
function getData(caseIndex, key) {
    $.ajax({
        type: 'get',
        url: '//e.12580.tv/api/LksInfo/getData',
        data: {
            time: getTimeStamp(),
            code: caseIndex,
            lksKey: key,
            lks_table_id: lks_table_id,
            lks_company_id: lks_company_id,
            // company_id: company_id,
            company_name: company_name,
            test:test
        },
        success: function (response) {
            let arr = response.data ? response.data : [];
            if (caseIndex == 2) {
                setHtml1(arr, true);
            } else if (caseIndex == 3) {
                setHtml2(arr, true);
            } else if (caseIndex == 4) {
                setHtml3(arr, true);
            } else if (caseIndex == 5) {
                setHtml4(arr, true);
            }
        },
        error: function (xhr, status, error) {
            if (caseIndex == 2) {
                setHtml1([], true);
            } else if (caseIndex == 3) {
                setHtml2([], true);
            } else if (caseIndex == 4) {
                setHtml3([], true);
            } else if (caseIndex == 5) {
                setHtml4([], true);
            }
        },
    });
}

function appendPopYear(regno, year) {
    $.ajax({
        url: '//e.12580.tv/api/info/year_data',
        method: 'GET',
        data: {
            company_regno: regno,
            year: year,
            is_new:is_new,
            test:test
        },
        headers: {
            'Accept': 'application/json',
        },
        success: function (response) {
            console.log(response);
            if (response.status == 1) {
                showMaskScr(response.data);
            } else {
                showTipMask();
            }
        },
        error: function () {
            showTipMask();
        }
    });
}

function appendPopYearFromTian(date) {
    $.ajax({
        url: '//e.12580.tv/api/LksInfo/getAnnualreportDetail',
        method: 'GET',
        data: {
            // biaoid: shengid_h,
            // gsid: gongsi_id_h,
            lks_table_id: lks_table_id,
            lks_company_id: lks_company_id,
            date: date,
            company_id: company_id,
            test:test
        },
        headers: {
            'Accept': 'application/json',
        },
        success: function (response) {
            console.log(response);
            if (response.code == 200) {
                showMaskScr(response.data);
            } else {
                showTipMask();
            }
        },
        error: function () {
            showTipMask();
        }
    });
}

function showMaskScr(info) {
    console.log(info);
    let html = ` <div class="year_detail">
                    <div class="year_main">
                    <div class="year_mess">
                        <h6 class="title">${info.company_name} ${info.date} 年度报告</h6>
                        <h5 class="table_title">基本信息</h5>
                        <ul class="basic_mess mb40">
                        <li>
                            <span class="s1 bgf3">企业名称</span>
                            <span class="s2 ">${info.company_name}</span>
                            <span class="s1 bgf3">统一社会信用代码</span>
                            <span class="s2 ">${info.company_regno}</span>
                        </li>
                        <li>
                            <span class="s1 bgf3">企业经营状态</span>
                            <span class="s2 ">${info.basic_open_status}</span>
                            <span class="s1 bgf3">从业人数</span>
                            <span class="s2 ">${info.basic_employee_num}</span>
                        </li>
                        <li>
                            <span class="s1 bgf3">企业联系电话</span>
                            <span class="s2 ">${info.basic_phone}</span>
                            <span class="s1 bgf3">是否有网站或网店</span>
                            <span class="s2 ">${info.web_list.length > 0 ? '是' : '否'}</span>
                        </li>
                        <li>
                            <span class="s1 bgf3">企业电子邮箱</span>
                            <span class="s2 ema">${info.basic_email}</span>
                            <span class="s1 bgf3">邮政编码</span>
                            <span class="s2 ">${info.basic_post_code}</span>
                        </li>
                        <li>
                            <span class="s1 bgf3">企业地址</span>
                            <span class="s2 ">${info.basic_address}</span>
                            <span class="s1 bgf3">企业是否有投资信息或购买其他公司股权</span>
                            <span class="s2 ">${info.is_outbound_investment ? info.is_outbound_investment : '-'}</span>
                        </li>
                        </ul>
                        ${showWebList(info.web_list)}
                        ${showShareholderList(info.shareholder_list)}
                        
                        <h5 class="table_title">企业资产状况信息</h5>
                        <ul class="basic_mess mb40">
                        <li>
                            <span class="s1 bgf3">资产总额</span>
                            <span class="s2 ">${info.total_assets ? info.total_assets : '-'}</span>
                            <span class="s1 bgf3">所有者权益合计</span>
                            <span class="s2 ">${info.total_equity ? info.total_equity : '-'}</span>
                        </li>
                        <li>
                            <span class="s1 bgf3">销售总额</span>
                            <span class="s2 ">${info.total_sales ? info.total_sales : '-'}</span>
                            <span class="s1 bgf3">利润总额</span>
                            <span class="s2 ">${info.total_profit ? info.total_profit : '-'}</span>
                        </li>
                        <li>
                            <span class="s1 bgf3">营业总收入中主营业务收入</span>
                            <span class="s2 ">${info.prime_bus_profit ? info.prime_bus_profit : '-'}</span>
                            <span class="s1 bgf3">净利润</span>
                            <span class="s2 ">${info.retained_profit ? info.retained_profit : '-'}</span>
                        </li>
                        <li>
                            <span class="s1 bgf3">纳税总额</span>
                            <span class="s2 ">${info.total_tax ? info.total_tax : '-'}</span>
                            <span class="s1 bgf3">负债总额</span>
                            <span class="s2 ">${info.total_liability ? info.total_liability : '-'}</span>
                        </li>
            
                        </ul>
                        <h5 class="table_title">社保信息</h5>
                        <ul class="basic_mess">
                        <li>
                            <span class="s1 bgf3">城镇职工基本养老保险</span>
                            <span class="s3 ">${info.endowment_insurance ? info.endowment_insurance : '-'}</span>
                            <span class="s1 bgf3">职工基本医疗保险</span>
                            <span class="s3 ">${info.medical_insurance ? info.medical_insurance : '-'}</span>
                            <span class="s1 bgf3">生育保险</span>
                            <span class="s3 ">${info.maternity_insurance ? info.maternity_insurance : '-'}</span>
                        </li>
                        <li>
                            <span class="s1 bgf3">失业保险</span>
                            <span class="s3 ">${info.unemployment_insurance ? info.unemployment_insurance : '-'}</span>
                            <span class="s1 bgf3">工伤保险</span>
                            <span class="s4 ">${info.employment_injury_insurance ? info.employment_injury_insurance : '-'}</span>
                        </li>
            
                        </ul>
                        <ul class="pro_money">
                        <li>
                            <span class="p1 bgf3">单位缴费基数</span>
                            <div class="p2">
                            <span class="br">单位参加城镇职工基本养老保险缴费基数</span>
                            <span class="br">单位参加失业保险缴费基数</span>
                            <span class="br">单位参加职工基本医疗保险缴费基数</span>
                            <span class="br">单位参加生育保险缴费基数</span>
                            </div>
                            <div class="p2">
                            <span>${info.endowment_insurance_base ? info.endowment_insurance_base : '-'}</span>
                            <span>${info.unemployment_insurance_base ? info.unemployment_insurance_base : '-'}</span>
                            <span>${info.medical_insurance_base ? info.medical_insurance_base : '-'}</span>
                            <span>${info.maternity_insurance_base ? info.maternity_insurance_base : '-'}</span>
                            </div>
                        </li>
                        <li>
                            <span class="p1 bgf3">本期实际缴费金额</span>
                            <div class="p2">
                            <span class="br">参加城镇职工基本养老保险本期实际缴费金额</span>
                            <span class="br">参加失业保险本期实际缴费金额</span>
                            <span class="br">参加职工基本医疗保险本期实际缴费金额</span>
                            <span class="br">参加工伤保险本期实际缴费金额</span>
                            <span class="br">参加生育保险本期实际缴费金额</span>
                            </div>
                            <div class="p2">
                            <span>${info.endowment_insurance_pay_amount ? info.endowment_insurance_pay_amount : '-'}</span>
                            <span>${info.unemployment_insurance_pay_amount ? info.unemployment_insurance_pay_amount : '-'}</span>
                            <span>${info.medical_insurance_pay_amount ? info.medical_insurance_pay_amount : '-'}</span>
                            <span>${info.employment_injury_insurance_pay_amount ? info.employment_injury_insurance_pay_amount : '-'}</span>
                            <span>${info.maternity_insurance_pay_amount ? info.maternity_insurance_pay_amount : '-'}</span>
                            </div>
                        </li>
                        <li>
                            <span class="p1 bgf3 bb">单位累计欠缴金额</span>
                            <div class="p2">
                            <span class="br ">单位参加城镇职工基本养老保险累计欠缴金额</span>
                            <span class="br ">单位参加失业保险累计欠缴金额</span>
                            <span class="br ">单位参加职工基本医疗保险累计欠缴金额</span>
                            <span class="br ">单位参加工伤保险累计欠缴金额</span>
                            <span class="br bb">单位参加生育保险累计欠缴金额</span>
                            </div>
                            <div class="p2">
                            <span class="">${info.endowment_insurance_owe_amount ? info.endowment_insurance_owe_amount : '-'}</span>
                            <span class="">${info.unemployment_insurance_owe_amount ? info.unemployment_insurance_owe_amount : '-'}</span>
                            <span class="">${info.medical_insurance_owe_amount ? info.medical_insurance_owe_amount : '-'}</span>
                            <span class="">${info.employment_injury_insurance_owe_amount ? info.employment_injury_insurance_owe_amount : '-'}</span>
                            <span class="bb">${info.maternity_insurance_owe_amount ? info.maternity_insurance_owe_amount : '-'}</span>
                            </div>
                        </li>
                        </ul>
                    </div>
                    </div>
            </div>`;
    $('.year_mask .year_scroll').html(html);

    $('.year_mask').fadeIn();
    $('.year_mask').css('display', 'flex');
    $(document).ready(function () {
        $('.basic_mess li').each(function () {
            var maxHeight_basic = 0;
            $(this).find('span').each(function () {
                console.log();
                var height = $(this).outerHeight(true); // 包括margin和border
                if (height > maxHeight_basic) {
                    maxHeight_basic = height;
                }
            });
            $(this).css('height', maxHeight_basic + 'px');
            $(this).find('span').css('height', maxHeight_basic + 'px');
        });
    });

    $('.close_year').on('click', function () {
        $('.year_mask').fadeOut();
        $('.year_mask').css('display', 'none');
    });
}

function showTipMask() {
    $('.mask_tip').fadeIn();
    let showTime = setTimeout(() => {
        clearTimeout(showTime);
        $('.mask_tip').fadeOut();
    }, 2000);
}

function showWebList(list) {
    console.log(list);
    let html = '';
    if (list.length > 0) {
        html += `  <h5 class="table_title">网站或网店信息</h5>
                                      <ul class="door_mess mb40">
                                        <li class="bgf3">
                                          <span class="d1">序号</span>
                                          <span class="d2">类型</span>
                                          <span class="d3">名称</span>
                                          <span class="d4">网址</span>
                                        </li>`;
        list.forEach((item, index) => {
            html += `<li>
                          <span class="d1">${index + 1}</span>
                          <span class="d2">${item.web_type}</span>
                          <span class="d3">${item.name}</span>
                          <span class="d4">${item.website}</span>
                        </li>`;
        });
        html += '</ul>';
    }
    return html;
}

function showShareholderList(list) {
    let html = '';
    if (list.length > 0) {
        html += `<h5 class="table_title">股东及出资信息</h5>
                <ul class="door_mess mb40">
                <li class="bgf3">
                    <span class="g1">序号</span>
                    <span class="g2">股东名称</span>
                    <span class="g3">认缴出资额</span>
                    <span class="g4">认缴出资日期</span>
                    <span class="g4">认缴出资方式</span>
                    <span class="g4">实缴出资额</span>
                    <span class="g4">实缴出资日期</span>
                    <span class="g4">实缴出资方式</span>
                </li>`;
        list.forEach((item, index) => {
            html += `<li class="bgf3">
                        <span class="g1">${index + 1}</span>
                        <span class="g2">
                        <span>${item.name.slice(0, 2)}</span>
                        <span>${item.name}</span>
                        </span>
                        <span class="g3">${item.subscribe_amount}</span>
                        <span class="g4">${item.subscribe_time}</span>
                        <span class="g4">${item.subscribe_type}</span>
                        <span class="g4">${item.paid_amount}</span>
                        <span class="g4">${item.paid_time}</span>
                        <span class="g4">${item.paid_type}</span>
                    </li>`;
        });
        html += '</ul>';
    }
    return html;
}
$('#faLvSuSong,#jingYingFenXian,#zhaoTouBiao').click(function(){
    // $('.app-pup').show();
    $('.WX').click();
})