无关风月
2025-05-08 9486766c806fe1d9e082b2fd02ea1cc558f1b443
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
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
/**
 * 系统管理--用户管理的单例对象
 */
let RegistrationRecord = {
    id: "managerTable",//表格id
    seItem: null,        //选中的条目
    table: null,
    layerIndex: -1
};
let language =$("#language").val()
/**
 * 初始化表格的列
 */
RegistrationRecord.initColumn = function () {
    let columns = [
        {field: 'selectItem', checkbox: true},
        {title: '序号', field: 'id', visible: true, align: 'center', valign: 'middle',
            formatter: function (value, row) {
              if (row.status ==7){
                    return '<div style="color: blue;">' + value + '</div>';
                }
                else {
                    return value;
                }
            }},
        {title: '购买用户', field: 'userName', align: 'center', valign: 'middle',
            formatter: function (value, row) {
                if (row.status ==7){
                    return '<div style="color: blue;">' + value + '</div>';
                }
                else {
                    return value;
                }
            }},
        {title: '联系方式', field: 'phone', align: 'center', valign: 'middle',
            formatter: function (value, row) {
                if (row.status ==7){
                    return '<div style="color: blue;">' + value + '</div>';
                }
                else {
                    return value;
                }
            }},
        {title: '购课学员', field: 'studentName', align: 'center', valign: 'middle',
            formatter: function (value, row) {
                if (row.status ==7){
                    return '<div style="color: blue;">' + value + '</div>';
                }
                else {
                    return value;
                }
            }},
        {title: '报名时间', field: 'insertTime', align: 'center', valign: 'middle',
            formatter: function (value, row) {
                if (row.status ==7){
                    return '<div style="color: blue;">' + value + '</div>';
                }
                else {
                    return value;
                }
            }},
        {title: '总课时数', field: 'totalClassHours', align: 'center', valign: 'middle',
            formatter: function (value, row) {
                if (row.status ==7){
                    return '<div style="color: blue;">' + value + '</div>';
                }
                else {
                    return value;
                }
            }},
        {
            title: '剩余课时数',
            field: 'laveClassHours',
            align: 'center',
            valign: 'middle',
            formatter: function (value, row) {
                if (value < 3) {
                    return '<div style="color: red;">' + value + '</div>';
                }else if (row.status ==7){
                    return '<div style="color: blue;">' + value + '</div>';
                }
                else {
                    return value;
                }
            }
        },
        {
            title: '已上课时数',
            field: 'already',
            align: 'center',
            valign: 'middle',
            formatter: function (value, row) {
                if (row.status ==7){
                    return '<div style="color: blue;">' + value + '</div>';
                }
                else {
                    return value;
                }
            }
            // ,
            // formatter: function (value, row) {
            //     var totalClassHours = row.totalClassHours;
            //     var laveClassHours = row.laveClassHours;
            //     var alreadyClassHours = totalClassHours - laveClassHours;
            //     return alreadyClassHours;
            // }
        },
        {title: '请假次数', field: 'absencesNumber', align: 'center', valign: 'middle',
            formatter: function (value, row) {
                if (row.status ==7){
                    return '<div style="color: blue;">' + value + '</div>';
                }
                else {
                    return value;
                }
            }},
        {
            title: '状态',
            field: 'status',
            align: 'center',
            valign: 'middle',
            formatter: function (v) {
                switch (v) {
                    case 1:
                        return '正常';
                    case 2:
                        return '已退课';
                    case 3:
                        return '换课中';
                    case 4:
                        return '申请退费中';
                    case 5:
                        return '已转移';
                    case 6:
                        return '已赠课'
                    case 7:
                        return '体验购课';
                    default:
                        return '';
                }
            }
        }
    ];
    return columns;
};
 
/**
 * 检查是否选中
 */
RegistrationRecord.check = function () {
    let selected = $('#' + this.id).bootstrapTable('getSelections');
    if (selected.length > 1) {
        Feng.info("只能选中表格中的一条记录!");
        return false;
    } else {
        RegistrationRecord.seItem = selected[0];
        RegistrationRecord.seItem1 = selected;
 
        return true;
    }
};
 
RegistrationRecord.check1 = function () {
    let selected = $('#' + this.id).bootstrapTable('getSelections');
    if (selected.length == 0) {
        Feng.info("必须选中表格中的某一记录!");
        return false;
    } else {
        RegistrationRecord.seItem = selected[0];
        RegistrationRecord.seItem1 = selected;
 
        return true;
    }
};
 
/**
 * 上课记录
 */
RegistrationRecord.classRecord = function () {
    let index = layer.open({
        type: 2,
        title: '上课记录',
        area: ['100%', '100%'], //宽高
        fix: false, //不固定
        maxmin: true,
        content: Feng.ctxPath + '/coursePackage/openClassRecord?id=' + $('#id').val()
    });
    this.layerIndex = index;
};
 
 
RegistrationRecord.holiClass = function () {
    if (this.check1()) {
        var ids = RegistrationRecord.seItem1.map(function(item) {
            return item.studentId;
        }).join(",");
        let index = layer.open({
            type: 2,
            title: '报名信息',
            area: ['50%', '50%'], //宽高
            fix: false, //不固定
            maxmin: true,
            content: Feng.ctxPath + '/tStudent/TTT?ids='+ids+'&id='+$('#id').val()
        });
        this.layerIndex = index;
    }
};
 
