'use strict';
/*var UserID = sessionStorage.getItem("MiaoMuUserID");
var userInfo = JSON.parse(sessionStorage.getItem("miaomuUserInfo"));*/
if(UserID!=null&&UserID!=""){
    var forShow = userInfo.name;
    if(forShow==null||forShow==""){
        forShow = userInfo.mobile;
    }
}
var gyFlag = 1;
var cardFlag=1;

var vm = new Vue({
    methods: {
        init: function init() {
            $.get(url+'/newsweb/selectOrgUsers1', function (list) {
                //console.log(list);
                var MyMarhq = '';
                clearInterval(MyMarhq);
                $('.tbl-body tbody').empty();
                $('.tbl-header tbody').empty();
                var str = '';
                var ID = "";
                var count = 0;
                var Items = [{ "Ranking": list[0].parentName, "City": list[0].code, "SaleIncome": list[0].status, "SaleRough": "296071.96", "SalePlan": "7200000", "PlanFinish": "34.82", "TonOilincome": "264.15", "OilTransform": "29.62", "An": list[0].name, "Mom": "-13.00" }, { "Ranking": list[1].parentName, "City": list[1].code, "SaleIncome": list[1].status, "SaleRough": "93717.83", "SalePlan": "3200000", "PlanFinish": "44.56", "TonOilincome": "366.59", "OilTransform": "11.23", "An": list[1].name, "Mom": "43.00" }, { "Ranking": list[2].parentName, "City": list[2].code, "SaleIncome": list[2].status, "SaleRough": "241071.82", "SalePlan": "3000000", "PlanFinish": "45.74", "TonOilincome": "342.32", "OilTransform": "6.61", "An": list[2].name, "Mom": "7.00" }, { "Ranking": list[3].parentName, "City": list[3].code, "SaleIncome": list[3].status, "SaleRough": "87638.60", "SalePlan": "2700000", "PlanFinish": "36.02", "TonOilincome": "246.03", "OilTransform": "11.56", "An": list[3].name, "Mom": "-18.00" }, { "Ranking": list[4].parentName, "City": list[4].code, "SaleIncome": list[4].status, "SaleRough": "140217.37", "SalePlan": "7200000", "PlanFinish": "13.04", "TonOilincome": "139.44", "OilTransform": "19.23", "An": list[4].name, "Mom": "-48.00" }, { "Ranking": list[5].parentName, "City": list[5].code, "SaleIncome": list[5].status, "SaleRough": "124693.90", "SalePlan": "3700000", "PlanFinish": "20.93", "TonOilincome": "138.87", "OilTransform": "9.44", "An": list[5].name, "Mom": "-44.00" }, { "Ranking": list[6].parentName, "City": list[6].code, "SaleIncome": list[6].status, "SaleRough": "50542.14", "SalePlan": "3600000", "PlanFinish": "18.90", "TonOilincome": "243.60", "OilTransform": "16.95", "An": list[6].name, "Mom": "-49.00" }, { "Ranking": list[7].parentName, "City": list[7].code, "SaleIncome": list[7].status, "SaleRough": "176075.96", "SalePlan": "3000000", "PlanFinish": "20.44", "TonOilincome": "87.09", "OilTransform": "7.97", "An": list[7].name, "Mom": "-24.00" }, { "Ranking": list[8].parentName, "City": list[8].code, "SaleIncome": list[8].status, "SaleRough": "387024.26", "SalePlan": "11000000", "PlanFinish": "5.42", "TonOilincome": "93.58", "OilTransform": "19.06", "An": list[8].name, "Mom": "6.00" }, { "Ranking": list[9].parentName, "City": list[9].code, "SaleIncome": list[9].status, "SaleRough": "68966.73", "SalePlan": "2200000", "PlanFinish": "26.77", "TonOilincome": "193.24", "OilTransform": "11.29", "An": list[9].name, "Mom": "-28.00" }, { "Ranking": list[10].parentName, "City": list[10].code, "SaleIncome": list[10].status, "SaleRough": "137934.72", "SalePlan": "3500000", "PlanFinish": "14.73", "TonOilincome": "95.47", "OilTransform": "8.80", "An": list[10].name, "Mom": "-3.00" }, { "Ranking": list[11].parentName, "City": list[11].code, "SaleIncome": list[11].status, "SaleRough": "85371.46", "SalePlan": "2000000", "PlanFinish": "19.99", "TonOilincome": "114.42", "OilTransform": "11.42", "An": list[11].name, "Mom": "-30.00" }, { "Ranking": list[12].parentName, "City": list[12].code, "SaleIncome": list[12].status, "SaleRough": "20065.14", "SalePlan": "430000", "PlanFinish": "21.06", "TonOilincome": "213.44", "OilTransform": "20.45", "An": list[12].name, "Mom": "-17.00" }, { "Ranking": list[13].parentName, "City": list[13].code, "SaleIncome": list[13].status, "SaleRough": "8743.12", "SalePlan": "250000", "PlanFinish": "19.70", "TonOilincome": "202.67", "OilTransform": "29.95", "An": list[13].name, "Mom": "-6.00" }, { "Ranking": list[14].parentName, "City": list[14].code, "SaleIncome": list[14].status, "SaleRough": "2175.66", "SalePlan": "140000", "PlanFinish": "21.20", "TonOilincome": "730.20", "OilTransform": "25.55", "An": list[14].name, "Mom": "-52.00" }, { "Ranking": list[15].parentName, "City": list[15].code, "SaleIncome": list[15].status, "SaleRough": "2944.97", "SalePlan": "100000", "PlanFinish": "11.89", "TonOilincome": "118.12", "OilTransform": "34.16", "An": list[15].name, "Mom": "-72.00" }];
                $.each(Items, function (i, item) {
                    ID = list[count].orgId;
                    str="<tr><td><a class='aa1'  href='syjh/bussiness_info/"+ID+".html' target='_blank'>"+item.Ranking.slice(0, 15)+"</a></td><td>"+item.City+"</td><td>"+item.SaleIncome+"</td><td>"+item.An.slice(0, 10)+"</td></tr>";
                    //str = '<tr><td><a class="aa1"   abc=' + ID + '>' + item.Ranking.slice(0, 15) + '</a></td><td>' + item.City + '</td><td>' + item.SaleIncome + '</td><td>' + item.An.slice(0, 10) + '</td></tr>';

                    $('#table2 tbody').append(str);
                    count++;
                });

                if (Items.length > 9) {
                    var tblTop;
                    var speedhq;
                    var outerHeight;

                    (function () {
                        var Marqueehq = function Marqueehq() {
                            if (tblTop <= -outerHeight / 2) {
                                tblTop = 0;
                            } else {
                                tblTop -= 1;
                            }
                            $('#table2').css('top', tblTop + 'px');
                        };

                        $('#table2 tbody').html($('#table2 tbody').html() + $('#table2 tbody').html());
                        $('#table2').css('top', '0');
                        tblTop = 0;
                        speedhq = 50; // 数值越大越慢

                        outerHeight = $('#table2 tbody').outerHeight();


                        MyMarhq = setInterval(Marqueehq, speedhq);

                        // 鼠标移上去取消事件
                        $("#table2 tbody").hover(function () {
                            clearInterval(MyMarhq);
                        }, function () {
                            clearInterval(MyMarhq);
                            MyMarhq = setInterval(Marqueehq, speedhq);
                        });
                    })();
                }
            });
        },
        // aa1:function(){
        //     sessionStorage.setItem('id',"aa");
        //     window.location.href="../../三级页/三级供应.html";
        // },
        acceptClick: function acceptClick() {
            //                  alert("dialogOpen");
            dialogClose();
        }
    },
    created: function created() {
        //alert( this.getMacro());
        this.init();
    }
});
//文档就绪
$(function () {
    lbt();
    ADB();
    ZYTT();
    ZPJS();
    YLYH();
    LHSJ();
    YLLW();
    ZLHY();
    LHZB1();
    LHZB2();
    //ZXHY();
    VIP();
    //TJGY();
    selectKeyWord();
    GSMM();
    $(".logo button").click(function () {
        var content = $("#Sou").val();
        var type = $("#selectType").val();
        if(content.trim().length<2){
            layer.tips("请至少输入两个字符","#Sou");
        }else{
            if(type=="供应"){
                window.location.href="spzs/?search="+content;
            }else if(type=="采购"){
                window.location.href="syjh/qiugou.htm?search="+content;
            }else if(type=="企业"){
                window.location.href="qyml/?search="+content;
            }else if(type=="资讯"){
                window.location.href="hyxx/informationSearch.html?search="+content;
            }else if(type=="百科"){
                window.location.href="qyfw/encyclopediaSearch.html?search="+content;
            }
        }
    });
    $(".C5 a").click(function () {
        window.location.href="other/province/"+$(this).text().slice(0,2)+".html";
    });
    GY(1);
    card(1);
});
function ZPJS() {
    $.get(url+"/newsweb/selectOrgUsers23", function (List) {
        var result = "";
        $.each(List, function (i, list) {
            if (i == 8) {
                return false;
            }
            result += "<li><div><a href='qyfw/shownews/"+list.orgId+".html' title='" + list.parentName + "' target='_blank'>" + list.parentName + "</a></div></li>";
        });
        $("#ZPJS").html(result);
    });
}
function YLYH() {
    $.get(url+"/newsweb/selectOrgUsers19", function (List) {
        var result = "";
        $.each(List, function (i, list) {
            if (i == 8) {
                return false;
            }
            result += "<li><div><a href='qyfw/shownews/"+list.orgId+".html' title='" + list.parentName + "' target='_blank'>" + list.parentName + "</a></div></li>";
        });
        $("#YLYH").html(result);
    });
}
function LHSJ() {
    $.get(url+"/newsweb/selectOrgUsers18", function (List) {
        var result = "";
        $.each(List, function (i, list) {
            if (i == 8) {
                return false;
            }
            result += "<li><div><a href='qyfw/shownews/"+list.orgId+".html' title='" + list.parentName + "' target='_blank'>" + list.parentName + "</a></div></li>";
        });
        $("#LHSJ").html(result);
    });
}
function YLLW() {
    $.get(url+"/newsweb/selectOrgUsers7", function (List) {
        var result = "";
        $.each(List, function (i, list) {
            if (i == 8) {
                return false;
            }
            result += "<li><div><a href='qyfw/shownews/"+list.orgId+".html' title='" + list.parentName + "' target='_blank'>" + list.parentName + "</a></div></li>";
        });
        $("#YLLW").html(result);
    });
}
function ZLHY() {
    $.get(url+"/newsweb/selectOrgUsers4", function (List) {
        var result = "";
        $.each(List, function (i, list) {
            if (i == 8) {
                return false;
            }
            result += "<li><div><a href='hyxx/shownews/"+list.orgId+".html' title='" + list.parentName + "' target='_blank'>" + list.parentName + "</a></div></li>";
        });
        $("#ZLHY").html(result);
    });
}
function LHZB1() {
    $.get(url+"/newsweb/selectOrgUsers3", function (List) {
        var result = "";
        $.each(List, function (i, list) {
            if (i == 8) {
                return false;
            }
            result += "<li><div><a href='hyxx/shownews/"+list.orgId+".html' title='" + list.parentName + "' target='_blank'>" + list.parentName + "</a></div></li>";
        });
        $("#LHZB1").html(result);
    });
}
function LHZB2() {
    $.get(url+"/newsweb/selectOrgUsers5", function (List) {
        var result = "";
        $.each(List, function (i, list) {
            if (i == 8) {
                return false;
            }
            result += "<li><div><a href='hyxx/shownews/"+list.orgId+".html' title='" + list.parentName + "' target='_blank'>" + list.parentName + "</a></div></li>";
        });
        $("#LHZB2").html(result);
    });
}
function ZXHY() {
    $.get(url+"/user2019/qyml/listUser", function (List) {
        var result = "";
        $.each(List, function (i, list) {
            if (i == 9) {
                return false;
            }
            result += '<li><a>' + list.user + '</a></li>';
        });
        $("#ul1").html(result);
    });
}
function VIP() {
    $.get(url+"/user2019/qyml/listUser2", function (List) {
        var result = "";
        $.each(List, function (i, list) {
            result += "<li><div><a href='company/vip/"+list.id+".html' target='_blank'>" + list.qymc + "</a></div></li>";
        });
        $("#ul2").html(result);
    });
}
function TJGY() {
    $.get(url+"/newsweb/selectOrgUsers", function (List) {
        var result = "";
        var ID = "";
        var count = 0;
        $.each(List, function (i, list) {
            if (i == 16) {
                return false;
            }
            ID = list.orgId;
            result += "<tr><td><a class='aa1'href='spzs/Show_product/"+ID+".html' target='_blank'>"+list.parentName.slice(0, 15)+"</a></td><td>"+list.code+"</td><td>"+list.status+"</td><td>"+list.name.slice(0, 10)+"</td></tr>";
            //result += '<tr><td><a class="aa1">' + list.parentName.slice(0, 15) + '</a></td><td>' + list.code + '</td><td>' + list.status + '</td><td>' + list.name.slice(0, 10) + '</td></tr>';
            count++;
        });
        var MyMarhq2 = "";
        $("#table1 tbody").html(result);
        if (count > 9) {
            (function () {
                var Marqueehq2 = function Marqueehq2() {
                    if (tblToTop <= -totalHeight / 2) {
                        tblToTop = 0;
                    } else {
                        tblToTop -= 1;
                    }
                    $('#table1').css('top', tblToTop + 'px');
                };

                $('#table1 tbody').html($('#table1 tbody').html() + $('#table1 tbody').html());
                $('#table1').css('top', '0');
                var tblToTop = 0;
                var speedSet = 50; // 数值越大越慢
                var totalHeight = $('#table1 tbody').outerHeight();


                MyMarhq2 = setInterval(Marqueehq2, speedSet);

                // 鼠标移上去取消事件
                $("#table1 tbody").hover(function () {
                    clearInterval(MyMarhq2);
                }, function () {
                    clearInterval(MyMarhq2);
                    MyMarhq2 = setInterval(Marqueehq2, speedSet);
                });
            })();
        }
    });
}

