luo
2023-09-23 6357f89bf38b83b779e233249c2b0e480b78e164
cloud-server-management/src/main/webapp/static/modular/system/coursePackage/coursePackage_info.js
@@ -15,6 +15,33 @@
};
CoursePackageInfo.openDia = function (i) {
        let index = layer.open({
            type: 2,
            title: '编辑',
            area: ['80%', '80%'], //宽高
            fix: false, //不固定
            maxmin: true,
            content: Feng.ctxPath + '/coursePackage/conpun/'+i
        });
        this.layerIndex = index;
};
CoursePackageInfo.openDia1 = function (i) {
    var ids = $("#counpons"+i).val()
        console.log($("#counpons"+i).val())
    let index = layer.open({
        type: 2,
        title: '编辑',
        area: ['80%', '80%'], //宽高
        fix: false, //不固定
        maxmin: true,
        content: Feng.ctxPath + '/coursePackage/conpun1'+'/'+i+'?conpunids='+ids
    });
    this.layerIndex = index;
};
/**
 * 提交添加用户
 */
@@ -29,7 +56,16 @@
    let siteId = $('#siteId').val();
    let coachId = $('#coachId').val();
    let maxSubscribeNumber = $('#maxSubscribeNumber').val();
    let classStartTime = $('#classStartTime').val();
    let codeTime = $('#codeTime').val();
    // let classStartTime = JSON.stringify($('#classStartTime').val());
    var inputElements = document.querySelectorAll('input[name="classStartTime"]');
    let classStartTime =  JSON.stringify(Array.from(inputElements).map(function(element) {
        return element.value;
    }))
    let classWeeks = '';
    $('input[name="classWeeks"]:checked').each(function (index, e) {
        classWeeks += $(e).val() + ";";
@@ -40,15 +76,17 @@
    let sort = $('#sort').val();
    let validDays = $('#validDays').val();
    let price = [];
    $('#price>.form-group').each(function (i, e) {
    $('#price > .form-group').each(function (i, e) {
        let classHours = $($(e).find(".classNumber_span input[class='classNumber']")[0]).val();
        let cash = $($(e).find(".cash_span input[class='cash']")[0]).val();
        let paiCoin = $($(e).find(".paiCoin_span input[class='paiCoin']")[0]).val();
        let counpons = $($(e).find(".counpons")).val();
        price.push({
            classHours: classHours,
            cashPayment: typeof cash == "undefined" ? 0 : cash,
            playPaiCoin: typeof paiCoin == "undefined" ? 0 : paiCoin
        })
            playPaiCoin: typeof paiCoin == "undefined" ? 0 : paiCoin,
            couponIds: typeof counpons == "undefined" ? 0 : counpons
        });
    });
    if(null == provinceCode || '' == provinceCode){
        Feng.error("所在省不能为空");
@@ -79,6 +117,10 @@
        return
    }
    if(null == maxSubscribeNumber || '' == maxSubscribeNumber){
        Feng.error("最多预约人数不能为空");
        return
    }
    if(null == codeTime || '' == codeTime){
        Feng.error("最多预约人数不能为空");
        return
    }
@@ -120,8 +162,10 @@
        siteId: siteId,
        coachId: coachId,
        maxSubscribeNumber: maxSubscribeNumber,
        classStartTime: classStartTime.split(" - ")[0],
        classEndTime: classStartTime.split(" - ")[1],
        classStartTime: classStartTime,
        codeTime:codeTime,
        // classStartTime: classStartTime.split(" - ")[0],
        // classEndTime: classStartTime.split(" - ")[1],
        classWeeks: classWeeks,
        coverDrawing: coverDrawing,
        detailDrawing: detailDrawing,
@@ -162,6 +206,8 @@
    let siteId = $('#siteId').val();
    let coachId = $('#coachId').val();
    let maxSubscribeNumber = $('#maxSubscribeNumber').val();
    let codeTime = $('#codeTime').val();
    let classStartTime = $('#classStartTime').val();
    let classWeeks = '';
    $('input[name="classWeeks"]:checked').each(function (index, e) {
@@ -172,15 +218,21 @@
    let introduceDrawing = $('#introduceDrawing').val();
    let sort = $('#sort').val();
    let validDays = $('#validDays').val();
    // let counpons = $($(e).find(".counpons")).val();
    let price = [];
    $('#price>.form-group').each(function (i, e) {
        let classHours = $($(e).find(".classNumber_span input[class='classNumber']")[0]).val();
        let cash = $($(e).find(".cash_span input[class='cash']")[0]).val();
        let paiCoin = $($(e).find(".paiCoin_span input[class='paiCoin']")[0]).val();
        let counpons = $($(e).find(".counpons")).val();
        price.push({
            classHours: classHours,
            cashPayment: typeof cash == "undefined" ? 0 : cash,
            playPaiCoin: typeof paiCoin == "undefined" ? 0 : paiCoin
            playPaiCoin: typeof paiCoin == "undefined" ? 0 : paiCoin,
            couponIds: typeof counpons == "undefined" ? 0 : counpons
        })
    });
    if(null == provinceCode || '' == provinceCode){
@@ -213,6 +265,9 @@
    }
    if(null == maxSubscribeNumber || '' == maxSubscribeNumber){
        Feng.error("最多预约人数不能为空");
        return
    }  if(null == codeTime || '' == codeTime){
        Feng.error("扣除课时不能为空");
        return
    }
    if(null == classStartTime || '' == classStartTime){
@@ -254,6 +309,8 @@
        siteId: siteId,
        coachId: coachId,
        maxSubscribeNumber: maxSubscribeNumber,
        codeTime: codeTime,
        classStartTime: classStartTime.split(" - ")[0],
        classEndTime: classStartTime.split(" - ")[1],
        classWeeks: classWeeks,
@@ -344,7 +401,7 @@
            paiCoin = true;
        }
    })
    var i =  $('#price > div').length+1
    let htmlStr = '' +
        '<div class="form-group">\n' +
        '                        <label class="col-sm-3 control-label">*课时数:</label>\n' +
@@ -357,13 +414,19 @@
        if(paiCoin){
            htmlStr += '玩湃币支付:<input class="paiCoin" type="number" min="0" placeholder="请输入金额" style="width: 110px;background-color: #FFFFFF;background-image: none;border: 1px solid #e5e6e7;border-radius: 1px;color: inherit;padding: 6px 12px;"> 币&nbsp;&nbsp;&nbsp;&nbsp;\n';
        }
        htmlStr += '</span> <i class="fa fa-trash-o" style="font-size:24px" onclick="removePrice(this)"></i>\n' +
        '</div>\n' +
    htmlStr += '<button type="button" class="btn btn-info " onclick="CoursePackageInfo.openDia('+i+')" id="ensure">\n' +
        '    <i class="fa fa-check"></i>&nbsp;优惠卷\n' +
        '</button>';
    htmlStr += '</span> <i class="fa fa-trash-o" style="font-size:24px" onclick="removePrice(this)"></i>\n' +
        '</div>\n' +'<input type="text" class = "counpons" id = "counpons'+i+'" >'+i+
        '</div>';
    $('#price').append(htmlStr);
}
function removePrice(e){
    $(e).parent('div').parent('div').remove();
}