|
-
-
- var man_id="";
-
- var temp_id_type="150";
-
- window.onload=function(){
-
-
- man_id=getPar('man_id');
- if(man_id!=""){
- $('.cir_info').text('查询中...');
- $("#loadingToast").show(); //转圈圈展示
- $('title').html('修改乘客');
- $('#btn_add').addClass('ui_hide');
- $('#up_del').removeClass('ui_hide');
- var url=base_api+"./zz_wxsct/control.php";
- var parm={
- type:"order_updatecustomer",
- id:man_id
- }
- ZZLog(url+JSON.stringify(parm));
- $.post(url,parm,function(res_data){
- res_data=JSON.parse(res_data);
- ZZLog(res_data);
- $("#loadingToast").hide(); //转圈圈隐藏
- if(res_data['code']!="0"){
- alert(res_data['info']);return;
- }
- var list=res_data['list'];
-
- $('#name').val(list['name']);
- $('#card_id').val(list['id_num']);
- $('#card_style').attr('cardid',list['id_type']);
- temp_id_type=list['id_type'];
- if(list['id_type']=="153"){
- $('#card_style').text('护照');
- }else if(list['id_type']=="150"){
- $('#card_style').text('身份证');
- }else{
- $('#card_style').text('未知类型');
- }
-
- });
- }
- }
-
- $(document).ready(function(){
-
- $('.weui_actionsheet_cell').click(function(){
- $('#actionsheet_cancel').click(function(){
- $('#mask').click();
- })
- $('#card_style').html(this.innerHTML);
- $('#card_style').attr('cardid',this.id);
- temp_id_type=this.id;
- $('#mask').click();
- })
- })
-
-
-
- //选择站点的下侧弹层
- $("#port_type").click(function(){
- $("#mask").css("display","block");
- $("#weui_actionsheet").addClass("weui_actionsheet_toggle");
- //选中当前证件类型
- if(temp_id_type=="150"){
- $('#id_card').attr('src','images/a3/ic_select_sel.png');
- $('#hu_pic').attr('src','images/a3/ic_select_nor.png');
- }else{
- $('#id_card').attr('src','images/a3/ic_select_nor.png');
- $('#hu_pic').attr('src','images/a3/ic_select_sel.png');
- }
- })
- $('#mask').click(function(){
- $("#mask").css("display","none");
- $("#weui_actionsheet").removeClass("weui_actionsheet_toggle");
- })
-
-
- function commitDidClicked(){
- var name = $('#name').val();
- var cardstyle = $('#card_style').attr('cardid');
- var cardid = $('#card_id').val();
-
- if (name == '') {
- alert('请输入姓名!');
- return;
- }
- // if (cardid == '') {
- // alert('请输入证件号码!');
- // return;
- // }
- if(man_id==""){
- add_customer(name,cardstyle,cardid);
- }else{
-
- update_customer(name,cardstyle,cardid);
- }
-
-
- }
- // 添加乘客
- function add_customer(name,cardstyle,cardid){
- // if(cardstyle=="150"){
- // if(isCardNo(cardid)==false){
- // return;
- // }
- // }
- $('.cir_info').text('添加中...');
- $("#loadingToast").show(); //转圈圈展示
- var url=base_api+"./zz_wxsct/control.php";
- var parm={
- type:"order_addcustomer",
- name:name,
- id_type:cardstyle,
- id_num:cardid
- }
- $.post(url,parm,function(res_data){
- res_data=JSON.parse(res_data);
- ZZLog(res_data);
- $("#loadingToast").hide(); //转圈圈展示
- if(res_data['code']!="0"){
- alert(res_data.info);
- return;
- }
- var temp = getPar('go_ticket_id');
- var run_id = getPar('run_id');
- var start_area_id = getPar('start_area_id');
- var end_area_id = getPar('end_area_id');
- var start_res_id = getPar('start_res_id');
- var end_res_id = getPar('end_res_end');
- if (temp == '') {
- 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;
- } else{
- 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;
- }
- });
- }
-
- // 修改乘客
- function update_customer(name,cardstyle,cardid){
- // if(cardstyle=="150"){
- // if(isCardNo(cardid)==false){
- // return;
- // }
- // }
- $('.cir_info').text('修改中...');
- $("#loadingToast").show(); //转圈圈展示
- var url=base_api+"./zz_wxsct/control.php";
- var parm={
- type:"order_updatecustomer",
- id:man_id,
- name:name,
- id_num:cardid,
- id_type:cardstyle
- }
- ZZLog(url+JSON.stringify(parm));
- $.post(url,parm,function(res_data){
- res_data=JSON.parse(res_data);
- ZZLog(res_data);
- $("#loadingToast").hide(); //转圈圈隐藏
- if(res_data['code']!="0"){
- alert(res_data['info']);
- return;
- }
- var temp = getPar('go_ticket_id');
- var run_id = getPar('run_id');
- var start_area_id = getPar('start_area_id');
- var end_area_id = getPar('end_area_id');
- var start_res_id = getPar('start_res_id');
- var end_res_id = getPar('end_res_end');
- if (temp == '') {
- 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;
- } else{
- 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;
- }
- });
- }
- // 删除乘客
- function del_costomer(){
- var r = confirm("你确定要删除该乘客吗?");
- if(r == true) {
- $("#loadingToast").show(); //转圈圈展示
- var url = base_api + "./zz_wxsct/control.php";
- var parm = {
- type: "order_delcustomer",
- id: man_id
- }
- $.post(url, parm, function(res_data) {
- res_data = JSON.parse(res_data);
- ZZLog(res_data);
- $("#loadingToast").hide(); //转圈圈隐藏
- if(res_data['code'] != "0") {
- alert(res_data.info);
- return;
- }
- var temp = getPar('go_ticket_id');
- var run_id = getPar('run_id');
- var start_area_id = getPar('start_area_id');
- var end_area_id = getPar('end_area_id');
- var start_res_id = getPar('start_res_id');
- var end_res_id = getPar('end_res_end');
- if (temp == '') {
- 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;
- } else{
- 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;
- }
- });
- } else {
-
- }
-
- }
-
- function isCardNo(card) {
- if(card) {
- // 身份证号码为15位或者18位,15位时全为数字,18位前17位为数字,最后一位是校验位,可能为数字或字符X
- var reg = /(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/;
- if(reg.test(card) === false) {
- alert("身份证输入不合法");
- return false;
- } else {
- return true;
- }
- }
-
- }
|