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.
 
 
 
 

231 lines
5.5 KiB

  1. //每页显示的数据个数
  2. var pagesize = 10;
  3. var tttHTML = '';
  4. window.onload = function(){
  5. var cur = '';
  6. var currpage = getPar("currpage");
  7. var keywords = '';
  8. var data = '';
  9. if(!currpage){
  10. cur = 1;
  11. keywords = $('#keywords').val();
  12. data = '{type:"fina_apply",keywords:'+keywords+',currpage:'+cur+'}';
  13. }else{
  14. cur = currpage;
  15. keywords = getPar('keywords');
  16. $('#keywords').val(keywords);
  17. data = '{type:"fina_apply",keywords:'+keywords+',currpage:'+cur+'}';
  18. }
  19. tttHTML = $('#list').html();
  20. initdata(cur,keywords,data);
  21. }
  22. //请求列表
  23. function initdata(cur,keywords,data) {
  24. if (!cur) {
  25. cur = 1;
  26. }
  27. if (!keywords) {
  28. keywords = $('#keywords').val();
  29. }
  30. $.ajax({
  31. url: './st-xm/control.php',
  32. type: "post",
  33. data: {
  34. type: "fina_apply",
  35. keywords: keywords,
  36. pagesize: pagesize,
  37. cur: cur
  38. },
  39. dataType: "json",
  40. success: function (data) {
  41. if (data.code == 0) {
  42. console.log(data);
  43. var sum = data.totalNum;
  44. var tag = "test";
  45. var sendurl = './money_applyfor.html?keywords=' + keywords;
  46. getPager(sendurl, sum, cur, pagesize, tag, 'currpage');
  47. createHtml(data);
  48. document.getElementById("aaa").innerHTML = "共"+sum+"条数据";
  49. } else if (data.code == -1) {
  50. alert('没有相关数据');
  51. var sum = data.totalNum;
  52. var tag = "test";
  53. var sendurl = './money_applyfor.html?keywords=' + keywords;
  54. getPager(sendurl, sum, cur, pagesize, tag, 'currpage');
  55. createHtml(data);
  56. }
  57. },
  58. fail: function (data) {
  59. // 此处放失败后执行的代码
  60. }
  61. });
  62. }
  63. //拼接数据
  64. function createHtml(data){
  65. var list = data.list;
  66. console.log(tttHTML)
  67. var newHTML='';
  68. for(var i=0;i<list.length;i++){
  69. var tempHTML=tttHTML;
  70. tempHTML=tempHTML.replace('[渠道性质]',list[i].CHAN_QUALITY);
  71. tempHTML=tempHTML.replace('[渠道分类]',list[i].CHAN_TYPE);
  72. tempHTML=tempHTML.replace('[渠道名称]',list[i].CHAN_NAME);
  73. tempHTML=tempHTML.replace('[申请时间]',list[i].APPLY_TIME);
  74. tempHTML=tempHTML.replace('[申请事项]','佣金提现');
  75. tempHTML=tempHTML.replace('[申请金额]',list[i].APPLY_MONEY);
  76. tempHTML=tempHTML.replace('[账号]',list[i].BANK_ACCOUNT);
  77. tempHTML=tempHTML.replace('[银行]',list[i].BANK_NAME);
  78. tempHTML=tempHTML.replace('[状态]',list[i].STUTAS);
  79. tempHTML=tempHTML.replace('[APPLYID]',list[i].ID);
  80. tempHTML=tempHTML.replace('[STUTA]',list[i].STUTA);
  81. tempHTML=tempHTML.replace('[name]',list[i].ID);
  82. tempHTML=tempHTML.replace('[ids]',"ids"+i);
  83. tempHTML=tempHTML.replace('[tradeId]',list[i].ID);
  84. if(list[i].STUTA==0){
  85. tempHTML=tempHTML.replace('[处理]',"");
  86. }else{
  87. tempHTML=tempHTML.replace('[处理]',"处理");
  88. }
  89. // tempHTML=tempHTML.replace('[佣金金额]',list[i].COMMISSION_REE);
  90. newHTML+=tempHTML;
  91. }
  92. $('#list').html(newHTML);
  93. $(".deal").click(function(){
  94. var applyid = $(this).attr("APPLYID");
  95. if(confirm("该条佣金申请已经进行打款处理?")){
  96. $.ajax({
  97. url:'./st-xm/control.php',
  98. type: "post",
  99. data: {type:"fina_updateapply",id:applyid},
  100. dataType: "json",
  101. success: function (data) {
  102. if(data.code == 0){
  103. window.location.reload();
  104. }else if(data.code == -1){
  105. alert("请检查网络!!!")
  106. }
  107. },
  108. fail: function (data) {
  109. // 此处放失败后执行的代码
  110. }
  111. });
  112. }else{
  113. return;
  114. }
  115. });
  116. // $(".trade").click(function(){
  117. // var tradeId = $(this).attr("tradeId");
  118. // setStorage("tradeId",tradeId);
  119. // window.location.href="";
  120. // });
  121. //window.location.href="sell_manage.html";
  122. }
  123. //复选框判断
  124. function select_checked(index) {
  125. //index=0最上面的全选 index=1表示的是下面所有的
  126. var cur_check = $('.ace_check')[0];
  127. var checkList = $('.ace_check');
  128. var checkCount = checkList.length - 1;
  129. var true_count = 0;
  130. for (var i = 1; i < checkList.length; i++) {
  131. if (index == '0') {
  132. checkList[i].checked = cur_check.checked;
  133. } else {
  134. if (checkList[i].checked == false) {
  135. cur_check.checked = false
  136. } else {
  137. true_count = true_count + 1;
  138. }
  139. }
  140. }
  141. //判断下面是否选中完
  142. if (checkCount == true_count) {
  143. cur_check.checked = true;
  144. }
  145. }
  146. //得到url上的参数
  147. function getPar(par){
  148. var local_url = document.location.href;
  149. local_url = decodeURI(local_url);
  150. var get = local_url.indexOf(par +"=");
  151. if(get == -1){
  152. return false;
  153. }
  154. var get_par = local_url.slice(par.length + get + 1);
  155. var nextPar = get_par.indexOf("&");
  156. if(nextPar != -1){
  157. get_par = get_par.slice(0, nextPar);
  158. }
  159. return get_par;
  160. }
  161. //批量处理
  162. function click_batch_manage(){
  163. var arr_manage = new Array();
  164. $('.ace_check').each(function(index, item) {
  165. if (this.checked && index != 0) {
  166. arr_manage.push($(this).attr('name'));
  167. }
  168. });
  169. if (arr_manage.length <= 0) {
  170. alert('请勾选!!!');
  171. return;
  172. }
  173. var arr_manage_str = arr_manage.join(',');
  174. $.ajax({
  175. url:'./st-xm/control.php',
  176. data: {type:"fina_updateapply",id: arr_manage_str},
  177. dataType: "json",
  178. success: function (data) {
  179. if(data.code == 0){
  180. window.location.reload();
  181. }else if(data.code == -1){
  182. alert("请检查网络!!!")
  183. }
  184. },
  185. fail: function (data) {
  186. // 此处放失败后执行的代码
  187. }
  188. });
  189. }