|
- var httpData;
- var m_projcode = '';
- var runid = '';
- var m_godate = '';
- var m_gotime = '';
- var m_backdate = '';
- var m_backtime = '';
- var ticket = '';
- if (window.ActiveXObject) {
- var myreq = new ActiveXObject("Microsoft.XMLHTTP");
- } else {
- var myreq = new XMLHttpRequest();
- }
- function getPar(par){
- //获取当前URL
- var local_url = document.location.href;
- local_url = decodeURI(local_url);
- //获取要取得的get参数位置
- var get = local_url.indexOf(par +"=");
- if(get == -1){
- return false;
- }
- //截取字符串
- var get_par = local_url.slice(par.length + get + 1);
- //判断截取后的字符串是否还有其他get参数
- var nextPar = get_par.indexOf("&");
- if(nextPar != -1){
- get_par = get_par.slice(0, nextPar);
- }
- return get_par;
- }
- window.onload = function(){
- m_projcode = getPar('prodcode');
- ticket = getPar('ticket');
- runid = getPar('runid');
- m_godate = getPar('m_godate');
- m_gotime = getPar('m_gotime');
- m_backdate = getPar('m_backdate');
- m_backtime = getPar('m_backtime');
- myreq.open("get", "http://wx.zhizhuchuxing.com/core/customer_list.asp", true);
- myreq.onreadystatechange = show_user_list;
- myreq.send();
- }
- function show_user_list() {
- if (myreq.readyState == 4) {
- var newstr = myreq.responseText;
- httpData = JSON.parse(newstr);
- var c_code = httpData.code;
- if (c_code == '0'){
- show();
- }else{
- alert(httpData.info);
- return;
- }
- }
- }
- function go_edit(user_id, link_name, link_phone, link_id) {
- if(user_id < 0){
- var listURL = "./edit_contacts.html?prodcode="+m_projcode + "&user_id="+user_id;
- if(!ticket){
- }else{
- listURL += "&ticket="+ticket;
- }
- if(!runid){
- }else{
- listURL += "&runid="+runid;
- if(!m_godate || !m_gotime){
- }else{
- listURL += "&m_godate="+m_godate;
- listURL += "&m_gotime="+m_gotime;
- }
- if(!m_backdate || !m_backtime){
- }else{
- listURL += "&m_backdate="+m_backdate;
- listURL += "&m_backtime="+m_backtime;
- }
- }
- listURL = encodeURI(listURL);
- window.location.href = listURL;
- }else{
- var listURL = "./edit_contacts.html?prodcode="+m_projcode + "&user_id="+user_id+"&link_name="+link_name+"&link_phone="+link_phone+"&link_id="+link_id;
- if(!ticket){
- }else{
- listURL += "&ticket="+ticket;
- }
- if(!runid){
- }else{
- listURL += "&runid="+runid;
- if(!m_godate || !m_gotime){
- }else{
- listURL += "&m_godate="+m_godate;
- listURL += "&m_gotime="+m_gotime;
- }
- if(!m_backdate || !m_backtime){
- }else{
- listURL += "&m_backdate="+m_backdate;
- listURL += "&m_backtime="+m_backtime;
- }
- }
- listURL = encodeURI(listURL);
- window.location.href = listURL;
- }
- }
- function delete_user_info(link_id){
- var c_url = 'http://wx.zhizhuchuxing.com/core/customer_del.asp?cusid=' + link_id;
- myreq.open("get", c_url, true);
- myreq.onreadystatechange = delete_account;
- myreq.send();
- }
- function delete_account(){
- if (myreq.readyState == 4) {
- var newstr = myreq.responseText;
- httpData = JSON.parse(newstr);
- var c_code = httpData.code;
- if (c_code == '0'){
- show();
- }else{
- alert(httpData.info);
- return;
- }
- }
- }
- function show(){
- var s = "";
- for (var i = 0; i < httpData.customer.length; i++) {
- s += '<div style="position: relative; width: 92%; height: 76px; border-bottom: 1px solid #ECEBEE; margin-left: 4%; margin-right:4%;">';
- s += '<div style="float: left; width: 70%; height: 80px;" onclick="select('
- + '\''+ httpData.customer[i].customer_id + '\'' + ',' + '\'' + httpData.customer[i].customer_name+ '\'' + ',' + '\''
- + httpData.customer[i].customer_mobile + '\'' + ',' + '\'' + httpData.customer[i].customer_idno +'\')">';
- s += '<span style="float: left; font-size: 15px; margin-top: 15px; margin-bottom: 0; margin-right: 0px; color: #303030; overflow: hidden; width: 20%">'+httpData.customer[i].customer_name+'</span>';
- s += '<span style="float: left; margin-left: 15px; font-size: 15px; margin-top: 15px; margin-bottom: 0; margin-right: 0px; color: #303030; overflow: hidden; width: 60%">'+httpData.customer[i].customer_mobile+'</span>';
- s += '<span style="float: left; font-size: 15px; margin-top: 10px; margin-bottom: 0; margin-right: 0px; color: #808080; overflow: hidden; width: 100%">身份证:'+httpData.customer[i].customer_idno+'</span>';
- s += '</div>';
- s += '<div style="float: left; width: 30%; height: 76px;">';
- s += '<img style="float: right; margin-right: 0; margin-top: 27px; margin-bottom: 0; width: 20px; height: 20px;" onclick="delete_user_info(\''+ httpData.customer[i].customer_id +'\')" src="../img/delete_user_info.png"></img>';
- s += '<img style="float: right; margin-right: 10%; margin-left: 0; margin-top: 27px; margin-bottom: 0; width: 20px; height: 20px;" onclick="go_edit(' +'\''+ httpData.customer[i].customer_id + '\'' + ',' + '\'' + httpData.customer[i].customer_name+ '\'' + ',' + '\''
- + httpData.customer[i].customer_mobile + '\'' + ',' + '\'' + httpData.customer[i].customer_idno +'\')" src="../img/edit_user_info.png"></img>';
- s += '</div>';
- s += '</div>';
- }
- document.getElementById("add_link").innerHTML = s;
- }
- function select(link_id, link_name, link_phone, link_idno) {
- var listURL = "./reserve.html?prodcode="+m_projcode+"&user_id="+link_id+"&link_name="+link_name+"&link_phone="+link_phone+"&link_idno="+link_idno;
- if(!ticket){
- }else{
- listURL += "&ticket="+ticket;
- }
- if(!runid){
- }else{
- listURL += "&runid="+runid;
- if(!m_godate || !m_gotime){
- }else{
- listURL += "&m_godate="+m_godate;
- listURL += "&m_gotime="+m_gotime;
- }
- if(!m_backdate || !m_backtime){
- }else{
- listURL += "&m_backdate="+m_backdate;
- listURL += "&m_backtime="+m_backtime;
- }
- }
- listURL = encodeURI(listURL);
- window.location.href = listURL;
-
- }
|