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.
 
 
 
 

210 lines
6.6 KiB

  1. /*
  2. author:yimazsq
  3. * 2016-10-27
  4. * */
  5. //分页参数
  6. var current_page = 1;
  7. var page_size = 10;
  8. var urlstr = base_api + 'index.php';
  9. var user_type = window.getStorage('user_type');
  10. window.onload = function () {
  11. listHTML = $('#list').html();
  12. $('#start_date_all').val(getDateTime(0));
  13. $('#end_date_all').val(getDateTime(0));
  14. selectOnePage(1);
  15. }
  16. //查询按钮的点击
  17. function searchBtnDidClicked() {
  18. selectOnePage(1);
  19. }
  20. //选中页码
  21. function selectOnePage(page) {
  22. var start_date = $('#start_date_all').val();
  23. var end_date = $('#end_date_all').val();
  24. var line_code = $('#line').val();
  25. var bill_type = $('#order_channel').val();
  26. var tp = 'finance_groupFinance_getFinanceList';
  27. current_page = page;
  28. var data = {
  29. tp: tp,
  30. start_date: start_date,
  31. end_date: end_date,
  32. line_code: line_code,
  33. bill_type: bill_type,
  34. current_page: page,
  35. page_size: page_size
  36. };
  37. ZZLog(data);
  38. $.ajax({
  39. url: urlstr, //请求地址
  40. data: data,
  41. type: "post",
  42. dataType: "json",
  43. async: false,
  44. success: function (data) {
  45. if (data.code == "0") {
  46. ZZLog(data);
  47. totalpage = data.page.total_page;
  48. reloadData(data);
  49. if (totalpage == 0) {
  50. $('.pageDiv').hide();
  51. } else {
  52. createPage(current_page, totalpage);
  53. $('.pageDiv').show();
  54. }
  55. } else {
  56. ZZAlertInfo(data.info);
  57. }
  58. },
  59. error: function (e) {
  60. ZZLog(e);
  61. }
  62. });
  63. }
  64. //创建分页控件
  65. function createPage(currpage, totalpage) {
  66. $(".pageDiv").createPage({
  67. pageCount: totalpage, //总页数
  68. current: currpage, //当前页
  69. turndown: 'true', //是否显示跳转框,显示为true,不现实为false,一定记得加上引号...
  70. backFn: function (p) {
  71. var start_date = $('#start_date_all').val();
  72. var end_date = $('#end_date_all').val();
  73. var line_code = $('#line').val();
  74. var bill_type = $('#order_channel').val();
  75. var tp = 'finance_groupFinance_getFinanceList';
  76. current_page = p;
  77. var data = {
  78. tp: tp,
  79. start_date: start_date,
  80. end_date: end_date,
  81. line_code: line_code,
  82. bill_type: bill_type,
  83. current_page: p,
  84. page_size: page_size
  85. };
  86. ZZLog(data);
  87. $.ajax({
  88. url: urlstr, //请求地址
  89. data: data,
  90. type: "post",
  91. dataType: "json",
  92. async: false,
  93. success: function (data) {
  94. if (data.code == "0") {
  95. console.log(data);
  96. totalpage = data.page.total_page;
  97. reloadData(data);
  98. } else {
  99. ZZAlertInfo(data.info);
  100. }
  101. },
  102. error: function (e) {
  103. ZZLog(e);
  104. }
  105. });
  106. }
  107. });
  108. }
  109. //加载数据
  110. function reloadData(data){
  111. var list = data.finance_list;
  112. var newHTML = '', action = '', action_url = '';
  113. for(var i = 0; i < list.length; i++) {
  114. var tempHTML = listHTML;
  115. var str = list[i].line_code_name;
  116. if(str!=null)
  117. {
  118. str = str.replace(',','</br>');
  119. }
  120. list[i].bus_order_id = list[i].bus_order_id < 10 ? '0'+list[i].bus_order_id : list[i].bus_order_id;
  121. //申请报账
  122. //<a href="[id]" style="cursor: pointer;">申请报账</a><a href="[changeid]" style="cursor: pointer;padding-left: 10px;">修改</a>
  123. if(list[i].finance_status == 340){
  124. action_url = "./apply_statement.html?bus_order_id="+list[i].bus_order_id+'&run_id='+list[i].run_id;
  125. action = '申请';
  126. }else if(list[i].finance_status == 137 ){ //修改报账
  127. action_url = "./change_statement.html?bus_order_id="+list[i].bus_order_id+'&run_id='+list[i].run_id;
  128. if(user_type == 0)
  129. action = '审核';
  130. else
  131. action = '修改';
  132. }else if(list[i].finance_status == 341 ){ //查看报账
  133. action_url = "./change_statement.html?ac=view&bus_order_id="+list[i].bus_order_id+'&run_id='+list[i].run_id;
  134. action = '查看';
  135. }
  136. tempHTML = tempHTML.replace('[编号]', list[i].run_id+''+list[i].bus_order_id);
  137. tempHTML = tempHTML.replace('[线路]', str);
  138. tempHTML = tempHTML.replace('[出发日期]', list[i].run_date);
  139. tempHTML = tempHTML.replace('[出发时间]', list[i].run_time);
  140. tempHTML = tempHTML.replace('[车次]', list[i].bus_order_id);
  141. tempHTML = tempHTML.replace('[座位数]', list[i].seat_count);
  142. tempHTML = tempHTML.replace('[人数]', list[i].saled_count);
  143. tempHTML = tempHTML.replace('[车辆]', list[i].bus_no);
  144. tempHTML = tempHTML.replace('[司机]', list[i].driver_name);
  145. tempHTML = tempHTML.replace('[导游]', list[i].guide_name);
  146. tempHTML = tempHTML.replace('[报账状态]', list[i].finance_type);
  147. // tempHTML = tempHTML.replace('[id]', "./apply_statement.html?bus_order_id="+list[i].bus_order_id+'&run_id='+list[i].run_id);
  148. // tempHTML = tempHTML.replace('[changeid]', "./change_statement.html?bus_order_id="+list[i].bus_order_id+'&run_id='+list[i].run_id);
  149. tempHTML = tempHTML.replace('[操作_url]', action_url);
  150. tempHTML = tempHTML.replace('[操作]', action);
  151. // tempHTML = tempHTML.replace('[oneCheck]', 'oneCheck' + list[i].M_ID);
  152. // tempHTML = tempHTML.replace('[oneCheckName]', list[i].M_ID);
  153. newHTML += tempHTML;
  154. }
  155. $('#list').html(newHTML);
  156. $('#list').show();
  157. }
  158. //复选框判断
  159. function select_checked(index) {
  160. //index=0最上面的全选 index=1表示的是下面所有的
  161. var cur_check = $('.ace_check')[0];
  162. var checkList = $('.ace_check');
  163. var checkCount = checkList.length - 1;
  164. var true_count = 0;
  165. for (var i = 1; i < checkList.length; i++) {
  166. if (index == '0') {
  167. checkList[i].checked = cur_check.checked;
  168. } else {
  169. if (checkList[i].checked == false) {
  170. cur_check.checked = false
  171. } else {
  172. true_count = true_count + 1;
  173. }
  174. }
  175. }
  176. //判断下面是否选中完
  177. if (checkCount == true_count) {
  178. cur_check.checked = true;
  179. }
  180. }
  181. //点击昨天
  182. function yesterday() {
  183. var yesterday = before(getDateTime(0));
  184. $('.start_date_all').val(yesterday);
  185. $('.end_date_all').val(yesterday);
  186. }
  187. //点击今天
  188. function today() {
  189. var today = getDateTime(0);
  190. $('.start_date_all').val(today);
  191. $('.end_date_all').val(today);
  192. }