Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

3 лет назад
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338
  1. //每页显示的数据个数
  2. var pagesize = 1;
  3. var tttHTML = '';
  4. window.onload = function(){
  5. $('.date-picker').datepicker({autoclose:true}).next().on("click", function(){$(this).prev().focus();});
  6. $('#timepicker1').timepicker({minuteStep: 1,showSeconds: false,showMeridian: false}).next().on("click", function(){$(this).prev().focus();});
  7. $('#timepicker2').timepicker({minuteStep: 1,showSeconds: false,showMeridian: false}).next().on("click", function(){$(this).prev().focus();});
  8. var cur = '';
  9. var currpage = getPar("currpage");
  10. var select_money_style = '';
  11. var select_sale_style = '';
  12. var start_time = '';
  13. var end_time = '';
  14. var keywords = '';
  15. var tradeId = '-1';
  16. var data = '';
  17. if(!currpage){
  18. cur = 1;
  19. select_money_style = $('#select_money_style').val();
  20. select_sale_style = $('#select_sale_style').val();
  21. start_time = '';
  22. end_time = '';
  23. tradeId = '-1';
  24. keywords = $('#keywords').val();
  25. data = '{type:"fina_log",select_money_style:'+select_money_style+',select_sale_style:'+select_sale_style+',start_time:'+start_time+',end_time:'+end_time+',keywords:'+keywords+',currpage:'+cur+',tradeId:'+tradeId+'}';
  26. }else{
  27. cur = currpage;
  28. select_money_style = getPar('select_money_style');
  29. $('#select_money_style').val(select_money_style);
  30. select_sale_style = getPar('select_sale_style');
  31. $('#select_sale_style').val(select_sale_style);
  32. start_time = getPar('start_time');
  33. $('#start_time').val(start_time);
  34. tradeId = getPar('tradeId');
  35. end_time = getPar('end_time');
  36. $('#end_time').val(end_time);
  37. keywords = getPar('keywords');
  38. $('#keywords').val(keywords);
  39. data = '{type:"fina_log",select_money_style:'+select_money_style+',select_sale_style:'+select_sale_style+',start_time:'+start_time+',end_time:'+end_time+',keywords:'+keywords+',currpage:'+cur+',tradeId:'+tradeId+'}';
  40. }
  41. tttHTML = $('#list').html();
  42. initdata(cur,select_money_style,select_sale_style,start_time,end_time,keywords,tradeId,data);
  43. }
  44. //请求列表
  45. function initdata(cur,select_money_style,select_sale_style,start_time,end_time,keywords,tradeId,data){
  46. if(!cur){
  47. cur = 1;
  48. }
  49. if(!select_money_style||!select_sale_style||!start_time||!end_time||!keywords){
  50. select_money_style = $('#select_money_style').val();
  51. select_sale_style = $('#select_sale_style').val();
  52. if(($("#start_time").val()=="")&&($("#end_time").val()=="")){
  53. start_time = '';
  54. end_time = '';
  55. }else{
  56. start_time = $("#start_time").val();
  57. end_time = $("#end_time").val();
  58. }
  59. keywords = $('#keywords').val();
  60. tradeId = getPar("tradeId");
  61. if(!tradeId){
  62. tradeId="-1";
  63. }
  64. }
  65. $.ajax({
  66. url:'./st-xm/control.php',
  67. type: "post",
  68. data: {type:"fina_log",
  69. start_time: start_time,
  70. end_time: end_time,
  71. keywords: keywords,
  72. pagesize: pagesize,
  73. money: select_money_style,
  74. channel: select_sale_style,
  75. cur:cur,
  76. id:tradeId
  77. },
  78. dataType: "json",
  79. success: function (data) {
  80. if(data.code == 0){
  81. console.log(data);
  82. var sum = data.totalNum;
  83. var tag = "test";
  84. var sendurl = './transaction_log.html?select_sale_style='+select_sale_style+'&start_time='+start_time+'&end_time='+end_time+'&keywords='+keywords+'&select_money_style='+select_money_style+'&tradeId='+tradeId;
  85. getPager(sendurl, sum, cur, pagesize,tag,'currpage');
  86. createHtml(data);
  87. }else if(data.code == -1){
  88. alert('没有相关数据');
  89. var sum = data.totalNum;
  90. var tag = "test";
  91. var sendurl = './transaction_log.html?select_sale_style='+select_sale_style+'&start_time='+start_time+'&end_time='+end_time+'&keywords='+keywords+'&select_money_style='+select_money_style+'&tradeId='+tradeId;
  92. getPager(sendurl, sum, cur, pagesize,tag,'currpage');
  93. createHtml(data);
  94. }
  95. },
  96. fail: function (data) {
  97. // 此处放失败后执行的代码
  98. }
  99. });
  100. }
  101. //拼接数据
  102. function createHtml(data){
  103. var list = data.list;
  104. console.log(tttHTML)
  105. var newHTML='';
  106. for(var i=0;i<list.length;i++){
  107. var tempHTML=tttHTML;
  108. tempHTML=tempHTML.replace('[渠道性质]',list[i].CHAN_QUALITY);
  109. tempHTML=tempHTML.replace('[渠道分类]',list[i].CHAN_TYPE);
  110. tempHTML=tempHTML.replace('[渠道名称]',list[i].CHAN_NAME);
  111. tempHTML=tempHTML.replace('[交易时间]',list[i].CREATE_TIME);
  112. tempHTML=tempHTML.replace('[交易金额]',list[i].ORDER_PRICE);
  113. tempHTML=tempHTML.replace('[对应订单号]',list[i].ID);
  114. tempHTML=tempHTML.replace('[支付方式]',list[i].TYPE_NAME);
  115. tempHTML=tempHTML.replace('[应收]',list[i].RECE_REE);
  116. tempHTML=tempHTML.replace('[佣金金额]',list[i].COMMISSION_REE);
  117. tempHTML=tempHTML.replace('[佣金结算]',list[i].ORDER_PAY_STATUS);
  118. tempHTML=tempHTML.replace('[ORDER_PAY_ID]',list[i].ORDER_PAY_ID);
  119. tempHTML=tempHTML.replace('[order_id]',list[i].ID);
  120. tempHTML=tempHTML.replace('[name]',list[i].ID);
  121. tempHTML=tempHTML.replace('[id]','ord_'+i);
  122. newHTML+=tempHTML;
  123. }
  124. $('#list').html(newHTML);
  125. //佣金结算
  126. $(".order_pay").click(function(){
  127. var ORDER_PAY_ID = $(this).attr("ORDER_PAY_ID");
  128. var order_id = $(this).attr("order_id");
  129. var ord_id = $(this).attr("id");
  130. if(ORDER_PAY_ID == 0){
  131. return;
  132. }else{
  133. if(confirm("该订单佣金已经结算完毕?")){
  134. $.ajax({
  135. url:'./st-xm/control.php',
  136. type: "post",
  137. data: {type:"fina_update",order_id: order_id},
  138. dataType: "json",
  139. success: function (data) {
  140. if(data.code == 0){
  141. $("#"+ord_id).text("已结");
  142. }else if(data.code == -1){
  143. alert("请检查网络!!!")
  144. }
  145. },
  146. fail: function (data) {
  147. // 此处放失败后执行的代码
  148. }
  149. });
  150. }else{
  151. return;
  152. }
  153. }
  154. });
  155. }
  156. //复选框判断
  157. function select_checked(index) {
  158. //index=0最上面的全选 index=1表示的是下面所有的
  159. var cur_check = $('.ace_check')[0];
  160. var checkList = $('.ace_check');
  161. var checkCount = checkList.length - 1;
  162. var true_count = 0;
  163. for (var i = 1; i < checkList.length; i++) {
  164. if (index == '0') {
  165. checkList[i].checked = cur_check.checked;
  166. } else {
  167. if (checkList[i].checked == false) {
  168. cur_check.checked = false
  169. } else {
  170. true_count = true_count + 1;
  171. }
  172. }
  173. }
  174. //判断下面是否选中完
  175. if (checkCount == true_count) {
  176. cur_check.checked = true;
  177. }
  178. }
  179. //得到url上的参数
  180. function getPar(par){
  181. var local_url = document.location.href;
  182. local_url = decodeURI(local_url);
  183. var get = local_url.indexOf(par +"=");
  184. if(get == -1){
  185. return false;
  186. }
  187. var get_par = local_url.slice(par.length + get + 1);
  188. var nextPar = get_par.indexOf("&");
  189. if(nextPar != -1){
  190. get_par = get_par.slice(0, nextPar);
  191. }
  192. return get_par;
  193. }
  194. //点击批量处理按钮
  195. function click_batch_manage() {
  196. var arr_manage = new Array();
  197. $('.ace_check').each(function(index, item) {
  198. if (this.checked && index != 0) {
  199. arr_manage.push($(this).attr('name'));
  200. }
  201. });
  202. if (arr_manage.length <= 0) {
  203. alert('请勾选!!!');
  204. return;
  205. }
  206. var arr_manage_str = arr_manage.join(',');
  207. alert(arr_manage_str);
  208. $.ajax({
  209. url:'./st-xm/control.php',
  210. type: "post",
  211. data: {type:"fina_update",order_id: arr_manage_str},
  212. dataType: "json",
  213. success: function (data) {
  214. if(data.code == 0){
  215. window.location.reload();
  216. }else if(data.code == -1){
  217. alert("请检查网络!!!")
  218. }
  219. },
  220. fail: function (data) {
  221. // 此处放失败后执行的代码
  222. }
  223. });
  224. }
  225. //批量导出
  226. function batch_export(){
  227. var select_money_style = $('#select_money_style').val();
  228. var select_sale_style = $('#select_sale_style').val();
  229. var start_time = $("#start_time").val();
  230. var end_time = $("#end_time").val();
  231. var keywords = $('#keywords').val();
  232. var arr_manage = new Array();
  233. var arr_manage_str = "";
  234. $('.ace_check').each(function(index, item) {
  235. if (this.checked && index != 0) {
  236. arr_manage.push($(this).attr('name'));
  237. }
  238. });
  239. if (arr_manage.length <= 0) {
  240. arr_manage_str = "-1";
  241. }else{
  242. arr_manage_str = arr_manage.join(',');
  243. }
  244. var url =
  245. "./st-xm/Model/fina/export.php?start_time=" + start_time +
  246. "&end_time=" + end_time +
  247. "&keywords=" + keywords +
  248. "&money=" + select_money_style +
  249. "&channel=" + select_sale_style +
  250. "&arr_manage_str=" + arr_manage_str;
  251. var listURL = url;
  252. window.location.href = listURL;
  253. // $.ajax({
  254. // url:'./st-xm/control.php',
  255. // type: "post",
  256. // data: {type:"fina_export",
  257. // start_time: start_time,
  258. // end_time: end_time,
  259. // keywords: keywords,
  260. // money: select_money_style,
  261. // channel: select_sale_style,
  262. // arr_manage_str:arr_manage_str
  263. // },
  264. // dataType: "json",
  265. // success: function (data) {
  266. // if(data.code == 0){
  267. // window.location.reload();
  268. // }else if(data.code == -1){
  269. // alert("请检查网络!!!")
  270. // }
  271. // },
  272. // fail: function (data) {
  273. // // 此处放失败后执行的代码
  274. // }
  275. // });
  276. }