You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

100 lines
2.5 KiB

  1. $("#loading_html").show();
  2. function submit_info() {
  3. var id = $("#travel_id").val();
  4. var name = $("#travel_name").val();
  5. if(id != '' && name != '') {
  6. var answer = isCardID(id);
  7. if(answer != true) {
  8. alert(answer); //身份证非法
  9. return;
  10. } else {
  11. var param = {
  12. customer_id_card: id,
  13. customer_name: name,
  14. }
  15. ZZLog(base_api + "order/order/addCustomer&" + JSON.stringify(param));
  16. $.ajax({
  17. type: "post",
  18. url: base_api + "order/order/addCustomer",
  19. data: param,
  20. dataType: 'json',
  21. success: function(res_data) {
  22. ZZLog(res_data);
  23. if(res_data.flag == true) {
  24. change_html();
  25. } else {
  26. alert(res_data.msg);
  27. }
  28. },
  29. error: function(e) {
  30. ZZLog(e);
  31. }
  32. });
  33. }
  34. } else {
  35. alert("请输入姓名和身份证号码!");
  36. return;
  37. }
  38. }
  39. function change_html() {
  40. //转跳页面
  41. //回传拿到缓存拼url
  42. var data = getStorJson("trave_around_fill_order")
  43. window.location.href = 'trave_around_fill_order.html?peo_no=' + data.p_num + '&go_date=' + data.date + '&pro_id=' + data.pro_id; //回跳
  44. }
  45. //身份证正则
  46. function isCardID(sId) {
  47. var aCity = {
  48. 11: "北京",
  49. 12: "天津",
  50. 13: "河北",
  51. 14: "山西",
  52. 15: "内蒙古",
  53. 21: "辽宁",
  54. 22: "吉林",
  55. 23: "黑龙江",
  56. 31: "上海",
  57. 32: "江苏",
  58. 33: "浙江",
  59. 34: "安徽",
  60. 35: "福建",
  61. 36: "江西",
  62. 37: "山东",
  63. 41: "河南",
  64. 42: "湖北",
  65. 43: "湖南",
  66. 44: "广东",
  67. 45: "广西",
  68. 46: "海南",
  69. 50: "重庆",
  70. 51: "四川",
  71. 52: "贵州",
  72. 53: "云南",
  73. 54: "西藏",
  74. 61: "陕西",
  75. 62: "甘肃",
  76. 63: "青海",
  77. 64: "宁夏",
  78. 65: "新疆",
  79. 71: "台湾",
  80. 81: "香港",
  81. 82: "澳门",
  82. 91: "国外"
  83. }
  84. var iSum = 0;
  85. var info = "";
  86. if(!/^\d{17}(\d|x)$/i.test(sId)) return "请填写正确的身份证号!";
  87. sId = sId.replace(/x$/i, "a");
  88. if(aCity[parseInt(sId.substr(0, 2))] == null) return "请填写正确的身份证号!";
  89. sBirthday = sId.substr(6, 4) + "-" + Number(sId.substr(10, 2)) + "-" + Number(sId.substr(12, 2));
  90. var d = new Date(sBirthday.replace(/-/g, "/"));
  91. if(sBirthday != (d.getFullYear() + "-" + (d.getMonth() + 1) + "-" + d.getDate())) return "请填写正确的身份证号!";
  92. for(var i = 17; i >= 0; i--) iSum += (Math.pow(2, i) % 11) * parseInt(sId.charAt(17 - i), 11);
  93. if(iSum % 11 != 1) return "请填写正确的身份证号!";
  94. //aCity[parseInt(sId.substr(0,2))]+","+sBirthday+","+(sId.substr(16,1)%2?"男":"女");//此次还可以判断出输入的身份证号的人性别
  95. return true;
  96. }