curingFN.js 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281
  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,lock) {
  137. $('#name').val(name);
  138. $('#_id').val(_id);
  139. $('#lock').val(lock);
  140. var curingMobile = $('#curingMobile').val();
  141. var lockHtml="";
  142. if(lock==1){
  143. lockHtml="借出";
  144. }else if(lock==2){
  145. lockHtml="销售";
  146. }
  147. var html = '<p>为用户 <b>' + curingMobile + ',' + username + '</b> '+lockHtml+' <b>' + name + '</b></p>';
  148. 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>';
  149. 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>';
  150. html += '<div class="form-group" style="display: none"><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>';
  151. $('div[upCuring] span').html(html);
  152. }
  153. /**
  154. * 养护产品降级
  155. * @param {} name
  156. * @param {*} _id
  157. * @param {*} username
  158. */
  159. function downCuring(name, _id, username) {
  160. $('#name').val(name);
  161. $('#_id').val(_id);
  162. var curingMobile = $('#curingMobile').val();
  163. // let html = `<p>为用户 <b>${curingMobile},${username}</b> <span class="text-danger">降级</span> <b>${name}免费版</b></p>
  164. // <div class="form-group">
  165. // <div class="custom-control custom-switch">
  166. // <input type="checkbox" class="custom-control-input" downSmssend id="customSwitch23" >
  167. // <label class="custom-control-label" for="customSwitch23">给客户发送短信通知</label>
  168. // </div>
  169. // </div>`;
  170. var html = '<p>为用户 <b>'+curingMobile+','+username+'</b> <span class="text-danger">降级</span> <b>'+name+'免费版</b></p><div class="form-group" style="display: none"><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>';
  171. $('div[downCuring] span').html(html);
  172. }
  173. function deadlineCuring(name, _id, username,deadline,lock){
  174. $('#name').val(name);
  175. $('#_id').val(_id);
  176. $('#lock').val(lock);
  177. var curingMobile = $('#curingMobile').val();
  178. var html = '<p>为用户 <b>'+curingMobile+','+username+'</b> <b>'+name+'</b> 设置延期</p><p>当前限期为:'+deadline+'</p>';
  179. 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>';
  180. 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" style="display: none"><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>';
  181. //
  182. // let html = `<p>为用户 <b>${curingMobile},${username}</b> <b>${name}</b> 设置延期</p>
  183. // <p>当前限期为:${deadline}</p>
  184. // <div class="form-group">
  185. // <label class="form-label" for="example-date">到期时间</label>
  186. // <input class="form-control" id="deadlineInput" type="date" name="date" value="">
  187. // </div>
  188. // <div class="form-group">
  189. // <div class="custom-control custom-switch">
  190. // <input type="checkbox" class="custom-control-input" deadlineSmssend id="customSwitch222" >
  191. // <label class="custom-control-label" for="customSwitch222">给客户发送短信通知</label>
  192. // </div>
  193. // </div>`;
  194. $('div[deadlineCuring] span').html(html);
  195. }
  196. function curingDo(compilationId, name, curingSsoid, status, mobile, client_id, deadline, smssend,lock) {
  197. if (curingSsoid != '' && compilationId != '') {
  198. $.ajax({
  199. cache: false,
  200. type: 'post',
  201. url: '/cloud/curing/ajax/upCuringDo',
  202. data: { ssoid: curingSsoid, compilationId: compilationId, mobile: mobile, client_id: client_id, name: name,
  203. deadline: deadline, smssend: smssend, status: status,lock:lock },
  204. dataType: 'json',
  205. success: function (data) {
  206. if (data.status == 1) {
  207. refreshCuringPageDetail(curingSsoid, client_id);
  208. } else {
  209. alert(data.msg);
  210. }
  211. }
  212. })
  213. } else {
  214. alert('请选择需要升级的版本');
  215. }
  216. }
  217. $(function () {
  218. $('div[upcuring]').delegate('label[deadlineLabel]', 'click', function () {
  219. $('#deadline').attr('disabled', 'disabled');
  220. if($('input[deadline]').prop('checked')){
  221. $('input[deadline]').prop("checked",false);
  222. }else{
  223. $('input[deadline]').prop("checked",true);
  224. }
  225. if ($('input[deadline]').get(0).checked) {
  226. $('#deadline').removeAttr('disabled');
  227. }
  228. });
  229. $('div[deadlinecuring]').delegate('label[deadlineLabel]', 'click', function () {
  230. $('#deadlineInput').removeAttr('disabled');
  231. if($('input[deadlineEver]').prop('checked')){
  232. $('input[deadlineEver]').prop("checked",false);
  233. }else{
  234. $('input[deadlineEver]').prop("checked",true);
  235. }
  236. if ($('input[deadlineEver]').get(0).checked) {
  237. $('#deadlineInput').val('');
  238. $('#deadlineInput').attr('disabled', 'disabled');
  239. }
  240. });
  241. })