/**
|
* 车辆管理管理初始化
|
*/
|
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: '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: '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 id = row.id;
|
// 已退费不展示按钮
|
if (temp==0){
|
var str = '<button class="btn btn-outline btn-primary" onclick="TCompetition.refund(\'' + id + '\')" >'+'会员退费'+'</button>'
|
btn = ['<p class="toolTip" style="overflow:hidden;white-space:nowrap;text-overflow:ellipsis;" title="" onfocus="TUser.tooltip()">' + str + '</p>']
|
return btn;
|
}else{
|
return '已退费';
|
}
|
}
|
},
|
];
|
};
|
/**
|
* 打开编辑
|
*/
|
TCompetition.refund = function (e) {
|
console.log("退款记录id")
|
console.log( e)
|
const data1 = {
|
id:null,
|
vipEndTime:""
|
|
};
|
var index = layer.load(1,{
|
type: 1
|
, title: '会员退费'
|
, area: ['800px', '600px']
|
, offset: 'auto' //具体配置参考:http://www.layui.com/doc/modules/layer.html#offset
|
, id: 'layerDemo' //防止重复弹出cge
|
, content: '<div class="form-horizontal" style="padding-top: 20px;">' +
|
' <div class="col-sm-11" >' +
|
' <div class="col-sm-11">' +
|
' <div class="form-group">\n' +
|
'<label class="col-sm-3 control-label">*会员到期时间:</label>'+
|
'<div class="col-sm-9">'+
|
'<input style="width: 300px" class="form-control" id="vipEndTime" name="vipEndTime" type="date">'+
|
'</div>'+
|
' <div class="form-group refusal" >\n' +
|
' <label class="col-sm-3 control-label">备注:</label>\n' +
|
' <div class="col-sm-9">\n' +
|
' <textarea id="refusal" class="form-control" style="width: 100%;height: 200px"></textarea>'+
|
' </div>\n' +
|
' </div>\n' +
|
' </div>' +
|
' </div>' +
|
'</div>'
|
, 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.vipEndTime = $("#vipEndTime").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(xhr, status, error) {
|
var errorMessage = xhr.responseText ? xhr.responseText : "退费失败!";
|
Feng.error("退费失败!");
|
}
|
});
|
}
|
});
|
this.layerIndex = index;
|
|
};
|
|
|
/**
|
* 查询车辆管理列表
|
*/
|
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);
|
}
|
}
|