puzhibing
2023-12-04 3ad6b6ba2ba56fc0bcd2130e47190779c6e15acc
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
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
/**
 * 车辆管理管理初始化
 */
var TQuestion = {
    id: "TQuestionTable",    //表格id
    seItem: null,        //选中的条目
    table: null,
    layerIndex: -1
};
var role =$("#roleType").val()
var appUserId ;
/**
 * 初始化表格的列
 */
TQuestion.initColumn = function () {
    return [
        {field: 'selectItem', checkbox: true},
        {title: '序号', field: 'id', visible: true, align: 'center', valign: 'middle'},
        {title: '所在省市', field: 'provinceAndCity', visible: role==1?true:false, align: 'center', valign: 'middle'},
        {title:  '门店名称', field: 'storeName', visible: true, align: 'center', valign: 'middle'},
        {title:  '课包类型', field: 'coursePackageType', visible: true, align: 'center', valign: 'middle'},
        {title:  '课包名称', field: 'coursePackage', visible: true, align: 'center', valign: 'middle'},
        {title:  '购买用户', field: 'payUser', visible: true, align: 'center', valign: 'middle'},
        {title:  '联系方式', field: 'phone', visible: true, align: 'center', valign: 'middle'},
        {title:  '购课学员', field: 'payStudent', visible: true, align: 'center', valign: 'middle'},
        {title:  '购买方式', field: 'buyType', visible: true, align: 'center', valign: 'middle',
            formatter:function (data) {
                return{1:"线下",2:"线上",3:"折扣"}[data]
            }
        },
        {title:  '支付方式', field: 'buyTypeName', visible: true, align: 'center', valign: 'middle'},
        {title:  '总金额', field: 'originalPrice', visible: true, align: 'center', valign: 'middle'},
        {title:  '优惠金额', field: 'discountAmount', visible: true, align: 'center', valign: 'middle'},
        {title:  '支付价格', field: 'cashPayment', visible: true, align: 'center', valign: 'middle'},
        {title:  '支付状态', field: 'payStatus', visible: true, align: 'center', valign: 'middle',
            formatter:function (data) {
                return{1:"待支付",2:"已支付"}[data]
            }
        },
        {title:  '赠送课时', field: 'giftClassHours', visible: true, align: 'center', valign: 'middle'}
    ];
};
function currentTime(timestamp){
    var time = timestamp + '';
    if(time.length != 13){
        timestamp = timestamp * 1000;
    }
    var date = new Date(timestamp);;
    var Y = date.getFullYear() + '-';
    var M = (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1) + '-';
    var D = (date.getDate() < 10 ? '0' + (date.getDate()) : date.getDate()) + ' ';
 
    var h = (date.getHours() < 10 ? '0' + (date.getHours()) : date.getHours()) + ':';
    var m = (date.getMinutes() < 10 ? '0' + (date.getMinutes()) : date.getMinutes()) + ':';
    var s = (date.getSeconds() < 10 ? '0' + (date.getSeconds()) : date.getSeconds());
    var strDate = Y + M + D + h + m + s;
    return strDate
}
 
function currentTime1(timestamp){
    var time = timestamp + '';
    if(time.length != 13){
        timestamp = timestamp * 1000;
    }
    var date = new Date(timestamp);;
    var Y = date.getFullYear() + '-';
    var M = (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1) + '-';
    var D = (date.getDate() < 10 ? '0' + (date.getDate()) : date.getDate()) + ' ';
 
    var h = (date.getHours() < 10 ? '0' + (date.getHours()) : date.getHours()) + ':';
    var m = (date.getMinutes() < 10 ? '0' + (date.getMinutes()) : date.getMinutes()) + ':';
    var s = (date.getSeconds() < 10 ? '0' + (date.getSeconds()) : date.getSeconds());
    var strDate = Y + M + D ;
    return strDate
}
/**
 * 检查是否选中
 */
TQuestion.check = function () {
    var selected = $('#' + this.id).bootstrapTable('getSelections');
    if(selected.length == 0){
        Feng.info("请先选中表格中的某一记录!");
        return false;
    }else{
        TQuestion.seItem = selected[0];
        return true;
    }
};
 