RegistrationRecord.transClass = function () {
    if (this.check()) {
        var ids = RegistrationRecord.seItem1.map(function(item) {
            return item.studentId;
        }).join(",");
        let index = layer.open({
            type: 2,
            title: '报名信息',
            area: ['50%', '50%'], //宽高
            fix: false, //不固定
            maxmin: true,
            content: Feng.ctxPath + '/tStudent/trans?ids='+ids+'&id='+$('#id').val()
        });
        this.layerIndex = index;
    }
};
 
 
/**
 * 点击修改按钮时
 * @param userId 管理员id
 */
RegistrationRecord.dropClass = function () {
    if (this.check()) {
        if(ClassRecord.seItem.status == 2){
            Feng.error("不能重复退课");
            return
        }
        let htmlStr =
            '<div class="form-horizontal">' +
            '   <div class="col-sm-11">' +
            '       <div class="form-group">\n' +
            '           <label class="col-sm-8 control-label">课程名称:' + $("#name").text() + '</label>\n' +
            '       </div>' +
            '       <div class="form-group">\n' +
            '           <label class="col-sm-8 control-label">用户姓名:' + ClassRecord.seItem.userName + '</label>\n' +
            '       </div>' +
            '       <div class="form-group">\n' +
            '           <label class="col-sm-8 control-label">学员姓名:' + ClassRecord.seItem.studentName + '</label>\n' +
            '       </div>' +
            '       <div class="form-group">\n' +
            '           <label class="col-sm-8 control-label">*上传凭证:</label>\n' +
            '       </div>' +
            '       <div class="form-group">\n' +
            '           <div class="col-sm-8">\n' +
            '               <img id="certificate" src="" style="height: 100px;">' +
            '               <input type="file" id="file" style="display: none;"/>' +
            '               <button onclick="uploadImgs()" style="width: 20px;padding: 10px; color: white;background-color: #0d8ddb;border-radius: 5px;"> 上传 </button>' +
            '           </div>\n' +
            '       </div>' +
            '   </div>' +
            '</div>';
        layer.open({
            type: 1
            , title: '退课'
            , area: ['50%', '50%']
            , offset: 'auto' //具体配置参考:http://www.layui.com/doc/modules/layer.html#offset
            , id: 'layerDemo' //防止重复弹出cge
            , content: htmlStr
            , btn: ['保存', '关闭']
            , btnAlign: 'c' //按钮居中
            , shade: 0.5 //不显示遮罩
            , yes: function () {
                let certificate = $('#certificate').attr('img');
                if(null == certificate || '' == certificate){
                    Feng.error("请上传凭证图片");
                    return
                }
                let ajax = new $ax(Feng.ctxPath + "/coursePackage/dropTheClass", function (res) {
                    if(res.code == 200){
                        Feng.success("退课成功!");
                        layer.closeAll();
                        RegistrationRecord.table.refresh();
                    }else{
                        Feng.error(res.msg);
                    }
                }, function (data) {
                    Feng.error("退课失败!" + data.responseJSON.message + "!");
                });
                ajax.set("coursePackagePaymentId", ClassRecord.seItem.id);
                ajax.set("certificate", certificate);
                ajax.start();
            },
        });
 
        $('#file').on('change', function () {
            var formData = new FormData()  //创建一个forData
            formData.append('file', $('#file')[0].files[0]) //把file添加进去  name命名为img
            layer.load(); //上传loading
            $.ajax({
                url: Feng.ctxPath + '/mgr/uploadImg',
                data: formData,
                type: "POST",
                async: true,
                cache: false,
                contentType: false,
                processData: false,
                success: function(res) {
                    layer.closeAll('loading'); //关闭loading
                    $('#file').val('');
                    $('#certificate').attr('src', res);
                }
            })
        })
    }
};
 
 
 
function uploadImgs(){
    $('#file').click();
}
 
 
/**
 * 删除用户
 */
RegistrationRecord.makeUpMissedLessons = function () {
    if (this.check()) {
        let operation = function(){
            let ajax = new $ax(Feng.ctxPath + "/coursePackage/makeUpMissedLessons", function (data) {
                Feng.success(data.msg);
                RegistrationRecord.table.refresh();
            }, function (data) {
                Feng.error("补课失败!" + data.responseJSON.message + "!");
            });
            ajax.set("id", RegistrationRecord.seItem.id);
            ajax.start();
        };
 
        Feng.confirm("是否补课",operation);
    }
};
 
 
 
 
RegistrationRecord.resetSearch = function () {
    $("#userName").val("");
    $("#studentName").val("");
    RegistrationRecord.search();
}
 
RegistrationRecord.search = function () {
    let queryData = {};
    queryData['userName'] = $("#userName").val();
    queryData['studentName'] = $("#studentName").val();
    queryData['id'] = $('#id').val();
    RegistrationRecord.table.refresh({query: queryData});
}
 
 
$(function () {
    let defaultColunms = RegistrationRecord.initColumn();
    let table = new BSTable(RegistrationRecord.id, "/coursePackage/queryRegistrationRecord", defaultColunms);
    // 设置物理分页server(逻辑分页client)
    table.setPaginationType("server");
    table.setQueryParams({
        id: $('#id').val()
    })
    RegistrationRecord.table = table.init();
});