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.
 
 
 
 
 
 

119 lines
3.2 KiB

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