/**
 * 点击添加车辆管理
 */
TQuestion.openAddTQuestion = function () {
    var index = layer.open({
        type: 2,
        title: '添加',
        area: ['100%', '100%'], //宽高
        fix: false, //不固定
        maxmin: true,
        content: Feng.ctxPath + '/cpPayment/add'
    });
    this.layerIndex = index;
};
 
/**
 * 打开查看车辆管理详情
 */
TQuestion.openTQuestionDetail = function () {
    if (this.check()) {
        var index = layer.open({
            type: 2,
            title:'编辑',
            area: ['100%', '100%'], //宽高
            fix: false, //不固定
            maxmin: true,
            content: Feng.ctxPath + '/tShop/tShop_update/' + TQuestion.seItem.id
        });
        this.layerIndex = index;
    }
};
TQuestion.info = function () {
    if (this.check()) {
        var index = layer.open({
            type: 2,
            title:'详情',
            area: ['100%', '100%'], //宽高
            fix: false, //不固定
            maxmin: true,
            content: Feng.ctxPath + '/tShop/tShop_info/' + TQuestion.seItem.id
        });
        this.layerIndex = index;
    }
};
TQuestion.gift = function () {
    if (this.check()) {
        var index = layer.open({
            type: 2,
            title:'免费福利',
            area: ['100%', '100%'], //宽高
            fix: false, //不固定
            maxmin: true,
            content: Feng.ctxPath + '/tShop/tShop_gift/' + TQuestion.seItem.id
        });
        this.layerIndex = index;
    }
};
TQuestion.indexSet = function () {
    if (this.check()) {
        var index = layer.open({
            type: 2,
            title:'首页设置',
            area: ['100%', '100%'], //宽高
            fix: false, //不固定
            maxmin: true,
            content: Feng.ctxPath + '/tShop/tShop_indexSet/' + TQuestion.seItem.id
        });
        this.layerIndex = index;
    }
};
 
/**
 * 删除车辆管理
 */
TQuestion.delete = function () {
    if (this.check()) {
        var nickname = TQuestion.seItem.carLicensePlate;
        if (nickname == "" || nickname == null || nickname == undefined){
            nickname = "该车辆";
        }else{
            nickname = "【"+nickname+"】";
        }
        swal({
            title: language==1?"您是否确认删除" + nickname + "?":(language==2?"Are you sure to delete the" + nickname + "?":"Apakah Anda pasti akan menghapus" + nickname + "?"),
            text: language==1?"请谨慎操作!":(language==2?' Please operate with caution!':'Harap beroperasi dengan hati -hati!'),
            type: "warning",
            showCancelButton: true,
            confirmButtonColor: "#DD6B55",
            confirmButtonText: language==1?"删除":(language==2?'Delete':'Hapus'),
            closeOnConfirm: true
        }, function () {
            var ajax = new $ax(Feng.ctxPath + "/TCompetition/delete", function (data) {
                if(language==1){
                    swal("删除成功", "您已经成功删除了" + nickname + "。", "success");
                }else if(language==2){
                    swal("Delete succeeded!", "You have successfully deleted it" + nickname + "。", "success");
                }else {
                    swal("Hapus berhasil!", "Anda berhasil menghapus" + nickname + "。", "success");
                }
                TQuestion.table.refresh();
            }, function (data) {
                if(language==1){
                    swal("删除失败", data.responseJSON.message + "!", "warning");
                }else if(language==2){
                    swal("Failed to delete", data.responseJSON.message + "!", "warning");
                }else {
                    swal("Hapus Gagal", data.responseJSON.message + "!", "warning");
                }
 
            });
            ajax.set("TCompetitionId",TCompetition.seItem.id);
            ajax.start();
        });
    }
};
TQuestion.oneChange = function (e) {
    console.log(111)
    var oneId=$(e).val();
    console.log(oneId)
    var content = "<option value=''>请选择</option>";
    var ajax = new $ax(Feng.ctxPath + "/tCompetition/onChange", function(data){
        if(data!=null){
 
            $.each(data, function(k,v) {
                content += "<option value='"+v.name+"'>"+v.name+"</option>";
            });
            $("#cCode").empty().append(content);
        }
    });
    ajax.set("oneId",oneId);
    ajax.start();
};
 
