New file |
| | |
| | | /** |
| | | * 用户详情对话框(可用于添加和修改对话框) |
| | | */ |
| | | var CoursePackageDiscount = { |
| | | userInfoData: {}, |
| | | coursePackagePaymentConfig: {} |
| | | }; |
| | | |
| | | |
| | | |
| | | /** |
| | | * 关闭此对话框 |
| | | */ |
| | | CoursePackageDiscount.close = function () { |
| | | parent.layer.close(window.parent.CoursePackage.layerIndex); |
| | | }; |
| | | CoursePackageDiscount.close1 = function () { |
| | | parent.layer.close(window.parent.TCompetition.layerIndex); |
| | | }; |
| | | |
| | | CoursePackageDiscount.audit = function () { |
| | | var id = $("#id").val(); |
| | | var type = $("#type").val(); |
| | | if (type=="未通过"){ |
| | | Feng.error("当前状态不能再次审核!") |
| | | return ; |
| | | } |
| | | let audit = document.querySelector('input[name="r1"]:checked').value; |
| | | let text = $("#text").val() |
| | | if(audit==3){ |
| | | if(text==''){ |
| | | Feng.info("请输入拒绝理由") |
| | | return false; |
| | | } |
| | | } |
| | | var ajax = new $ax(Feng.ctxPath + "/tDiscount/auditDiscount", function (data) { |
| | | if (data.code == 200) { |
| | | Feng.success("操作成功!"); |
| | | window.parent.TCompetition.table.refresh(); |
| | | CoursePackageDiscount.close1(); |
| | | } else if(data=="repeat"){ |
| | | Feng.error("请勿重复操作"); |
| | | }else { |
| | | return Feng.error(data.msg); |
| | | } |
| | | }, function (data) { |
| | | return Feng.error("操作失败!"); |
| | | }); |
| | | ajax.set("id", id); |
| | | ajax.set("audit", audit); |
| | | ajax.set("text", text); |
| | | ajax.start(); |
| | | layer.closeAll(); |
| | | } |
| | | /** |
| | | * 提交修改 |
| | | */ |
| | | CoursePackageDiscount.editSubmit = function () { |
| | | //提交信息 |
| | | var ajax = new $ax(Feng.ctxPath + "/coursePackage/setCoursePackageDiscount", function (data) { |
| | | if(data.code == 200){ |
| | | Feng.success("编辑成功!"); |
| | | CoursePackageDiscount.close(); |
| | | window.parent.CoursePackage.table.refresh(); |
| | | }else{ |
| | | Feng.error(data.msg); |
| | | } |
| | | }, function (data) { |
| | | Feng.error("编辑失败!" + data.responseJSON.message + "!"); |
| | | }); |
| | | ajax.set('json', JSON.stringify(CoursePackageDiscount.coursePackagePaymentConfig)); |
| | | ajax.set('id', $('#id').val()); |
| | | ajax.start(); |
| | | }; |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | function addPrice(type){ |
| | | let index = $('#classHours').find('button[checked]').attr('index'); |
| | | if(type == 3){ |
| | | let ll = $('#limitedTimeDiscount .limitedTimeDiscount').length; |
| | | let htmlStr = |
| | | ' <div class="form-group limitedTimeDiscount" index="' + ll + '">' + |
| | | ' <div class="col-sm-2"></div>\n' + |
| | | ' <div class="col-sm-8" style="border: 1px solid; padding: 20px;">\n' + |
| | | ' <div class="form-group">\n' + |
| | | ' <label class="col-sm-2 control-label">折扣有效期:</label>\n' + |
| | | ' <div class="col-sm-9">\n' + |
| | | ' <input class="startAndEndDay" style="width: 300px;background-color: #FFFFFF;background-image: none;border: 1px solid #e5e6e7;border-radius: 1px;color: inherit;padding: 6px 12px;"/>' + |
| | | ' </div>\n' + |
| | | ' <div class="col-sm-1"><i class="fa fa-trash-o" style="font-size:24px;color: red;" onclick="removePrice(3, this)"></i></div>\n' + |
| | | ' </div>' + |
| | | ' <div class="form-group">\n' + |
| | | ' <label class="col-sm-2 control-label">*折扣时间:</label>\n' + |
| | | ' <div class="col-sm-5">\n' + |
| | | ' <input class="time" style="width: 200px;background-color: #FFFFFF;background-image: none;border: 1px solid #e5e6e7;border-radius: 1px;color: inherit;padding: 6px 12px;"/>\n' + |
| | | ' </div>\n' + |
| | | ' </div>' + |
| | | ' <div class="form-group">\n' + |
| | | ' <label class="col-sm-2 control-label"></label>\n' + |
| | | ' <div class="col-sm-8" style="margin-top: 6px;">\n' + |
| | | ' <input type="checkbox" name="week" value="1" onclick="addPriceValue(3, this, \'weeks\')"/> 周一 ' + |
| | | ' <input type="checkbox" name="week" value="2" onclick="addPriceValue(3, this, \'weeks\')"/> 周二 ' + |
| | | ' <input type="checkbox" name="week" value="3" onclick="addPriceValue(3, this, \'weeks\')"/> 周三 ' + |
| | | ' <input type="checkbox" name="week" value="4" onclick="addPriceValue(3, this, \'weeks\')"/> 周四 ' + |
| | | ' <input type="checkbox" name="week" value="5" onclick="addPriceValue(3, this, \'weeks\')"/> 周五 ' + |
| | | ' <input type="checkbox" name="week" value="6" onclick="addPriceValue(3, this, \'weeks\')"/> 周六 ' + |
| | | ' <input type="checkbox" name="week" value="7" onclick="addPriceValue(3, this, \'weeks\')"/> 周日 ' + |
| | | ' </div>\n' + |
| | | ' </div>' + |
| | | ' <div class="form-group">\n' + |
| | | ' <label class="col-sm-2 control-label">*现金支付:</label>\n' + |
| | | ' <div class="col-sm-4">\n' + |
| | | ' <input type="number" class="price" onblur="addPriceValue(3, this, \'cashPayment\')" min="0" placeholder="请输入折扣后支付价格" style="width: 180px;background-color: #FFFFFF;background-image: none;border: 1px solid #e5e6e7;border-radius: 1px;color: inherit;padding: 6px 12px;"/> ¥\n' + |
| | | ' </div>\n' + |
| | | ' </div>' + |
| | | ' </div>' + |
| | | ' </div>'; |
| | | |
| | | $('#limitedTimeDiscount').append(htmlStr); |
| | | let arr = CoursePackageDiscount.coursePackagePaymentConfig[index].coursePackageDiscount; |
| | | for(let k in arr){ |
| | | if(arr[k].type == 3){ |
| | | arr[k].content.push({}) |
| | | } |
| | | } |
| | | lay('.startAndEndDay').each(function(i, e){ |
| | | laydate.render({ |
| | | elem: this |
| | | ,type: 'datetime' |
| | | ,range: true |
| | | ,done: function(value, date, endDate){ |
| | | let index = $('#classHours').find('button[checked]').attr('index'); |
| | | let obj = CoursePackageDiscount.coursePackagePaymentConfig[index]; |
| | | let ii = $(e).parent('div').parent('div').parent('div').parent('div').attr('index'); |
| | | for (let i = 0; i < obj.coursePackageDiscount.length; i++) { |
| | | if(type == obj.coursePackageDiscount[i].type){ |
| | | let jsonArray = obj.coursePackageDiscount[i].content; |
| | | for (let j = 0; j < jsonArray.length; j++) { |
| | | if(j == ii){ |
| | | let arr = value.split(" - "); |
| | | obj.coursePackageDiscount[i].content[j]['startDate'] = arr[0]; |
| | | obj.coursePackageDiscount[i].content[j]['endDate'] = arr[1]; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | }); |
| | | }); |
| | | lay('.time').each(function(i, e){ |
| | | laydate.render({ |
| | | elem: this |
| | | ,type: 'time' |
| | | ,range: true |
| | | ,done: function(value, date, endDate){ |
| | | let index = $('#classHours').find('button[checked]').attr('index'); |
| | | let obj = CoursePackageDiscount.coursePackagePaymentConfig[index]; |
| | | let ii = $(e).parent('div').parent('div').parent('div').parent('div').attr('index'); |
| | | for (let i = 0; i < obj.coursePackageDiscount.length; i++) { |
| | | if(type == obj.coursePackageDiscount[i].type){ |
| | | let jsonArray = obj.coursePackageDiscount[i].content; |
| | | for (let j = 0; j < jsonArray.length; j++) { |
| | | if(j == ii){ |
| | | let arr = value.split(" - "); |
| | | obj.coursePackageDiscount[i].content[j]['startTime'] = arr[0]; |
| | | obj.coursePackageDiscount[i].content[j]['endTime'] = arr[1]; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | }); |
| | | }); |
| | | } |
| | | if(type == 4){ |
| | | let ll = $('#complimentaryClass .complimentaryClass').length; |
| | | let htmlStr = |
| | | ' <div class="form-group complimentaryClass" index="' + ll + '">' + |
| | | ' <div class="col-sm-2"></div>\n' + |
| | | ' <div class="col-sm-8" style="border: 1px solid; padding: 20px;">\n' + |
| | | ' <div class="form-group">\n' + |
| | | ' <label class="col-sm-2 control-label">*赠送有效期:</label>\n' + |
| | | ' <div class="col-sm-9">\n' + |
| | | ' <input class="startAndEndDay" style="width: 300px;background-color: #FFFFFF;background-image: none;border: 1px solid #e5e6e7;border-radius: 1px;color: inherit;padding: 6px 12px;"/>' + |
| | | ' </div>\n' + |
| | | ' <div class="col-sm-1"><i class="fa fa-trash-o" style="font-size:24px;color: red;" onclick="removePrice(4, this)"></i></div>\n' + |
| | | ' </div>' + |
| | | ' <div class="form-group">\n' + |
| | | ' <label class="col-sm-2 control-label">*赠送时间:</label>\n' + |
| | | ' <div class="col-sm-5">\n' + |
| | | ' <input class="time" style="width: 200px;background-color: #FFFFFF;background-image: none;border: 1px solid #e5e6e7;border-radius: 1px;color: inherit;padding: 6px 12px;"/>\n' + |
| | | ' </div>\n' + |
| | | ' </div>' + |
| | | ' <div class="form-group">\n' + |
| | | ' <label class="col-sm-2 control-label"></label>\n' + |
| | | ' <div class="col-sm-8" style="margin-top: 6px;">\n' + |
| | | ' <input type="checkbox" name="week" value="1" onclick="addPriceValue(4, this, \'weeks\')"/> 周一 ' + |
| | | ' <input type="checkbox" name="week" value="2" onclick="addPriceValue(4, this, \'weeks\')"/> 周二 ' + |
| | | ' <input type="checkbox" name="week" value="3" onclick="addPriceValue(4, this, \'weeks\')"/> 周三 ' + |
| | | ' <input type="checkbox" name="week" value="4" onclick="addPriceValue(4, this, \'weeks\')"/> 周四 ' + |
| | | ' <input type="checkbox" name="week" value="5" onclick="addPriceValue(4, this, \'weeks\')"/> 周五 ' + |
| | | ' <input type="checkbox" name="week" value="6" onclick="addPriceValue(4, this, \'weeks\')"/> 周六 ' + |
| | | ' <input type="checkbox" name="week" value="7" onclick="addPriceValue(4, this, \'weeks\')"/> 周日 ' + |
| | | ' </div>\n' + |
| | | ' </div>' + |
| | | ' <div class="form-group">\n' + |
| | | ' <label class="col-sm-2 control-label">*赠送课时数:</label>\n' + |
| | | ' <div class="col-sm-4">\n' + |
| | | ' <input type="number" class="price" onblur="addPriceValue(4, this, \'hour\')" min="0" placeholder="请输入赠送课时数" style="width: 180px;background-color: #FFFFFF;background-image: none;border: 1px solid #e5e6e7;border-radius: 1px;color: inherit;padding: 6px 12px;"/> ¥\n' + |
| | | ' </div>\n' + |
| | | ' </div>' + |
| | | ' </div>' + |
| | | ' </div>'; |
| | | $('#complimentaryClass').append(htmlStr); |
| | | let arr = CoursePackageDiscount.coursePackagePaymentConfig[index].coursePackageDiscount; |
| | | for(let k in arr){ |
| | | if(arr[k].type == 4){ |
| | | arr[k].content.push({}) |
| | | } |
| | | } |
| | | lay('.startAndEndDay').each(function(i, e){ |
| | | laydate.render({ |
| | | elem: this |
| | | ,type: 'datetime' |
| | | ,range: true |
| | | ,done: function(value, date, endDate){ |
| | | let index = $('#classHours').find('button[checked]').attr('index'); |
| | | let obj = CoursePackageDiscount.coursePackagePaymentConfig[index]; |
| | | let ii = $(e).parent('div').parent('div').parent('div').parent('div').attr('index'); |
| | | for (let i = 0; i < obj.coursePackageDiscount.length; i++) { |
| | | if(type == obj.coursePackageDiscount[i].type){ |
| | | let jsonArray = obj.coursePackageDiscount[i].content; |
| | | for (let j = 0; j < jsonArray.length; j++) { |
| | | if(j == ii){ |
| | | let arr = value.split(" - "); |
| | | obj.coursePackageDiscount[i].content[j]['startDate'] = arr[0]; |
| | | obj.coursePackageDiscount[i].content[j]['endDate'] = arr[1]; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | }); |
| | | }); |
| | | lay('.time').each(function(i, e){ |
| | | laydate.render({ |
| | | elem: this |
| | | ,type: 'time' |
| | | ,range: true |
| | | ,done: function(value, date, endDate){ |
| | | let index = $('#classHours').find('button[checked]').attr('index'); |
| | | let obj = CoursePackageDiscount.coursePackagePaymentConfig[index]; |
| | | let ii = $(e).parent('div').parent('div').parent('div').parent('div').attr('index'); |
| | | for (let i = 0; i < obj.coursePackageDiscount.length; i++) { |
| | | if(type == obj.coursePackageDiscount[i].type){ |
| | | let jsonArray = obj.coursePackageDiscount[i].content; |
| | | for (let j = 0; j < jsonArray.length; j++) { |
| | | if(j == ii){ |
| | | let arr = value.split(" - "); |
| | | obj.coursePackageDiscount[i].content[j]['startTime'] = arr[0]; |
| | | obj.coursePackageDiscount[i].content[j]['endTime'] = arr[1]; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | }); |
| | | }); |
| | | } |
| | | } |
| | | |
| | | |
| | | function removePrice(type, e){ |
| | | let index = $('#classHours').find('button[checked]').attr('index'); |
| | | let object = $(e).parent('div').parent('div').parent('div').parent('div'); |
| | | let ii = object.attr('index'); |
| | | let obj = CoursePackageDiscount.coursePackagePaymentConfig[index]; |
| | | for (let i = 0; i < obj.coursePackageDiscount.length; i++) { |
| | | if(type == obj.coursePackageDiscount[i].type){ |
| | | let jsonArray = null; |
| | | if(typeof obj.coursePackageDiscount[i].content == "string"){ |
| | | jsonArray = JSON.parse(obj.coursePackageDiscount[i].content); |
| | | }else{ |
| | | jsonArray = obj.coursePackageDiscount[i].content; |
| | | } |
| | | |
| | | let arr = []; |
| | | for (let j = 0; j < jsonArray.length; j++) { |
| | | if(j == ii){ |
| | | continue |
| | | } |
| | | arr.push(jsonArray[j]); |
| | | } |
| | | CoursePackageDiscount.coursePackagePaymentConfig[index].coursePackageDiscount[i].content = arr; |
| | | } |
| | | } |
| | | object.remove(); |
| | | } |
| | | |
| | | |
| | | function addPriceValue(type, e, name){ |
| | | let index = $('#classHours').find('button[checked]').attr('index'); |
| | | if(type == 1){ |
| | | let obj = CoursePackageDiscount.coursePackagePaymentConfig[index]; |
| | | for (let i = 0; i < obj.coursePackageDiscount.length; i++) { |
| | | if(type == obj.coursePackageDiscount[i].type){ |
| | | let content = null; |
| | | if(typeof obj.coursePackageDiscount[i].content == "string"){ |
| | | content = JSON.parse(obj.coursePackageDiscount[i].content); |
| | | }else{ |
| | | content = obj.coursePackageDiscount[i].content; |
| | | } |
| | | content[name] = parseFloat($(e).val()); |
| | | CoursePackageDiscount.coursePackagePaymentConfig[index].coursePackageDiscount[i].content = content; |
| | | } |
| | | } |
| | | } |
| | | if(type == 2){ |
| | | let obj = CoursePackageDiscount.coursePackagePaymentConfig[index]; |
| | | for (let i = 0; i < obj.coursePackageDiscount.length; i++) { |
| | | if(type == obj.coursePackageDiscount[i].type){ |
| | | let content = null; |
| | | if(typeof obj.coursePackageDiscount[i].content == "string"){ |
| | | content = JSON.parse(obj.coursePackageDiscount[i].content); |
| | | }else{ |
| | | content = obj.coursePackageDiscount[i].content; |
| | | } |
| | | content[name] = parseFloat($(e).val()); |
| | | CoursePackageDiscount.coursePackagePaymentConfig[index].coursePackageDiscount[i].content = content; |
| | | } |
| | | } |
| | | } |
| | | if(type == 3){ |
| | | let obj = CoursePackageDiscount.coursePackagePaymentConfig[index]; |
| | | let ii = $(e).parent('div').parent('div').parent('div').parent('div').attr('index'); |
| | | for (let i = 0; i < obj.coursePackageDiscount.length; i++) { |
| | | if(type == obj.coursePackageDiscount[i].type){ |
| | | let jsonArray = null; |
| | | if(typeof obj.coursePackageDiscount[i].content == "string"){ |
| | | jsonArray = JSON.parse(obj.coursePackageDiscount[i].content); |
| | | }else{ |
| | | jsonArray = obj.coursePackageDiscount[i].content; |
| | | } |
| | | |
| | | for (let j = 0; j < jsonArray.length; j++) { |
| | | if(j == ii){ |
| | | if('weeks' == name){ |
| | | let weeks = jsonArray[j].weeks; |
| | | let v = parseInt($(e).val()); |
| | | if(null != weeks && typeof weeks != "undefined"){ |
| | | if(e.checked){ |
| | | weeks.push(v); |
| | | }else{ |
| | | let arr = []; |
| | | for (let k = 0; k < weeks.length; k++) { |
| | | if(weeks[k] == v){ |
| | | continue |
| | | } |
| | | arr.push(weeks[k]); |
| | | } |
| | | weeks = arr; |
| | | } |
| | | }else{ |
| | | weeks = [v]; |
| | | } |
| | | jsonArray[j].weeks = weeks; |
| | | }else{ |
| | | jsonArray[j][name] = parseFloat($(e).val()); |
| | | } |
| | | } |
| | | } |
| | | CoursePackageDiscount.coursePackagePaymentConfig[index].coursePackageDiscount[i].content = jsonArray; |
| | | } |
| | | } |
| | | } |
| | | if(type == 4){ |
| | | let obj = CoursePackageDiscount.coursePackagePaymentConfig[index]; |
| | | let ii = $(e).parent('div').parent('div').parent('div').parent('div').attr('index'); |
| | | for (let i = 0; i < obj.coursePackageDiscount.length; i++) { |
| | | if(type == obj.coursePackageDiscount[i].type){ |
| | | let jsonArray = null; |
| | | if(typeof obj.coursePackageDiscount[i].content == "string"){ |
| | | jsonArray = JSON.parse(obj.coursePackageDiscount[i].content); |
| | | }else{ |
| | | jsonArray = obj.coursePackageDiscount[i].content; |
| | | } |
| | | for (let j = 0; j < jsonArray.length; j++) { |
| | | if(j == ii){ |
| | | if('weeks' == name){ |
| | | let weeks = jsonArray[j].weeks; |
| | | let v = parseInt($(e).val()); |
| | | if(null != weeks && typeof weeks != "undefined"){ |
| | | if(e.checked){ |
| | | weeks.push(v); |
| | | }else{ |
| | | let arr = []; |
| | | for (let k = 0; k < weeks.length; k++) { |
| | | if(weeks[k] == v){ |
| | | continue |
| | | } |
| | | arr.push(weeks[k]); |
| | | } |
| | | weeks = arr; |
| | | } |
| | | }else{ |
| | | weeks = [v]; |
| | | } |
| | | jsonArray[j].weeks = weeks; |
| | | }else{ |
| | | jsonArray[j][name] = parseFloat($(e).val()); |
| | | } |
| | | } |
| | | } |
| | | CoursePackageDiscount.coursePackagePaymentConfig[index].coursePackageDiscount[i].content = jsonArray; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | function selectedPperiod(e){ |
| | | $('#classHours').find('button[checked]').attr('style', 'width: 60px;height: 30px;border: none;border-radius: 5px;'); |
| | | $('#classHours').find('button[checked]').removeAttr('checked'); |
| | | if(typeof e != "undefined"){ |
| | | $(e).attr('style', 'width: 60px;height: 30px;background-color: #0086F6;border: none;border-radius: 5px;color: white;'); |
| | | $(e).attr('checked', true); |
| | | }else{ |
| | | $($('#classHours').find('button')[0]).attr('style', 'width: 60px;height: 30px;background-color: #0086F6;border: none;border-radius: 5px;color: white;'); |
| | | $($('#classHours').find('button')[0]).attr('checked', true); |
| | | } |
| | | |
| | | let index = $('#classHours').find('button[checked]').attr('index'); |
| | | let obj = CoursePackageDiscount.coursePackagePaymentConfig[index]; |
| | | console.log(obj) |
| | | console.log("看看obj") |
| | | |
| | | $('#payment').text(obj.payment); |
| | | $('#cashPayment').text(obj.cashPayment); |
| | | |
| | | $('#memberDiscount').html(''); |
| | | $('#renewalOffer').html(''); |
| | | $('#limitedTimeDiscount').html(''); |
| | | $('#complimentaryClass').html(''); |
| | | let objv = CoursePackageDiscount.coursePackagePaymentConfig[index]; |
| | | $('input[name="type"]').each(function (i, e) { |
| | | e.checked = false; |
| | | let v = $(e).val(); |
| | | for (let i = 0; i < objv.coursePackageDiscount.length; i++) { |
| | | if(v == objv.coursePackageDiscount[i].type){ |
| | | $(e).click(); |
| | | } |
| | | } |
| | | }) |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | $(function () { |
| | | var type2 = $('#type2').val(); |
| | | if (type2 == 3){ |
| | | console.log("进入隐藏") |
| | | $('#classHours').hide(); |
| | | } |
| | | CoursePackageDiscount.coursePackagePaymentConfig = JSON.parse($('#coursePackagePaymentConfig').val()); |
| | | let htmlStr = ''; |
| | | for (let i = 0; i < CoursePackageDiscount.coursePackagePaymentConfig.length; i++) { |
| | | let obj = CoursePackageDiscount.coursePackagePaymentConfig[i]; |
| | | if(i == 0){ |
| | | htmlStr += '<button checked onclick="selectedPperiod(this)" index="' + i + '" style="width: 60px;height: 30px;background-color: #0086F6;border: none;border-radius: 5px;color: white;">' + obj.classHours + '课时</button> '; |
| | | }else{ |
| | | htmlStr += '<button onclick="selectedPperiod(this)" index="' + i + '" style="width: 60px;height: 30px;border: none;border-radius: 5px;">' + obj.classHours + '课时</button> '; |
| | | } |
| | | } |
| | | $('#classHours').html(htmlStr); |
| | | |
| | | $('input[name="type"]').click(function () { |
| | | let v = $(this).val(); |
| | | let index = $('#classHours').find('button[checked]').attr('index'); |
| | | if(this.checked && v == '1'){ |
| | | let discountMember = true; |
| | | let hh = '<div class="hr-line-dashed"></div>' + |
| | | '<h3>会员折扣</h3>\n' + |
| | | ' <div class="form-group">\n' + |
| | | ' <div class="col-sm-2"></div>'+ |
| | | ' <div class="col-sm-10">' + |
| | | ' <label class="col-sm-2 control-label">*现金支付:</label>\n' + |
| | | ' <div class="col-sm-3">\n' + |
| | | ' <input type="number" min="0" value="'; |
| | | let obj = CoursePackageDiscount.coursePackagePaymentConfig[index]; |
| | | for (let i = 0; i < obj.coursePackageDiscount.length; i++) { |
| | | if(v == obj.coursePackageDiscount[i].type){ |
| | | let jsonObject = null; |
| | | if(typeof obj.coursePackageDiscount[i].content == "string"){ |
| | | jsonObject = JSON.parse(obj.coursePackageDiscount[i].content); |
| | | }else{ |
| | | jsonObject = obj.coursePackageDiscount[i].content; |
| | | } |
| | | hh += (null == jsonObject.discountMember ? '' : jsonObject.discountMember); |
| | | discountMember = false; |
| | | } |
| | | } |
| | | hh += '" placeholder="请输入会员支付价格" onblur="addPriceValue(1, this, \'discountMember\')" style="width: 180px;background-color: #FFFFFF;background-image: none;border: 1px solid #e5e6e7;border-radius: 1px;color: inherit;padding: 6px 12px;"/> ¥\n' + |
| | | ' </div>\n' + |
| | | ' </div>'+ |
| | | ' </div>'; |
| | | |
| | | $('#memberDiscount').html(hh); |
| | | if(discountMember){ |
| | | CoursePackageDiscount.coursePackagePaymentConfig[index].coursePackageDiscount.push({ |
| | | type: 1, |
| | | content:{ |
| | | discountMember: null |
| | | } |
| | | }); |
| | | } |
| | | }else if(!this.checked && v == '1'){ |
| | | $('#memberDiscount').html(''); |
| | | let datas = CoursePackageDiscount.coursePackagePaymentConfig[index].coursePackageDiscount; |
| | | let arra = []; |
| | | for (let i = 0; i < datas.length; i++){ |
| | | if(datas[i].type == v){ |
| | | continue; |
| | | } |
| | | arra.push(datas[i]); |
| | | } |
| | | CoursePackageDiscount.coursePackagePaymentConfig[index].coursePackageDiscount = arra; |
| | | } |
| | | if(this.checked && v == '2'){ |
| | | let continuingMember = true; |
| | | let hh = '<div class="hr-line-dashed"></div>' + |
| | | '<h3>续课优惠</h3>\n' + |
| | | ' <div class="form-group">\n' + |
| | | ' <div class="col-sm-2"></div>'+ |
| | | ' <div class="col-sm-10">' + |
| | | ' <label class="col-sm-2 control-label">会员续课:</label>\n' + |
| | | ' <div class="col-sm-3">\n' + |
| | | ' </div>\n' + |
| | | ' <label class="col-sm-2 control-label">用户续课:</label>\n' + |
| | | ' <div class="col-sm-3">\n' + |
| | | ' </div>\n' + |
| | | ' </div>'+ |
| | | ' </div>' + |
| | | ' <div class="form-group">\n' + |
| | | ' <div class="col-sm-2"></div>'+ |
| | | ' <div class="col-sm-10">' + |
| | | ' <label class="col-sm-2 control-label">*现金支付:</label>\n' + |
| | | ' <div class="col-sm-3">\n' + |
| | | ' <input type="number" min="0" value="'; |
| | | let obj = CoursePackageDiscount.coursePackagePaymentConfig[index]; |
| | | for (let i = 0; i < obj.coursePackageDiscount.length; i++) { |
| | | if(v == obj.coursePackageDiscount[i].type){ |
| | | let jsonObject = null; |
| | | if(typeof obj.coursePackageDiscount[i].content == "string"){ |
| | | jsonObject = JSON.parse(obj.coursePackageDiscount[i].content); |
| | | }else{ |
| | | jsonObject = obj.coursePackageDiscount[i].content; |
| | | } |
| | | hh += (null == jsonObject.continuingMember ? '' : jsonObject.continuingMember); |
| | | continuingMember = false; |
| | | } |
| | | } |
| | | hh += '" placeholder="请输入会员支付价格" onblur="addPriceValue(2, this, \'continuingMember\')" style="width: 180px;background-color: #FFFFFF;background-image: none;border: 1px solid #e5e6e7;border-radius: 1px;color: inherit;padding: 6px 12px;"/> ¥\n' + |
| | | ' </div>\n' + |
| | | ' <label class="col-sm-2 control-label">*现金支付:</label>\n' + |
| | | ' <div class="col-sm-3">\n' + |
| | | ' <input type="number" min="0" value="'; |
| | | let obje = CoursePackageDiscount.coursePackagePaymentConfig[index]; |
| | | for (let i = 0; i < obje.coursePackageDiscount.length; i++) { |
| | | if(v == obje.coursePackageDiscount[i].type){ |
| | | let jsonObject = null; |
| | | if(typeof obje.coursePackageDiscount[i].content == "string"){ |
| | | jsonObject = JSON.parse(obje.coursePackageDiscount[i].content); |
| | | }else{ |
| | | jsonObject = obje.coursePackageDiscount[i].content; |
| | | } |
| | | hh += (null == jsonObject.continuingUser ? '' : jsonObject.continuingUser); |
| | | } |
| | | } |
| | | hh += '" placeholder="请输入用户支付价格" onblur="addPriceValue(2, this, \'continuingUser\')" style="width: 180px;background-color: #FFFFFF;background-image: none;border: 1px solid #e5e6e7;border-radius: 1px;color: inherit;padding: 6px 12px;"/> ¥\n' + |
| | | ' </div>\n' + |
| | | ' </div>'+ |
| | | ' </div>'; |
| | | $('#renewalOffer').html(hh); |
| | | if(continuingMember){ |
| | | CoursePackageDiscount.coursePackagePaymentConfig[index].coursePackageDiscount.push({ |
| | | type: 2, |
| | | content: { |
| | | continuingMember: null, |
| | | continuingUser: null |
| | | } |
| | | }) |
| | | } |
| | | }else if(!this.checked && v == '2'){ |
| | | $('#renewalOffer').html(''); |
| | | let datas = CoursePackageDiscount.coursePackagePaymentConfig[index].coursePackageDiscount; |
| | | let arra = []; |
| | | for (let i = 0; i < datas.length; i++){ |
| | | if(datas[i].type == v){ |
| | | continue; |
| | | } |
| | | arra.push(datas[i]); |
| | | } |
| | | CoursePackageDiscount.coursePackagePaymentConfig[index].coursePackageDiscount = arra; |
| | | } |
| | | if(this.checked && v == '3'){ |
| | | let data_value = true; |
| | | let hh = '<div class="hr-line-dashed"></div>' + |
| | | '<span style="font-size: 16px;font-weight: 500;">限时折扣</span> <i class="fa fa-plus-circle" style="font-size:24px" onclick="addPrice(3)"></i>\n'; |
| | | let obje = CoursePackageDiscount.coursePackagePaymentConfig[index]; |
| | | for (let i = 0; i < obje.coursePackageDiscount.length; i++) { |
| | | if(v == obje.coursePackageDiscount[i].type){ |
| | | data_value = false |
| | | let jsonArray = null; |
| | | if(typeof obje.coursePackageDiscount[i].content == "string"){ |
| | | jsonArray = JSON.parse(obje.coursePackageDiscount[i].content); |
| | | }else{ |
| | | jsonArray = obje.coursePackageDiscount[i].content; |
| | | } |
| | | |
| | | for (let j = 0; j < jsonArray.length; j++) { |
| | | hh += '' + |
| | | ' <div class="form-group limitedTimeDiscount" index="' + j + '">' + |
| | | ' <div class="col-sm-2"></div>\n' + |
| | | ' <div class="col-sm-8" style="border: 1px solid; padding: 20px;">\n' + |
| | | ' <div class="form-group">\n' + |
| | | ' <label class="col-sm-2 control-label">折扣有效期:</label>\n' + |
| | | ' <div class="col-sm-9">\n' + |
| | | ' <input class="startAndEndDay" value="' + (jsonArray[j].startDate + " - " + jsonArray[j].endDate) + '" style="width: 300px;background-color: #FFFFFF;background-image: none;border: 1px solid #e5e6e7;border-radius: 1px;color: inherit;padding: 6px 12px;"/>' + |
| | | ' </div>\n' + |
| | | ' <div class="col-sm-1"><i class="fa fa-trash-o" style="font-size:24px;color: red;" onclick="removePrice(3, this)"></i></div>\n' + |
| | | ' </div>' + |
| | | ' <div class="form-group">\n' + |
| | | ' <label class="col-sm-2 control-label">*折扣时间:</label>\n' + |
| | | ' <div class="col-sm-5">\n' + |
| | | ' <input class="time" value="' + jsonArray[j].startTime + " - " + jsonArray[j].endTime + '" style="width: 200px;background-color: #FFFFFF;background-image: none;border: 1px solid #e5e6e7;border-radius: 1px;color: inherit;padding: 6px 12px;"/>\n' + |
| | | ' </div>\n' + |
| | | ' </div>' + |
| | | ' <div class="form-group">\n' + |
| | | ' <label class="col-sm-2 control-label"></label>\n' + |
| | | ' <div class="col-sm-8" style="margin-top: 6px;">\n' + |
| | | ' <input type="checkbox" name="week" value="1"'; |
| | | for (let k = 0; k < jsonArray[j].weeks.length; k++) { |
| | | let w = jsonArray[j].weeks[k]; |
| | | if(w == 1){ |
| | | hh += 'checked'; |
| | | } |
| | | } |
| | | hh += '/> 周一 ' + |
| | | ' <input type="checkbox" name="week" value="2"'; |
| | | for (let k = 0; k < jsonArray[j].weeks.length; k++) { |
| | | let w = jsonArray[j].weeks[k]; |
| | | if(w == 2){ |
| | | hh += 'checked'; |
| | | } |
| | | } |
| | | hh += '/> 周二 ' + |
| | | ' <input type="checkbox" name="week" value="3"'; |
| | | for (let k = 0; k < jsonArray[j].weeks.length; k++) { |
| | | let w = jsonArray[j].weeks[k]; |
| | | if(w == 3){ |
| | | hh += 'checked'; |
| | | } |
| | | } |
| | | hh += '/> 周三 ' + |
| | | ' <input type="checkbox" name="week" value="4"'; |
| | | for (let k = 0; k < jsonArray[j].weeks.length; k++) { |
| | | let w = jsonArray[j].weeks[k]; |
| | | if(w == 4){ |
| | | hh += 'checked'; |
| | | } |
| | | } |
| | | hh += '/> 周四 ' + |
| | | ' <input type="checkbox" name="week" value="5"'; |
| | | for (let k = 0; k < jsonArray[j].weeks.length; k++) { |
| | | let w = jsonArray[j].weeks[k]; |
| | | if(w == 5){ |
| | | hh += 'checked'; |
| | | } |
| | | } |
| | | hh += '/> 周五 ' + |
| | | ' <input type="checkbox" name="week" value="6"'; |
| | | for (let k = 0; k < jsonArray[j].weeks.length; k++) { |
| | | let w = jsonArray[j].weeks[k]; |
| | | if(w == 6){ |
| | | hh += 'checked'; |
| | | } |
| | | } |
| | | hh += '/> 周六 ' + |
| | | ' <input type="checkbox" name="week" value="7"'; |
| | | for (let k = 0; k < jsonArray[j].weeks.length; k++) { |
| | | let w = jsonArray[j].weeks[k]; |
| | | if(w == 7){ |
| | | hh += 'checked'; |
| | | } |
| | | } |
| | | hh += '/> 周日 ' + |
| | | ' </div>\n' + |
| | | ' </div>' + |
| | | ' <div class="form-group">\n' + |
| | | ' <label class="col-sm-2 control-label">*现金支付:</label>\n' + |
| | | ' <div class="col-sm-4">\n' + |
| | | ' <input type="number" min="0" value="' + jsonArray[j].cashPayment + '" onblur="addPriceValue(3, this, \'cashPayment\')" placeholder="请输入折扣后支付价格" style="width: 180px;background-color: #FFFFFF;background-image: none;border: 1px solid #e5e6e7;border-radius: 1px;color: inherit;padding: 6px 12px;"/> ¥\n' + |
| | | ' </div>\n' + |
| | | ' </div>' + |
| | | ' </div>' + |
| | | ' </div>'; |
| | | } |
| | | |
| | | } |
| | | } |
| | | $('#limitedTimeDiscount').html(hh); |
| | | if(data_value){ |
| | | CoursePackageDiscount.coursePackagePaymentConfig[index].coursePackageDiscount.push({ |
| | | type: 3, |
| | | content: [] |
| | | }) |
| | | } |
| | | }else if(!this.checked && v == '3'){ |
| | | $('#limitedTimeDiscount').html(''); |
| | | let datas = CoursePackageDiscount.coursePackagePaymentConfig[index].coursePackageDiscount; |
| | | let arra = []; |
| | | for (let i = 0; i < datas.length; i++){ |
| | | if(datas[i].type == v){ |
| | | continue; |
| | | } |
| | | arra.push(datas[i]); |
| | | } |
| | | CoursePackageDiscount.coursePackagePaymentConfig[index].coursePackageDiscount = arra; |
| | | } |
| | | if(this.checked && v == '4'){ |
| | | let data_value = true; |
| | | let hh = |
| | | '<div class="hr-line-dashed"></div>' + |
| | | '<span style="font-size: 16px;font-weight: 500;">赠送课时</span> <i class="fa fa-plus-circle" style="font-size:24px" onclick="addPrice(4)"></i>\n'; |
| | | let obje = CoursePackageDiscount.coursePackagePaymentConfig[index]; |
| | | for (let i = 0; i < obje.coursePackageDiscount.length; i++) { |
| | | if (v == obje.coursePackageDiscount[i].type) { |
| | | data_value = false; |
| | | let jsonArray = null; |
| | | if(typeof obje.coursePackageDiscount[i].content == "string"){ |
| | | jsonArray = JSON.parse(obje.coursePackageDiscount[i].content); |
| | | }else{ |
| | | jsonArray = obje.coursePackageDiscount[i].content; |
| | | } |
| | | for (let j = 0; j < jsonArray.length; j++) { |
| | | hh += |
| | | ' <div class="form-group complimentaryClass" index="' + j + '">' + |
| | | ' <div class="col-sm-2"></div>\n' + |
| | | ' <div class="col-sm-8" style="border: 1px solid; padding: 20px;">\n' + |
| | | ' <div class="form-group">\n' + |
| | | ' <label class="col-sm-2 control-label">*赠送有效期:</label>\n' + |
| | | ' <div class="col-sm-9">\n' + |
| | | ' <input class="startAndEndDay" value="' + (jsonArray[j].startDate + " - " + jsonArray[j].endDate) + '" style="width: 300px;background-color: #FFFFFF;background-image: none;border: 1px solid #e5e6e7;border-radius: 1px;color: inherit;padding: 6px 12px;"/>' + |
| | | ' </div>\n' + |
| | | ' <div class="col-sm-1"><i class="fa fa-trash-o" style="font-size:24px;color: red;" onclick="removePrice(4, this)"></i></div>\n' + |
| | | ' </div>' + |
| | | ' <div class="form-group">\n' + |
| | | ' <label class="col-sm-2 control-label">*赠送时间:</label>\n' + |
| | | ' <div class="col-sm-5">\n' + |
| | | ' <input class="time" value="' + jsonArray[j].startTime + " - " + jsonArray[j].endTime + '" style="width: 200px;background-color: #FFFFFF;background-image: none;border: 1px solid #e5e6e7;border-radius: 1px;color: inherit;padding: 6px 12px;"/>\n' + |
| | | ' </div>\n' + |
| | | ' </div>' + |
| | | ' <div class="form-group">\n' + |
| | | ' <label class="col-sm-2 control-label"></label>\n' + |
| | | ' <div class="col-sm-8" style="margin-top: 6px;">\n' + |
| | | ' <input type="checkbox" name="week" value="1"'; |
| | | for (let k = 0; k < jsonArray[j].weeks.length; k++) { |
| | | let w = jsonArray[j].weeks[k]; |
| | | if(w == 1){ |
| | | hh += 'checked'; |
| | | } |
| | | } |
| | | hh += '/> 周一 ' + |
| | | ' <input type="checkbox" name="week" value="2"'; |
| | | for (let k = 0; k < jsonArray[j].weeks.length; k++) { |
| | | let w = jsonArray[j].weeks[k]; |
| | | if(w == 2){ |
| | | hh += 'checked'; |
| | | } |
| | | } |
| | | hh += '/> 周二 ' + |
| | | ' <input type="checkbox" name="week" value="3"'; |
| | | for (let k = 0; k < jsonArray[j].weeks.length; k++) { |
| | | let w = jsonArray[j].weeks[k]; |
| | | if(w == 3){ |
| | | hh += 'checked'; |
| | | } |
| | | } |
| | | hh += '/> 周三 ' + |
| | | ' <input type="checkbox" name="week" value="4"'; |
| | | for (let k = 0; k < jsonArray[j].weeks.length; k++) { |
| | | let w = jsonArray[j].weeks[k]; |
| | | if(w == 4){ |
| | | hh += 'checked'; |
| | | } |
| | | } |
| | | hh += '/> 周四 ' + |
| | | ' <input type="checkbox" name="week" value="5"'; |
| | | for (let k = 0; k < jsonArray[j].weeks.length; k++) { |
| | | let w = jsonArray[j].weeks[k]; |
| | | if(w == 5){ |
| | | hh += 'checked'; |
| | | } |
| | | } |
| | | hh += '/> 周五 ' + |
| | | ' <input type="checkbox" name="week" value="6"'; |
| | | for (let k = 0; k < jsonArray[j].weeks.length; k++) { |
| | | let w = jsonArray[j].weeks[k]; |
| | | if(w == 6){ |
| | | hh += 'checked'; |
| | | } |
| | | } |
| | | hh += '/> 周六 ' + |
| | | ' <input type="checkbox" name="week" value="7"'; |
| | | for (let k = 0; k < jsonArray[j].weeks.length; k++) { |
| | | let w = jsonArray[j].weeks[k]; |
| | | if(w == 7){ |
| | | hh += 'checked'; |
| | | } |
| | | } |
| | | hh += '/> 周日 ' + |
| | | ' </div>\n' + |
| | | ' </div>' + |
| | | ' <div class="form-group">\n' + |
| | | ' <label class="col-sm-2 control-label">*赠送课时数:</label>\n' + |
| | | ' <div class="col-sm-4">\n' + |
| | | ' <input type="number" value="' + jsonArray[j].hour + '" onblur="addPriceValue(4, this, \'hour\')" min="0" placeholder="请输入赠送课时数" style="width: 180px;background-color: #FFFFFF;background-image: none;border: 1px solid #e5e6e7;border-radius: 1px;color: inherit;padding: 6px 12px;"/> ¥\n' + |
| | | ' </div>\n' + |
| | | ' </div>' + |
| | | ' </div>' + |
| | | ' </div>'; |
| | | } |
| | | } |
| | | } |
| | | $('#complimentaryClass').html(hh); |
| | | if(data_value){ |
| | | CoursePackageDiscount.coursePackagePaymentConfig[index].coursePackageDiscount.push({ |
| | | type: 4, |
| | | content: [] |
| | | }) |
| | | } |
| | | }else if(!this.checked && v == '4'){ |
| | | $('#complimentaryClass').html(''); |
| | | let datas = CoursePackageDiscount.coursePackagePaymentConfig[index].coursePackageDiscount; |
| | | let arra = []; |
| | | for (let i = 0; i < datas.length; i++){ |
| | | if(datas[i].type == v){ |
| | | continue; |
| | | } |
| | | arra.push(datas[i]); |
| | | } |
| | | CoursePackageDiscount.coursePackagePaymentConfig[index].coursePackageDiscount = arra; |
| | | } |
| | | }) |
| | | |
| | | |
| | | selectedPperiod(); |
| | | }); |