无关风月
昨天 ff94903b42fc1616cc139d071d915e271d12422a
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
/**
 * 车辆管理管理初始化
 */
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);
    }
}