function go(id,type) {
    sessionStorage.setItem("addressActive",type);
    sessionStorage.setItem("contentNewsId",id);
    if(id != ''){
        window.location.href="hyxx/shownews.html";
    } else {
        layer.msg("无详细内容")
    }
}

function go2(id,type) {
    sessionStorage.setItem("addressActive",type);
    sessionStorage.setItem("contentNewsId",id);
    if(id != ''){
        window.location.href="qyfw/shownews.html";
    } else {
        layer.msg("无详细内容")
    }
}

function go3(type) {
    sessionStorage.setItem("addressActive",type);
    sessionStorage.setItem("url",type);
    window.location.href="hyxx/informationIndustryNews.html";
}

function go4(type) {
    sessionStorage.setItem("three_page",type);
    window.location.href="qyfw/encyclopediaThreePage.html";
}

function GY(page) {
    var limit = (page-1)*15;
    $.ajax({
        url:url+"/info/supply/selectForHome",
        data:{"page":limit},
        type: "post",
        dateType: "json",
        async: false,
        success: function (response, status, xhr) {
            var result = "";
            $.each(response,function (i, list) {
                var jg = "面议";
                if(list.cpjg!=null && list.cpjg != ""&& list.cpjg != "0"&& list.cpjg != "无"&& list.cpjg != 0){
                    jg = list.cpjg;
                }
                var pic = list.picture;
                if(pic!=null){
                    pic = formatImgUrl(pic);
                }
                var sm = "";
                var zz = "";
                var db = "";
                var hy = "";
                switch (list.hyjb) {
                    case 5:
                        hy="<img src='images/皇冠级别.png' title='皇冠VIP'>";
                        break;
                    case 4:
                        hy="<img src='images/黄钻级别.png' title='黄钻VIP'>";
                        break;
                    case 3:
                        hy="<img src='images/红钻级别.png' title='红钻VIP'>";
                        break;
                    case 2:
                        hy="<img src='images/绿钻级别.png' title='绿钻VIP'>";
                        break;
                    case 1:

                        break;
                    default:

                        break;
                }
                //if(list.gsid!=null){
                    //var companyInfo  = loadCompany(list.gsid);
                    //if(companyInfo!=null){
                        if(list.gd1==1){
                            sm = "<img src='images/三级详情页供应改身份验证.png' title='已通过实名认证'>";
                        }
                        if(list.less==1){
                            zz = "<img src='images/三级详情页供应改danbao_23.png' title='已通过执照认证'>";
                        }
                        if(list.gd2==1){
                            db = "<img src='images/三级详情页供应改danbao_30.png' title='已缴费担保认证'>"
                        }
                    //}
                //}
                var rz = "";
                if(sm==""&&zz==""&&db==""&&hy==""){
                    rz = "无";
                }
                result +="<div class=\"products\">" +
                   "<div>" +
                   "<ul>" +
                   "<li><a href='spzs/Show_product/"+list.id+".html' target='_blank'><img src=\""+pic+"\"></a></li>" +
                   "<li><a href='spzs/Show_product/"+list.id+".html' target='_blank' class=\"showName\" title='"+list.cpmc+"'>"+list.cpmc.slice(0,8)+"</a><span class=\"hits\">数量:"+list.hits+"</span></li>" +
                   "<li class=\"company\" title='"+list.sccj+"'>"+list.sccj+"</li>" +
                   "<li>认证:"+rz+hy+sm+zz+db+"</li>" +
                   "<li><a href='javascript:void(0);' onclick=\"insertCollection('"+list.cpmc+"','"+list.id+"')\" class=\"collect\"><img src=\"images/三级详情页供应改danbao_34.png\">收藏</a><span class=\"price\">¥"+jg+"</span></li>" +
                   "</ul>" +
                   "</div>" +
                   "</div>";
            });
            $("#showSupply").html(result);
        },
        error: function (e) {
            layer.msg("系统错误,请联系客服!", { icon: 5 });
            console.log("GY方法ajax错误");
            console.log(e.status);
            console.log(e.responseText);
        }
    });
}

