read_new.html 32 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842
  1. {extend name="public/layout" /}
  2. {block name="title"}详情{/block}
  3. {block name="body"}
  4. <link rel="stylesheet" href="__STATIC__/css/csspc.css">
  5. <link rel="stylesheet" href="__STATIC__/css/font.css">
  6. <link rel="stylesheet" " href=" __STATIC__/css/common.css">
  7. <style type="text/css">
  8. html,body{
  9. background: #f5f5f5;
  10. font-size: 12px;
  11. padding-bottom: 20px;
  12. min-width: 900px;
  13. overflow: auto;
  14. }
  15. .toptitbox{
  16. display: block;
  17. width: 900px;
  18. padding: 15px 10px;
  19. border: 1px solid #F0F0F0;
  20. background: #FCFCFC;
  21. margin-bottom: 10px;
  22. position: relative;
  23. line-height: 28px;
  24. }
  25. .golastbtn{
  26. display: block;
  27. margin-right: 21px;
  28. color: #000;
  29. background: url(__STATIC__/img/btn_bg.gif) repeat-x;
  30. border: 1px solid #C0C0C0;
  31. padding: 0 12px;
  32. *padding: 0 6px;
  33. height: 28px;
  34. cursor: pointer;
  35. }
  36. .mainbox{
  37. display: block;
  38. width: 900px;
  39. height:100%;
  40. padding-top: 20px;
  41. margin: 0 auto;
  42. }
  43. .bodys{
  44. padding: 10px ;
  45. background-color: #fff;
  46. }
  47. .layui-card {
  48. box-shadow: unset;
  49. }
  50. .layui-fluid{
  51. padding: 0;
  52. }
  53. .layui-card-header {
  54. border-width: 0px;
  55. height: auto;
  56. line-height: auto;
  57. }
  58. .titletext {
  59. display: block;
  60. font-size: 14px;
  61. color: #210605;
  62. font-weight: bold;
  63. margin-bottom: 20px;
  64. line-height: 20px;
  65. }
  66. .clearfix:after {
  67. clear: both;
  68. content: ' ';
  69. display: table;
  70. }
  71. .clearfix:before {
  72. content: ' ';
  73. display: table;
  74. }
  75. .fleft {
  76. float: left;
  77. }
  78. .fright {
  79. float: right;
  80. }
  81. .contentext {
  82. font-size: 14px;
  83. color: #210605;
  84. line-height: 20px;
  85. margin-bottom: 12px;
  86. margin-right: 55px;
  87. }
  88. .layui-tab {
  89. padding-top: 14px;
  90. }
  91. .layui-card .layui-tab-brief .layui-tab-title li.layui-this {
  92. color: #249EFB;
  93. }
  94. .layui-tab-brief>.layui-tab-more li.layui-this:after,
  95. .layui-tab-brief>.layui-tab-title .layui-this:after {
  96. border-bottom: 4px solid #249EFB;
  97. }
  98. .layui-tab-title li {
  99. margin: 0px 5px;
  100. font-weight: bold;
  101. font-size: 14px;
  102. }
  103. .allocatenumbox {
  104. display: block;
  105. text-align: center;
  106. background-color: #fff;
  107. margin: 20px 0;
  108. box-shadow: 0 0 4px 0 #979797;
  109. border-radius: 5px;
  110. font-size: 12px;
  111. color: #000000;
  112. }
  113. .width12_5 {
  114. width: 10%;
  115. }
  116. .bold {
  117. font-weight: bold;
  118. }
  119. .allocatenum {
  120. line-height: 20px;
  121. margin-top: 14px;
  122. }
  123. .allocatetext {
  124. margin-top: 2px;
  125. line-height: 17px;
  126. margin-bottom: 12px;
  127. }
  128. .linebox {
  129. display: block;
  130. border-bottom: 1px solid rgba(151, 151, 151, 1);
  131. margin-bottom: 16px;
  132. }
  133. select {
  134. width: auto;
  135. padding:0 5px;
  136. height: 38px;
  137. background: #f2f2f2;
  138. text-align: center;
  139. border: unset;
  140. /* //1px solid rgba(151,151,151,1) */
  141. }
  142. .searchtext {
  143. display: block;
  144. border-radius: 0px;
  145. width:150px;
  146. border: unset;
  147. height: 36px;
  148. padding-left: 14px;
  149. }
  150. input.searchtextx {
  151. display: block;
  152. width: 150px;
  153. border-radius: 0px;
  154. border: unset;
  155. height: 36px;
  156. padding-left: 14px;
  157. }
  158. .searchbox {
  159. /* border: 1px solid rgba(151, 151, 151, 1); */
  160. }
  161. .searchbox input,.searchbox select{border: 1px solid rgba(151, 151, 151, 0.7);margin-right: 10px;}
  162. .searchBtn {
  163. border-radius: unset;
  164. }
  165. .allocatedbox {
  166. margin-left: 50px;
  167. font-size: 14px;
  168. color: #210605;
  169. line-height: 40px;
  170. }
  171. .unallocatedbox {
  172. margin-left: 50px;
  173. font-size: 14px;
  174. color: #878787;
  175. line-height: 40px;
  176. }
  177. #demo1{width:130px;}
  178. #demo1 xm-select{border:1px solid #979797;}
  179. .layui-table-body{
  180. height: auto !important;
  181. }
  182. input{
  183. width: auto;
  184. }
  185. .oneRecyle {
  186. width: 90px !important;
  187. height: 30px !important;
  188. line-height: 30px !important;
  189. margin-top: 15px;
  190. margin-right: 19px;
  191. }
  192. ::-webkit-scrollbar {
  193. width: auto;
  194. height: auto;
  195. }
  196. ::-webkit-scrollbar-thumb {
  197. border-radius: 10px;
  198. -webkit-box-shadow: inset 0 0 2px rgba(0, 0, 0, 0.2);
  199. background: #DFDFDF;
  200. }
  201. ::-webkit-scrollbar-track {
  202. -webkit-box-shadow: inset 0 0 2px rgba(0, 0, 0, 0.2);
  203. border-radius: 10px;
  204. background: #f5f5f5;
  205. }
  206. </style>
  207. <body>
  208. <div class="mainbox">
  209. <div class="clearfix toptitbox">
  210. <div class="left">您当前的操作 · <b>资源库分配</b></div>
  211. <div class="right">
  212. <div class="left">点击这里返回列表:</div>
  213. <button class="left golastbtn" type="button">返回列表</button>
  214. </div>
  215. </div>
  216. <div class="bodys wpsr">
  217. <div class="layui-fluid">
  218. <div class="layui-card">
  219. <div class="layui-card-header " id="zyxx">
  220. <label class="titletext">基本信息</label>
  221. <div class="clearfix">
  222. <div class="fleft contentext">资源名称:{$data.name}</div>
  223. <div class="fleft contentext">渠道来源:{$data.source_name}</div>
  224. <div class="fleft contentext">导入人员:{$data.employee_name}</div>
  225. <div class="fleft contentext">资源数:{$data.count}</div>
  226. <div class="fleft contentext">可分资源:{$data.avaliable_count}</div>
  227. <div class="fleft contentext">问题客资:{$data.bad_phone_num}</div>
  228. <!-- <div class="fleft contentext">重复:{$data.repeat_phone_number}</div> -->
  229. <div class="fleft contentext">分配情况:{$data.state}</div>
  230. <div class="fleft contentext">已分配:{$data.y_count}</div>
  231. <div class="fleft contentext">未分配:{$data.new_left_num}</div>
  232. <div class="fleft contentext">导入时间:{$data.addtime}</div>
  233. </div>
  234. </div>
  235. <div class="layui-tab layui-tab-brief" lay-filter="maintenanceOrder">
  236. <ul class="layui-tab-title" id="fpxx">
  237. <!-- handdistribution -->
  238. <li class="{if condition='$type eq 0'} layui-this {/if}">已分配({$data.y_count})</li>
  239. <li class="{if condition='$type eq 1'} layui-this {/if}">未分配({$data.new_left_num})</li>
  240. <li class="{if condition='$type eq 2'} layui-this {/if}">问题客资({$data.bad_phone_num})</li>
  241. </ul>
  242. <div class="layui-tab-content">
  243. <div class="layui-tab-item {if condition='$type eq 0'} layui-show {/if}">
  244. <div class="clearfix allocatenumbox" id="yxxx">
  245. <div class="fleft width12_5">
  246. <div class="bold allocatenum">{$counts.valid}</div>
  247. <div class="allocatetext">有效线索</div>
  248. </div>
  249. <div class="fleft width12_5">
  250. <div class="bold allocatenum">{$counts.invalid}</div>
  251. <div class="allocatetext">无效线索</div>
  252. </div>
  253. <div class="fleft width12_5">
  254. <div class="bold allocatenum">{$counts.confirmed}</div>
  255. <div class="allocatetext">待确认</div>
  256. </div>
  257. <div class="fleft width12_5">
  258. <div class="bold allocatenum">{$counts.arrived_at_the_store}</div>
  259. <div class="allocatetext">已到店</div>
  260. </div>
  261. <div class="fleft width12_5">
  262. <div class="bold allocatenum">{$counts.measured_room}</div>
  263. <div class="allocatetext">已量房</div>
  264. </div>
  265. <div class="fleft width12_5">
  266. <div class="bold allocatenum">{$counts.already_present}</div>
  267. <div class="allocatetext">已到场</div>
  268. </div>
  269. <div class="fleft width12_5">
  270. <div class="bold allocatenum">{$counts.settled}</div>
  271. <div class="allocatetext">
  272. 定金
  273. </div>
  274. </div>
  275. <div class="fleft width12_5">
  276. <div class="bold allocatenum">{$counts.sign_the_bill}</div>
  277. <div class="allocatetext">
  278. 合同
  279. </div>
  280. </div>
  281. <div class="fleft width12_5">
  282. <div class="bold allocatenum">{$counts.unvisit}</div>
  283. <div class="allocatetext">未联系</div>
  284. </div>
  285. <div class="fleft width12_5">
  286. <div class="bold allocatenum">{$counts.no_connect}</div>
  287. <div class="allocatetext">未接通</div>
  288. </div>
  289. </div>
  290. <p class="linebox"></p>
  291. <div class="clearfix" style="margin-bottom: 20px;">
  292. <div class="fleft clearfix searchbox" style="display:inline-block;">
  293. <select class="fleft selectbox" name="order" id="order" lay-verify="">
  294. <option value="1" selected>按部门</option>
  295. <option value="2">按员工</option>
  296. </select>
  297. <input class="fleft searchtext" type="text" id="keyword1" name="title"
  298. placeholder="请输入部门名称" autocomplete="off">
  299. <input class="fleft searchtextx" type="text" name="phone" id="keyword3"
  300. placeholder="小区/手机号" autocomplete="off">
  301. <div id="demo1" class="xm-select-demo fleft" style="margin-right: 10px;"></div>
  302. <select class="fleft" name="call_state" id="call_state" lay-verify="">
  303. <option value="" selected>电话联系状态</option>
  304. <option value="已联系">已联系</option>
  305. <option value="未联系">未联系</option>
  306. <option value="未接通">未接通</option>
  307. </select>
  308. <button class="fleft layui-btn layuiadmin-btn-useradmin searchBtn" id="search1"
  309. lay-submit lay-filter="search">搜索</button>
  310. <button class="fleft layui-btn layuiadmin-btn-useradmin searchBtn" id="search3"
  311. lay-submit lay-filter="search">回收客户</button>
  312. </div>
  313. <br style="clear: both;">
  314. <div class="fleft allocatedbox" style="margin-left: 0 !important;margin-top:10px;">已分配{$data.y_count}组客户</div>
  315. <div class="fleft unallocatedbox" style="margin-top:10px;">有{$counts.unvisit}组客户未联系</div>
  316. <button class="oneRecyle fright layui-btn layuiadmin-btn-useradmin searchBtn" id="search4"
  317. lay-submit lay-filter="search">一键回收</button>
  318. </div>
  319. <table id="table1" lay-filter="table1"></table>
  320. </div>
  321. <div class="layui-tab-item {if condition='$type eq 1'} layui-show {/if}">
  322. <div class="clearfix" style="padding-top: 6px; padding-bottom: 20px;">
  323. <div class="fleft clearfix searchbox" style="display:inline-block;">
  324. <input class="fleft searchtextx" type="text" name="phone" id="keyword2"
  325. placeholder="小区/手机号" autocomplete="off">
  326. <button class="fleft layui-btn layuiadmin-btn-useradmin searchBtn" id='search2'
  327. lay-submit lay-filter="search">搜索</button>
  328. </div>
  329. <div class="fleft unallocatedbox">{$data.left_num}组客户未分配</div>
  330. <button class="fright layui-btn layuiadmin-btn-useradmin" id="distribution">分配客户</button>
  331. </div>
  332. <table id="table2" lay-filter="table2"></table>
  333. </div>
  334. <div class="layui-tab-item {if condition='$type eq 2'} layui-show {/if}">
  335. <table id="table3" lay-filter="table3"></table>
  336. </div>
  337. </div>
  338. </div>
  339. </div>
  340. </div>
  341. </div>
  342. </div>
  343. </body>
  344. {/block} {block name="js"}
  345. <script type="text/html" id="status">
  346. {{# if(d.state == '无效' || d.state == '待确认'){ }}
  347. <span style="color: #cccccc;">{{d.state}}</span>
  348. {{# }else{ }}
  349. {{# if(d.stateNum.shop > 0){ }}
  350. <button class="fright layui-btn-min layuiadmin-btn-useradmin" style="color: #FFFFFF; background-color: #CDB8F6 ;border-color: #CDB8F6;">店{{d.stateNum.shop}}</button>
  351. {{# } }}
  352. {{# if(d.stateNum.measure > 0){ }}
  353. <button class="fright layui-btn-min layuiadmin-btn-useradmin" style="color: #FFFFFF; background-color: #FF8383;border-color: #FF8383;">量{{d.stateNum.measure}}</button>
  354. {{# } }}
  355. {{# if(d.stateNum.activity > 0){ }}
  356. <button class="fright layui-btn-min layuiadmin-btn-useradmin" style="color: #FFFFFF; background-color: #FFD483;border-color: #FFD483;">活{{d.stateNum.activity}}</button>
  357. {{# } }}
  358. {{# if(d.stateNum.deposit > 0){ }}
  359. <button class="fright layui-btn-min layuiadmin-btn-useradmin" style="color: #FFFFFF ; background-color: #FFBC83 ;border-color: #FFBC83;">签
  360. <!-- {{d.stateNum.deposit}} -->
  361. </button>
  362. {{# } }}
  363. {{# if(d.stateNum.signed > 0){ }}
  364. <button class="fright layui-btn-min layuiadmin-btn-useradmin" style="color: #FFFFFF ; background-color: #FD431B ;border-color: #FFBC83;">转
  365. <!-- {{d.stateNum.deposit}} -->
  366. </button>
  367. {{# } }}
  368. {{# if(!d.stateNum.shop && !d.stateNum.measure && !d.stateNum.activity && !d.stateNum.deposit && !d.stateNum.signed){ }}
  369. 已联系
  370. {{# } }}
  371. {{# } }}
  372. </script>
  373. <script type="text/html" id="employee_name">
  374. {{# if(d.employee){ }}
  375. <span>{{d.employee.opt_name}}</span>
  376. {{# }else{ }}
  377. <span style="color: #cccccc;">无</span>
  378. {{# } }}
  379. </script>
  380. <script type="text/html" id="designer_name">
  381. {{# if(d.designer_name){ }}
  382. <span>{{d.designer_name}}</span>
  383. {{# }else{ }}
  384. <span style="color: #cccccc;">无</span>
  385. {{# } }}
  386. </script>
  387. <script type="text/html" id="org_name">
  388. {{# if(d.org_name){ }}
  389. <span>{{d.org_name}}</span>
  390. {{# }else{ }}
  391. <span style="color: #cccccc;">无</span>
  392. {{# } }}
  393. </script>
  394. <script type="text/html" id="sale_name">
  395. {{# if(d.sale_name){ }}
  396. <span>{{d.sale_name}}</span>
  397. {{# }else{ }}
  398. <span style="color: #cccccc;">无</span>
  399. {{# } }}
  400. </script>
  401. <script type="text/html" id="name">
  402. {{# if(d.name){ }}
  403. <span>{{d.name}}</span>
  404. {{# }else{ }}
  405. <span style="color: #cccccc;">无</span>
  406. {{# } }}
  407. </script>
  408. <script type="text/html" id="community_name">
  409. {{# if(d.community_name){ }}
  410. <span>{{d.community_name}}</span>
  411. {{# }else{ }}
  412. <span style="color: #cccccc;">无</span>
  413. {{# } }}
  414. </script>
  415. <script type="text/html" id="call_num">
  416. {{# if(d.outcall_count){ }}
  417. <span style="display: inline-block; width: 100%; height: 100%;cursor: pointer;" data-id="{{d.id}}" lay-event="cuslist_li">{{d.outcall_count}}</span>
  418. {{# }else{ }}
  419. <span class='cuslist_li' data-id="{{d.id}}" lay-event="cuslist_li" style="color: #cccccc;display: inline-block; width: 100%;height: 100%;cursor: pointer;">0</span>
  420. {{# } }}
  421. </script>
  422. <script type="text/html" id="allocate_time">
  423. {{# if(d.employee_time){ }}
  424. <span>{{d.employee_time}}</span>
  425. {{# }else{ }}
  426. <span>{{d.allocate_time}}</span>
  427. {{# } }}
  428. </script>
  429. <script type="text/html" id="op">
  430. <a class="layui-btn layui-btn-xs " lay-event="recovery">回收</a>
  431. </script>
  432. <script type="text/html" id="errortype">
  433. {{# if(d.type==1){ }}
  434. <span>手机号格式错误</span>
  435. {{# }else{ }}
  436. <span>手机号重复</span>
  437. {{# } }}
  438. </script>
  439. <script type="text/html" id="allocate_time">
  440. {{# if(d.employee_time){ }}
  441. <span>{{d.employee_time}}</span>
  442. {{# }else{ }}
  443. <span>{{d.allocate_time}}</span>
  444. {{# } }}
  445. </script>
  446. <script src="/static/js/jquery.min.js"></script>
  447. <script src="__STATIC__/layui/layui/lay/modules/xm-select.js" type="text/javascript" charset="utf-8"></script>
  448. <script>
  449. var opoo=null;
  450. layui.config({
  451. base: '__LAYUI__/',
  452. urlbase: '/sys'
  453. }).extend({
  454. index: 'lib/index' //主入口模块
  455. }).use(['index', 'jquery', 'table', 'tree', 'layer', 'element', 'form', 'laydate'], function () {
  456. var table = layui.table,
  457. tree = layui.tree,
  458. layer = layui.layer,
  459. $ = layui.jquery,
  460. element = layui.element,
  461. laydate = layui.laydate,
  462. allIds = "",
  463. form = layui.form;
  464. var where1 = [];
  465. var where2 = [];
  466. var select = [];
  467. var dtype = "{$type}";
  468. $('.selectbox').change(function () {
  469. var val = $('.selectbox').val();
  470. if (val == 1) {
  471. $('.searchtext').attr('placeholder', '请输入部门名称');
  472. } else {
  473. $('.searchtext').attr('placeholder', '请输入员工姓名');
  474. }
  475. });
  476. $('.golastbtn').click(function () {
  477. window.parent.backresourcefun(window.location.search.split('?')[1], '{:url("manager_emp/read_new")}', 'handdistribution');
  478. })
  479. var root_id = '{$root_id}';
  480. var datas = [
  481. {name: '待确认', value: '待确认'},
  482. {name: '有效线索', value: '有效'},
  483. {name: '已量房', value: '已量房'},
  484. {name: '已到店', value: '已到店'},
  485. {name: '已到场', value: '已到场'},
  486. ];
  487. datas.push({name: '定金', value: '已交定'},{name: '合同', value: '已签单'})
  488. datas.push({name: '无效', value: '无效'})
  489. var demo1 = xmSelect.render({
  490. el: '#demo1',
  491. data:datas
  492. })
  493. //初始化页面
  494. var type = 0;
  495. element.on('tab(maintenanceOrder)', function (data) {
  496. type = data.index;
  497. if (type == 0) {
  498. operate.table1(where1);
  499. } else if (type == 1) {
  500. operate.table2(where2);
  501. } else {
  502. operate.table3();
  503. }
  504. });
  505. //已分配人员列表
  506. var operate = {
  507. table1: function (where) {
  508. var tableheader = [ //表头
  509. { type: 'checkbox', fixed: 'left', width: 80},
  510. { field: 'org_name', title: '部门', minWidth: 150, templet: '#org_name' },
  511. { field: 'sale_name', title: '销售', minWidth: 150, templet: '#sale_name' },
  512. { field: 'designer_name', title: '设计师', minWidth: 150, templet: '#designer_name' },
  513. { field: 'name', title: '客户名称', minWidth: 150, templet: '#name' },
  514. { field: 'community_name', title: '小区', minWidth: 150, templet: '#community_name' },
  515. { field: 'allocate_time', title: '分配时间', minWidth: 150,templet: '#allocate_time' },
  516. { title: '状态', minWidth: 150, templet: '#status' },
  517. { title: '联系次数', field: 'call_num', minWidth: 150, templet: '#call_num'},
  518. { templet: '#op', title: '操作', Width: 50, fixed: 'right' }
  519. ];
  520. table.render({
  521. elem: '#table1'
  522. , url: '{:url("manager_emp/get_customers")}?id=' + "{$id}" + '&pid=' + "{$data.pid}" //数据接口
  523. , id: 'table1'
  524. , page: true
  525. , limit: 10
  526. , autoSort: false
  527. , cols: [tableheader]
  528. , height: 'full-120'
  529. ,done: function(res) {
  530. allIds = res.allids;
  531. console.log(allIds);
  532. }
  533. });
  534. }
  535. , table2: function (where) {
  536. var tableheader = [ //表头
  537. { field: 'name', title: '客户名称', minWidth: 150, templet: '#name' },
  538. { field: 'community_name', title: '小区', minWidth: 150, templet: '#community_name' },
  539. { field: 'phone', title: '手机号', minWidth: 100 },
  540. { type: 'checkbox', fixed: 'right', width: 150 }
  541. ];
  542. table.render({
  543. elem: '#table2'
  544. , url: '{:url("manager_emp/get_uncustomers")}?id=' + "{$id}" + '&pid=' + "{$data.pid}" //数据接口
  545. , id: 'table2'
  546. , page: true
  547. , limit: 10
  548. , autoSort: false
  549. , cols: [tableheader]
  550. , height: 'full-120'
  551. });
  552. }
  553. , table3:function(where){
  554. var tableheader = [ //表头
  555. { field: 'rows', title: '问题行数', minWidth: 150 },
  556. { field: 'type', title: '失败原因', minWidth: 150, templet: '#errortype' },
  557. ];
  558. table.render({
  559. elem: '#table3'
  560. , url: '{:url("manager_emp/get_error_customers")}?id=' + "{$id}" //数据接口
  561. , id: 'table3'
  562. , page: true
  563. , limit: 10
  564. , autoSort: false
  565. , cols: [tableheader]
  566. , height: 'full-120'
  567. });
  568. }
  569. };
  570. if (dtype == 0) {
  571. operate.table1(where1);
  572. } else if(dtype == 1) {
  573. operate.table2(where2);
  574. } else{
  575. operate.table3();
  576. }
  577. $("#search4").click(function() {
  578. if (!allIds) {
  579. layer.msg('没有要回收的数据', { anim: 0, time: 1000 }, function () {});
  580. return;
  581. }
  582. layer.confirm('确定回收所有数据吗?',{title:['信息', 'color:#333333;background-color:#D8E6F1;'],}, function(index){
  583. layer.close(index);
  584. var loadingIndex = layer.load('Loading...', {
  585. shade: [0.6,'#000'] //0.1透明度的白色背景
  586. });
  587. var type = $('#order').val();
  588. var keyword = $('#keyword1').val();
  589. var keyword3 = $('#keyword3').val();
  590. var state = $('#state').val();
  591. var datastr = allIds;
  592. $.ajax({
  593. url: '{:url("manager_emp/get_customers")}?id=' + "{$id}",
  594. type: 'post',
  595. data: { type: type, keyword: keyword , keyword3: keyword3,state:state ,recovery:1,ids:datastr},
  596. success: (ress) => {
  597. $("#fpxx").load(location.href + " #fpxx>*","");
  598. $("#zyxx").load(location.href + " #zyxx>*","");
  599. $("#yxxx").load(location.href + " #yxxx>*","");
  600. layer.close(loadingIndex);
  601. if (ress.code == 0) {
  602. operate.table1(where1);
  603. layer.msg(ress.msg, { anim: 0, time: 1000 });
  604. resolve(ress.data.src);
  605. }else if(ress.code == 403){
  606. $(".exitbtn").trigger("click");
  607. }else {
  608. operate.table1(where1);
  609. layer.msg(ress.msg, { anim: 0, time: 1000 }, function () {});
  610. }
  611. },
  612. });
  613. });
  614. })
  615. //监听table 选中
  616. table.on('checkbox(table2)', function (obj) {
  617. select = [];
  618. //选中的数据
  619. var selectData = layui.table.checkStatus('table2').data;
  620. if (selectData.length > 0) {
  621. for (let i = 0; i < selectData.length; i++) {
  622. const element = selectData[i];
  623. select.push(element.id);
  624. }
  625. }
  626. });
  627. //点击手动分配
  628. $('#distribution').click(function () {
  629. var wf = "{$data.left_num}";
  630. if (wf == 0) {
  631. layer.msg('没有未分配的客户', { anim: 0, time: 1000 }, function () {
  632. });
  633. return false;
  634. } else if (select.length == 0) {
  635. layer.msg('请选择要分配的客户', { anim: 0, time: 1000 }, function () {
  636. });
  637. return false;
  638. }
  639. var id = "{$id}";
  640. var count = select.length;
  641. var str = select.join(',');
  642. window.parent.distributionfun(id, count, str,'{:url("manager_emp/resource")}');
  643. //assignCustomerFunc(id, count, str);
  644. });
  645. //已分配搜索
  646. $('#search1').click(function () {
  647. var type = $('#order').val();
  648. var keyword = $('#keyword1').val();
  649. var keyword3 = $('#keyword3').val();
  650. var selectArr = demo1.getValue();
  651. var strs = [];
  652. var call_state = $('#call_state').val();
  653. selectArr.forEach(function(val,index){
  654. strs.push(selectArr[index].value)
  655. })
  656. var state = strs.toString();
  657. table.reload('table1', {
  658. where: { type: type, keyword: keyword , keyword3: keyword3,state:state,call_state:call_state}
  659. });
  660. });
  661. //回收客户
  662. $('#search3').click(function () {
  663. var checkStatus = table.checkStatus('table1')
  664. ,data = checkStatus.data; //获得选中的数据
  665. if(data.length === 0) return layer.msg('请选择要回收的客户', {time: 2000});
  666. var datastr = '';
  667. data.forEach(element => {
  668. datastr += element.id+','
  669. });
  670. var type = $('#order').val();
  671. var keyword = $('#keyword1').val();
  672. var keyword3 = $('#keyword3').val();
  673. var state = $('#state').val();
  674. layer.confirm('确定回收所选客户吗?',{title:['信息', 'color:#333333;background-color:#D8E6F1;'],}, function(index){
  675. var loadingIndex = layer.load('Loading...', {
  676. shade: [0.6,'#000'] //0.1透明度的白色背景
  677. });
  678. layer.close(index);
  679. $.ajax({
  680. url:'{:url("manager_emp/get_customers")}?id=' + "{$id}",
  681. type: 'post',
  682. data: { type: type, keyword: keyword , keyword3: keyword3,state:state ,recovery:1,ids:datastr},
  683. // dataType: 'json',
  684. success: function (res) {
  685. if (res.code === 0) {
  686. layer.msg(res.msg, {anim: 0, time: 1000}, function () {
  687. //更新列表
  688. table.reload('table1', {
  689. where: { type: type, keyword: keyword , keyword3: keyword3,state:state }
  690. });
  691. // parent.layui.table.reload('customer_table'); //重载表格
  692. // parent.layer.close(index); //再执行关闭
  693. });
  694. $("#fpxx").load(location.href + " #fpxx>*","");
  695. $("#zyxx").load(location.href + " #zyxx>*","");
  696. $("#yxxx").load(location.href + " #yxxx>*","");
  697. layer.close(loadingIndex);
  698. } else {
  699. layer.msg(res.msg, {anim: 6, time: 2000}, function () {
  700. //更新列表
  701. table.reload('table1', {
  702. where: { type: type, keyword: keyword , keyword3: keyword3,state:state }
  703. });
  704. // parent.layui.table.reload('customer_table'); //重载表格
  705. // parent.layer.close(index); //再执行关闭
  706. });
  707. layer.close(loadingIndex);
  708. }
  709. }
  710. });
  711. });
  712. });
  713. //未分配搜索
  714. $('#search2').click(function () {
  715. var keyword = $('#keyword2').val();
  716. table.reload('table2', {
  717. where: { keyword: keyword }
  718. });
  719. });
  720. opoo=function(){
  721. $("#fpxx").load(location.href + " #fpxx>*","");
  722. $("#zyxx").load(location.href + " #zyxx>*","");
  723. $("#yxxx").load(location.href + " #yxxx>*","");
  724. $('.layui-tab-content .layui-tab-item').eq(0).addClass('layui-show');
  725. $('.layui-tab-content .layui-tab-item').eq(1).removeClass('layui-show');
  726. operate.table1(where1);
  727. }
  728. table.on('tool(table1)', function (obj) {
  729. var type = $('#order').val();
  730. var keyword = $('#keyword1').val();
  731. var keyword3 = $('#keyword3').val();
  732. var state = $('#state').val();
  733. var id = obj.data.id;
  734. var layEvent = obj.event;
  735. if(layEvent == 'cuslist_li'){
  736. window.parent.call_cuslist(id);
  737. }
  738. if (layEvent == 'recovery') {
  739. //回收单个客户
  740. $.ajax({
  741. url:'{:url("manager_emp/recovery_customers")}?customer_id=' + id + '&crm_res_id='+"{$id}",
  742. type: 'post',
  743. // dataType: 'json',
  744. success: function (res) {
  745. if (res.code === 0) {
  746. layer.msg(res.msg, {anim: 0, time: 1000}, function () {
  747. //更新列表
  748. table.reload('table1', {
  749. where: { type: type, keyword: keyword , keyword3: keyword3,state:state }
  750. });
  751. // parent.layui.table.reload('customer_table'); //重载表格
  752. // parent.layer.close(index); //再执行关闭
  753. });
  754. $("#fpxx").load(location.href + " #fpxx>*","");
  755. $("#zyxx").load(location.href + " #zyxx>*","");
  756. $("#yxxx").load(location.href + " #yxxx>*","");
  757. } else {
  758. layer.msg(res.msg, {anim: 6, time: 2000});
  759. }
  760. }
  761. });
  762. }
  763. });
  764. });
  765. </script>
  766. {/block}