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.
 
 
 
 

265 lines
5.9 KiB

  1. $(document).ready(function() {
  2. $(".form_date").datetimepicker({
  3. format: 'yyyy-mm-dd',
  4. autoclose: true,
  5. minView: 2,
  6. pickerPosition: "bottom-left"
  7. });
  8. });
  9. var date_type = '';
  10. var start_date = '';
  11. var end_date = '';
  12. var org_id = '';
  13. var settlement_status = '';
  14. var more_search = '';
  15. var prod_type = '0';
  16. var page_size = '10';
  17. var current = '1';
  18. window.onload = function() {
  19. httpBaseInfo();
  20. }
  21. function httpBaseInfo(){
  22. let data = {
  23. type: 'des_ordersource',
  24. ordersource: ''
  25. }
  26. $.ajax({
  27. url: $$.base_api + 'st-xm/control.php',
  28. data: data,
  29. dataType: 'json',
  30. type: 'post',
  31. async: false,
  32. success: res_data => {
  33. $$.ZZLog(res_data);
  34. if(0 != res_data.code) {
  35. $$.alert(res_data.info);
  36. } else {
  37. let org_list = res_data.list;
  38. let temp_html = `<option value="0">请选择</option>`;
  39. org_list.forEach((dict, index) => {
  40. temp_html += `<option value="${dict.org_id}">${dict.org_name}</option>`
  41. });
  42. $('#org_list').html(temp_html);
  43. $('#org_list').comboSelect();
  44. $$.loading();
  45. $$.delay(httpFirstData, 10);
  46. // httpFirstData();
  47. }
  48. },
  49. error: (error) => {
  50. $$.alert($$.infoApiError);
  51. }
  52. })
  53. }
  54. function httpFirstData(){
  55. date_type = $('#date_type').val();
  56. start_date = $('#beforeDate').val();
  57. end_date = $('#currentDate').val();
  58. settlement_status = $('#settlement_status').val();
  59. org_id = $('#org_list').val();
  60. more_search = $('#more_search').val();
  61. let first_current = '1';
  62. let tp = 'payment_getList';
  63. let data = { date_type, start_date, end_date, settlement_status, org_id, more_search, prod_type, current_page: first_current, page_size, tp };
  64. $.ajax({
  65. type: "post",
  66. url: $$.base_api + 'application/financeManager/index.php',
  67. async: false,
  68. dataType: 'json',
  69. data: data,
  70. success: res_data => {
  71. $$.closeLoading();
  72. $$.ZZLog(res_data);
  73. if('0' != res_data.code) {
  74. $$.alert(res_data.info);
  75. } else {
  76. let total_page = res_data.data.page.total_page;
  77. let order_list = res_data.data.order_list;
  78. let temp_html = '';
  79. order_list.forEach((dict, index) => {
  80. temp_html += replaceOrderList(dict);
  81. });
  82. if(order_list.length <= 0) {
  83. var html = `<tr style="text-align: center;">
  84. <td style="color: #666;" colspan="11">无查询结果</td>
  85. </tr>`;
  86. $('#order_list').html(html);
  87. } else {
  88. $('#order_list').html(temp_html);
  89. }
  90. if(total_page == '0') {
  91. $('#page_order_list').hide();
  92. } else {
  93. createPage(first_current, total_page);
  94. $('#page_order_list').show();
  95. }
  96. $('#purchase').text(res_data.data.sum_info.total_price);
  97. $('#indemnity').text(res_data.data.sum_info.reparations_price);
  98. $('#price_div').css('opacity', '1');
  99. $('#order_list').show();
  100. }
  101. },
  102. error: error => {
  103. $$.closeLoading();
  104. $$.alert($$.infoApiError);
  105. }
  106. });
  107. }
  108. function replaceOrderList(dict) {
  109. // let title = getStatusDes(dict.order_prod_type);
  110. let html = `<tr>
  111. <td>${dict.order_id}</td>
  112. <td>${dict.outside_order_no}</td>
  113. <td>${dict.create_time}</td>
  114. <td>${dict.parent_prod_name}</td>
  115. <td>${dict.prodName}</td>
  116. <td>${dict.prodNum}</td>
  117. <td>${dict.prod_type_des}</td>
  118. <td>${dict.run_date}</td>
  119. <td>${dict.supplier_name}</td>
  120. <td>${dict.base_price}</td>
  121. <td>${dict.reparations_price}</td>
  122. <td>${dict.status_des}</td>
  123. </tr>`;
  124. return html;
  125. }
  126. //创建分页
  127. function createPage(currpage, totalpage) {
  128. $('#page_order_list').createPage({
  129. pageCount: totalpage,
  130. current: currpage,
  131. turndown: 'true',
  132. backFn: function(p) {
  133. current_page = p;
  134. $$.loading();
  135. $$.delay(httpData, 10);
  136. }
  137. });
  138. }
  139. //分页查询
  140. function httpData() {
  141. let tp = 'payment_getList';
  142. let data = { date_type, start_date, end_date, settlement_status, org_id, more_search, prod_type, current_page, page_size, tp };
  143. $.ajax({
  144. type: "post",
  145. url: $$.base_api + 'application/financeManager/index.php',
  146. async: false,
  147. dataType: 'json',
  148. data: data,
  149. success: res_data => {
  150. $$.ZZLog(res_data);
  151. $$.closeLoading();
  152. if('0' != res_data.code) {
  153. $$.alert(res_data.info);
  154. } else {
  155. let order_list = res_data.data.order_list;
  156. let temp_html = '';
  157. order_list.forEach((dict, index) => {
  158. temp_html += replaceOrderList(dict);
  159. });
  160. if(order_list.length <= 0) {
  161. var html = `<tr style="text-align: center;">
  162. <td style="color: #666;" colspan="11">无查询结果</td>
  163. </tr>`;
  164. $('#order_list').html(html);
  165. } else {
  166. $('#order_list').html(temp_html);
  167. }
  168. $('#order_list').show();
  169. }
  170. },
  171. error: error => {
  172. $$.closeLoading();
  173. $$.alert($$.infoApiError);
  174. }
  175. });
  176. }
  177. //查询
  178. function searchDidClick() {
  179. $$.loading();
  180. $$.delay(httpFirstData, 10);
  181. }
  182. //订单筛选
  183. function orderTypeDidClicked(index) {
  184. switch(index) {
  185. case 'all':
  186. prod_type = '0';
  187. break;
  188. case 'bar':
  189. prod_type = '81,82,38,369';
  190. break;
  191. case 'hotel':
  192. prod_type = '25,26';
  193. break;
  194. case 'ticket':
  195. prod_type = '258,282,311';
  196. break;
  197. default:
  198. break;
  199. }
  200. $$.loading();
  201. $$.delay(httpFirstData, 10);
  202. // httpFirstData();
  203. }
  204. //操作订单
  205. function operationBill(index) {
  206. let tp = '';
  207. switch(index) {
  208. case 'close':
  209. tp = 'payment_closesAmount';
  210. break;
  211. case 'generate':
  212. tp = 'payment_addBalance';
  213. break;
  214. case 'cancel':
  215. tp = 'payment_cancelCloses';
  216. break;
  217. default:
  218. break;
  219. }
  220. $$.loading();
  221. httpStatus(tp);
  222. }
  223. function httpStatus(tp) {
  224. let data = { date_type, start_date, end_date, settlement_status, org_id, more_search, prod_type, tp };
  225. $$.delay(function() {
  226. $.ajax({
  227. type: "post",
  228. url: $$.base_api + 'application/financeManager/index.php',
  229. async: false,
  230. dataType: 'json',
  231. data: data,
  232. success: res_data => {
  233. $$.closeLoading();
  234. if('0' != res_data.code) {
  235. $$.alert(res_data.info);
  236. } else {
  237. $$.alert('操作成功');
  238. httpFirstData();
  239. }
  240. },
  241. error: error => {
  242. $$.closeLoading();
  243. $$.alert($$.infoApiError);
  244. }
  245. });
  246. }, 10);
  247. }