function insertCollection(showName,id) {
    if(UserID!=null&&UserID!=""){
        if(checkCollection(id)){
            $.ajax({
                url:url+"/user/collect/insertCollect",
                data:{"shopId":id,"userId":userInfo.id,"type":"供应","time":new Date().toLocaleString(),"showName":showName},
                type: "post",
                dateType: "json",
                async: false,
                success: function (response, status, xhr) {
                    if(response==1){
                        layer.msg("收藏成功!", { icon: 1 });
                    }else{
                        layer.msg("系统错误,请联系客服!", { icon: 5 });
                        console.log("insertCollection!=1");
                    }
                },
                error: function (e) {
                    layer.msg("系统错误,请联系客服!", { icon: 5 });
                    console.log("insertCollection");
                    console.log(e.status);
                    console.log(e.responseText);
                }
            });
        }else{
            layer.msg("您已收藏该商品,不能重复收藏!", { icon: 2 });
        }
    }else{
        layer.confirm('您尚未登录,请前往登录或注册!', {
            btn: ['登录', '注册'] //按钮
        }, function () {
            window.location.href = "reg201206/login06.html";
        }, function () {
            window.location.href = "reg201206/register06.html";
        });
    }
}

function checkCollection(id) {
    var flag =false;
    $.ajax({
        url:url+"/user/collect/checkCollect",
        data:{"shopId":id,"userId":userInfo.id},
        type: "post",
        dateType: "json",
        async: false,
        success: function (response, status, xhr) {
            flag = response;
        },
        error: function (e) {
            layer.msg("系统错误,请联系客服!", { icon: 5 });
            console.log("checkCollection");
            console.log(e.status);
            console.log(e.responseText);
        }
    });
    return flag;
}

