assignment_list.html 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702
  1. {extend name="public/layout"}
  2. {block name="body"}
  3. <link rel="stylesheet" href="__LAYUI__/layui/css/layui.css" media="all">
  4. <link rel="stylesheet" " href=" /static/css/common.css">
  5. <script src="/static/js/jquery.min.js"></script>
  6. <style>
  7. html,body{
  8. width: 100%;
  9. height: 100%;
  10. }
  11. body {
  12. padding-bottom: 40px;
  13. overflow: auto;
  14. }
  15. .searchtitlebox {
  16. display: block;
  17. padding: 15px 10px;
  18. border: 1px solid #F0F0F0;
  19. background: #FCFCFC;
  20. margin-top: 5px;
  21. margin-bottom: 10px;
  22. position: relative;
  23. min-width: 800px;
  24. }
  25. .searchbox {
  26. display: block;
  27. margin-top: 8px;
  28. text-align: center;
  29. }
  30. .searchbox input {
  31. display: inline-block;
  32. height: 26px;
  33. line-height: 26px;
  34. padding-left: 3px;
  35. vertical-align: middle;
  36. border: 2px solid #4479ba;
  37. }
  38. body {
  39. font-size: 12px;
  40. font-family: "宋体";
  41. }
  42. .searchbox .searchbtn {
  43. display: inline-block;
  44. float: right;
  45. border: none;
  46. width: 98px;
  47. height: 30px;
  48. color: #fff;
  49. font-size: 14px;
  50. font-weight: bold;
  51. text-align: center;
  52. background: url(__STATIC__/img/icon-sub.png) no-repeat;
  53. cursor: pointer;
  54. vertical-align: middle;
  55. }
  56. .selectbox {
  57. float: left;
  58. }
  59. .leftselect {
  60. float: left;
  61. height: 26px;
  62. line-height: 26px;
  63. }
  64. .selectbox select {
  65. float: left;
  66. height: 26px;
  67. }
  68. .searchtext {
  69. border: 1px solid #ccc;
  70. background: #fff url(__STATIC__/img/icon071402.png) no-repeat;
  71. padding: 1px 2px;
  72. height: 24px;
  73. line-height: 24px;
  74. vertical-align: middle;
  75. text-indent: 3px;
  76. margin-left: 4px;
  77. }
  78. .searchbtn1 {
  79. margin-left: 4px;
  80. cursor: pointer;
  81. color: #000;
  82. background: url(__STATIC__/img/btn_bg.gif) repeat-x;
  83. border: 1px solid #C0C0C0;
  84. padding: 0 12px;
  85. *padding: 0 6px;
  86. height: 26px;
  87. }
  88. .layui-table td,
  89. .layui-table th {
  90. font-size: 12px;
  91. }
  92. .layui-table th {
  93. font-weight: bold;
  94. }
  95. .dingjingorder {
  96. height: 25px;
  97. width: 40px;
  98. background-color: #65c001;
  99. color: #FFF;
  100. text-align: center;
  101. line-height: 25px;
  102. z-index: 100;
  103. display: block;
  104. position: absolute;
  105. top: 1px;
  106. right: 3px;
  107. border-radius: 11px;
  108. font-size: 12px;
  109. }
  110. .addvx {
  111. position: absolute;
  112. top: -5px;
  113. right: 1px;
  114. height: 14px;
  115. line-height: 14px;
  116. font-size: 16px;
  117. color: #666;
  118. font-family: "宋体";
  119. }
  120. .statebox {
  121. width: 40px;
  122. text-align: center;
  123. z-index: 100;
  124. display: block;
  125. position: absolute;
  126. font-size: 12px;
  127. top: -5px;
  128. right: 0px;
  129. border-radius: 0px;
  130. background: #4285f4;
  131. color: #efefef;
  132. height: 20px;
  133. line-height: 20px;
  134. }
  135. .layui-table-cell {
  136. overflow: initial;
  137. }
  138. #customer_detail {
  139. display: block;
  140. width: 435px;
  141. height: 100%;
  142. position: absolute;
  143. top: 0;
  144. left: 0;
  145. }
  146. .rightbox {
  147. display: block;
  148. width: calc(100% - 435px);
  149. margin-left: 435px;
  150. }
  151. .unstatusbox {
  152. display: block;
  153. position: absolute;
  154. top: -5px;
  155. left: 0;
  156. width: 100%;
  157. height: 37px;
  158. background-color: #FF6600;
  159. text-align: center;
  160. color: #FFF;
  161. }
  162. .statusbox {
  163. position: absolute;
  164. top: 0px;
  165. right: 0px;
  166. color: #666;
  167. text-align: right;
  168. z-index: 100;
  169. display: block;
  170. font-size: 12px;
  171. }
  172. .layui-table-view .layui-form-checkbox {
  173. width: 16px;
  174. height: 16px;
  175. line-height: 16px;
  176. padding-right: 0;
  177. }
  178. .layui-table-view .layui-form-checkbox i {
  179. height: 16px;
  180. width: 16px;
  181. font-size: 14px;
  182. }
  183. .novisitlog {
  184. background-color: #9139db !important;
  185. color: #FFF;
  186. }
  187. .novisitlog a {
  188. color: #FFF;
  189. }
  190. .crmsearchlist {
  191. max-height: 760px;
  192. cursor: pointer;
  193. height: auto !important;
  194. }
  195. .tablebox .layui-form.layui-border-box.layui-table-view {
  196. max-height: 760px !important;
  197. height: auto !important;
  198. }
  199. .layui-table-body {
  200. max-height: 670px !important;
  201. height: auto !important;
  202. }
  203. .layui-table-view .layui-table td {
  204. cursor: pointer;
  205. overflow: hidden;
  206. }
  207. .link {
  208. width: 74px;
  209. height: 24px;
  210. line-height: 24px;
  211. background: url(__STATIC__/img/linkBG.gif);
  212. color: #FFF;
  213. border-top: 1px solid #A5DFFF;
  214. border-left: 1px solid A5DFFF;
  215. border-bottom: 1px solid #63A2DE;
  216. border-right: 1px solid #63A2DE;
  217. margin-right: 8px;
  218. cursor: pointer;
  219. color: #fff;
  220. }
  221. .link a{
  222. color: #fff;
  223. }
  224. .assignbox{
  225. position: relative;
  226. top: -44px;
  227. line-height: 28px;
  228. width: 50%;
  229. float: left;
  230. margin-left: 10px;
  231. }
  232. .layui-form-select{
  233. float: left;
  234. }
  235. .layui-form-select .layui-input{
  236. height: 28px;
  237. }
  238. .assignbtn{
  239. margin-left: 8px;
  240. cursor: pointer;
  241. color: #000;
  242. background: url(__STATIC__/img/btn_bg.gif) repeat-x;
  243. border: 1px solid #C0C0C0;
  244. padding: 0 12px;
  245. *padding: 0 6px;
  246. height: 28px;
  247. }
  248. .searchbox .layui-form-select{float:left;width:130px;}
  249. .searchbox input{border:1px solid #e6e6e6 !important;}
  250. .layui-table {
  251. width: 100% !important;
  252. }
  253. </style>
  254. <body class="clearfix">
  255. <iframe id="customer_detail" style="display: none;" src=""></iframe>
  256. <div class="crmbox">
  257. <form class="layui-form">
  258. <div class="searchtitlebox">
  259. <div style="margin-bottom:8px;">您当前的操作 · <b>所有客户</b> · <span class="firstit">分派给我的线索管理</span>&nbsp;&nbsp;</div>
  260. <div class="searchbox clearfix">
  261. <div class="selectbox">
  262. <div class="leftselect">检索:</div>
  263. <select name="source_id" lay-search>
  264. <option value="">==客户来源==</option>
  265. {volist name="soudata" id="vo"}
  266. <option value="{$vo.id}">{$vo.name}</option>
  267. {/volist}
  268. </select>
  269. <select name="employee_id" lay-search>
  270. <option value="">==业务员==</option>
  271. {volist name="employee_list" id="vo"}
  272. <option value="{$vo.id}">{$vo.name}</option>
  273. {/volist}
  274. </select>
  275. <input class="left searchtext" type="text" autocomplete="off" name="keyname" placeholder="输入关键字....." title="客户名、小区名其中任意一部分" />
  276. <button class="left searchbtn1" type="button" lay-submit lay-filter="search">搜索</button>
  277. </div>
  278. {if $is_manager eq 1}
  279. <div class="right link">
  280. <a href="javascript:void(0)">转移客户</a>
  281. </div>
  282. {/if}
  283. </div>
  284. </div>
  285. <div class="crmsearchlist">
  286. <table lay-filter="crmsearchlist" id="crmsearchlist"></table>
  287. <div class="clearfix assignbox" style="display: none;">
  288. <div class="left">将选中的线索批量转移至:</div>
  289. <select class="left" id="employeeid" name="employeeid" lay-search>
  290. <option value="">==业务员==</option>
  291. {volist name="assignemp_list" id="vo"}
  292. {if $vo.id neq $empid}
  293. <option value="{$vo.id}">{$vo.name}</option>
  294. {/if}
  295. {/volist}
  296. </select>
  297. <button class="left assignbtn" type="button">执行分派</button>
  298. </div>
  299. </div>
  300. </form>
  301. </div>
  302. </body>
  303. <script src="__LAYUI__/layui/layui.js"></script>
  304. {/block}{block name="js"}
  305. <script type="text/html" id="crmname">
  306. <span data-cid="{{=d.id}}" class="namecid">{{d.name?d.name:'未知'}}</span>
  307. {{# if(d.jiaoding_time){ }}
  308. <span class="dingjingorder">定金</span>
  309. {{# }else{ }}
  310. {{# } }}
  311. </script>
  312. <script type="text/html" id="empname">
  313. {{# if(d.employee){ }}
  314. {{d.employee.name}}
  315. {{# if(d.add_wechat=='是'){ }}
  316. <span class="addvx">v</span>
  317. {{# }else{ }}
  318. {{# } }}
  319. {{# }else{ }}
  320. <span style="color: #cccccc;">无</span>
  321. {{# if(d.add_wechat=='是'){ }}
  322. <span class="addvx">v</span>
  323. {{# }else{ }}
  324. {{# } }}
  325. {{# } }}
  326. </script>
  327. <script type="text/html" id="square">
  328. {{# if(d.square>200){ }}
  329. <span style="font-weight: bold;color: #ff6600;">{{d.square}}</span>
  330. {{# }else if(d.square){ }}
  331. <span >{{d.square}}</span>
  332. {{# }else{ }}
  333. {{# } }}
  334. </script>
  335. <script type="text/html" id="labeltpl">
  336. {{# if(d.label){ }}
  337. <span>{{d.label}}</span>
  338. {{# }else{ }}
  339. <span style="color: #cccccc;">无</span>
  340. {{# } }}
  341. </script>
  342. <script type="text/html" id="source">
  343. {{# if(d.source){ }}
  344. <span>{{d.source.source}}</span>
  345. {{# }else{ }}
  346. <span style="color: #cccccc;">无</span>
  347. {{# } }}
  348. </script>
  349. <script type="text/html" id="designer_name">
  350. {{# if(d.designer){ }}
  351. <span>{{d.designer.name}}</span>
  352. {{# }else{ }}
  353. <span style="color: #cccccc;">无</span>
  354. {{# } }}
  355. </script>
  356. <script type="text/html" id="editbox">
  357. {{# if(d.state=="待确认"){ }}
  358. <a style="display:inline-block;" lay-event="edit" href="javascript:void(0);">编辑</a>
  359. {{# }else { }}
  360. <a style="display:inline-block;" lay-event="editstate" href="javascript:void(0);">状态</a><span style="padding:0 4px;">/</span><a lay-event="edit" style="display:inline-block;" href="javascript:void(0);">编辑</a>
  361. {{# } }}
  362. </script>
  363. <script type="text/javascript">
  364. var reload = null, resizefun = null;
  365. layui.config({
  366. base: '__LAYUI__/',
  367. urlbase: '/sys'
  368. }).extend({
  369. index: 'lib/index' //主入口模块
  370. }).use(['table', 'laydate'], function () {
  371. var table = layui.table, laydate = layui.laydate,
  372. $ = layui.$;
  373. form = layui.form,
  374. assignVal = null;
  375. var field = {};
  376. form.on('submit(search)', function (data) {
  377. var source_id = $('[name=source_id]').val();
  378. var designer_id = $('[name=designer_id]').val();
  379. var employee_id = $('[name=employee_id]').val();
  380. var level = $('[name=level]').val();
  381. var keyname = $('[name=keyname]').val();
  382. field['level'] = level;
  383. if (assignVal == 1) {
  384. field['name'] = keyname;
  385. field['source_name'] = source_id;
  386. field['designer_name'] = designer_id;
  387. field['employee_name'] = employee_id;
  388. table.reload("crmsearchlist", {
  389. url: '{:url("community/list")}',
  390. where: field,
  391. cols: [[
  392. { type: 'checkbox', hide: false, event: 'checkdiv',width: 50 },
  393. ]]
  394. }, true);
  395. } else {
  396. field['keyname'] = keyname;
  397. field['source_id'] = source_id;
  398. field['designer_id'] = designer_id;
  399. field['employee_id'] = employee_id;
  400. //执行重载
  401. table.reload('crmsearchlist', {
  402. where: field
  403. , page: { curr: 1}
  404. });
  405. }
  406. });
  407. resizefun = function () {
  408. table.resize('crmsearchlist');
  409. };
  410. reload = function () {
  411. table.reload('crmsearchlist', { where: field }, true);
  412. };
  413. table.render({
  414. elem: '#crmsearchlist',
  415. url: '{:url("community/assignment_list")}',
  416. //even: true,
  417. cols: [
  418. [
  419. { type: 'checkbox', hide:true, event:'checkdiv',width:50 },
  420. {
  421. title: '客户姓名',
  422. field: 'name',
  423. align: 'center',
  424. minWidth:170,
  425. templet: '#crmname',
  426. },
  427. {
  428. title: '小区名称',
  429. field: 'community_name',
  430. minWidth:100,
  431. align: 'center',
  432. },
  433. {
  434. title: '重要级别',
  435. field: 'level',
  436. minWidth:100,
  437. align: 'center',
  438. },
  439. {
  440. title: '面积',
  441. field: 'square',
  442. align: 'center',
  443. minWidth:100,
  444. templet: '#square'
  445. },
  446. {
  447. title: '所属员工',
  448. field: 'empname',
  449. align: 'center',
  450. minWidth:100,
  451. templet: '#empname'
  452. },
  453. {
  454. title: '设计师',
  455. field: 'designer_name',
  456. align: 'center',
  457. minWidth:100,
  458. templet: '#designer_name'
  459. },
  460. {
  461. title: '客户来源',
  462. field: 'source',
  463. align: 'center',
  464. minWidth:100,
  465. templet: '#source'
  466. },
  467. {
  468. title: '首次见面',
  469. field: 'fisttime',
  470. align: 'center',
  471. minWidth:160,
  472. },
  473. {
  474. title: '报名时间',
  475. field: 'sign_time',
  476. align: 'center',
  477. minWidth: 160,
  478. },
  479. {
  480. title: '交房',
  481. field: 'jiaofang',
  482. align: 'center',
  483. minWidth:100,
  484. },
  485. {
  486. title: '状态',
  487. field: 'state',
  488. align: 'center',
  489. minWidth:100,
  490. }
  491. ]
  492. ],
  493. page: true,
  494. limits: [17],
  495. limit: 17, //每页默认显示的数量,
  496. height: 'full-120',
  497. text: '对不起,加载出现异常!',
  498. done: function (res, curr, count) {
  499. // res.data.forEach(function (item, index) {
  500. // // if(item.visit_log_count==0){
  501. // // $('.layui-table').find('tr[data-index="' + index + '"]').addClass('novisitlog');
  502. // // }
  503. // });
  504. }
  505. });
  506. $('.link').on('click',function () {
  507. $('.firstit').html('可以分派的线索管理');
  508. table.reload("crmsearchlist", {
  509. url: '{:url("community/list")}',
  510. cols: [[
  511. { type: 'checkbox', hide: false, event: 'checkdiv',width: 50 },
  512. ]]
  513. }, true);
  514. $('.link').hide();
  515. $('.assignbox').show();
  516. assignVal = 1;
  517. })
  518. var flag = true;
  519. table.on('tool(crmsearchlist)', function (result) {
  520. let event = result.event;
  521. let row = result.data;
  522. flag = true;
  523. if(event =='checkdiv'){
  524. flag = false;
  525. return false;
  526. }else if(event === "edit"){
  527. $.ajax({
  528. url: '{:url("community/checkCustomer")}'
  529. , data: {
  530. id: result.data.id,
  531. }
  532. , type: 'post'
  533. , success: function (rs) {
  534. if(rs.code==0){
  535. flag = false;
  536. window.parent.editcrmsg(result.data.id,'assignment_list.html')
  537. }else{
  538. alert(rs.msg)
  539. }
  540. }
  541. })
  542. return false;
  543. }else if (event === "editstate") {
  544. $.ajax({
  545. url: '{:url("community/checkCustomer")}'
  546. , data: {
  547. id: result.data.id,
  548. }
  549. , type: 'post'
  550. , success: function (rs) {
  551. if(rs.code==0){
  552. flag = false;
  553. window.parent.statemsg(result.data.id, 'assignment_list.html');
  554. }else{
  555. alert(rs.msg)
  556. }
  557. }
  558. })
  559. return false;
  560. }
  561. })
  562. $('.crmsearchlist').on('click', 'td', function (e) {
  563. var _event = $(this).find('[lay-event]').attr('lay-event');
  564. _event= _event? _event: $(this).attr('lay-event');
  565. var _obj = table.cache.crmsearchlist[parseInt($(this).parent('tr').attr('data-index'))];
  566. switch (_event) {
  567. case 'edit':
  568. break;
  569. case 'checkdiv':
  570. break;
  571. default:
  572. $.ajax({
  573. url: '{:url("community/checkCustomer")}'
  574. , data: {
  575. id: _obj.id,
  576. }
  577. , type: 'post'
  578. , success: function (rs) {
  579. if(rs.code==0){
  580. flag = true;
  581. $('#customer_detail')[0].src = "/empcrm/community/addlog.html?cid=" + _obj.id;
  582. $('.crmbox').addClass('rightbox');
  583. $('#customer_detail').show();
  584. resizefun();
  585. }else{
  586. alert(rs.msg)
  587. }
  588. }
  589. })
  590. }
  591. return false; //阻止事件冒泡
  592. })
  593. table.on('row(crmsearchlist)', function (obj) {
  594. var data = obj.data;
  595. if (flag) {
  596. $.ajax({
  597. url: '{:url("community/checkCustomer")}'
  598. , data: {
  599. id: data.id,
  600. }
  601. , type: 'post'
  602. , success: function (rs) {
  603. if(rs.code==0){
  604. $('#customer_detail')[0].src="/empcrm/community/addlog.html?cid="+ data.id;
  605. $('.crmbox').addClass('rightbox');
  606. $('#customer_detail').show();
  607. for (let i = 0; i < $('.crmsearchlist .layui-table-view .layui-table-box .layui-table tr').length; i++) {
  608. $($('.crmsearchlist .layui-table-view .layui-table-box .layui-table tr')[i]).removeClass('onclickbg');
  609. }
  610. $(obj.tr).addClass('onclickbg');
  611. resizefun();
  612. }else{
  613. alert(rs.msg)
  614. }
  615. }
  616. })
  617. }
  618. });
  619. $('.searchbtn').click(function () {
  620. window.parent.addcrmmsg('jiaoding_list.html')
  621. })
  622. $('.assignbtn').on('click',function(){
  623. let arr=[];
  624. for(let i=0;i< $('td div.laytable-cell-checkbox input[type="checkbox"]').length;i++){
  625. if($('td div.laytable-cell-checkbox input[type="checkbox"]')[i].checked){
  626. arr.push($($('.namecid')[i]).data("cid"));
  627. }
  628. }
  629. if(arr.length==0){
  630. alert('亲,别忘了选择要分派的客户')
  631. return false;
  632. }
  633. if(!$('#employeeid').val()){
  634. alert('亲,别忘了选择客户要转移业务员')
  635. return false;
  636. }
  637. //
  638. if(confirm("重要提示:确定要分派信息吗?")){
  639. $.ajax({
  640. url: '{:url("community/customerTransfer")}'
  641. , data: {
  642. customer_ids: arr.join(','),//要分派的客户id, 如果多个以逗号隔开
  643. employeeid: $('#employeeid').val(),//要分派给谁的员工id
  644. }
  645. , type: 'post'
  646. , success: function (res) {
  647. if(res.code == 403){
  648. $(".exitbtn").trigger("click");
  649. } else {
  650. alert(res.msg)
  651. }
  652. table.reload("crmsearchlist", {
  653. url: '{:url("community/list")}',
  654. cols: [[
  655. { type: 'checkbox', hide: false, event: 'checkdiv', width: 50 },
  656. ]]
  657. }, true);
  658. }
  659. });
  660. }
  661. })
  662. })
  663. function removealog(params) {
  664. $('#customer_detail').hide();
  665. $('.crmbox').removeClass('rightbox');
  666. }
  667. </script>
  668. {/block}