選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。
 
 
 
 
 
 

158 行
4.4 KiB

  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. var user_id = '';
  33. var link_name = '';
  34. var link_phone = '';
  35. var link_id = '';
  36. window.onload = function(){
  37. m_projcode = getPar('prodcode');
  38. ticket = getPar('ticket');
  39. runid = getPar('runid');
  40. m_godate = getPar('m_godate');
  41. m_gotime = getPar('m_gotime');
  42. m_backdate = getPar('m_backdate');
  43. m_backtime = getPar('m_backtime');
  44. user_id = getPar("user_id");
  45. link_name = getPar("link_name");
  46. link_phone = getPar("link_phone");
  47. link_id = getPar("link_id");
  48. if(user_id < 0){
  49. document.getElementById("user_id").value = user_id;
  50. document.getElementById("link_name").value = "";
  51. document.getElementById("link_phone").value = "";
  52. document.getElementById("link_id").value = "";
  53. }else{
  54. document.getElementById("user_id").value = user_id;
  55. document.getElementById("link_name").value = link_name;
  56. document.getElementById("link_phone").value = link_phone;
  57. document.getElementById("link_id").value = link_id;
  58. }
  59. }
  60. function submit_user(){
  61. var user_id_edit = document.getElementById("user_id").value;
  62. var link_name_edit = document.getElementById("link_name").value;
  63. var link_phone_edit = document.getElementById("link_phone").value;
  64. var link_idno_edit = document.getElementById("link_id").value;
  65. if(!link_name_edit){
  66. alert("联系人不能为空");
  67. }else if(!link_phone_edit){
  68. alert("手机号不能为空");
  69. }else if(!link_idno_edit){
  70. alert("身份证不能为空");
  71. }else{
  72. if(user_id < 0){
  73. add_user_info(link_name_edit, link_phone_edit, link_idno_edit);
  74. }else{
  75. edit_user_info(user_id_edit, link_name_edit, link_phone_edit, link_idno_edit);
  76. }
  77. }
  78. }
  79. function add_user_info(link_name, link_phone, link_idno){
  80. c_url = 'http://wx.zhizhuchuxing.com/core/customer_add.asp?name=' + link_name + '&mobile=' + link_phone + '&idno=' + link_idno;
  81. myreq.open('get', c_url, true);
  82. myreq.onreadystatechange = add_account;
  83. myreq.send();
  84. }
  85. function add_account(){
  86. if (myreq.readyState == 4) {
  87. var newstr = myreq.responseText;
  88. httpData = JSON.parse(newstr);
  89. var c_code = httpData.code;
  90. if (c_code == '0'){
  91. var listURL = "./select_contacts.html?prodcode="+m_projcode;
  92. if(!ticket){
  93. }else{
  94. listURL += "&ticket="+ticket;
  95. }
  96. if(!runid){
  97. }else{
  98. listURL += "&runid="+runid;
  99. if(!m_godate || !m_gotime){
  100. }else{
  101. listURL += "&m_godate="+m_godate;
  102. listURL += "&m_gotime="+m_gotime;
  103. }
  104. if(!m_backdate || !m_backtime){
  105. }else{
  106. listURL += "&m_backdate="+m_backdate;
  107. listURL += "&m_backtime="+m_backtime;
  108. }
  109. }
  110. // 跳转前将URL编码
  111. listURL = encodeURI(listURL);
  112. window.location.href = listURL;
  113. }else{
  114. alert(httpData.info);
  115. return;
  116. }
  117. }
  118. }
  119. function edit_user_info(link_id, link_name, link_phone, link_idno){
  120. myreq.open("get", "http://wx.zhizhuchuxing.com/core/customer_modify.asp?id="+link_id+"&name="+link_name+"&mobile="+link_phone+ "&idno="+link_idno, true);
  121. myreq.onreadystatechange = edit_account;
  122. myreq.send();
  123. }
  124. function edit_account(){
  125. if (myreq.readyState == 4) {
  126. var newstr = myreq.responseText;
  127. httpData = JSON.parse(newstr);
  128. var c_code = httpData.code;
  129. if (c_code == '0'){
  130. var listURL = "./select_contacts.html?prodcode="+m_projcode;
  131. if(!ticket){
  132. }else{
  133. listURL += "&ticket="+ticket;
  134. }
  135. if(!runid){
  136. }else{
  137. listURL += "&runid="+runid;
  138. if(!m_godate || !m_gotime){
  139. }else{
  140. listURL += "&m_godate="+m_godate;
  141. listURL += "&m_gotime="+m_gotime;
  142. }
  143. if(!m_backdate || !m_backtime){
  144. }else{
  145. listURL += "&m_backdate="+m_backdate;
  146. listURL += "&m_backtime="+m_backtime;
  147. }
  148. }
  149. // 跳转前将URL编码
  150. listURL = encodeURI(listURL);
  151. window.location.href = listURL;H
  152. }else{
  153. alert(httpData.info);
  154. return;
  155. }
  156. }
  157. }