Authored by weiqingting

按钮置灰代码

@@ -530,13 +530,13 @@ e.on("validate",function(){ @@ -530,13 +530,13 @@ e.on("validate",function(){
530 530
531 531
532 $(document).on("click","#btnReview",function(){ 532 $(document).on("click","#btnReview",function(){
533 - $("#btnReview").prop("disabled",true); 533 + var $this=$(this);
534 534
535 if(e.validate()){ 535 if(e.validate()){
536 common.dialog.confirm("温馨提示","<p>你确定提交吗?</p>",function(){ 536 common.dialog.confirm("温馨提示","<p>你确定提交吗?</p>",function(){
537 - setTimeout(function(){  
538 - $("#btnReview").prop("disabled",false);  
539 - },3000); 537 +
  538 + common.util.__disButton.call($this);
  539 +
540 e.submit($("#basicForm").attr("action"),function(option){ 540 e.submit($("#basicForm").attr("action"),function(option){
541 var select=tabTree.getAddress(); 541 var select=tabTree.getAddress();
542 542
@@ -426,7 +426,9 @@ $(document).on('click', "#filter-btn", function () { @@ -426,7 +426,9 @@ $(document).on('click', "#filter-btn", function () {
426 // 通过 426 // 通过
427 var BllPass = { 427 var BllPass = {
428 toast: function (content, fn) { 428 toast: function (content, fn) {
  429 + var $this=$(this);
429 common.dialog.confirm("温馨提示", content, function () { 430 common.dialog.confirm("温馨提示", content, function () {
  431 + common.util.__disButton.call($this);
430 common.util.__ajax({ 432 common.util.__ajax({
431 url: '/base/goods/pass', 433 url: '/base/goods/pass',
432 data: fn() 434 data: fn()
@@ -441,7 +443,10 @@ var BllPass = { @@ -441,7 +443,10 @@ var BllPass = {
441 // 驳回 443 // 驳回
442 var BllReject = { 444 var BllReject = {
443 toast: function (content, fn) { 445 toast: function (content, fn) {
  446 + var $this=$(this);
  447 +
444 common.dialog.confirm("温馨提示", content, function () { 448 common.dialog.confirm("温馨提示", content, function () {
  449 + common.util.__disButton.call($this);
445 common.util.__ajax({ 450 common.util.__ajax({
446 url: '/base/goods/reject', 451 url: '/base/goods/reject',
447 data: fn() 452 data: fn()
@@ -478,7 +483,7 @@ $(document).on("click", ".apply-success", function () { @@ -478,7 +483,7 @@ $(document).on("click", ".apply-success", function () {
478 productSknList: JSON.stringify([item.productSkn]), 483 productSknList: JSON.stringify([item.productSkn]),
479 }; 484 };
480 } 485 }
481 - BllPass.toast("你确定审核通过吗?", data); 486 + BllPass.toast.call(this,"你确定审核通过吗?", data);
482 }); 487 });
483 488
484 //单个驳回 489 //单个驳回
@@ -496,7 +501,7 @@ $(document).on("click", ".apply-back", function () { @@ -496,7 +501,7 @@ $(document).on("click", ".apply-back", function () {
496 rejectReason: reason 501 rejectReason: reason
497 }; 502 };
498 } 503 }
499 - BllReject.toast($("#template").html(), data); 504 + BllReject.toast.call(this,$("#template").html(), data);
500 }); 505 });
501 506
502 507
@@ -530,7 +535,7 @@ $(document).on("click", "#reject-btn", function () { @@ -530,7 +535,7 @@ $(document).on("click", "#reject-btn", function () {
530 rejectReason: reason 535 rejectReason: reason
531 }; 536 };
532 } 537 }
533 - BllReject.toast($("#template").html(), data); 538 + BllReject.toast.call(this,$("#template").html(), data);
534 }); 539 });
535 540
536 //批量通过 541 //批量通过
@@ -555,7 +560,7 @@ $(document).on("click", "#pass-btn", function () { @@ -555,7 +560,7 @@ $(document).on("click", "#pass-btn", function () {
555 productSknList: JSON.stringify(sknList), 560 productSknList: JSON.stringify(sknList),
556 }; 561 };
557 } 562 }
558 - BllPass.toast("确定要通过该申请吗?", data); 563 + BllPass.toast.call(this,"确定要通过该申请吗?", data);
559 }); 564 });
560 565
561 566
@@ -152,6 +152,7 @@ var util = { @@ -152,6 +152,7 @@ var util = {
152 var KEYWORDS = 'for,if,else,each,as'; 152 var KEYWORDS = 'for,if,else,each,as';
153 var SPECHAR = /\W/g; 153 var SPECHAR = /\W/g;
154 var NUMBER = /^\d[^,]*|,\d[^,]*/g; 154 var NUMBER = /^\d[^,]*|,\d[^,]*/g;
  155 +
155 var SPLIT2_RE = /^$|,+/; 156 var SPLIT2_RE = /^$|,+/;
156 var REGEXKEYWORDS = new RegExp("\\b" + [KEYWORDS.replace(/,/g, '\\b|\\b')].join('|'), 'g'); 157 var REGEXKEYWORDS = new RegExp("\\b" + [KEYWORDS.replace(/,/g, '\\b|\\b')].join('|'), 'g');
157 var getVar = function(code) { 158 var getVar = function(code) {
@@ -258,6 +259,13 @@ var util = { @@ -258,6 +259,13 @@ var util = {
258 } 259 }
259 260
260 return true; 261 return true;
  262 + },
  263 + __disButton:function(){
  264 + var $this=this;
  265 + $this.attr("disabled","disabled");
  266 + setTimeout(function(){
  267 + $this.removeAttr("disabled");
  268 + },3000);
261 } 269 }
262 } 270 }
263 module.exports = util; 271 module.exports = util;
@@ -109,4 +109,5 @@ $(document).on("click",".btn",function(){ @@ -109,4 +109,5 @@ $(document).on("click",".btn",function(){
109 setTimeout(function(){ 109 setTimeout(function(){
110 $this.prop("disabled",false) 110 $this.prop("disabled",false)
111 },2000); 111 },2000);
112 -})  
  112 +});
  113 +