TQuestion.nextStore = function (e) {
    var oneId=$(e).val();
    console.log(oneId)
    var content = "<option value=''>请选择</option>";
    var ajax = new $ax(Feng.ctxPath + "/coursePackage/getCoursePackageByStoreId", function(data){
        if(data!=null){
 
            $.each(data, function(k,v) {
                content += "<option value='"+v.id+"'>"+v.name+"</option>";
            });
            $("#coursePackageType").empty().append(content);
        }
    });
    ajax.set("storeId",oneId);
    ajax.start();
};
TQuestion.addSubmit = function(){
    var data = {
        appUserId:null,
        studentId:null,
        coursePackageId:null,
        payType:null,
        classHours:null,
        originalPrice:null,
        cashPayment:null,
        playPaiCoin:null,
        totalClassHours:null,
        laveClassHours:null,
        absencesNumber:null,
        payUserType:2,
        payStatus:1,
        orderNumber:null,
        payUserId:2,
        status:1,
        withdrawalTime:"",
        certificate:"",
        state:1,
        giftClassHours:null,
        useTime:"",
        payUserName:"",
        coursePackageConfigId:null
    };
    data.appUserId            = appUserId;
    console.log("我看看规格id")
    console.log($("#courseTime").val())
    data.coursePackageConfigId            = $("#courseTime").val();
    data.studentId                = $("#student").val()
    data.coursePackageId       = $("#coursePackageName").val()
    data.cashPayment             = $("#cashPayment").val()
    data.playPaiCoin          = $("#playPaiCoin").val()
    data.classHours          = $('#courseTime option:selected').text()
    if (role == 1){
        if($("#studentId").val()=='' ){
            Feng.info("请选择学员")
            return;
        }
        if($("#pCode").val()=='' ){
            Feng.info("请选择省")
            return;
        }
        if($("#cCode").val()=='' ){
            Feng.info("请选择市")
            return;
        }
    }
    if (role!=3){
        if($("#store").val()==''){
            Feng.info("请选择门店")
            return;
        }
    }
    if($("#coursePackageType").val()=='' ){
        Feng.info("请选择课包类型")
        return;
    }
    if($("#coursePackageName").val()==''){
        Feng.info("请选择课包名称")
        return;
    }
    if (role == 1) {
        if ($("#courseTime").val() == '') {
            Feng.info("请选择课时规格")
            return;
        }
    }
    if($("#cashPayment").val()==''){
        Feng.info("请输入支付金额")
        return;
    }
    if($("#playPaiCoin").val()==''){
        Feng.info("请输入玩湃币支付")
        return;
    }
    var courseTimeId= $("#courseTime").val()
    console.log("看看课时")
    console.log(courseTimeId)
    data.coursePackageConfigId            = courseTimeId;
    if(typeof courseTimeId === 'undefined'){
        console.log("进入")
        courseTimeId=0;
    }
    $.ajax({
        url: Feng.ctxPath + "/cpPayment/addCoursePackagePayment/"+ courseTimeId,
        type: "POST",
        contentType: "application/json", // 设置请求头的 Content-Type
        data: JSON.stringify(data), // 将数据转换为 JSON 字符串
        success: function(response) {
            if (response == "5001"){
                Feng.error("当前课包预约人数已满!")
            }else if(response == "5002"){
                Feng.error("剩余课时不足,无法购买!")
            }else{
                Feng.success("购买成功!");
                TQuestion.close();
                window.parent.TQuestion.table.refresh();
            }
        },
        error: function(xhr, status, error) {
            var errorMessage = xhr.responseText ? xhr.responseText : "上架失败!";
            Feng.error("您的网络异常!");
        }
    });
};
/**
 * 关闭此对话框
 */
