/**
|
* 车辆管理管理初始化
|
*/
|
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: 'ticketName', visible: true, align: 'center', valign: 'middle'},
|
{title: '权益类型', field: 'type', visible: true, align: 'center', valign: 'middle',
|
formatter:function (data) {
|
return {1:"优惠券",2:"门票"}[data]
|
}
|
},
|
{title: '关联会员类型', field: 'vipName', 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: 'status', visible: true, align: 'center', valign: 'middle',
|
formatter:function (data) {
|
return {1:"未使用",2:"已使用",3:"已过期"}[data]
|
}
|
},
|
{title: '使用场地/商品名称', field: 'goodsName', visible: true, align: 'center', valign: 'middle'},
|
{title: '使用门店', field: 'storeName', visible: true, align: 'center', valign: 'middle'},
|
{title: '归属运营商', field: 'operatorName', visible: true, align: 'center', valign: 'middle'},
|
{title: '获得时间', field: 'insertTime', visible: true, align: 'center', valign: 'middle'},
|
{title: '使用时间', field: 'useTime', visible: true, align: 'center', valign: 'middle'},
|
|
];
|
};
|
|
|
|
|
|
/**
|
* 查询车辆管理列表
|
*/
|
TCompetition.search = function () {
|
var queryData = {};
|
queryData['vipName'] = $("#vipName").val();
|
queryData['type'] = $("#type").val();
|
queryData['phone'] = $("#phone").val();
|
queryData['storeName'] = $("#storeName").val();
|
queryData['operatorId'] = $("#operatorId").val();
|
queryData['status'] = $("#status").val();
|
queryData['time'] = $("#time").val();
|
queryData['useTime'] = $("#useTime").val();
|
TCompetition.table.refresh({query: queryData});
|
};
|
|
|
TCompetition.resetSearch = function () {
|
$("#vipName").val("");
|
$("#type").val("");
|
$("#name").val("");
|
$("#phone").val("");
|
$("#storeName").val("");
|
$("#operatorId").val("");
|
$("#status").val("");
|
$("#time").val("");
|
$("#useTime").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);
|
}
|
}
|