certificateIssuance.js 4.75 KB
var list;
var houseInfo;
layui.use('element', function () {
    let element = layui.element;
});
$(function () {
    addTabs('#wssq')
    setAcceptFlow(GetQueryString('bsm_slsq'), GetQueryString('businessno'));
    if (business.sqfs == '1') {
        $('#sqfs').text('单方申请')
    } else {
        $('#sqfs').text('双方申请')
    }
    list = getApplyRecord(GetQueryString('bsm_slsq'), GetQueryString('businessno'));
    console.log(666, list)
    // 领证方式
    if (list.lzfs == '1') {
        $('.mail').hide();
    } else {
        $('.scene').hide();
    }
    if (list.sqrlb == '1') {
        $('#acceptance_info h3').text('权利人信息');
    } else {
        $('#acceptance_info h3').text('义务人信息');
    }
    // 房屋信息
    houseInfo = getFDCQ2(GetQueryString('bsm_slsq'));
    $('#typesPower p').text(list.qllxmc);
    $('#businessType p').text(list.shortname);
    $('#acceptanceNumber p').text(list.wwsqbh);
    $('#dateAcceptance p').text(list.sqrq);
    $('#unitNumber p').text(houseInfo.bdcdyh);
    $('#titleCertificate p').text(houseInfo.bdcqzh);
    $('#beLocated p').text(houseInfo.fdzl);
    $('#area p').text(houseInfo.jzmj);
    // 买方信息
    var listItem;
    let userInfo = [];
    userInfo.push(getItem('myCookie'));
    if (list.sqrList && list.sqrList.length > 0) {
        for (var i = 0; i < list.sqrList.length; i++) {
            listItem = '<li>'
            listItem += '<p><span>姓名</span>:' + list.sqrList[i].sqrmc + '</p>'
            if (list.sqrList[i].sqrzj == 1) {
                listItem += '<p><span>证件类型</span>:身份证</p>'
            }
            listItem += '<p><span>证件号码</span>:' + list.sqrList[i].zjhm + '</p>'
            listItem += '<p><span>联系电话</span>:' + list.sqrList[i].dhhm + '</p>'
            $('#informationList').append(listItem)
        }
    } else {
        for (var i = 0; i < userInfo.length; i++) {
            listItem = '<li>'
            listItem += '<p><span>姓名</span>:' + userInfo[i].username + '</p>'
            if (userInfo[i].zjzl == 1) {
                listItem += '<p><span>证件类型</span>:身份证</p>'
            }
            listItem += '<p><span>证件号码</span>:' + userInfo[i].zjhm + '</p>'
            listItem += '<p><span>联系电话</span>:' + userInfo[i].phone + '</p>'
            $('#informationList').append(listItem)
        }
    }
    // 确定按钮
    if (list.ajzt != 6) {
        $('#complete').append('<p>如您已经完成办理请点击确定</p>' +
            '<button type="button" class="layui-btn completeAudit layui-btn-radius layui-btn-normal">确定</button>')
    }else {
        $('#complete').append(
            '<button type="button" class="layui-btn completed-button layui-btn-radius layui-btn-normal">已完成</button>');
    }
})

$(document).on("click", ".completeAudit", function (e) {
    _completeBusiness();
})

// 完成办理
function _completeBusiness() {
    $.ajax({
        type: "post",  //提交方式  
        url: portal.api_url + "/portal/ApplyBusinessService/completeBusiness",//路径  
        dataType: "json",
        data: {
            'bsmSlsq': GetQueryString('bsm_slsq')
        },
        //数据,这里使用的是Json格式进行传输  
        success: function (result) {//返回数据根据结果进行相应的处理           
            if (result.code == 200) {
                layui.use('layer', function () {
                    layer.msg(result.message);
                });
                _completePage(GetQueryString('bsm_slsq'), GetQueryString('businessno'));
                $('#complete').empty()
                $('#complete').append(
                    '<button type="button" class="layui-btn completed-button layui-btn-radius layui-btn-normal">已完成</button>');
            }
        }
    });
}

function _completePage(bsm_slsq, businessno) {
    var nextStepIndex;
    $.each(business.stepList, function (index, item) {
        if (item.stepState == 1) {
            nextStepIndex = index;
            return;
        }
    });
    var datajson = {
        "bsmSlsq": bsm_slsq,
        "businessNo": businessno,
        "stepNo": business.stepList[nextStepIndex].stepno
    };
    //更新当前流程所处环节
    $.ajax({
        type: "post",  //提交方式  
        contentType: 'application/json',
        url: portal.api_url + "/portal/FillInformation/updateStepNo",//路径  
        dataType: "json",
        async: false,
        data: JSON.stringify(datajson),
        //数据,这里使用的是Json格式进行传输  
        success: function (result) {//返回数据根据结果进行相应的处理
            if (result.code == 200) {
                setAcceptFlow(GetQueryString('bsm_slsq'), GetQueryString('businessno'));
            }
        }
    });
}