Blame view

assets/pages/scripts/otherSetting/xxcoupon/undercoupon.js 26.8 KB
10646c94   Andy   add
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
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
  var fun = {
      init:function () {
          $('#coupon_type_add').selectpicker('refresh');
          fun.initSelect();
          fun.createTableData();
          fun.poptTimeinit();
          fun.popChangedata();
          fun.queryBtn();
  
      },
      //查询条件下拉框初始化
      initSelect:function() {
          //1.所有卡券类型
          $('#coupons_type').selectpicker('render');
  
          //2.card_state
          var html ="";
          html +="<option value='ALL'>所有状态</option>";
          html +="<option value='1'>生效</option>";
          html +="<option value='0'>失效</option>";
          html +="<option value='2'>未生效</option>";
  
          $("#card_state").empty();
          $("#card_state").append(html);
          $("#card_state").selectpicker('refresh');
  
          //3.所有使用类型 card_usetype
          var html ="";
          html +="<option value='ALL'>所有使用类型</option>";
          html +="<option value='1'>已使用</option>";
          html +="<option value='0'>未使用</option>";
  
          $("#card_usetype").empty();
          $("#card_usetype").append(html);
          $("#card_usetype").selectpicker('refresh');
      },
      //2ini表格
      createTableData: function() {
          $('#recordtableWhite').bootstrapTable('destroy').bootstrapTable({
              striped: true, //表格显示条纹
              pagination: true, //启动分页
              pageNumber: 1, //当前第几页
              // showColumns: true,
              pageSize: 10, //每页显示的记录数
              pageList: [10, 15, 20,50,100], //记录数可选列表
              sidePagination: 'server', //表示服务端分页
              queryParamsType: 'limit',
              method: 'POST', //请求方法
              clickToSelect: true,                //是否启用点击选中行
              paginationPreText: '<',
              paginationNextText: '>',
              ajax: tableLoadRequest, //自定义ajax加载数据
              uniqueId: 'id',
              rowStyle:fun.markTheTable,
              columns: [
                  {title:'',width: '1%',checkbox: true,align: 'center'},
                  {
                      field: 'cardNo',
                      title: '<span class="information-icon"></span>卡券编码',
                      width: '10%',
                      align: 'left',
                      formatter:commonObj.replacenull
  
                  },
                  // {
                  //     field: 'cardType',
                  //     title: '<span class="type-icon"></span>卡券',
                  //     width: '5%',
                  //     align: 'left',
                  //     formatter:  function(value, row, index){
                  //         if('1'==value){
                  //             return '优惠券';
                  //         }else if(4==value){
                  //             return '代金券';
                  //         }else if('2'==value){
                  //             return '停车券(线下兑换)'
                  //         }else{
                  //             return '其他'
                  //         }
                  //     }
                  // },
                  {
                      field: 'couponsType',
                      title: '<span class="type-icon"></span>优惠类型',
                      width: '3%',
                      align: 'left',
                      formatter:  function(value, row, index){
                          if('3'==value){
                              return '折扣';
                          }else if('4'==value){
                              return '优惠';
                          }else{
                              return '其他'
                          }
                      }
                  },
                  {
                      field: 'discValue',
                      title: '<span class="type-icon"></span>优惠值',
                      width: '3%',
                      align: 'left',
                      formatter:  function(value, row, index){
                          if('3'==row.couponsType){
                              return value/10+'折';
                          }else if('4'==row.couponsType){
                              return value/100+'元';
                          }else{
                              return '-'
                          }
                      }
                  },
                  {
                      field: 'beginTime',
                      title: '<span class="time-icon"></span>生效时间',
                      width: '10%',
                      align: 'left',
                      formatter:commonObj.timeOneFormatter
                  },
                  {
                      field: 'endTime',
                      title: '<span class="time-icon"></span>失效时间',
                      width: '10%',
                      align: 'left',
                      formatter:commonObj.timeOneFormatter
                  },
                  {
                      field: 'batchNo',
                      title: '<span class="information-icon"></span>批次号',
                      width: '10%',
                      align: 'left',
                      formatter:commonObj.replacenull
  
                  },
                  {
                      field: 'isUesed',
                      title: '<span class="status-icon"></span>使用状态',
                      width: '8%',
                      align: 'left',
                      formatter:  function(value, row, index){
                          //
                          if(value ==1){
                              return '已使用';
                          }else{
                              return '未使用';
                          }
                      }
                  },
                  {
                      field: 'dataState',
                      title: '<span class="status-icon"></span>卡状态',
                      width: '8%',
                      align: 'left',
                      formatter:  function(value, row, index){
                          //
                          if(new Date(row.endTime).getTime() >= new Date().getTime() && value ==1 && new Date(row.beginTime).getTime() <= new Date().getTime()){
                              return '生效';
                          }else if(new Date(row.beginTime).getTime() >= new Date().getTime() && value ==1){
                              return '未生效';
                          }else{
                              return '失效';
                          }
                      }
                  },
              ]
          });
  
      },
      markTheTable:function (value,row, index) {
          //这里有5个取值代表5中颜色['active', 'success', 'info', 'warning', 'danger'];
          var strclass = "";
          if (new Date(value.endTime).getTime() < new Date().getTime() || value ==0) {
              strclass = 'warning';
          }
          else {
              strclass = '';
          }
          return { classes: strclass }
      },
      /*获取查询参数*/
      getQueryParam: function() {
          //卡券名称
          var cardNo = $("#couponsettingName").val();
          //批次号
          var batchNo = $("#batchNo").val();
  
          //卡券状态
          var card_state = $("#card_state").val();
  
  
          //卡券使用状态
          var is_used = $("#card_usetype").val();
  
          //卡券类型
          var card_type = "[2]";
  
          //优惠类型状态
          var coupons_type = $("#coupons_type").val();
          if(coupons_type == null || coupons_type == "ALL" || coupons_type == ''){
              coupons_type = null;
          }
          if(card_state == null || card_state == "ALL" || card_state == ''){
              card_state = null;
          }
          if(is_used == null || is_used == "ALL" || is_used == ''){
              is_used = null;
          }
          var req = {
              cardNo:cardNo,
              batchNo:batchNo,
              cardTypes: JSON.parse(card_type),
              couponsType:coupons_type,
              isUesed:is_used,
              dataState: card_state
          };
          console.log(req);
          return req;
      },
      //弹窗生失效时间
      poptTimeinit:function () {
          $("#popdaterange_btnstaadd").datetimepicker({
              startDate: moment().add('days', 0).format('YYYY-MM-DD'),
              //endDate: moment().subtract('days', 0).format('YYYY-MM-DD HH:ss'),
              format: 'yyyy-mm-dd',
              autoclose: true,
              // startView: 3,
              // //maxDate:moment().subtract('months', 3),
              minView: 2,
              forceParse: false,
              locale: "zh-CN",
              language: 'zh-CN',
              pickerPosition: "bottom-left",
          });
          $("#popdaterange_btnendadd").datetimepicker({
              startDate: moment().add('days', 0).format('YYYY-MM-DD'),
              //endDate: moment().subtract('days', 0).format('YYYY-MM-DD HH:ss'),
              format: 'yyyy-mm-dd',
              autoclose: true,
              // startView: 3,
              // //maxDate:moment().subtract('months', 3),
              minView: 2,
              forceParse: false,
              locale: "zh-CN",
              language: 'zh-CN',
              pickerPosition: "bottom-left",
          });
      },
      //change 弹窗
      popChangedata:function () {
          $(document).on('change',"#coupon_type_add",function(){
              var counum=$('#coupon_type_add').val();
              if(counum==3){
                  $('#pop_cardname').text('折扣值');
                  $('#pop_carddk').addClass('display-none');
                  $('#pop_cardzc').removeClass('display-none');
              }else {
                  $('#pop_cardname').text('优惠金额');
                  $('#pop_cardzc').addClass('display-none');
                  $('#pop_carddk').removeClass('display-none');
              }
          });
      },
      //查询
      queryBtn:function(){
          documentBindFunc.on('click','#queryBtn',function(){
              $("#recordtableWhite").bootstrapTable('refresh');
          });
  
      },
  
      //初始化新增页面内容
      initAdd: function () {
          var html =" <option value=\"3\">折扣</option>\n" + " <option value=\"4\">优惠</option>";
          $("#coupon_type_add").empty();
          $("#coupon_type_add").append(html);
          $('#coupon_type_add').selectpicker('refresh');
          $('#pop_cardname').text('折扣值');
          $('#pop_carddk').addClass('display-none');
          $('#pop_cardzc').removeClass('display-none');
  
  
          $('#coupon_dk').val('')  //优惠值清空
          $('#coupon_zc').val('')  //折扣值清空
  
          $('#card_num').val('')  //卡券数量清空
          //初始化开始日期
          $("#popdaterange_btnstaadd").val(moment().subtract('days', 0).format('YYYY-MM-DD'))
          $("#popdaterange_btnendadd").val(moment().subtract('days', 0).format('YYYY-MM-DD'))
          $("#popdaterange_btnstaadd").datetimepicker({
              startDate: moment().subtract('days', 0).format('YYYY-MM-DD'),
              format: 'yyyy-mm-dd',
              autoclose: true,
              startView: 2,
              //maxDate:moment().subtract('months', 3),
              minView: 2,
              forceParse: false,
              locale: "zh-CN",
              language: 'zh-CN',
              pickerPosition: "bottom-right"
          });
          $("#popdaterange_btnendadd").datetimepicker({
              startDate: moment().subtract('days', 0).format('YYYY-MM-DD'),
              format: 'yyyy-mm-dd',
              autoclose: true,
              startView: 2,
              //maxDate:moment().subtract('months', 3),
              minView: 2,
              forceParse: false,
              locale: "zh-CN",
              language: 'zh-CN',
              pickerPosition: "bottom-right"
          });
  
          $("#giftsetting-add-submit").removeAttr("disabled");
  
          $('#under_addmodel').modal('show');
      },
      /*获取新增参数*/
      getCouponInfoParam: function() {
          var coupons_type =  $("#coupon_type_add").val(); //3.折扣,4.优惠
          /**优惠值*/
          var discValue = 0;
          var cardName = '';
          if(coupons_type == 3){
              discValue = $("#coupon_zc").val() * 10;
              cardName = $("#coupon_zc").val()+"折折扣券"
          }else{
              discValue = $("#coupon_dk").val() * 100;
              cardName = $("#coupon_dk").val()+"元现金抵扣券"
  
          }
          //发放数量
          var cardNum = $("#card_num").val();
          //每次领取数量
          var beginTime = $("#popdaterange_btnstaadd").val();
          beginTime = new Date(beginTime+" 00:00:00");
          //每次领取数量
          var endTime = $("#popdaterange_btnendadd").val();
          endTime = new Date(endTime+" 23:59:59");
          if(discValue == null || discValue == '' || discValue == undefined){
              $('#td_rule_add').removeClass('display-none').text('错误提示:折扣或优惠值不能为空或0');
              return false;
          }
          if(cardNum == null || cardNum == '' || cardNum == undefined){
              $('#td_rule_add').removeClass('display-none').text('错误提示:卡券张数不能为空');
              return false;
          }
          if(cardNum > 1000){
              $('#td_rule_add').removeClass('display-none').text('错误提示:卡券张数不能大于1000');
              return false;
          }
          if(beginTime>endTime){
              $('#td_rule_add').removeClass('display-none').text('错误提示:发放开始时间不能大于结束时间');
              return false;
          }
  
          $("#giftsetting-add-submit").attr("disabled","disabled");
          $('#td_rule_add').addClass('display-none');
          var req = {
              cardName: cardName,
              cardRes: 1,//卡券来源:1:平台发放,2:停车场发放
              cardType: 2,//卡券类型 :1-优惠券,2-停车券,3-充值卡
              couponsType: coupons_type,//优惠券类型:1:按次优惠,2:按时优惠,3:折扣优惠(打折),4:满减优惠
              isRecommend: 0,//是否推荐购买 1:是,0:否
              useRule: -1,//使用规则:1 满减使用(限制),-1无限制(充值卡都为-1)
              discValue: discValue,//优惠值(分)
              fullCutValue: 1,//满减金额(分)
              isSuperpUse: 0,//是否叠加使用 1:是 0:否
              beginTime: beginTime,//开始时间
              endTime: endTime,//结束时间
              cardRestNum: 1,//卡券剩余数量
              cardNum: cardNum,//卡券发放数量
              cardState: 1,//卡券状态:1、上架;2、下架
              dataState: 1,//数据状态:1有效,0无效
              cardContent: '不与其他优惠同时使用',//卡券说明,如:不与其他优惠同时使用
              validDays: 0,//使用天数(领取后)
              receiveChannels: 4,//领取渠道:1:app 2:积分商城兑换,4:线下兑换
              needIntegral: 0,//领取渠道:2:积分商城兑换  需填写的积分数字
              receiveNum: 1,//每次领取数量
              flg: 1,//保存、更新标志 1:保存
              sysCode:sysComm.sysCode
          };
          console.log(req);
          return req;
      },
      addCouponConfirm:function(){
          var req = fun.getCouponInfoParam();
          if(req!=false && req!=undefined){
              var opt = {
                  method: 'post',
                  url: dataUrl.util.saveCouponRule(),
                  data: JSON.stringify(req),
                  contentType: 'application/json; charset=utf-8',
                  dataType: 'json',
                  success: function (res) {
                      console.log(res);
                      if (res.code == '8888') {
                          console.log(res.data);
                          $("#giftsetting-add-submit").removeAttr("disabled");
                          $('#under_addmodel').modal('hide');
                          fun.createTableData();
                      }else{
                          $("#giftsetting-add-submit").removeAttr("disabled");
                      }
                  }
              };
              sysAjax(opt);
          }
  
  
      },
  
  };
  
  fun.init();
  
  
  // 打印功能
  documentBindFunc.on('click', '#domprintBtn', function () {
      doPrint();
  })
  function doPrint(){
      var rowsData= $("#recordtableWhite").bootstrapTable('getSelections');
      if(rowsData.length<=0){
          $('.ITD-alertmodel-contentmsg').text('请选中要打印的行数据!');
          $('#parkpoipop_alertmodel').modal('show');
          setTimeout(function () {
              $('.ITD-alertmodel-contentmsg').text('');
              $('#parkpoipop_alertmodel').modal('hide');
          },2000);
  
          return false;
      }
      var html = "";
  
      $.each(rowsData,function(index,row){
          if(row != null && row.id != null){
              var couponMsg = '';
              if('3'==row.couponsType){
                  couponMsg ='折扣'+ row.discValue/10+'折';
              }else if('4'==row.couponsType){
                  couponMsg ='抵扣'+row.discValue/100+'元';
              }else{
                  couponMsg = '-'
              }
              var  beginTime = DateUtils.long2String(row.beginTime, 1);
              var  endTime = DateUtils.long2String(row.endTime, 1);
              html +=
                  '<div class="pop_common" style="width: 340px;height: 182px;float: left;margin-right:4px;margin-bottom:4px;position: relative;">'
                  + '   <img src="../../assets/pages/scripts/otherSetting/img/car-bg.png" alt="" style="width: 340px;height: 182px;">'
                  + '  <img src="../../assets/pages/scripts/otherSetting/img/park_yhq.png" alt="" style="width: 104px;height: 72px;position: absolute;top: 50px;left: 10px">'
                  + ' <div style="height: 60px;width: 104px;position: absolute;top: 124px;font-size: 10px;transform: scale(0.8);left:10px">'
                  +beginTime+'至'+ endTime+'有效</div>'
                  + '  <div style="height: 30px;line-height: 30px;width:150px;text-align:right;font-weight: bold;font-size: 20px;position: absolute;padding-right:4px;top: 4px;right: 0px;color: #EA4242;">'+couponMsg+'</div>'
                  + '   <div style="height: 50px;width: 210px;position: absolute;top: 52px;right: 0px">'
                  + '  <div style="height: 34px;line-height: 34px;font-weight: bold;font-size: 30px;color: #EA4242;">'+row.cardNo+'</div>'
                  + ' <div style="font-size: 10px;transform: scale(0.8);margin-top: 20px">1.扫码支付界面输入优惠码抵扣停车费</div>'
                  + ' <div style="font-size: 10px;transform: scale(0.8);">2.APP提前绑定优惠码停车抵扣停车费</div>'
                  + ' </div>'
  
                  + '</div>'
          }
      });
      $('#printContent').html(html);
  
  
  
      var newWindow=window.open("打印窗口","_blank");
      var docStr = document.getElementById('printContent').innerHTML;//需要打印的内容
      newWindow.document.write(docStr);
      var head = newWindow.document.head || newWindow.document.getElementsByTagName('head')[0];
      // var goodsInfo = newWindow.document.getElementById('goodsInfo');//动态修改要打印的内容样式
      // goodsInfo.style.padding='0';
      var link = newWindow.document.createElement('link');
      link.type='text/css';
      link.rel = 'stylesheet';
      link.href = '../assets/pages/scripts/otherSetting/xxcoupon/undersoupon.css';
      head.appendChild(link);//引入样式文件
      newWindow.document.close();
      setTimeout(function () {
          newWindow.print();
          newWindow.close();
      },500);
  }
  
  
  /**
   * 自定义table AJAX请求
   * @param {Object} params
   */
  function tableLoadRequest(params) {
      var req = fun.getQueryParam();
      //设置请求参数
      var pageNum = (params.data.offset / params.data.limit) + 1;
  
      //条件查询
      req.baseRequest = {
          pageNum: pageNum,
          pageSize: params.data.limit
      };
      req.sysCode = sysComm.sysCode;
      var opt = {
          method: 'post',
          url: dataUrl.util.queryCouponRuleForpage(),
          data: JSON.stringify(req),
          contentType: 'application/json; charset=utf-8',
          dataType: 'json',
          success: function(res) {
              console.log(res);
              if(res.code == '8888') {
                  params.success(res.data);
              }
          }
      };
      sysAjax(opt);
  }
  
  //点击新增事件
  documentBindFunc.on('click', '#ratemanage-addBtn',function () {
      $('#td_rule_add').addClass('display-none');
      fun.initAdd();
  });
  
  //点击新增或修改确定事件
  documentBindFunc.on('click', '#giftsetting-add-submit',function () {
          fun.addCouponConfirm();
  });
  
  /**批量删除.*/
  documentBindFunc.on('click','#parkset-del',function () {
      var rowsData= $("#recordtableWhite").bootstrapTable('getSelections');
      if(rowsData.length<=0){
          $('.ITD-alertmodel-contentmsg').text('请选中要删除的行数据!');
          $('#parkpoipop_alertmodel').modal('show');
          setTimeout(function () {
              $('.ITD-alertmodel-contentmsg').text('');
              $('#parkpoipop_alertmodel').modal('hide');
          },2000);
  
          return false;
      }
  
      // $('#coupon_deletemodel').modal('show');
  
      var deleteIds = [];
      $.each(rowsData,function(index,row){
          if(row != null && row.id != null){
              deleteIds.push(row.id);
          }
      });
  
      //删除弹窗 确定按钮 提交事件
      var req = {
          ids:deleteIds,
          sysCode: sysComm.sysCode
      };
      console.log(deleteIds);
      sysAjax({
          method: 'POST',
          url: dataUrl.util.deleteBatchCouponRule(),
          data: JSON.stringify(req),
          dataType: 'json',
          async: false,
          success: function (res) {
              if (res.code == '8888') {
                  $('.ITD-alertmodel-contentmsg').text('删除成功!');
                  $('#parkpoipop_alertmodel').modal('show')
                  setTimeout(function () {
                      $('.ITD-alertmodel-contentmsg').text('');
                      $('#parkpoipop_alertmodel').modal('hide')
                  },2000);
                  //初始化table
                  $("#recordtableWhite").bootstrapTable('refresh');
              } else {
                  console.log(res);
                  $('.ITD-alertmodel-contentmsg').text('删除失败!');
                  $('#parkpoipop_alertmodel').modal('show')
                  setTimeout(function () {
                      $('.ITD-alertmodel-contentmsg').text('');
                      $('#parkpoipop_alertmodel').modal('hide')
                  },2000);
                  return false;
              }
          }
      });
  });
  
  //导出excle
  documentBindFunc.on('click','#reportBtn',function (){
      //获取table所有行数据
      var couponNum = $("#recordtableWhite").bootstrapTable('getData');
      //获取table总条数
      var numTotal = $("#recordtableWhite").bootstrapTable('getOptions').totalRows;
      //提示 无数据不导出
      console.log(couponNum)
      if(couponNum.length<1){
          $('.ITD-alertmodel-contentmsg').text('无数据可导出!');
          $('#parkpoipop_alertmodel').modal('show');
          setTimeout(function () {
              $('.ITD-alertmodel-contentmsg').text('');
              $('#parkpoipop_alertmodel').modal('hide');
          },3000);
          return false;
      }
      //超1万条 缩短查询范围
      if(numTotal>10000){
          $('.ITD-alertmodel-contentmsg').text('数据量过大,请缩小查询范围!');
          $('#parkpoipop_alertmodel').modal('show');
          setTimeout(function () {
              $('.ITD-alertmodel-contentmsg').text('');
              $('#parkpoipop_alertmodel').modal('hide');
          },3000);
          return false;
      }
  
      //执行倒计时函数s
      sendMessage();
      //卡券名称
      var cardNo = $("#couponsettingName").val();
      //批次号
      var batchNo = $("#batchNo").val();
  
      //卡券状态
      var card_state = $("#card_state").val();
  
  
      //卡券使用状态
      var is_used = $("#card_usetype").val();
  
      //卡券类型
      var card_type = [2];
  
      //优惠类型状态
      var coupons_type = $("#coupons_type").val();
      if(coupons_type == null || coupons_type == "ALL" || coupons_type == ''){
          coupons_type = null;
      }
      if(card_state == null || card_state == "ALL" || card_state == ''){
          card_state = null;
      }
      if(is_used == null || is_used == "ALL" || is_used == ''){
          is_used = null;
      }
      var orgId = fn.getOrgId();
      var url = dataUrl.util.exportCouponRuleMsgOpration();
      var forms = exportCouponRuleMsg(url,cardNo,batchNo,card_state,is_used,card_type,coupons_type,orgId);
      forms.submit();
  });
  
  //导出
  var InterValObj; //timer变量,控制时间
  var count = 8; //间隔函数,1秒执行
  var curCount;//当前剩余秒数
  
  function sendMessage() {
      curCount = count;
      //设置button效果,开始计时
      $("#reportBtn").attr("disabled", "true");
      $(".ITD-export-btn").css("width", "138px");
      $("#reportBtn").val(curCount + "秒后可再次导出");
      InterValObj = window.setInterval(SetRemainTime, 1000); //启动计时器,1秒执行一次
  }
  //timer处理函数
  function SetRemainTime() {
      if (curCount == 0) {
          window.clearInterval(InterValObj);//停止计时器
          $("#reportBtn").removeAttr("disabled");//启用按钮
          $(".ITD-export-btn").css("width", "72px");
          $("#reportBtn").val("导出");
      }
      else {
          curCount--;
          $("#reportBtn").val(curCount + "秒后可再次导出");
      }
  }
  
  function exportCouponRuleMsg(url,cardNo,batchNo,card_state,is_used,card_type,coupons_type,orgId) {
  
      var form = document.createElement("form");
      form.style.display = 'none';
      form.action = url;
      form.method = "get";
      document.body.appendChild(form);
  
      var input = document.createElement("input");
      input.name = "cardNo";
      input.value = cardNo;
      form.appendChild(input);
  
      var input2 = document.createElement("input");
      input2.name = "batchNo";
      input2.value = batchNo;
      form.appendChild(input2);
  
      var input3 = document.createElement("input");
      input3.name = "cardTypes";
      input3.value = card_type;
      form.appendChild(input3);
  
      var input4 = document.createElement("input");
      input4.name = "couponsType";
      input4.value = coupons_type;
      form.appendChild(input4);
  
      var input5 = document.createElement("input");
      input5.name = "isUesed";
      input5.value = is_used;
      form.appendChild(input5);
  
      var input6 = document.createElement("input");
      input6.name = "dataState";
      input6.value = card_state;
      form.appendChild(input6);
  
      var input7 = document.createElement("input");
      input7.name = "orgId";
      input7.value = orgId;
      form.appendChild(input7);
  
      return form;
  
  };
  
  
  // //折扣验证
  $('#coupon_zc').keyup(function () {
      var obj = this;
      clearNoNumZheKou(obj);
  });
  
  
  //折扣验证
  function clearNoNumZheKou(obj){
      obj.value = obj.value.replace(/[^\d.]/g,"");  //清除“数字”和“.”以外的字符
      obj.value = obj.value.replace(/\.{2,}/g,"."); //只保留第一个. 清除多余的
      //obj.value = obj.value.charAt(1).replace(/\/g,".");
      obj.value = obj.value.replace(".","$#$").replace(/\./g,"").replace("$#$",".");
      obj.value = obj.value.replace(/^(\-)*(\d+)\.(\d\d).*$/,'$1$2.$3');//只能输入两个小数
  
      if(obj.value.indexOf(".")< 0 && obj.value !="" && Number(obj.value)!=0){//以上已经过滤,此处控制的是如果没有小数点,首位不能为类似于 01、02的金额
          obj.value= parseFloat(obj.value);
      }
      if(Number(obj.value)>=10 || Number(obj.value)==0){
          obj.value = obj.value.charAt(0)
      };
  }