curingFN.js 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270
  1. /**
  2. * 分页列表--刷新用户列表
  3. * @param parameter
  4. * @param currentPage
  5. * @returns
  6. */
  7. function refreshCuringPagination(parameter, currentPage) {
  8. $.ajax({
  9. cache: false,
  10. type: 'get',
  11. url: '/cloud/curing/ajax/getCuringPage/' + currentPage + parameter,
  12. dataType: 'json',
  13. success: function (data) {
  14. if (data.status == 1) {
  15. fnStructureCuringUser(data.curingList);
  16. fnPage(data.pageData);
  17. refreshColumn(columnLength);
  18. } else {
  19. alert(data.msg);
  20. }
  21. }
  22. })
  23. }
  24. function GetRequest(url) {
  25. //var url = location.search; //获取url中"?"符后的字串
  26. var theRequest = new Object();
  27. if (url.indexOf("?") != -1) {
  28. var str = url.substr(1);
  29. strs = str.split("&");
  30. for(var i = 0; i < strs.length; i ++) {
  31. theRequest[strs[i].split("=")[0]] = unescape(strs[i].split("=")[1]);
  32. }
  33. }
  34. return theRequest;
  35. }
  36. /**
  37. * 筛选-统一请求--刷新用户列表
  38. * @returns
  39. */
  40. function refreshCuringPage(compilation, latestCompilation, sortField, sort, wd) {
  41. $.ajax({
  42. cache: false,
  43. type: 'get',
  44. url: '/cloud/curing/ajax/refreshCuringPage?sortField=' + sortField + '&sort=' + sort + '&compilation=' + compilation + '&latestCompilation=' + latestCompilation +
  45. '&wd=' + wd,
  46. dataType: 'json',
  47. success: function (data) {
  48. if (data.status == 1) {
  49. $('button[closeRefresh]').attr('currentPage', 1);
  50. fnStructureCuringUser(data.curingList);
  51. fnPage(data.pageData);
  52. refreshColumn(columnLength);
  53. } else {
  54. alert(data.msg);
  55. }
  56. }
  57. })
  58. }
  59. /**
  60. * 通行证账号检索用户--刷新列表和分页
  61. * @returns
  62. */
  63. function fnMobile2Info() {
  64. mobile2InfoTimeout = null;
  65. //if((/^1[34578]\d{9}$/.test(mobile))) {
  66. refreshCuringPage('', '', '', '', mobile);
  67. //}
  68. }
  69. /**
  70. * 刷新用户详情页
  71. * @param ssoid
  72. * @param client_id
  73. * @returns
  74. */
  75. function refreshCuringPageDetail(ssoid, client_id) {
  76. $.ajax({
  77. cache: false,
  78. type: 'GET',
  79. url: '/cloud/curing/ajax/getCuringBySsoid',
  80. data: { ssoid: encodeURI(ssoid), client_id: encodeURI(client_id) },
  81. dataType: 'json',
  82. success: function (data) {
  83. if (data.status == 1 || data.status == 2) {
  84. //设置 养护用户信息
  85. var objHtml = buildCuringInfo(data.detail.userInfo);
  86. $('div[curingInfo] curing').html(objHtml);
  87. $('div[curingInfo] curingClient').html('');
  88. //设置CLD客户信息
  89. //if(data.detail.curingInfo.updateTotal!=0){
  90. //$("#id").val(id);
  91. var clientHtml = relevanceClient(data.detail.clientInfo);
  92. $('div[curingInfo] curingClient').html(clientHtml);
  93. //}
  94. //设置养护详情页里产品升级信息
  95. var upMajorBoxHtml = buildCuringCompilation(data);
  96. $('tbody[upMajorBox]').html(upMajorBoxHtml);
  97. //更新在线时长
  98. var onlineTimesHtml = buildCuringOnlineTimes(data.detail.userInfo.online_list);
  99. $('tbody[onlineTimes]').html(onlineTimesHtml);
  100. //设置服务日志
  101. var serviceLogHtml=buildServiceLog(data.detail.serviceLog);
  102. $('tbody[serveRecord]').html(serviceLogHtml);
  103. //设置参数
  104. $('#curingSsoid').val(data.detail.userInfo.ssoIdKey);
  105. $('#curingMobile').val(data.detail.userInfo.mobile);
  106. $('#client_id').val(data.detail.clientInfo.cidKey);
  107. //设置养护日志
  108. var operateLogHtml = buildCuringOperateLog(data.detail.operateLog);
  109. $('div[operateLog] curingOperate').html(operateLogHtml);
  110. setTimeout(autoHeight, 400);
  111. //autoHeight();
  112. $('#detail').modal('show');
  113. } else if (data.status == 3) {
  114. alert(data.msg);
  115. }
  116. },
  117. error: function (xhr, type) {
  118. console.log('Ajax error!')
  119. }
  120. })
  121. }
  122. /**
  123. * DOM加载完毕后初始化
  124. * @returns
  125. */
  126. function init() {
  127. refreshColumn(columnLength);
  128. }
  129. /**
  130. * 用户升级专业版 弹框提示--用户详情界面
  131. * @param name
  132. * @param _id
  133. * @param username
  134. * @returns
  135. */
  136. function upCuring(name, _id, username) {
  137. $('#name').val(name);
  138. $('#_id').val(_id);
  139. var curingMobile = $('#curingMobile').val();
  140. var html = '<p>为用户 <b>' + curingMobile + ',' + username + '</b> 升级 <b>' + name + '</b></p>';
  141. html += '<div class="form-group"><div class="custom-control custom-switch"><input type="checkbox" class="custom-control-input" deadline id="customSwitch2" ><label class="custom-control-label" deadlineLabel for="customSwitch2">限期</label></div></div>';
  142. html += '<div class="form-group"><label class="form-label" for="example-date">到期时间</label><input class="form-control" id="deadline" type="date" name="deadline" disabled value=""></div>';
  143. html += '<div class="form-group"><div class="custom-control custom-switch"><input type="checkbox" class="custom-control-input" smssend id="customSwitch22" ><label class="custom-control-label" for="customSwitch22">给客户发送短信通知</label></div></div>';
  144. $('div[upCuring] span').html(html);
  145. }
  146. /**
  147. * 养护产品降级
  148. * @param {} name
  149. * @param {*} _id
  150. * @param {*} username
  151. */
  152. function downCuring(name, _id, username) {
  153. $('#name').val(name);
  154. $('#_id').val(_id);
  155. var curingMobile = $('#curingMobile').val();
  156. // let html = `<p>为用户 <b>${curingMobile},${username}</b> <span class="text-danger">降级</span> <b>${name}免费版</b></p>
  157. // <div class="form-group">
  158. // <div class="custom-control custom-switch">
  159. // <input type="checkbox" class="custom-control-input" downSmssend id="customSwitch23" >
  160. // <label class="custom-control-label" for="customSwitch23">给客户发送短信通知</label>
  161. // </div>
  162. // </div>`;
  163. var html = '<p>为用户 <b>'+curingMobile+','+username+'</b> <span class="text-danger">降级</span> <b>'+name+'免费版</b></p><div class="form-group"><div class="custom-control custom-switch"><input type="checkbox" class="custom-control-input" downSmssend id="customSwitch23" ><label class="custom-control-label" for="customSwitch23">给客户发送短信通知</label></div></div>';
  164. $('div[downCuring] span').html(html);
  165. }
  166. function deadlineCuring(name, _id, username,deadline){
  167. $('#name').val(name);
  168. $('#_id').val(_id);
  169. var curingMobile = $('#curingMobile').val();
  170. var html = '<p>为用户 <b>'+curingMobile+','+username+'</b> <b>'+name+'</b> 设置延期</p><p>当前限期为:'+deadline+'</p>';
  171. html+='<div class="form-group"><div class="custom-control custom-switch"><input type="checkbox" class="custom-control-input" deadlineEver id="customSwitch2"><label class="custom-control-label" deadlinelabel="" for="customSwitch2">升级为永久版</label></div></div>';
  172. html +='<div class="form-group"><label class="form-label" for="example-date">到期时间</label><input class="form-control" id="deadlineInput" type="date" name="date" value=""></div><div class="form-group"><div class="custom-control custom-switch"><input type="checkbox" class="custom-control-input" deadlineSmssend id="customSwitch222" ><label class="custom-control-label" for="customSwitch222">给客户发送短信通知</label></div></div>';
  173. // let html = `<p>为用户 <b>${curingMobile},${username}</b> <b>${name}</b> 设置延期</p>
  174. // <p>当前限期为:${deadline}</p>
  175. // <div class="form-group">
  176. // <label class="form-label" for="example-date">到期时间</label>
  177. // <input class="form-control" id="deadlineInput" type="date" name="date" value="">
  178. // </div>
  179. // <div class="form-group">
  180. // <div class="custom-control custom-switch">
  181. // <input type="checkbox" class="custom-control-input" deadlineSmssend id="customSwitch222" >
  182. // <label class="custom-control-label" for="customSwitch222">给客户发送短信通知</label>
  183. // </div>
  184. // </div>`;
  185. $('div[deadlineCuring] span').html(html);
  186. }
  187. function curingDo(compilationId, name, curingSsoid, status, mobile, client_id, deadline, smssend) {
  188. if (curingSsoid != '' && compilationId != '') {
  189. $.ajax({
  190. cache: false,
  191. type: 'post',
  192. url: '/cloud/curing/ajax/upCuringDo',
  193. data: { ssoid: curingSsoid, compilationId: compilationId, mobile: mobile, client_id: client_id, name: name, deadline: deadline, smssend: smssend, status: status },
  194. dataType: 'json',
  195. success: function (data) {
  196. if (data.status == 1) {
  197. refreshCuringPageDetail(curingSsoid, client_id);
  198. } else {
  199. alert(data.msg);
  200. }
  201. }
  202. })
  203. } else {
  204. alert('请选择需要升级的版本');
  205. }
  206. }
  207. $(function () {
  208. $('div[upcuring]').delegate('label[deadlineLabel]', 'click', function () {
  209. $('#deadline').attr('disabled', 'disabled');
  210. if($('input[deadline]').prop('checked')){
  211. $('input[deadline]').prop("checked",false);
  212. }else{
  213. $('input[deadline]').prop("checked",true);
  214. }
  215. if ($('input[deadline]').get(0).checked) {
  216. $('#deadline').removeAttr('disabled');
  217. }
  218. });
  219. $('div[deadlinecuring]').delegate('label[deadlineLabel]', 'click', function () {
  220. $('#deadlineInput').removeAttr('disabled');
  221. if($('input[deadlineEver]').prop('checked')){
  222. $('input[deadlineEver]').prop("checked",false);
  223. }else{
  224. $('input[deadlineEver]').prop("checked",true);
  225. }
  226. if ($('input[deadlineEver]').get(0).checked) {
  227. $('#deadlineInput').val('');
  228. $('#deadlineInput').attr('disabled', 'disabled');
  229. }
  230. });
  231. })