TQuestion.close = function() {
    parent.layer.close(window.parent.TQuestion.layerIndex);
}
TQuestion.getCoursePackage = function (e) {
    var oneId=$(e).val();
    console.log("门店id")
    console.log(oneId)
    var storeId = $("#store").val();
    console.log("课包类型")
    console.log(storeId)
    var content = "<option value=''>请选择</option>";
    var ajax = new $ax(Feng.ctxPath + "/coursePackage/getCoursePackageByType", function(data){
        if(data!=null){
 
            $.each(data, function(k,v) {
                content += "<option value='"+v.id+"'>"+v.name+"</option>";
            });
            $("#coursePackageName").empty().append(content);
        }
    });
    ajax.set("storeId",storeId);
    ajax.set("typeId",oneId);
    ajax.start();
};
TQuestion.getCoursePackageConfig = function (e) {
    var c1 = document.getElementById("c1");
    var c2 = document.getElementById("c2");
    var oneId=$(e).val();
    console.log(oneId)
    var content = "<option value=''>请选择</option>";
    var ajax = new $ax(Feng.ctxPath + "/cpPayment/getCoursePackageConfig", function(data){
        if(data!=null){
 
            $.each(data, function(k,v) {
                content += "<option value='"+v.id+"'  data-cashPayment='"+v.cashPayment+"' data-playPaiCoin='"+v.playPaiCoin+"'>"+v.classHours+"</option>";
            });
            $("#courseTime").empty().append(content);
        }else{
            c1.style.display = "none";
            c2.style.display = "none";
        }
    });
    if (oneId == ""){
        console.log("关闭");
        c1.style.display = "none";
        c2.style.display = "none";
    }else{
        console.log("展示")
        c1.style.display = 'block'
        c2.style.display = 'block'
    }
    ajax.set("id",oneId);
    ajax.start();
 
 
 
    var ajax1 = new $ax(Feng.ctxPath + "/cpPayment/getCoursePackageType", function(data){
        if(data!=null){
                console.log("data ===="+data)
            if (data != 1){
                document.getElementById("toHidden").style.display = "none";
 
                var selectElement = document.getElementById('courseTime');
                var selectedOption = selectElement.options[1];
                console.log("插入")
                var cashPayment = selectedOption.getAttribute('data-cashpayment');
                var playPaiCoin = selectedOption.getAttribute('data-playpaicoin');
                console.log(cashPayment)
                console.log(playPaiCoin)
                $("#cashPayment").val(cashPayment);
                $("#playPaiCoin").val(playPaiCoin);
 
 
            }else {
                document.getElementById("toHidden").style.display = "block";
 
            }
 
        }
    });
 
    ajax1.set("id",oneId);
    ajax1.start();
 
};
TQuestion.getCoursePackagePrice = function (e) {
    var c1 = document.getElementById("c1");
    var c2 = document.getElementById("c2");
    var oneId=$(e).val();
    var selectElement = document.getElementById('courseTime');
    var selectedOption = selectElement.options[selectElement.selectedIndex];
    console.log("插入")
    var cashPayment = selectedOption.getAttribute('data-cashpayment');
    var playPaiCoin = selectedOption.getAttribute('data-playpaicoin');
    console.log(cashPayment)
    console.log(playPaiCoin)
    $("#cashPayment").val(cashPayment);
    $("#playPaiCoin").val(playPaiCoin);
};
TQuestion.twoChange = function (e) {
    var oneId=e;
    var content = "<option value=''>请选择</option>";
    var ajax = new $ax(Feng.ctxPath + "/tCompetition/onChange", function(data){
        if(data!=null){
 
            $.each(data, function(k,v) {
                content += "<option value='"+v.name+"'>"+v.name+"</option>";
            });
            $("#cCode").empty().append(content);
        }
    });
    ajax.set("oneId",oneId);
    ajax.start();
};
 
TQuestion.threeChange = function (e) {
    var oneId=$(e).val();
    var content1 = "<option value=''>请选择门店</option>";
    var ajax2=new $ax(Feng.ctxPath + "/cpPayment/getStore", function(data){
        $.each(data, function(k,v) {
            content1 += "<option value='"+v.id+"'>"+v.name+"</option>";
        });
        $("#store").empty().append(content1);
    });
    ajax2.set("city",oneId);
    ajax2.start();
};
TQuestion.fourChange = function (e) {
    var content1 = "<option value=''>请选择门店</option>";
    var ajax2=new $ax(Feng.ctxPath + "/cpPayment/getStore", function(data){
        $.each(data, function(k,v) {
            content1 += "<option value='"+v.id+"'>"+v.name+"</option>";
        });
        $("#store").empty().append(content1);
    });
    ajax2.set("city",e);
    ajax2.start();
};
 
