From f88cfa02e36752e4acad7adc4b045155e8e50f21 Mon Sep 17 00:00:00 2001 From: puzhibing <393733352@qq.com> Date: 星期五, 08 十二月 2023 09:16:29 +0800 Subject: [PATCH] Merge branch 'master' of http://120.76.84.145:10101/gitblit/r/java/PlayPai --- cloud-server-management/src/main/webapp/static/modular/system/cpPayment/cpPayment_info.js | 188 +++++++++++++++++++++++++++++++++-------------- 1 files changed, 132 insertions(+), 56 deletions(-) diff --git a/cloud-server-management/src/main/webapp/static/modular/system/cpPayment/cpPayment_info.js b/cloud-server-management/src/main/webapp/static/modular/system/cpPayment/cpPayment_info.js index 41741fb..8c6b42d 100644 --- a/cloud-server-management/src/main/webapp/static/modular/system/cpPayment/cpPayment_info.js +++ b/cloud-server-management/src/main/webapp/static/modular/system/cpPayment/cpPayment_info.js @@ -1,8 +1,8 @@ /** * 车辆管理管理初始化 */ -var TCompetition = { - id: "TCompetitionTable", //表格id +var TQuestion = { + id: "TQuestionTable", //表格id seItem: null, //选中的条目 table: null, layerIndex: -1 @@ -12,7 +12,7 @@ /** * 初始化表格的列 */ -TCompetition.initColumn = function () { +TQuestion.initColumn = function () { return [ {field: 'selectItem', checkbox: true}, {title: '序号', field: 'id', visible: true, align: 'center', valign: 'middle'}, @@ -76,13 +76,13 @@ /** * 检查是否选中 */ -TCompetition.check = function () { +TQuestion.check = function () { var selected = $('#' + this.id).bootstrapTable('getSelections'); if(selected.length == 0){ Feng.info("请先选中表格中的某一记录!"); return false; }else{ - TCompetition.seItem = selected[0]; + TQuestion.seItem = selected[0]; return true; } }; @@ -90,7 +90,7 @@ /** * 点击添加车辆管理 */ -TCompetition.openAddTCompetition = function () { +TQuestion.openAddTQuestion = function () { var index = layer.open({ type: 2, title: '添加', @@ -105,7 +105,7 @@ /** * 打开查看车辆管理详情 */ -TCompetition.openTCompetitionDetail = function () { +TQuestion.openTQuestionDetail = function () { if (this.check()) { var index = layer.open({ type: 2, @@ -113,12 +113,12 @@ area: ['100%', '100%'], //宽高 fix: false, //不固定 maxmin: true, - content: Feng.ctxPath + '/tShop/tShop_update/' + TCompetition.seItem.id + content: Feng.ctxPath + '/tShop/tShop_update/' + TQuestion.seItem.id }); this.layerIndex = index; } }; -TCompetition.info = function () { +TQuestion.info = function () { if (this.check()) { var index = layer.open({ type: 2, @@ -126,12 +126,12 @@ area: ['100%', '100%'], //宽高 fix: false, //不固定 maxmin: true, - content: Feng.ctxPath + '/tShop/tShop_info/' + TCompetition.seItem.id + content: Feng.ctxPath + '/tShop/tShop_info/' + TQuestion.seItem.id }); this.layerIndex = index; } }; -TCompetition.gift = function () { +TQuestion.gift = function () { if (this.check()) { var index = layer.open({ type: 2, @@ -139,12 +139,12 @@ area: ['100%', '100%'], //宽高 fix: false, //不固定 maxmin: true, - content: Feng.ctxPath + '/tShop/tShop_gift/' + TCompetition.seItem.id + content: Feng.ctxPath + '/tShop/tShop_gift/' + TQuestion.seItem.id }); this.layerIndex = index; } }; -TCompetition.indexSet = function () { +TQuestion.indexSet = function () { if (this.check()) { var index = layer.open({ type: 2, @@ -152,7 +152,7 @@ area: ['100%', '100%'], //宽高 fix: false, //不固定 maxmin: true, - content: Feng.ctxPath + '/tShop/tShop_indexSet/' + TCompetition.seItem.id + content: Feng.ctxPath + '/tShop/tShop_indexSet/' + TQuestion.seItem.id }); this.layerIndex = index; } @@ -161,9 +161,9 @@ /** * 删除车辆管理 */ -TCompetition.delete = function () { +TQuestion.delete = function () { if (this.check()) { - var nickname = TCompetition.seItem.carLicensePlate; + var nickname = TQuestion.seItem.carLicensePlate; if (nickname == "" || nickname == null || nickname == undefined){ nickname = "该车辆"; }else{ @@ -186,7 +186,7 @@ }else { swal("Hapus berhasil!", "Anda berhasil menghapus" + nickname + "。", "success"); } - TCompetition.table.refresh(); + TQuestion.table.refresh(); }, function (data) { if(language==1){ swal("删除失败", data.responseJSON.message + "!", "warning"); @@ -202,7 +202,7 @@ }); } }; -TCompetition.oneChange = function (e) { +TQuestion.oneChange = function (e) { console.log(111) var oneId=$(e).val(); console.log(oneId) @@ -220,7 +220,7 @@ ajax.start(); }; -TCompetition.nextStore = function (e) { +TQuestion.nextStore = function (e) { var oneId=$(e).val(); console.log(oneId) var content = "<option value=''>请选择</option>"; @@ -236,7 +236,7 @@ ajax.set("storeId",oneId); ajax.start(); }; -TCompetition.addSubmit = function(){ +TQuestion.addSubmit = function(){ var data = { appUserId:null, studentId:null, @@ -260,8 +260,12 @@ giftClassHours:null, useTime:"", payUserName:"", + coursePackageConfigId:null }; data.appUserId = appUserId; + console.log("我看看规格id") + console.log($("#courseTime").val()) + data.coursePackageConfigId = $("#courseTime").val(); data.studentId = $("#student").val() data.coursePackageId = $("#coursePackageName").val() data.cashPayment = $("#cashPayment").val() @@ -309,8 +313,16 @@ Feng.info("请输入玩湃币支付") return; } + var courseTimeId= $("#courseTime").val() + console.log("看看课时") + console.log(courseTimeId) + data.coursePackageConfigId = courseTimeId; + if(typeof courseTimeId === 'undefined'){ + console.log("进入") + courseTimeId=0; + } $.ajax({ - url: Feng.ctxPath + "/cpPayment/addCoursePackagePayment/"+ $("#courseTime").val(), + url: Feng.ctxPath + "/cpPayment/addCoursePackagePayment/"+ courseTimeId, type: "POST", contentType: "application/json", // 设置请求头的 Content-Type data: JSON.stringify(data), // 将数据转换为 JSON 字符串 @@ -320,9 +332,9 @@ }else if(response == "5002"){ Feng.error("剩余课时不足,无法购买!") }else{ - Feng.success("上架成功!"); - TCompetition.close(); - window.parent.TCompetition.table.refresh(); + Feng.success("购买成功!"); + TQuestion.close(); + window.parent.TQuestion.table.refresh(); } }, error: function(xhr, status, error) { @@ -334,12 +346,16 @@ /** * 关闭此对话框 */ -TCompetition.close = function() { - parent.layer.close(window.parent.TCompetition.layerIndex); +TQuestion.close = function() { + parent.layer.close(window.parent.TQuestion.layerIndex); } -TCompetition.getCoursePackage = function (e) { +TQuestion.getCoursePackage = function (e) { var oneId=$(e).val(); + console.log("门店id") console.log(oneId) + var storeId = $("#store").val(); + console.log("课包类型") + console.log(storeId) var content = "<option value=''>请选择</option>"; var ajax = new $ax(Feng.ctxPath + "/coursePackage/getCoursePackageByType", function(data){ if(data!=null){ @@ -350,10 +366,13 @@ $("#coursePackageName").empty().append(content); } }); - ajax.set("storeId",oneId); + ajax.set("storeId",storeId); + ajax.set("typeId",oneId); ajax.start(); }; -TCompetition.getCoursePackageConfig = function (e) { +TQuestion.getCoursePackageConfig = function (e) { + var c1 = document.getElementById("c1"); + var c2 = document.getElementById("c2"); var oneId=$(e).val(); console.log(oneId) var content = "<option value=''>请选择</option>"; @@ -361,15 +380,72 @@ if(data!=null){ $.each(data, function(k,v) { - content += "<option value='"+v.id+"'>"+v.classHours+"</option>"; + content += "<option value='"+v.id+"' data-cashPayment='"+v.cashPayment+"' data-playPaiCoin='"+v.playPaiCoin+"'>"+v.classHours+"</option>"; }); $("#courseTime").empty().append(content); + }else{ + c1.style.display = "none"; + c2.style.display = "none"; } }); + if (oneId == ""){ + console.log("关闭"); + c1.style.display = "none"; + c2.style.display = "none"; + }else{ + console.log("展示") + c1.style.display = 'block' + c2.style.display = 'block' + } ajax.set("id",oneId); ajax.start(); + + + + var ajax1 = new $ax(Feng.ctxPath + "/cpPayment/getCoursePackageType", function(data){ + if(data!=null){ + console.log("data ===="+data) + if (data != 1){ + document.getElementById("toHidden").style.display = "none"; + + var selectElement = document.getElementById('courseTime'); + var selectedOption = selectElement.options[1]; + console.log("插入") + var cashPayment = selectedOption.getAttribute('data-cashpayment'); + var playPaiCoin = selectedOption.getAttribute('data-playpaicoin'); + console.log(cashPayment) + console.log(playPaiCoin) + $("#cashPayment").val(cashPayment); + $("#playPaiCoin").val(playPaiCoin); + + + }else { + document.getElementById("toHidden").style.display = "block"; + + } + + } + }); + + ajax1.set("id",oneId); + ajax1.start(); + }; -TCompetition.twoChange = function (e) { +TQuestion.getCoursePackagePrice = function (e) { + var c1 = document.getElementById("c1"); + var c2 = document.getElementById("c2"); + var oneId=$(e).val(); + var selectElement = document.getElementById('courseTime'); + var selectedOption = selectElement.options[selectElement.selectedIndex]; + console.log("插入") + var cashPayment = selectedOption.getAttribute('data-cashpayment'); + var playPaiCoin = selectedOption.getAttribute('data-playpaicoin'); + console.log(cashPayment) + console.log(playPaiCoin) + $("#cashPayment").val(cashPayment); + $("#playPaiCoin").val(playPaiCoin); +}; +TQuestion.twoChange = function (e) { var oneId=e; var content = "<option value=''>请选择</option>"; var ajax = new $ax(Feng.ctxPath + "/tCompetition/onChange", function(data){ @@ -385,7 +461,7 @@ ajax.start(); }; -TCompetition.threeChange = function (e) { +TQuestion.threeChange = function (e) { var oneId=$(e).val(); var content1 = "<option value=''>请选择门店</option>"; var ajax2=new $ax(Feng.ctxPath + "/cpPayment/getStore", function(data){ @@ -397,7 +473,7 @@ ajax2.set("city",oneId); ajax2.start(); }; -TCompetition.fourChange = function (e) { +TQuestion.fourChange = function (e) { var content1 = "<option value=''>请选择门店</option>"; var ajax2=new $ax(Feng.ctxPath + "/cpPayment/getStore", function(data){ $.each(data, function(k,v) { @@ -409,7 +485,7 @@ ajax2.start(); }; -TCompetition.getStudent = function () { +TQuestion.getStudent = function () { var phone = $("#vipPhone").val(); var phoneRegex = /^1[3456789]\d{9}$/; // 使用正则表达式进行验证 @@ -450,15 +526,16 @@ , yes: function () { var index = layer.open({ type: 2, - title:'首页设置', + title:'添加用户', area: ['100%', '100%'], //宽高 fix: false, //不固定 maxmin: true, - // todo 写用户管理路径 content: Feng.ctxPath + '/appUser/add' }); - this.layerIndex = index; + // layer.closeAll('page'); }, + btn2:function () { + } }); }else{ province = response.province; @@ -491,10 +568,9 @@ area: ['100%', '100%'], //宽高 fix: false, //不固定 maxmin: true, - // todo 写用户管理路径 content: Feng.ctxPath + '/appUser/addStudent/'+appUserId }); - this.layerIndex = index; + // layer.closeAll('page'); }, }); } @@ -508,7 +584,7 @@ if (option.text === province) { option.selected = true; console.log(option.value) - TCompetition.twoChange(option.value); + TQuestion.twoChange(option.value); break; // 找到匹配的选项后,可以选择停止遍历 } } @@ -520,7 +596,7 @@ if (option.text === city) { option.selected = true; c = option.text; - TCompetition.fourChange(c) + TQuestion.fourChange(c) break; // 找到匹配的选项后,可以选择停止遍历 } @@ -536,11 +612,11 @@ }; -TCompetition.freeze = function () { +TQuestion.freeze = function () { if (this.check()) { var ajax = new $ax(Feng.ctxPath + "/tShop/freeze", function (data) { Feng.success("冻结成功!"); - TCompetition.table.refresh(); + TQuestion.table.refresh(); }, function (data) { Feng.error("冻结失败!" + data.responseJSON.message + "!"); }); @@ -548,7 +624,7 @@ ajax.start(); } }; -TCompetition.unfreeze = function () { +TQuestion.unfreeze = function () { if (this.check()) { var selected = $('#' + this.id).bootstrapTable('getSelections'); console.log("看看选择") @@ -570,7 +646,7 @@ data: JSON.stringify(data1), // 将数据转换为 JSON 字符串 success: function(response) { Feng.success("支付成功!"); - TCompetition.table.refresh(); + TQuestion.table.refresh(); }, error: function(xhr, status, error) { var errorMessage = xhr.responseText ? xhr.responseText : "上架失败!"; @@ -579,13 +655,13 @@ }); } }; -TCompetition.reload = function () { +TQuestion.reload = function () { if (this.check()) { let id = this.seItem.id var operation = function(){ var ajax = new $ax(Feng.ctxPath + "/tCity/pwd", function (data) { Feng.success("重置成功!"); - TCompetition.table.refresh(); + TQuestion.table.refresh(); }, function (data) { Feng.error("重置失败!" + data.responseJSON.message + "!"); }); @@ -597,7 +673,7 @@ }; -TCompetition.carInsurance = function () { +TQuestion.carInsurance = function () { if (this.check()) { var index = layer.open({ type: 2, @@ -605,7 +681,7 @@ area: ['100%', '100%'], //宽高 fix: false, //不固定 maxmin: true, - content: Feng.ctxPath + '/TCompetition/carInsurance?carId=' + TCompetition.seItem.id + content: Feng.ctxPath + '/TQuestion/carInsurance?carId=' + TQuestion.seItem.id }); this.layerIndex = index; } @@ -616,7 +692,7 @@ /** * 查询车辆管理列表 */ -TCompetition.search = function () { +TQuestion.search = function () { var queryData = {}; if ($('#pCode option:selected').text()!="全部"){ queryData['province'] = $('#pCode option:selected').text(); @@ -630,10 +706,10 @@ queryData['payStatus'] = $("#state").val(); queryData['payUser'] = $("#payUser").val(); queryData['payStudent'] = $("#payStudent").val(); - TCompetition.table.refresh({query: queryData}); + TQuestion.table.refresh({query: queryData}); }; -TCompetition.resetSearch = function () { +TQuestion.resetSearch = function () { $("#pCode").val(""); $("#cCode").val(""); $("#coursePackage").val(""); @@ -641,14 +717,14 @@ $("#state").val(""); $("#payUser").val(""); $("#payStudent").val(""); - TCompetition.search(); + TQuestion.search(); }; $(function () { - var defaultColunms = TCompetition.initColumn(); - var table = new BSTable(TCompetition.id, "/cpPayment/listAll", defaultColunms); + var defaultColunms = TQuestion.initColumn(); + var table = new BSTable(TQuestion.id, "/cpPayment/listAll", defaultColunms); table.setPaginationType("client"); - TCompetition.table = table.init(); + TQuestion.table = table.init(); }); -- Gitblit v1.7.1