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.
 
 
 
 
 

229 lines
6.3 KiB

  1. var man_id="";
  2. var temp_id_type="150";
  3. window.onload=function(){
  4. man_id=getPar('man_id');
  5. if(man_id!=""){
  6. $('.cir_info').text('查询中...');
  7. $("#loadingToast").show(); //转圈圈展示
  8. $('title').html('修改乘客');
  9. $('#btn_add').addClass('ui_hide');
  10. $('#up_del').removeClass('ui_hide');
  11. var url=base_api+"./zz_wxsct/control.php";
  12. var parm={
  13. type:"order_updatecustomer",
  14. id:man_id
  15. }
  16. ZZLog(url+JSON.stringify(parm));
  17. $.post(url,parm,function(res_data){
  18. res_data=JSON.parse(res_data);
  19. ZZLog(res_data);
  20. $("#loadingToast").hide(); //转圈圈隐藏
  21. if(res_data['code']!="0"){
  22. alert(res_data['info']);return;
  23. }
  24. var list=res_data['list'];
  25. $('#name').val(list['name']);
  26. $('#card_id').val(list['id_num']);
  27. $('#card_style').attr('cardid',list['id_type']);
  28. temp_id_type=list['id_type'];
  29. if(list['id_type']=="153"){
  30. $('#card_style').text('护照');
  31. }else if(list['id_type']=="150"){
  32. $('#card_style').text('身份证');
  33. }else{
  34. $('#card_style').text('未知类型');
  35. }
  36. });
  37. }
  38. }
  39. $(document).ready(function(){
  40. $('.weui_actionsheet_cell').click(function(){
  41. $('#actionsheet_cancel').click(function(){
  42. $('#mask').click();
  43. })
  44. $('#card_style').html(this.innerHTML);
  45. $('#card_style').attr('cardid',this.id);
  46. temp_id_type=this.id;
  47. $('#mask').click();
  48. })
  49. })
  50. //选择站点的下侧弹层
  51. $("#port_type").click(function(){
  52. $("#mask").css("display","block");
  53. $("#weui_actionsheet").addClass("weui_actionsheet_toggle");
  54. //选中当前证件类型
  55. if(temp_id_type=="150"){
  56. $('#id_card').attr('src','images/a3/ic_select_sel.png');
  57. $('#hu_pic').attr('src','images/a3/ic_select_nor.png');
  58. }else{
  59. $('#id_card').attr('src','images/a3/ic_select_nor.png');
  60. $('#hu_pic').attr('src','images/a3/ic_select_sel.png');
  61. }
  62. })
  63. $('#mask').click(function(){
  64. $("#mask").css("display","none");
  65. $("#weui_actionsheet").removeClass("weui_actionsheet_toggle");
  66. })
  67. function commitDidClicked(){
  68. var name = $('#name').val();
  69. var cardstyle = $('#card_style').attr('cardid');
  70. var cardid = $('#card_id').val();
  71. if (name == '') {
  72. alert('请输入姓名!');
  73. return;
  74. }
  75. // if (cardid == '') {
  76. // alert('请输入证件号码!');
  77. // return;
  78. // }
  79. if(man_id==""){
  80. add_customer(name,cardstyle,cardid);
  81. }else{
  82. update_customer(name,cardstyle,cardid);
  83. }
  84. }
  85. // 添加乘客
  86. function add_customer(name,cardstyle,cardid){
  87. // if(cardstyle=="150"){
  88. // if(isCardNo(cardid)==false){
  89. // return;
  90. // }
  91. // }
  92. $('.cir_info').text('添加中...');
  93. $("#loadingToast").show(); //转圈圈展示
  94. var url=base_api+"./zz_wxsct/control.php";
  95. var parm={
  96. type:"order_addcustomer",
  97. name:name,
  98. id_type:cardstyle,
  99. id_num:cardid
  100. }
  101. $.post(url,parm,function(res_data){
  102. res_data=JSON.parse(res_data);
  103. ZZLog(res_data);
  104. $("#loadingToast").hide(); //转圈圈展示
  105. if(res_data['code']!="0"){
  106. alert(res_data.info);
  107. return;
  108. }
  109. var temp = getPar('go_ticket_id');
  110. var run_id = getPar('run_id');
  111. var start_area_id = getPar('start_area_id');
  112. var end_area_id = getPar('end_area_id');
  113. var start_res_id = getPar('start_res_id');
  114. var end_res_id = getPar('end_res_end');
  115. if (temp == '') {
  116. window.location.href = './fill_order.html?run_id='+run_id+'&start_area_id='+start_area_id+'&end_area_id='+end_area_id+'&start_res_id='+start_res_id+'&end_res_id='+end_res_id;
  117. } else{
  118. window.location.href = './fill_order.html?run_id='+run_id+'&start_area_id='+start_area_id+'&end_area_id='+end_area_id+'&start_res_id='+start_res_id+'&end_res_id='+end_res_id+'&go_ticket_id='+temp;
  119. }
  120. });
  121. }
  122. // 修改乘客
  123. function update_customer(name,cardstyle,cardid){
  124. // if(cardstyle=="150"){
  125. // if(isCardNo(cardid)==false){
  126. // return;
  127. // }
  128. // }
  129. $('.cir_info').text('修改中...');
  130. $("#loadingToast").show(); //转圈圈展示
  131. var url=base_api+"./zz_wxsct/control.php";
  132. var parm={
  133. type:"order_updatecustomer",
  134. id:man_id,
  135. name:name,
  136. id_num:cardid,
  137. id_type:cardstyle
  138. }
  139. ZZLog(url+JSON.stringify(parm));
  140. $.post(url,parm,function(res_data){
  141. res_data=JSON.parse(res_data);
  142. ZZLog(res_data);
  143. $("#loadingToast").hide(); //转圈圈隐藏
  144. if(res_data['code']!="0"){
  145. alert(res_data['info']);
  146. return;
  147. }
  148. var temp = getPar('go_ticket_id');
  149. var run_id = getPar('run_id');
  150. var start_area_id = getPar('start_area_id');
  151. var end_area_id = getPar('end_area_id');
  152. var start_res_id = getPar('start_res_id');
  153. var end_res_id = getPar('end_res_end');
  154. if (temp == '') {
  155. window.location.href = './fill_order.html?run_id='+run_id+'&start_area_id='+start_area_id+'&end_area_id='+end_area_id+'&start_res_id='+start_res_id+'&end_res_id='+end_res_id;
  156. } else{
  157. window.location.href = './fill_order.html?run_id='+run_id+'&start_area_id='+start_area_id+'&end_area_id='+end_area_id+'&start_res_id='+start_res_id+'&end_res_id='+end_res_id+'&go_ticket_id='+temp;
  158. }
  159. });
  160. }
  161. // 删除乘客
  162. function del_costomer(){
  163. var r = confirm("你确定要删除该乘客吗?");
  164. if(r == true) {
  165. $("#loadingToast").show(); //转圈圈展示
  166. var url = base_api + "./zz_wxsct/control.php";
  167. var parm = {
  168. type: "order_delcustomer",
  169. id: man_id
  170. }
  171. $.post(url, parm, function(res_data) {
  172. res_data = JSON.parse(res_data);
  173. ZZLog(res_data);
  174. $("#loadingToast").hide(); //转圈圈隐藏
  175. if(res_data['code'] != "0") {
  176. alert(res_data.info);
  177. return;
  178. }
  179. var temp = getPar('go_ticket_id');
  180. var run_id = getPar('run_id');
  181. var start_area_id = getPar('start_area_id');
  182. var end_area_id = getPar('end_area_id');
  183. var start_res_id = getPar('start_res_id');
  184. var end_res_id = getPar('end_res_end');
  185. if (temp == '') {
  186. window.location.href = './fill_order.html?run_id='+run_id+'&start_area_id='+start_area_id+'&end_area_id='+end_area_id+'&start_res_id='+start_res_id+'&end_res_id='+end_res_id;
  187. } else{
  188. window.location.href = './fill_order.html?run_id='+run_id+'&start_area_id='+start_area_id+'&end_area_id='+end_area_id+'&start_res_id='+start_res_id+'&end_res_id='+end_res_id+'&go_ticket_id='+temp;
  189. }
  190. });
  191. } else {
  192. }
  193. }
  194. function isCardNo(card) {
  195. if(card) {
  196. // 身份证号码为15位或者18位,15位时全为数字,18位前17位为数字,最后一位是校验位,可能为数字或字符X
  197. var reg = /(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/;
  198. if(reg.test(card) === false) {
  199. alert("身份证输入不合法");
  200. return false;
  201. } else {
  202. return true;
  203. }
  204. }
  205. }