From 89c36365eda5cdd23de2338f1c28a5b250ea7b34 Mon Sep 17 00:00:00 2001 From: 44323 <443237572@qq.com> Date: 星期一, 25 九月 2023 17:12:59 +0800 Subject: [PATCH] 后台代码 --- cloud-server-management/src/main/webapp/static/modular/system/cpPayment/cpPayment.js | 126 +++++++++++++++++++++++++++-------------- 1 files changed, 83 insertions(+), 43 deletions(-) diff --git a/cloud-server-management/src/main/webapp/static/modular/system/cpPayment/cpPayment.js b/cloud-server-management/src/main/webapp/static/modular/system/cpPayment/cpPayment.js index 4bfbcac..b88d861 100644 --- a/cloud-server-management/src/main/webapp/static/modular/system/cpPayment/cpPayment.js +++ b/cloud-server-management/src/main/webapp/static/modular/system/cpPayment/cpPayment.js @@ -8,13 +8,14 @@ layerIndex: -1 }; var role =$("#roleType").val() +var appUserId ; /** * 初始化表格的列 */ TCompetition.initColumn = function () { return [ {field: 'selectItem', checkbox: true}, - {title: 'id', field: 'id', visible: true, align: 'center', valign: 'middle'}, + {title: 'id', field: 'id', visible: false, align: 'center', valign: 'middle'}, {title: '所在省市', field: 'provinceAndCity', visible: role==1?true:false, align: 'center', valign: 'middle'}, {title: '门店名称', field: 'storeName', visible: true, align: 'center', valign: 'middle'}, {title: '课包类型', field: 'coursePackageType', visible: true, align: 'center', valign: 'middle'}, @@ -237,12 +238,12 @@ }; TCompetition.addSubmit = function(){ var data = { - appUserId:"", - studentId:"", - coursePackageId:"", - payType:7, - classHours:"", - originalPrice:"", + appUserId:null, + studentId:null, + coursePackageId:null, + payType:null, + classHours:null, + originalPrice:null, cashPayment:null, playPaiCoin:null, totalClassHours:null, @@ -250,9 +251,9 @@ absencesNumber:null, payUserType:2, payStatus:1, - orderNumber:2, + orderNumber:null, payUserId:2, - status:null, + status:1, withdrawalTime:"", certificate:"", state:1, @@ -260,27 +261,31 @@ useTime:"", payUserName:"", }; - data.appUserId = appUserId + data.appUserId = appUserId; data.studentId = $("#student").val() data.coursePackageId = $("#coursePackageName").val() data.cashPayment = $("#cashPayment").val() data.playPaiCoin = $("#playPaiCoin").val() - - if($("#studentId").val()=='' ){ - Feng.info("请选择学员") - return; + data.classHours = $('#courseTime option:selected').text() + if (role == 1){ + if($("#studentId").val()=='' ){ + Feng.info("请选择学员") + return; + } + if($("#pCode").val()=='' ){ + Feng.info("请选择省") + return; + } + if($("#cCode").val()=='' ){ + Feng.info("请选择市") + return; + } } - if($("#pCode").val()=='' ){ - Feng.info("请选择省") - return; - } - if($("#cCode").val()=='' ){ - Feng.info("请选择市") - return; - } - if($("#store").val()==''){ - Feng.info("请选择门店") - return; + if (role!=3){ + if($("#store").val()==''){ + Feng.info("请选择门店") + return; + } } if($("#coursePackageType").val()=='' ){ Feng.info("请选择课包类型") @@ -290,30 +295,46 @@ Feng.info("请选择课包名称") return; } - if($("#courseTime").val()==''){ - Feng.info("请选择课时规格") + if (role == 1) { + if ($("#courseTime").val() == '') { + Feng.info("请选择课时规格") + return; + } + } + if($("#cashPayment").val()==''){ + Feng.info("请输入支付金额") return; } - if($("#cashPayment").val()=='' || $("#playPaiCoin").val()==''){ - Feng.info("请输入支付金额或请输入玩湃币支付") + if($("#playPaiCoin").val()==''){ + Feng.info("请输入玩湃币支付") return; } $.ajax({ - url: Feng.ctxPath + "/tSite/changeState", + url: Feng.ctxPath + "/cpPayment/addCoursePackagePayment/"+ $("#courseTime").val(), type: "POST", contentType: "application/json", // 设置请求头的 Content-Type - data: JSON.stringify(data1), // 将数据转换为 JSON 字符串 + data: JSON.stringify(data), // 将数据转换为 JSON 字符串 success: function(response) { - Feng.success("上架成功!"); - TSite.search(); + if (response == "5001"){ + Feng.error("当前课包预约人数已满!") + }else{ + Feng.success("上架成功!"); + TCompetition.close(); + TCompetition.search(); + } }, error: function(xhr, status, error) { var errorMessage = xhr.responseText ? xhr.responseText : "上架失败!"; Feng.error("您的网络异常!"); } }); - }; +/** + * 关闭此对话框 + */ +TCompetition.close = function() { + parent.layer.close(window.parent.TCompetition.layerIndex); +} TCompetition.getCoursePackage = function (e) { var oneId=$(e).val(); console.log(oneId) @@ -328,6 +349,22 @@ } }); ajax.set("storeId",oneId); + ajax.start(); +}; +TCompetition.getCoursePackageConfig = function (e) { + var oneId=$(e).val(); + console.log(oneId) + var content = "<option value=''>请选择</option>"; + var ajax = new $ax(Feng.ctxPath + "/cpPayment/getCoursePackageConfig", function(data){ + if(data!=null){ + + $.each(data, function(k,v) { + content += "<option value='"+v.id+"'>"+v.classHours+"</option>"; + }); + $("#courseTime").empty().append(content); + } + }); + ajax.set("id",oneId); ajax.start(); }; TCompetition.twoChange = function (e) { @@ -345,23 +382,20 @@ ajax.set("oneId",oneId); ajax.start(); }; + TCompetition.threeChange = function (e) { - var oneId=e; - console.log("看看奥") - console.log(oneId) var content1 = "<option value=''>请选择门店</option>"; var ajax2=new $ax(Feng.ctxPath + "/cpPayment/getStore", function(data){ - console.log("看看返回数据") - console.log(data) $.each(data, function(k,v) { content1 += "<option value='"+v.id+"'>"+v.name+"</option>"; }); $("#store").empty().append(content1); }); - ajax2.set("city",oneId); + ajax2.set("city",e); ajax2.start(); }; -var appUserId ; + + TCompetition.getStudent = function () { var phone = $("#vipPhone").val(); var phoneRegex = /^1[3456789]\d{9}$/; @@ -408,7 +442,7 @@ fix: false, //不固定 maxmin: true, // todo 写用户管理路径 - content: Feng.ctxPath + '/cpPayment/add' + content: Feng.ctxPath + '/appUser/add' }); this.layerIndex = index; }, @@ -445,7 +479,7 @@ fix: false, //不固定 maxmin: true, // todo 写用户管理路径 - content: Feng.ctxPath + '/cpPayment/add' + content: Feng.ctxPath + '/appUser/addStudent/'+appUserId }); this.layerIndex = index; }, @@ -505,6 +539,7 @@ TCompetition.unfreeze = function () { if (this.check()) { var selected = $('#' + this.id).bootstrapTable('getSelections'); + console.log("看看选择") console.log(selected) const data1 = { @@ -512,8 +547,13 @@ payUserName:"" }; selected.forEach(function(obj) { + if (obj.payStatus == 2){ + Feng.error("订单已支付!不能再手动支付了") + return; + } var id = ""; id = obj.id; + console.log(obj.id); data1.ids.push(id); }); console.log(data1) -- Gitblit v1.7.1