

let el = {
    id:'#id'
};



// 保存配额
function savePurchaseMethod(call) {
    var purchaseMethod = $("#purchaseMethod option:selected").val();

    if ( purchaseMethod === null || purchaseMethod === undefined || purchaseMethod === '' || purchaseMethod === '0'){
        layer.msg('请选择采购方式');
        return ;
    }
    let loadIndex = layer.load(2);
    $.ajax({
        url: g.ctx + 'pc/inquiry/purchase/apply/bill/detail/rest/updateDetailMethod',
        type: "POST",
        contentType: 'application/json',
        data: JSON.stringify({
            id: $(el.id).val(),
            purchaseMethod: purchaseMethod
        }),
        success: function (data) {
            layer.close(loadIndex);
            // if (data) {
            //     parent.layer.msg('保存成功', {icon: 1, time: 2000});
            //     closeLayer();
            // } else {
            //     parent.layer.msg('保存失败：' + data.msg, {icon: 2, time: 2000});
            // }
            call();
        },
        error: function (data) {
            layer.close(loadIndex);
            topWin.layer.alert(data.responseJSON.message, {icon: 2});
        }
    });

}

/**
 * 关闭弹框
 */
function closeLayer() {
    parent.layer.closeAll();
}
