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.
 
 
 
 

183 lines
6.5 KiB

  1. var page_size = 10;
  2. var list_HTML = '';
  3. $(document).ready(function() {
  4. list_HTML = $('#order_list').html();
  5. var or_fr_url = "./st-xm/Api/disney_get_org_list.php";
  6. get_order_from(or_fr_url); //订单源
  7. var cur_page = getPar('cur_page');
  8. if (!cur_page) {
  9. click_search();
  10. } else {
  11. var order_id = getPar('search_order_no');
  12. var pay_order_id = getPar('search_pay_no');
  13. var order_from = getPar('search_org_id');
  14. var start_date = getPar('search_create_date');
  15. var us_name = getPar('search_cus_name');
  16. var us_mobile = getPar('search_cus_mobile');
  17. $('#order_id').val(order_id);
  18. $('#pay_order_id').val(pay_order_id);
  19. $('#id-date-picker-1').val(start_date);
  20. $('#order_from').val(order_from);
  21. $('#us_name').val(us_name);
  22. $('#us_mobile').val(us_mobile);
  23. var URL1 = './st-xm/Api/disney_get_order_list.php?cur_page=' + cur_page + '&page_size=10&search_order_no=' + order_id +
  24. "&search_pay_no=" + pay_order_id +
  25. "&search_org_id=" + order_from +
  26. "&search_create_date=" + start_date +
  27. "&search_cus_name=" + us_name +
  28. "&search_cus_mobile=" + us_mobile;
  29. var URL2 = './distribution_order_list.html?page_size=10&search_order_no=' + order_id +
  30. "&search_pay_no=" + pay_order_id +
  31. "&search_org_id=" + order_from +
  32. "&search_create_date=" + start_date +
  33. "&search_cus_name=" + us_name +
  34. "&search_cus_mobile=" + us_mobile;
  35. get_order_list(URL1, URL2)
  36. }
  37. });
  38. //订单源
  39. function get_order_from(URL) {
  40. var or_from_HTML = '<option value="0">请选择</option>';
  41. $.getJSON(URL, function(res_data) {
  42. var HTML = or_from_HTML;
  43. for (var i = 0, m = res_data.length; i < m; i++) {
  44. var tempHTML = or_from_HTML;
  45. tempHTML = tempHTML.replace('0', res_data[i]['org_id']);
  46. tempHTML = tempHTML.replace('请选择', res_data[i]['org_name']);
  47. HTML += tempHTML;
  48. }
  49. $('#order_from').html(HTML);
  50. });
  51. }
  52. //表格list
  53. function get_order_list(URL1, URL2) {
  54. $.getJSON(URL1, function(res_data) {
  55. if (!res_data) {
  56. alert("出现问题,自己查找!!!");
  57. }
  58. var order_list = res_data['order_list'];
  59. var HTML = '';
  60. for (var i = 0, m = order_list.length; i < m; i++) {
  61. var dict = order_list[i];
  62. var tempHTML = list_HTML;
  63. tempHTML = tempHTML.replace('[订单编号]', dict['order_serial_no']);
  64. if( dict['prod_id'] == 1 ) {
  65. tempHTML = tempHTML.replace('[订单内容]', dict['prod_name'] + "<br />" + dict['start_day'] + " " + dict['start_time'] + " ~ " + dict['end_day'] + " " + dict['end_time'] );
  66. } else if( dict['prod_id'] == 2 ){
  67. var disp_prod = dict['prod_name'] + "<br />" + dict['start_day'] + " " + dict['start_time'] + " ~ " + dict['end_day'] + " " + dict['end_time'];
  68. if( dict['start_day2'].length > 0 ) {
  69. disp_prod = disp_prod + "<br />" + dict['start_day2'] + " " + dict['start_time2'] + " ~ " + dict['end_day2'] + " " + dict['end_time2'];
  70. }
  71. tempHTML = tempHTML.replace('[订单内容]', disp_prod );
  72. } else if( dict['prod_id'] >= 9 && dict['prod_id'] <= 15) {
  73. tempHTML = tempHTML.replace('[订单内容]', dict['prod_name'] + "<br />" + dict['start_day'] + " " + dict['start_time'] );
  74. }else {
  75. tempHTML = tempHTML.replace('[订单内容]', dict['prod_name'] + "<br />" + dict['start_day'] );
  76. }
  77. tempHTML = tempHTML.replace('[订单金额]', dict['order_price']);
  78. tempHTML = tempHTML.replace('[订单源]', dict['org_name']);
  79. tempHTML = tempHTML.replace('[下单时间]', dict['create_time']);
  80. var payinfo = dict['pay_status'].replace('[br /]', '<br />')
  81. tempHTML = tempHTML.replace('[支付信息]', payinfo);
  82. var userinfo = dict['cus_name'] + "<br />" + dict['cus_mobile'] + "<br />" + dict['cus_iden'];
  83. tempHTML = tempHTML.replace('[用户信息]', userinfo);
  84. tempHTML = tempHTML.replace('[textarea-value]', dict['comment']);
  85. tempHTML = tempHTML.replace('[comment]', 'comment_' + dict['id']);
  86. tempHTML = tempHTML.replace('[param1]', dict['id']);
  87. tempHTML = tempHTML.replace('[param2]', dict['order_serial_no']);
  88. HTML += tempHTML;
  89. }
  90. if (HTML) {
  91. $('#order_list').html(HTML);
  92. var currpage = getPar("cur_page");
  93. if (!currpage) {
  94. currpage = 1
  95. }
  96. var sum = parseInt(res_data['total_page'] * 10);
  97. var size = page_size;
  98. var tag = "test";
  99. getPager(URL2, sum, currpage, size, tag, 'cur_page');
  100. } else {
  101. $('#order_list').html("");
  102. $('#test').html("");
  103. }
  104. });
  105. }
  106. //点击搜索
  107. function click_search() {
  108. var order_id = $('#order_id').val();
  109. var pay_order_id = $('#pay_order_id').val();
  110. var start_date = $('#id-date-picker-1').val();
  111. var order_from = $('#order_from').val();
  112. var us_name = $('#us_name').val();
  113. var us_mobile = $('#us_mobile').val();
  114. var url = './st-xm/Api/disney_get_order_list.php?cur_page=1&page_size=10&search_order_no=' + order_id +
  115. "&search_pay_no=" + pay_order_id +
  116. "&search_org_id=" + order_from +
  117. "&search_create_date=" + start_date +
  118. "&search_cus_name=" + us_name +
  119. "&search_cus_mobile=" + us_mobile;
  120. var URL2 = './distribution_order_list.html?page_size=10&search_order_no=' + order_id +
  121. "&search_pay_no=" + pay_order_id +
  122. "&search_org_id=" + order_from +
  123. "&search_create_date=" + start_date +
  124. "&search_cus_name=" + us_name +
  125. "&search_cus_mobile=" + us_mobile;
  126. get_order_list(url, URL2);
  127. }
  128. function update_order_comment(index,order_serial_no) {
  129. var comment_id = "comment_" + index;
  130. var comment_txt = document.getElementById(comment_id).value;
  131. comment_txt=encodeURI(encodeURI(comment_txt));
  132. if (window.ActiveXObject) {
  133. var request = new ActiveXObject("Microsoft.XMLHTTP");
  134. } else {
  135. var request = new XMLHttpRequest();
  136. }
  137. // var url = "http://wx.zhizhuchuxing.com/update_order_comment.php?odr=" + order_serial_no;
  138. var url = "./st-xm/Api/disney_update_org_comment.php?odr=" + index+"&odc="+comment_txt;
  139. console.log(url);
  140. var postData = "";
  141. postData = "odc=" + comment_txt;
  142. request.open("POST", url, true);
  143. request.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
  144. request.onreadystatechange = function() {
  145. if (request.readyState == 4 && request.status == 200) {
  146. if (request.responseText == '0') {
  147. } else {
  148. }
  149. }
  150. }
  151. // request.send(postData);
  152. request.send(postData);
  153. }
  154. function getPar(par) {
  155. //获取当前URL
  156. var local_url = document.location.href;
  157. local_url = decodeURI(local_url);
  158. //获取要取得的get参数位置
  159. var get = local_url.indexOf(par + "=");
  160. if (get == -1) {
  161. return "";
  162. }
  163. //截取字符串
  164. var get_par = local_url.slice(par.length + get + 1);
  165. //判断截取后的字符串是否还有其他get参数
  166. var nextPar = get_par.indexOf("&");
  167. if (nextPar != -1) {
  168. get_par = get_par.slice(0, nextPar);
  169. }
  170. return get_par;
  171. }