/** * 车辆管理管理初始化 */ var TCompetition = { id: "TCompetitionTable", //表格id seItem: null, //选中的条目 table: null, layerIndex: -1 }; var language =1 var role =$("#role").val() /** * 初始化表格的列 */ TCompetition.initColumn = function () { return [ {field: 'selectItem', radio: true}, {title: '序号', field: 'id', visible: true, align: 'center', valign: 'middle'}, {title: '订单编号', field: 'code', visible: true, align: 'center', valign: 'middle'}, {title: '用户姓名', field: 'appUserName', visible: true, align: 'center', valign: 'middle'}, {title: '联系电话', field: 'appUserPhone', visible: true, align: 'center', valign: 'middle'}, {title: '会员卡名称', field: 'vipName', visible: true, align: 'center', valign: 'middle'}, {title: '时长', field: 'vipTime', visible: true, align: 'center', valign: 'middle'}, {title: '支付流水号', field: 'orderNumber', visible: true, align: 'center', valign: 'middle'}, {title: '金额', field: 'amountValue', visible: true, align: 'center', valign: 'middle'}, {title: '下单时间', field: 'insertTime', visible: true, align: 'center', valign: 'middle'}, {title: '是否退费', field: 'isRefund', visible: true, align: 'center', valign: 'middle', formatter:function (data) { return {0:"否",1:"是"}[data] } }, {title: '权限展示', field: 'menuShow', visible: false, align: 'center', valign: 'middle', formatter:function (data) { return {2:"否",1:"是"}[data] } }, {title: '备注', field: 'remark', visible: true, align: 'center', valign: 'middle'}, { title: '操作', field: 'remark', visible: true, align: 'center', valign: 'middle', formatter: function (data,row) { // row.redCode存储的设备二维码连接 var temp = row.isRefund; var menuShow = row.menuShow; var id = row.id; // 已退费不展示按钮 if (temp==0 && menuShow==1){ var str = '' btn = ['

' + str + '

'] return btn; }else if (temp==0 && menuShow==2){ return "-"; }else{ return '已退费'; } } }, ]; }; TCompetition.check = function () { var selected = $('#' + this.id).bootstrapTable('getSelections'); if (selected.length === 0) { Feng.info('请先选中表格中的某一记录!'); return false; } TCompetition.seItem = selected[0]; return true; }; TCompetition.viewSensitiveData = function () { if (this.check()) SensitiveInfo.view('/system/sensitive/app-user/' + this.seItem.appUserId); }; TCompetition.export = function (){ var queryData = TCompetition.getQueryParam(); // 生成带参数的完整URL var exportUrl = Feng.ctxPath + "/vipDetail/export?" + $.param(queryData); window.location.href = exportUrl; } TCompetition.getQueryParam = function () { var queryData = {}; queryData['appUserName'] = $("#appUserName").val(); queryData['vipName'] = $("#vipName").val(); queryData['phone'] = $("#phone").val(); queryData['isRefund'] = $("#isRefund").val(); queryData['time'] = $("#time").val(); return queryData; } /** * 打开编辑 */ TCompetition.refund = function (e) { console.log("退款记录id") console.log( e) const data1 = { id:null, endTime:"", remark:"" }; var index = layer.load(1,{ type: 1 , title: '会员退费' , area: ['600px', '550px'] , offset: 'auto' //具体配置参考:http://www.layui.com/doc/modules/layer.html#offset , id: 'layerDemo' //防止重复弹出cge , content: '
' + '
' + '
' + '
\n' + ''+ '
'+ ''+ '
'+ '
' + '
' + '
\n' + ' \n' + '
\n' + ' '+ '
\n' + '
\n' + '
' , btn: ['保存', '关闭'] , btnAlign: 'c' //按钮居中 , shade: 0.5 //不显示遮罩 ,load:1 , yes: function () { var vipEndTime = $("#vipEndTime").val(); if(vipEndTime==null || vipEndTime==''){ Feng.error("请选择会员到期时间!"); return; } data1.id = e; data1.endTime = $("#vipEndTime").val(); data1.remark = $("#refusal").val(); $.ajax({ url: Feng.ctxPath + "/vipDetail/refund", type: "POST", contentType: "application/json", // 设置请求头的 Content-Type data: JSON.stringify(data1), // 将数据转换为 JSON 字符串 success: function(response) { Feng.success("操作成功!"); window.location.reload(); layer.closeAll(); }, error: function(response) { Feng.error("退费失败!原因:"+response.msg); } }); } }); this.layerIndex = index; }; TCompetition.export = function (){ var queryData = TCompetition.getQueryParam(); // 生成带参数的完整URL var exportUrl = Feng.ctxPath + "/vipDetail/export?" + $.param(queryData); window.location.href = exportUrl; } TCompetition.getQueryParam = function () { var queryData = {}; queryData['appUserName'] = $("#appUserName").val(); queryData['vipName'] = $("#vipName").val(); queryData['phone'] = $("#phone").val(); queryData['isRefund'] = $("#isRefund").val(); queryData['time'] = $("#time").val(); return queryData; } /** * 查询车辆管理列表 */ TCompetition.search = function () { var queryData = {}; queryData['appUserName'] = $("#appUserName").val(); queryData['vipName'] = $("#vipName").val(); queryData['phone'] = $("#phone").val(); queryData['isRefund'] = $("#isRefund").val(); queryData['time'] = $("#time").val(); TCompetition.table.refresh({query: queryData}); }; TCompetition.resetSearch = function () { $("#appUserName").val(""); $("#vipName").val(""); $("#phone").val(""); $("#isRefund").val(""); $("#time").val(""); TCompetition.search(); }; $(function () { var defaultColunms = TCompetition.initColumn(); var table = new BSTable(TCompetition.id, "/vipDetail/list", defaultColunms); table.setPaginationType("client"); TCompetition.table = table.init(); TCompetition.getAmount(); }); /** * 下载模板 */ TCompetition.uploadCarModel = function () { window.location.href = Feng.ctxPath + "/TCompetition/uploadCarModel"; } var agreement = function(){ this.init = function(){ //模拟上传excel   $("#uploadEventBtn").unbind("click").bind("click",function(){ $("#uploadEventFile").click(); }); }; } /** * 导入合同 */ TCompetition.exporTCompetition = function () { var uploadEventFile = $("#uploadEventFile").val(); if(uploadEventFile == ''){ if(language==1){ Feng.info("请选择Excel,再上传"); }else if(language==2){ Feng.info("Please select Excel and upload"); }else { Feng.info("Silakan pilih Excel dan upload"); } }else if(uploadEventFile.lastIndexOf(".xls")<0){//可判断以.xls和.xlsx结尾的excel   if(language==1){ Feng.info("只能上传Excel文件"); }else if(language==2){ Feng.info("Only Excel files can be uploaded"); }else { Feng.info("Hanya berkas Excel yang dapat diunggah"); } }else{ var url = Feng.ctxPath + '/TCompetition/exporTCompetition'; var file = document.querySelector('input[name=file]').files[0]; var reader = new FileReader(); if (file) { var formData = new FormData(); formData.append("myfile", file); this.sendAjaxRequest(url, 'POST', formData); } } } TCompetition.sendAjaxRequest = function(url,type,data){ $.ajax({ url : url, type : type, data : data, success : function(result) { if(result.code==500) { Feng.info(result.message); }else { if(language==1){ Feng.success("导入成功!"); }else if(language==2){ Feng.success("SUCCESSFUL IMPORT!"); }else { Feng.success("Import berhasil!"); } } TCompetition.table.refresh(); }, error : function() { if(language==1){ Feng.error("excel上传失败!"); }else if(language==2){ Feng.error("Uploading excel Fails. Procedure!"); }else { Feng.error("Gagal mengunggah excel!"); } }, cache : false, contentType : false, processData : false }); }; var agreement; $(function(){ agreement = new agreement(); agreement.init(); }); /** * 导出车辆操作 */ TCompetition.ouTCompetition = function () { var operation = function() { window.location.href = Feng.ctxPath + "/TCompetition/ouTCompetition"; }; if(language==1){ Feng.confirm("是否确认导出车辆信息?", operation); }else if(language==2){ Feng.confirm("Are you sure to export vehicle information?", operation); }else { Feng.confirm("Apakah Anda pasti akan mengekspor informasi kendaraan?", operation); } }