TQuestion.getStudent = function () {
    var phone = $("#vipPhone").val();
    var phoneRegex = /^1[3456789]\d{9}$/;
    // 使用正则表达式进行验证
    if (!phoneRegex.test(phone)) {
        Feng.error("手机号不合法");
        return;
    }
    // 回填省市
    var province;
    var city;
    var c;
    var content = "<option value=''>请选择学员</option>";
    $.ajax({
        url: Feng.ctxPath + "/cpPayment/getUserByPhone/"+phone,
        type: "GET",
        contentType: "application/json", // 设置请求头的 Content-Type
        success: function(response) {
            console.log("===================");
            console.log(response)
            if (response==""){
                let htmlStr =
                    '<div class="form-horizontal">' +
                    '   <div class="col-sm-11" style="padding: 20px;">' +
                    '       <div class="form-group">\n' +
                    '           <h2>验证失败,当前手机号未注册玩湃会员</h2>\n' +
                    '       </div>';
 
                layer.open({
                    type: 1
                    , title: '提示'
                    , area: ['50%', '90%']
                    , offset: 'auto' //具体配置参考:http://www.layui.com/doc/modules/layer.html#offset
                    , id: 'layerDemo' //防止重复弹出cge
                    , content: htmlStr
                    , btn: ['去添加', '关闭']
                    , btnAlign: 'c' //按钮居中
                    , shade: 0.5 //不显示遮罩
                    , yes: function () {
                        var index = layer.open({
                            type: 2,
                            title:'添加用户',
                            area: ['100%', '100%'], //宽高
                            fix: false, //不固定
                            maxmin: true,
                            content: Feng.ctxPath + '/appUser/add'
                        });
                        // layer.closeAll('page');
                    },
                    btn2:function () {
                    }
                });
            }else{
                province = response.province;
                city = response.city;
                appUserId = response.id;
                var ajax1=new $ax(Feng.ctxPath + "/cpPayment/queryStudentList", function(data){
 
                    if (data.length==0){
                        let htmlStr =
                            '<div class="form-horizontal">' +
                            '   <div class="col-sm-11" style="padding: 20px;">' +
                            '       <div class="form-group">\n' +
                            '           <h2>验证失败,当前用户未添加学员信息</h2>\n' +
                            '       </div>';
 
                        layer.open({
                            type: 1
                            , title: '提示'
                            , area: ['50%', '90%']
                            , offset: 'auto' //具体配置参考:http://www.layui.com/doc/modules/layer.html#offset
                            , id: 'layerDemo' //防止重复弹出cge
                            , content: htmlStr
                            , btn: ['去添加', '关闭']
                            , btnAlign: 'c' //按钮居中
                            , shade: 0.5 //不显示遮罩
                            , yes: function () {
                                var index = layer.open({
                                    type: 2,
                                    title:'首页设置',
                                    area: ['100%', '100%'], //宽高
                                    fix: false, //不固定
                                    maxmin: true,
                                    content: Feng.ctxPath + '/appUser/addStudent/'+appUserId
                                });
                                // layer.closeAll('page');
                            },
                        });
                    }
                    $.each(data, function(k,v) {
                        content += "<option value='"+v.id+"'>"+v.name+"</option>";
                    });
                    $("#student").empty().append(content);
                    var provinceSelect = document.getElementById("pCode");
                    for (var i = 0; i < provinceSelect.options.length; i++) {
                        var option = provinceSelect.options[i];
                        if (option.text === province) {
                            option.selected = true;
                            console.log(option.value)
                            TQuestion.twoChange(option.value);
                            break; // 找到匹配的选项后,可以选择停止遍历
                        }
                    }
 
                    var content1 = "<option value=''>请选择门店</option>";
                    var citySelect = document.getElementById("cCode");
                    for (var i = 0; i < citySelect.options.length; i++) {
                        var option = citySelect.options[i];
                        if (option.text === city) {
                            option.selected = true;
                            c =  option.text;
                            TQuestion.fourChange(c)
 
                            break; // 找到匹配的选项后,可以选择停止遍历
                        }
                    }
                });
                ajax1.set("appUserId",appUserId);
                ajax1.start();
            }
        }
    });
 
 
 
};
 