function HYP() {
    gyFlag++;
    if(gyFlag>10){ //修改此处数字可修改最大批次
        gyFlag=1;
    }
    GY(gyFlag);
}

function countShow() {
    var total =0;
    $.ajax({
        url:url+"/index/keyWord/countShow",
        data:{},
        type: "post",
        dateType: "json",
        async: false,
        success: function (response, status, xhr) {
            total = response;
        },
        error: function (e) {
            layer.msg("系统错误,请联系客服!", { icon: 5 });
            console.log("countShow");
            console.log(e.status);
            console.log(e.responseText);
        }
    });
    return total;
}

function selectKeyWord() {
    var count = countShow();
    var temp = count%3;
    var num = Math.floor(count/3);
    console.log("字母:"+count);
    console.log("余:"+temp);
    console.log("每列:"+num);
    $.post(url+"/index/keyWord/selectForHome",function (List) {
        if(temp==0){
            var result1="";
            var result2="";
            var result3="";
            $.each(List,function (i, list) {
                var keyword = list.keyword;
                if(keyword==null){
                    keyword = "";
                }
                if(i<num*4){
                    if(i%4==0){
                        result1+="<tr><td><div>"+list.letter+"</div></td>";
                    }
                    result1+="<td><a href='spzs/?search="+keyword+"' target='_blank'>"+keyword+"</a></td>";
                    if((i+1)%4==0){
                        result1+="</tr>";
                    }
                }else if(i<num*8){
                    if(i%4==0){
                        result2+="<tr><td><div>"+list.letter+"</div></td>";
                    }
                    result2+="<td><a href='spzs/?search="+keyword+"' target='_blank'>"+keyword+"</a></td>";
                    if((i+1)%4==0){
                        result2+="</tr>";
                    }
                }else{
                    if(i%4==0){
                        result3+="<tr><td><div>"+list.letter+"</div></td>";
                    }
                    result3+="<td><a href='spzs/?search="+keyword+"' target='_blank'>"+keyword+"</a></td>";
                    if((i+1)%4==0){
                        result3+="</tr>";
                    }
                }
            });
            $("#hot1").html(result1);
            $("#hot2").html(result2);
            $("#hot3").html(result3);
        }else if(temp==1){
            var result1="";
            var result2="";
            var result3="";
            $.each(List,function (i, list) {
                var keyword = list.keyword;
                if(keyword==null){
                    keyword = "";
                }
                if(i<(num+1)*4){
                    if(i%4==0){
                        result1+="<tr><td><div>"+list.letter+"</div></td>";
                    }
                    result1+="<td><a href='spzs/?search="+keyword+"' target='_blank'>"+keyword+"</a></td>";
                    if((i+1)%4==0){
                        result1+="</tr>";
                    }
                }else if(i<(2*num+1)*4){
                    if(i%4==0){
                        result2+="<tr><td><div>"+list.letter+"</div></td>";
                    }
                    result2+="<td><a href='spzs/?search="+keyword+"' target='_blank'>"+keyword+"</a></td>";
                    if((i+1)%4==0){
                        result2+="</tr>";
                    }
                }else{
                    if(i%4==0){
                        result3+="<tr><td><div>"+list.letter+"</div></td>";
                    }
                    result3+="<td><a href='spzs/?search="+keyword+"' target='_blank'>"+keyword+"</a></td>";
                    if((i+1)%4==0){
                        result3+="</tr>";
                    }
                }
            });
            $("#hot1").html(result1);
            $("#hot2").html(result2);
            $("#hot3").html(result3);
        }else if(temp==2){
            var result1="";
            var result2="";
            var result3="";
            $.each(List,function (i, list) {
                var keyword = list.keyword;
                if(keyword==null){
                    keyword = "";
                }
                if(i<(num+1)*4){
                    if(i%4==0){
                        result1+="<tr><td><div>"+list.letter+"</div></td>";
                    }
                    result1+="<td><a href='spzs/?search="+keyword+"' target='_blank'>"+keyword+"</a></td>";
                    if((i+1)%4==0){
                        result1+="</tr>";
                    }
                }else if(i<(num+1)*8){
                    if(i%4==0){
                        result2+="<tr><td><div>"+list.letter+"</div></td>";
                    }
                    result2+="<td><a href='spzs/?search="+keyword+"' target='_blank'>"+keyword+"</a></td>";
                    if((i+1)%4==0){
                        result2+="</tr>";
                    }
                }else{
                    if(i%4==0){
                        result3+="<tr><td><div>"+list.letter+"</div></td>";
                    }
                    result3+="<td><a href='spzs/?search="+keyword+"' target='_blank'>"+keyword+"</a></td>";
                    if((i+1)%4==0){
                        result3+="</tr>";
                    }
                }
            });
            $("#hot1").html(result1);
            $("#hot2").html(result2);
            $("#hot3").html(result3);
        }
    });
}
function card(page) {
    var limit = (page-1)*15;
    $.ajax({
        url:url+"/user2019/qyml/qyCard",
        data:{"page":limit},
        type: "post",
        dateType: "json",
        async: false,
        success: function (response, status, xhr) {
            var result = "";
            $.each(response,function (i, list) {
                var qymc = list.qymc;
                var zycp = list.zycp;
                var sm = "";
                var zz = "";
                var db = "";
                var hy = "";
                switch (list.hyjb) {
                    case 5:
                        hy="<img src='images/皇冠级别.png' title='皇冠VIP'>";
                        break;
                    case 4:
                        hy="<img src='images/黄钻级别.png' title='黄钻VIP'>";
                        break;
                    case 3:
                        hy="<img src='images/红钻级别.png' title='红钻VIP'>";
                        break;
                    case 2:
                        hy="<img src='images/绿钻级别.png' title='绿钻VIP'>";
                        break;
                    case 1:

                        break;
                    default:

                        break;
                }
                if(list.shiming==1){
                    sm = "<img src='images/三级详情页供应改身份验证.png' title='已通过实名认证'>";
                }
                if(list.gs==1){
                    zz = "<img src='images/三级详情页供应改danbao_23.png' title='已通过执照认证'>";
                }
                if(list.danbao==1){
                    db = "<img src='images/三级详情页供应改danbao_30.png' title='已缴费担保认证'>"
                }
                var rz = hy+sm + zz + db;
                if(!rz){
                    rz = '无';
                }
                result += "<div class='card'>" +
                    "<div>" +
                    "<ul>" +
                    "<li title='"+list.qymc+"'><a href='company/vip/"+list.id+".html' target='_blank'>"+qymc+"</a></li>" +
                    "<li>认证:"+rz+"</li>" +
                    "<li title='"+list.zycp+"'>主要供应:"+zycp+"</li>" +
                    "<li>电话:"+list.mobile+"</li>" +
                    "<li>联系人:"+list.name+"</li>" +
                    "<li><a href='company/vip/"+list.id+".html' target='_blank'>进入店铺></a></li>" +
                    "</ul>" +
                    "</div>" +
                    "</div>";
            });
            $("#Cards").html(result);
        },
        error: function (e) {
            layer.msg("系统错误,请联系客服!", { icon: 5 });
            console.log("card");
            console.log(e.status);
            console.log(e.responseText);
        }
    });
}
function changeCard() {
    cardFlag++;
    if(cardFlag>10){ //修改此处数字可修改最大批次
        cardFlag=1;
    }
    card(cardFlag);
}
function lbt() {
    $.ajax({
        url:url+"/lbt/lbtt/selectForHome",
        data:{},
        type: "post",
        dateType: "json",
        async: false,
        success: function (response, status, xhr) {
            if(response.length==4){
                $("#lbt1").html(setLbt(response[0].url));
                $("#lbt2").html(setLbt(response[1].url));
                $("#lbt3").html(setLbt(response[2].url));
                $("#lbt4").html(setLbt(response[3].url));
                $("#lbt1").attr("href",setHref(response[0].blob));
                $("#lbt2").attr("href",setHref(response[1].blob));
                $("#lbt3").attr("href",setHref(response[2].blob));
                $("#lbt4").attr("href",setHref(response[3].blob));
            }else{
                layer.msg("系统错误",{icon:5});
                console.log("轮播图数据库错误");
            }
        },
        error: function (e) {
            layer.msg("系统错误,请联系客服!", { icon: 5 });
            console.log("lbt");
            console.log(e.status);
            console.log(e.responseText);
        }
    });
}
function setLbt(url) {
    if(url==null||url==""){
        return "<div style='width: 1200px;height: 320px;background-color: #7aac4b;color: white'>暂无图片</div>"
    }else{
        return "<img src='"+formatImgUrl(url)+"'>";
    }
}
function setHref(href) {
    if(href==null||href==""){
        return "#";
    }else{
        return href;
    }
}
function ADB() {
    $.ajax({
        url:url+"/ad/adb/selectAll",
        data:{},
        type: "post",
        dateType: "json",
        async: false,
        success: function (response, status, xhr) {
            if(response.length==20){
                $.each(response,function (i, list) {
                   if(i<15){
                       if(list.picture!=null||list.picture!=""){
                           $("#"+list.position).html("<img src='"+formatImgUrl(list.picture)+"'><div style='padding: 2px 4px;color: #ffffff;background-color: rgba(0,0,0,0.3);font-size: 12px;position: absolute;right: 8px;bottom: 8px;border-radius: 5px;height: 21px;width: 32px;opacity: 0.7'>广告</div>");
                           $("#"+list.position).attr("href",setHref(list.link));
                       }
                   }else{
                       return false;
                   }
                });
            }else{
                layer.msg("系统错误",{icon:5});
                console.log("广告位数据库错误");
            }
        },
        error: function (e) {
            layer.msg("系统错误,请联系客服!", { icon: 5 });
            console.log("ADB");
            console.log(e.status);
            console.log(e.responseText);
        }
    });
}
function ZZ(id) {
    var result = false;
    $.ajax({
        url:url+"/user/qyzz/selectqyzz",
        data:{"userid":id},
        type: "post",
        dateType: "json",
        async: false,
        success:function (response, status, xhr) {
            if(response.length!=0){
                if(response[0].flag==1){
                    result = true;
                }
            }
        },
        error:function (e) {
            layer.msg("系统错误,请联系客服!", { icon: 5 });
            console.log("ZZ");
            console.log(e.status);
            console.log(e.responseText);
        }
    });
    return result;
}
function loadCompany(gsid) {
    var companyInfo = null;
    $.ajax({
        url:url+"/user2019/qyml/listchaxungongsi",
        data:{"id":gsid},
        type: "post",
        dateType: "json",
        async: false,
        success: function (response, status, xhr) {
            companyInfo = response[0];
        },
        error: function (e) {
            layer.msg("系统错误,请联系客服!", { icon: 5 });
            console.log("读取公司信息ajax错误");
            console.log(e.status);
            console.log(e.responseText);
        }
    });
    return companyInfo;
}
function ZYTT() {
    $.ajax({
        url:url+"/zytt/tt/listForPage",
        data:{},
        type: "post",
        dateType: "json",
        async: false,
        success: function (response, status, xhr) {
            if(response.length==1){
                var list =response[0];
                var result = "<div class='pull-left C3-img1'><img src='"+formatImgUrl(list.picture)+"'></div>" +
                    "<div class='pull-left C3-text1'>" +
                    "<p>"+list.title+"</p>" +
                    "<p>"+list.content.replace(/{{/g,'<').replace(/}}/g,'>').replace(/<[^>]+>/g,'').slice(0,35)+"...</p>" +
                    "<p><a href='../hyxx/shownews/"+list.newsid+".html' target='_blank'>展开>></a></p>" +
                    "</div>";
                $("#zytt").html(result);
            }
        },
        error: function (e) {
            layer.msg("系统错误,请联系客服!", { icon: 5 });
            console.log("ZYTT");
            console.log(e.status);
            console.log(e.responseText);
        }
    });
}
//各省苗木
function GSMM(){
    $.ajax({
        url:url+"/gsmm/gsmm/listForPage",
        data:{},
        type: "get",
        dateType: "json",
        async: false,
        success: function (response, status, xhr) {
            $("#gsmm1").empty();
            $("#gsmm2").empty();
            $.each(response,function (i, list) {
                if(i<9){
                    $("#gsmm1").append("<td><a href='javascript:void(0);' target='_blank'>"+list.province+"苗木</a></td>");
                }else{
                    $("#gsmm2").append("<td><a href='javascript:void(0);' target='_blank'>"+list.province+"苗木</a></td>");
                }
            });
        },
        error: function (e) {
            layer.msg("系统错误,请联系客服!", { icon: 5 });
            console.log("ZYTT");
            console.log(e.status);
            console.log(e.responseText);
        }
    });
}