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.

select_contacts.js 5.6 KiB

3 年之前
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166
  1. var httpData;
  2. var m_projcode = '';
  3. var runid = '';
  4. var m_godate = '';
  5. var m_gotime = '';
  6. var m_backdate = '';
  7. var m_backtime = '';
  8. var ticket = '';
  9. if (window.ActiveXObject) {
  10. var myreq = new ActiveXObject("Microsoft.XMLHTTP");
  11. } else {
  12. var myreq = new XMLHttpRequest();
  13. }
  14. function getPar(par){
  15. //获取当前URL
  16. var local_url = document.location.href;
  17. local_url = decodeURI(local_url);
  18. //获取要取得的get参数位置
  19. var get = local_url.indexOf(par +"=");
  20. if(get == -1){
  21. return false;
  22. }
  23. //截取字符串
  24. var get_par = local_url.slice(par.length + get + 1);
  25. //判断截取后的字符串是否还有其他get参数
  26. var nextPar = get_par.indexOf("&");
  27. if(nextPar != -1){
  28. get_par = get_par.slice(0, nextPar);
  29. }
  30. return get_par;
  31. }
  32. window.onload = function(){
  33. m_projcode = getPar('prodcode');
  34. ticket = getPar('ticket');
  35. runid = getPar('runid');
  36. m_godate = getPar('m_godate');
  37. m_gotime = getPar('m_gotime');
  38. m_backdate = getPar('m_backdate');
  39. m_backtime = getPar('m_backtime');
  40. myreq.open("get", "http://wx.zhizhuchuxing.com/core/customer_list.asp", true);
  41. myreq.onreadystatechange = show_user_list;
  42. myreq.send();
  43. }
  44. function show_user_list() {
  45. if (myreq.readyState == 4) {
  46. var newstr = myreq.responseText;
  47. httpData = JSON.parse(newstr);
  48. var c_code = httpData.code;
  49. if (c_code == '0'){
  50. show();
  51. }else{
  52. alert(httpData.info);
  53. return;
  54. }
  55. }
  56. }
  57. function go_edit(user_id, link_name, link_phone, link_id) {
  58. if(user_id < 0){
  59. var listURL = "./edit_contacts.html?prodcode="+m_projcode + "&user_id="+user_id;
  60. if(!ticket){
  61. }else{
  62. listURL += "&ticket="+ticket;
  63. }
  64. if(!runid){
  65. }else{
  66. listURL += "&runid="+runid;
  67. if(!m_godate || !m_gotime){
  68. }else{
  69. listURL += "&m_godate="+m_godate;
  70. listURL += "&m_gotime="+m_gotime;
  71. }
  72. if(!m_backdate || !m_backtime){
  73. }else{
  74. listURL += "&m_backdate="+m_backdate;
  75. listURL += "&m_backtime="+m_backtime;
  76. }
  77. }
  78. listURL = encodeURI(listURL);
  79. window.location.href = listURL;
  80. }else{
  81. var listURL = "./edit_contacts.html?prodcode="+m_projcode + "&user_id="+user_id+"&link_name="+link_name+"&link_phone="+link_phone+"&link_id="+link_id;
  82. if(!ticket){
  83. }else{
  84. listURL += "&ticket="+ticket;
  85. }
  86. if(!runid){
  87. }else{
  88. listURL += "&runid="+runid;
  89. if(!m_godate || !m_gotime){
  90. }else{
  91. listURL += "&m_godate="+m_godate;
  92. listURL += "&m_gotime="+m_gotime;
  93. }
  94. if(!m_backdate || !m_backtime){
  95. }else{
  96. listURL += "&m_backdate="+m_backdate;
  97. listURL += "&m_backtime="+m_backtime;
  98. }
  99. }
  100. listURL = encodeURI(listURL);
  101. window.location.href = listURL;
  102. }
  103. }
  104. function delete_user_info(link_id){
  105. var c_url = 'http://wx.zhizhuchuxing.com/core/customer_del.asp?cusid=' + link_id;
  106. myreq.open("get", c_url, true);
  107. myreq.onreadystatechange = delete_account;
  108. myreq.send();
  109. }
  110. function delete_account(){
  111. if (myreq.readyState == 4) {
  112. var newstr = myreq.responseText;
  113. httpData = JSON.parse(newstr);
  114. var c_code = httpData.code;
  115. if (c_code == '0'){
  116. show();
  117. }else{
  118. alert(httpData.info);
  119. return;
  120. }
  121. }
  122. }
  123. function show(){
  124. var s = "";
  125. for (var i = 0; i < httpData.customer.length; i++) {
  126. s += '<div style="position: relative; width: 92%; height: 76px; border-bottom: 1px solid #ECEBEE; margin-left: 4%; margin-right:4%;">';
  127. s += '<div style="float: left; width: 70%; height: 80px;" onclick="select('
  128. + '\''+ httpData.customer[i].customer_id + '\'' + ',' + '\'' + httpData.customer[i].customer_name+ '\'' + ',' + '\''
  129. + httpData.customer[i].customer_mobile + '\'' + ',' + '\'' + httpData.customer[i].customer_idno +'\')">';
  130. 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>';
  131. 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>';
  132. 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>';
  133. s += '</div>';
  134. s += '<div style="float: left; width: 30%; height: 76px;">';
  135. 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>';
  136. 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+ '\'' + ',' + '\''
  137. + httpData.customer[i].customer_mobile + '\'' + ',' + '\'' + httpData.customer[i].customer_idno +'\')" src="../img/edit_user_info.png"></img>';
  138. s += '</div>';
  139. s += '</div>';
  140. }
  141. document.getElementById("add_link").innerHTML = s;
  142. }
  143. function select(link_id, link_name, link_phone, link_idno) {
  144. var listURL = "./reserve.html?prodcode="+m_projcode+"&user_id="+link_id+"&link_name="+link_name+"&link_phone="+link_phone+"&link_idno="+link_idno;
  145. if(!ticket){
  146. }else{
  147. listURL += "&ticket="+ticket;
  148. }
  149. if(!runid){
  150. }else{
  151. listURL += "&runid="+runid;
  152. if(!m_godate || !m_gotime){
  153. }else{
  154. listURL += "&m_godate="+m_godate;
  155. listURL += "&m_gotime="+m_gotime;
  156. }
  157. if(!m_backdate || !m_backtime){
  158. }else{
  159. listURL += "&m_backdate="+m_backdate;
  160. listURL += "&m_backtime="+m_backtime;
  161. }
  162. }
  163. listURL = encodeURI(listURL);
  164. window.location.href = listURL;
  165. }