TQuestion.freeze = function () {
    if (this.check()) {
        var ajax = new $ax(Feng.ctxPath + "/tShop/freeze", function (data) {
            Feng.success("冻结成功!");
            TQuestion.table.refresh();
        }, function (data) {
            Feng.error("冻结失败!" + data.responseJSON.message + "!");
        });
        ajax.set("id",this.seItem.id);
        ajax.start();
    }
};
TQuestion.unfreeze = function () {
    if (this.check()) {
        var selected = $('#' + this.id).bootstrapTable('getSelections');
        console.log("看看选择")
        console.log(selected)
        const data1 = {
            ids:[],
            payUserName:""
        };
        selected.forEach(function(obj) {
            var id = "";
            id = obj.id;
            data1.ids.push(id);
        });
        console.log(data1)
        $.ajax({
            url: Feng.ctxPath + "/cpPayment/pay",
            type: "POST",
            contentType: "application/json", // 设置请求头的 Content-Type
            data: JSON.stringify(data1), // 将数据转换为 JSON 字符串
            success: function(response) {
                Feng.success("支付成功!");
                TQuestion.table.refresh();
            },
            error: function(xhr, status, error) {
                var errorMessage = xhr.responseText ? xhr.responseText : "上架失败!";
                Feng.error("您的网络异常!");
            }
        });
    }
};
TQuestion.reload = function () {
    if (this.check()) {
        let id = this.seItem.id
        var operation = function(){
            var ajax = new $ax(Feng.ctxPath + "/tCity/pwd", function (data) {
                Feng.success("重置成功!");
                TQuestion.table.refresh();
            }, function (data) {
                Feng.error("重置失败!" + data.responseJSON.message + "!");
            });
            ajax.set("id",id);
            ajax.start();
        }
        Feng.confirm("确认重置密码?重置后密码为:a123456", operation);
    }
 
};
 
TQuestion.carInsurance = function () {
    if (this.check()) {
        var index = layer.open({
            type: 2,
            title: language==1?'车辆保险':(language==2?'Vehicle insurance':'Asuransi kendaraan'),
            area: ['100%', '100%'], //宽高
            fix: false, //不固定
            maxmin: true,
            content: Feng.ctxPath + '/TQuestion/carInsurance?carId=' + TQuestion.seItem.id
        });
        this.layerIndex = index;
    }
};
 
 
 
/**
 * 查询车辆管理列表
 */
TQuestion.search = function () {
    var queryData = {};
    if ($('#pCode option:selected').text()!="全部"){
        queryData['province'] = $('#pCode option:selected').text();
    }else{
        queryData['province'] = "";
    }
 
    queryData['city'] = $("#cCode").val();
    queryData['coursePackageTypeId'] = $("#coursePackage").val();
    queryData['coursePackageTypeName'] = $("#coursePackageName").val();
    queryData['payStatus'] = $("#state").val();
    queryData['payUser'] = $("#payUser").val();
    queryData['payStudent'] = $("#payStudent").val();
    TQuestion.table.refresh({query: queryData});
};
 
TQuestion.resetSearch = function () {
    $("#pCode").val("");
    $("#cCode").val("");
    $("#coursePackage").val("");
    $("#coursePackageName").val("");
    $("#state").val("");
    $("#payUser").val("");
    $("#payStudent").val("");
    TQuestion.search();
};
 
$(function () {
    var defaultColunms = TQuestion.initColumn();
    var table = new BSTable(TQuestion.id, "/cpPayment/listAll", defaultColunms);
    table.setPaginationType("client");
    TQuestion.table = table.init();
});