invoice.validator.js 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  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. })