invoice.validator.js 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. function invoiceShow(){
  2. var chkRadio = $('input:radio[name="invoiceType"]:checked').val();
  3. if (chkRadio == null) {
  4. alert("没有选中项");
  5. return false;
  6. } else if(chkRadio==1) {
  7. $('#plainInvoice_box').hide();
  8. $('#specialInvoice_box').show();
  9. }else if(chkRadio==0){
  10. $('#plainInvoice_box').show();
  11. $('#specialInvoice_box').hide();
  12. }
  13. }
  14. function mailShow(){
  15. var chkRadio = $('input:radio[name="doPost"]:checked').val();
  16. if (chkRadio == null) {
  17. alert("没有选中项");
  18. return false;
  19. } else if(chkRadio==1) {
  20. $('#mail_box').show();
  21. }else if(chkRadio==0){
  22. $('#mail_box').hide();
  23. }
  24. }
  25. $(function () {
  26. $('#invoice').validator({
  27. timely: 3,
  28. focusCleanup: true,
  29. rules: {
  30. invoiceTitle: function() {
  31. return $('#invoicePlain').prop('checked');
  32. },
  33. invoiceCompany: function() {
  34. return $('#invoiceSpecial').prop('checked');
  35. }
  36. ,isMail: function() {
  37. return $('#isMail').prop('checked');
  38. }
  39. },
  40. fields: {
  41. invoiceTitle: 'required(invoiceTitle);',
  42. invoiceCompany:'required(invoiceCompany);',
  43. TIN:'required(invoiceCompany);',
  44. address:'required(invoiceCompany);',
  45. phone:'required(invoiceCompany);',
  46. bank:'required(invoiceCompany);',
  47. bankAccount:'required(invoiceCompany);',
  48. 'invoicePrice': 'required; '
  49. ,invoiceElement: 'required; '
  50. ,'invoiceType': 'required'
  51. ,recipients: 'required(isMail); '
  52. ,recipientsPhone: 'required(isMail); '
  53. ,recipientsAddress: 'required(isMail); '
  54. }
  55. });
  56. $("form[name='invoiceApproval']").validator({
  57. timely: 3,
  58. focusCleanup: true,
  59. theme:"yellow_top",
  60. fields: {
  61. 'opinion': 'required; '
  62. }
  63. });
  64. $("form[name='invoicePrint']").validator({
  65. timely: 3,
  66. focusCleanup: true,
  67. theme:"yellow_top",
  68. fields: {
  69. 'invoiceNo': 'required; '
  70. }
  71. });
  72. })