manage_statistics.html 42 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355
  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. body {
  8. padding-bottom: 40px;
  9. }
  10. .searchtitlebox {
  11. display: block;
  12. padding: 15px 10px;
  13. border: 1px solid #F0F0F0;
  14. background: #FCFCFC;
  15. margin-top: 5px;
  16. margin-bottom: 10px;
  17. /* position: relative; */
  18. min-width: 800px;
  19. }
  20. .searchbox {
  21. display: block;
  22. margin-top: 8px;
  23. text-align: center;
  24. }
  25. .searchbox input {
  26. display: inline-block;
  27. height: 26px;
  28. line-height: 26px;
  29. padding-left: 3px;
  30. vertical-align: middle;
  31. border: 2px solid #4479ba;
  32. }
  33. body {
  34. font-size: 12px;
  35. font-family: "宋体";
  36. }
  37. .searchbox .searchbtn {
  38. display: inline-block;
  39. float: right;
  40. border: none;
  41. width: 98px;
  42. height: 30px;
  43. color: #fff;
  44. font-size: 14px;
  45. font-weight: bold;
  46. text-align: center;
  47. background: url(__STATIC__/img/icon-sub.png) no-repeat;
  48. cursor: pointer;
  49. vertical-align: middle;
  50. }
  51. .selectbox {
  52. float: left;
  53. }
  54. .leftselect {
  55. float: left;
  56. height: 26px;
  57. line-height: 26px;
  58. }
  59. .selectbox select {
  60. float: left;
  61. height: 26px;
  62. }
  63. .searchtext {
  64. border: 1px solid #ccc;
  65. background: #fff url(__STATIC__/img/icon071402.png) no-repeat;
  66. padding: 1px 2px;
  67. height: 24px;
  68. line-height: 24px;
  69. vertical-align: middle;
  70. text-indent: 3px;
  71. margin-left: 4px;
  72. }
  73. .searchbtn1 {
  74. margin-left: 4px;
  75. cursor: pointer;
  76. color: #000;
  77. background: url(__STATIC__/img/btn_bg.gif) repeat-x;
  78. border: 1px solid #C0C0C0;
  79. padding: 0 12px;
  80. *padding: 0 6px;
  81. height: 26px;
  82. }
  83. .layui-table td,
  84. .layui-table th {
  85. font-size: 12px;
  86. }
  87. .layui-table th {
  88. font-weight: bold;
  89. }
  90. .dingjingorder {
  91. height: 25px;
  92. width: 40px;
  93. background-color: #65c001;
  94. color: #FFF;
  95. text-align: center;
  96. line-height: 25px;
  97. z-index: 100;
  98. display: block;
  99. position: absolute;
  100. top: 1px;
  101. right: 3px;
  102. border-radius: 11px;
  103. font-size: 12px;
  104. }
  105. .addvx {
  106. position: absolute;
  107. top: -5px;
  108. right: 1px;
  109. height: 14px;
  110. line-height: 14px;
  111. font-size: 16px;
  112. color: #666;
  113. font-family: "宋体";
  114. }
  115. .statebox {
  116. width: 40px;
  117. text-align: center;
  118. z-index: 100;
  119. display: block;
  120. position: absolute;
  121. font-size: 12px;
  122. top: -5px;
  123. right: 0px;
  124. border-radius: 0px;
  125. background: #4285f4;
  126. color: #efefef;
  127. height: 20px;
  128. line-height: 20px;
  129. }
  130. .layui-table-cell {
  131. overflow: initial;
  132. }
  133. #customer_detail {
  134. display: block;
  135. width: 435px;
  136. height: 100%;
  137. position: fixed;
  138. top: 0;
  139. left: 0;
  140. bottom: 0;
  141. }
  142. .rightbox {
  143. display: block;
  144. width: calc(100% - 435px);
  145. margin-left: 435px;
  146. }
  147. .unstatusbox {
  148. display: block;
  149. position: absolute;
  150. top: -5px;
  151. left: 0;
  152. width: 100%;
  153. height: 37px;
  154. background-color: #FF6600;
  155. text-align: center;
  156. color: #FFF;
  157. }
  158. .statusbox {
  159. position: absolute;
  160. top: 0px;
  161. right: 0px;
  162. color: #666;
  163. text-align: right;
  164. z-index: 100;
  165. display: block;
  166. font-size: 12px;
  167. }
  168. .layui-table-view .layui-form-checkbox {
  169. width: 16px;
  170. height: 16px;
  171. line-height: 16px;
  172. padding-right: 0;
  173. }
  174. .layui-table-view .layui-form-checkbox i {
  175. height: 16px;
  176. width: 16px;
  177. font-size: 14px;
  178. }
  179. .novisitlog {
  180. background-color: #9139db !important;
  181. color: #FFF;
  182. }
  183. .novisitlog a {
  184. color: #FFF;
  185. }
  186. .crmsearchlist {
  187. max-height: 760px;
  188. cursor: pointer;
  189. }
  190. .tablebox .layui-form.layui-border-box.layui-table-view {
  191. max-height: 760px !important;
  192. height: auto !important;
  193. }
  194. .layui-table-body {
  195. /* max-height: 670px !important; */
  196. height: auto !important;
  197. }
  198. .layui-table-view .layui-table td {
  199. cursor: pointer;
  200. overflow: hidden;
  201. }
  202. .layui-form-checked {
  203. background-color: #37AF6E;
  204. }
  205. .layui-table-view .layui-form-checked i {
  206. color: #fff;
  207. }
  208. .layui-table-cell {
  209. overflow: hidden;
  210. }
  211. .searchbox .layui-form-select {
  212. float: left;
  213. width: 130px;
  214. }
  215. .searchbox input {
  216. border: 1px solid #e6e6e6 !important;
  217. }
  218. .totalBox {
  219. width: 100%;
  220. height: 100px;
  221. border: 1px solid #f2f2f2;
  222. display: flex;
  223. align-items: center;
  224. }
  225. .totalBox>div {
  226. flex: 1;
  227. display: flex;
  228. flex-direction: column;
  229. align-items: center;
  230. justify-content: center;
  231. }
  232. .totalName {
  233. font-size: 16px;
  234. color: #999999;
  235. }
  236. .totalNum {
  237. font-size: 20px;
  238. font-weight: 600;
  239. }
  240. .totalline {
  241. flex: none !important;
  242. width: 1px !important;
  243. height: 50px !important;
  244. background-color: #f2f2f2;
  245. }
  246. .ml5 {
  247. margin-left: 5px;
  248. }
  249. .cursor {
  250. cursor: pointer;
  251. margin-bottom: 8px;
  252. position: relative;
  253. }
  254. .cursor>.layui-form-select {
  255. width: 115px;
  256. display: inline-block;
  257. }
  258. .cursor>.layui-form-select>.layui-select-title {
  259. border: none;
  260. }
  261. .cursor>.layui-form-select>.layui-select-title>input {
  262. border: none;
  263. color: #333333;
  264. font-weight: 600;
  265. }
  266. /* .layui-table-fixed-r .layui-table-body {
  267. overflow: hidden !important;
  268. } */
  269. .relative {
  270. position: relative;
  271. }
  272. .lay-setting {
  273. position: absolute;
  274. right: 10px;
  275. top: 10px;
  276. z-index: 999 !important;
  277. cursor: pointer;
  278. }
  279. .lay-mask {
  280. width: 100%;
  281. height: 100%;
  282. background-color: rgba(0, 0, 0, 0.3);
  283. position: fixed;
  284. top: 0px;
  285. left: 0px;
  286. z-index: 9999 !important;
  287. }
  288. .lay-block {
  289. width: 400px;
  290. height: 100%;
  291. background-color: #fff;
  292. position: absolute;
  293. right: 0px;
  294. top: 0px;
  295. box-sizing: border-box;
  296. padding: 10px 10px 30px 10px;
  297. overflow: auto;
  298. }
  299. .lay-title {
  300. width: 100%;
  301. height: 40px;
  302. display: flex;
  303. align-items: center;
  304. justify-content: space-between;
  305. }
  306. .lay-title>span {
  307. font-size: 16px;
  308. color: #333333;
  309. font-weight: 600;
  310. }
  311. .lay-title>i {
  312. font-weight: 600;
  313. cursor: pointer;
  314. }
  315. .layui-content {
  316. width: 100%;
  317. height: auto;
  318. }
  319. .lay-item {
  320. width: 100%;
  321. height: 50px;
  322. /* display: flex;
  323. align-items: center;
  324. justify-content: space-between; */
  325. }
  326. .lay-item>div {
  327. display: flex;
  328. align-items: center;
  329. }
  330. .lay-item>div>span {
  331. margin-left: 6px;
  332. }
  333. .sort_lis01 {
  334. float: left;
  335. }
  336. .sort_lis02 {
  337. float: right;
  338. }
  339. .sort_time {
  340. overflow: hidden;
  341. }
  342. .layui-form-switch i {
  343. top: 2px !important;
  344. }
  345. .relative {
  346. position: relative;
  347. }
  348. .selectDateBox {
  349. position: absolute;
  350. width: 330px;
  351. height: 100px;
  352. box-shadow: 0 2px 4px rgb(0 0 0 / 12%);
  353. background-color: #fff;
  354. z-index: 99999 !important;
  355. top: 45px;
  356. box-sizing: border-box;
  357. padding: 5px 8px;
  358. }
  359. .selecstDateBox {
  360. position: absolute;
  361. width: 330px;
  362. height: 100px;
  363. box-shadow: 0 2px 4px rgb(0 0 0 / 12%);
  364. background-color: #fff;
  365. z-index: 99999 !important;
  366. top: 45px;
  367. right: 0;
  368. box-sizing: border-box;
  369. padding: 5px 8px;
  370. }
  371. .date-flex,
  372. .date-flex1 {
  373. display: flex;
  374. align-items: center;
  375. }
  376. .date-box {
  377. padding: 15px 0px 10px;
  378. }
  379. .line-middle {
  380. width: 10px;
  381. height: 100%;
  382. margin: 0px 10px;
  383. }
  384. .line {
  385. width: 10px;
  386. height: 2px;
  387. background-color: #999999;
  388. }
  389. .mb0 {
  390. margin-bottom: 0px;
  391. }
  392. .layui-btn {
  393. background-color: #fff;
  394. color: #555;
  395. border: 1px solid #c9c9c9;
  396. }
  397. .layui-btn:hover {
  398. background-color: #fff;
  399. color: #555;
  400. border: 1px solid #249efb;
  401. }
  402. .layui-btn-primary,
  403. .sBtn {
  404. background-color: #249efb;
  405. color: #fff;
  406. border: 1px solid #249efb;
  407. }
  408. .layui-btn-primary:hover {
  409. background-color: #249efb;
  410. color: #fff;
  411. border: 1px solid #249efb;
  412. }
  413. .sBtn:hover {
  414. background-color: #249efb;
  415. color: #fff;
  416. border: 1px solid #249efb;
  417. }
  418. .flex-row,
  419. .row {
  420. display: flex;
  421. }
  422. .align-center {
  423. align-items: center;
  424. }
  425. .ml10 {
  426. margin-left: 10px;
  427. }
  428. .mt10 {
  429. margin-top: 10px;
  430. }
  431. .padding-tlr {
  432. padding: 15px 15px 0px;
  433. }
  434. .layui-input-block {
  435. margin-left: 0px;
  436. }
  437. .justify-between {
  438. justify-content: space-between;
  439. }
  440. .qdtj_m {
  441. padding: 0 15px;
  442. width: 100%;
  443. box-sizing: border-box;
  444. margin: 20px 0 10px;
  445. }
  446. .qdtj_ul {
  447. overflow: hidden;
  448. border: 1px solid #94d0ff;
  449. padding: 15px 0;
  450. background-color: #fbfdff;
  451. }
  452. .qdtj_ul li {
  453. float: left;
  454. position: relative;
  455. text-align: center;
  456. width: 10%;
  457. }
  458. .qdtj_1 {
  459. font-size: 20px;
  460. font-weight: 400;
  461. }
  462. .qdtj_2 {
  463. font-size: 14px;
  464. color: #888;
  465. margin-top: 5px;
  466. }
  467. .qdtj_r_x {
  468. height: 40px;
  469. width: 1px;
  470. background: #d8d8d9;
  471. position: absolute;
  472. right: 0;
  473. top: 50%;
  474. margin-top: -20px;
  475. }
  476. ::-webkit-scrollbar {
  477. width: auto;
  478. height: auto;
  479. }
  480. ::-webkit-scrollbar-thumb {
  481. border-radius: 10px;
  482. -webkit-box-shadow: inset 0 0 2px rgba(0, 0, 0, 0.2);
  483. background: #DFDFDF;
  484. }
  485. ::-webkit-scrollbar-track {
  486. -webkit-box-shadow: inset 0 0 2px rgba(0, 0, 0, 0.2);
  487. border-radius: 10px;
  488. background: #f5f5f5;
  489. }
  490. </style>
  491. <body class="clearfix">
  492. <iframe id="customer_detail" style="display: none;" src=""></iframe>
  493. <div class="crmbox">
  494. <div class="search-form layui-form padding-tlr" style="margin-bottom: 10px;">
  495. <!-- <div class="flex-row align-center justify-between" style="overflow: hidden;"> -->
  496. <form id="reset_form">
  497. <div class="" style="">
  498. <div class="flex-row align-center" style="float:left;">
  499. <div class="layui-input-block">
  500. <input type="text" class="layui-input" id="keyword" autocomplete="off" name="keyword"
  501. placeholder="请输入员工名称" />
  502. </div>
  503. <div class="layui-input-inline layui-form ml10">
  504. <select name="org_id" class="type_id" id="org_id" lay-search>
  505. <option value="">请选择部门</option>
  506. {volist name="org" id="i"}
  507. <option value="{$i.id}">{$i.name}</option>
  508. {/volist}
  509. </select>
  510. </div>
  511. <div class="layui-input-inline layui-form ml10" style="display: inline-block">
  512. <!-- <label class="layui-form-label" style="width: 60px;">跟进时间</label> -->
  513. <div class="layui-input-inline select-date relative">
  514. <!-- 注意:这一层元素并不是必须的 -->
  515. <input type="text" class="layui-input" id="sDate" name="start_date"
  516. placeholder="开始日期 - 结束日期" autocomplete="off" />
  517. <div data-type="" class="selecstDateBox layui-hide">
  518. <div data-type="" class="date-flex1">
  519. <div data-type="today"
  520. class="layui-btn layui-btn-primary layui-border-blue layui-btn-xs">
  521. 今日
  522. </div>
  523. <div data-type="yesterday"
  524. class="layui-btn layui-btn-primary layui-border-blue layui-btn-xs">
  525. 昨日
  526. </div>
  527. <div data-type="week"
  528. class="layui-btn layui-btn-primary layui-border-blue layui-btn-xs">
  529. 本周
  530. </div>
  531. <div data-type="lastWeek"
  532. class="layui-btn layui-btn-primary layui-border-blue layui-btn-xs">
  533. 上周
  534. </div>
  535. <div data-type="month"
  536. class="layui-btn layui-btn-primary layui-border-blue layui-btn-xs">
  537. 本月
  538. </div>
  539. <div data-type="lastMonth"
  540. class="layui-btn layui-btn-primary layui-border-blue layui-btn-xs">
  541. 上月
  542. </div>
  543. <div data-type="all"
  544. class="layui-btn layui-btn-primary layui-border-blue layui-btn-xs">
  545. 累计
  546. </div>
  547. </div>
  548. <div data-type="" class="date-box">
  549. <input data-type="" type="text" id="select_sDate" placeholder="选择开始时间 - 结束时间"
  550. readonly autocomplete="off" class="layui-input" />
  551. </div>
  552. </div>
  553. </div>
  554. </div>
  555. </div>
  556. <div style="float:right;">
  557. <button class="layui-btn sBtn ml10 submitbtn" id="searchbtn" type="button"
  558. lay-filter="table-search">
  559. 筛选
  560. </button>
  561. <button type="reset" class="layui-btn sBtn ml10" id="resetbtn">重置</button>
  562. </div>
  563. </div>
  564. </form>
  565. <div style="clear: both;"></div>
  566. </div>
  567. <div class="crmsearchlist relative">
  568. <i class="layui-icon layui-icon-set-fill lay-setting"></i>
  569. <table lay-filter="crmsearchlist" id="crmsearchlist"></table>
  570. </div>
  571. </div>
  572. <!-- -->
  573. <div class="lay-mask layui-hide">
  574. <div class="lay-block">
  575. <div class="lay-title">
  576. <span>表格显示设置</span>
  577. <i class="layui-icon layui-icon-close"></i>
  578. </div>
  579. <div class="layui-content layui-form">
  580. </div>
  581. </div>
  582. </div>
  583. </body>
  584. <script src="__LAYUI__/layui/layui.js"></script>
  585. <script type="text/javascript" src="__STATIC__/js/Sortable.js"></script>
  586. {/block}{block name="js"}
  587. <script type="text/html" id="crmname">
  588. {{d.name?d.name:'未知'}}
  589. {{# if(d.jiaoding_time){ }}
  590. <span class="dingjingorder">定金</span>
  591. {{# }else{ }}
  592. {{# } }}
  593. </script>
  594. <script type="text/html" id="empname">
  595. {{# if(d.employee){ }}
  596. {{d.employee.name}}
  597. {{# if(d.add_wechat=='是'){ }}
  598. <span class="addvx">v</span>
  599. {{# }else{ }}
  600. {{# } }}
  601. {{# }else{ }}
  602. <span style="color: #cccccc;">无</span>
  603. {{# if(d.add_wechat=='是'){ }}
  604. <span class="addvx">v</span>
  605. {{# }else{ }}
  606. {{# } }}
  607. {{# } }}
  608. </script>
  609. <script type="text/html" id="square">
  610. {{# if(d.square>200){ }}
  611. <span style="font-weight: bold;color: #ff6600;">{{d.square}}</span>
  612. {{# }else if(d.square){ }}
  613. <span >{{d.square}}</span>
  614. {{# }else{ }}
  615. <span style="color: #cccccc;">无</span>
  616. {{# } }}
  617. </script>
  618. <script type="text/html" id="designer_name">
  619. {{# if(d.designer){ }}
  620. <span>{{d.designer.name}}</span>
  621. {{# }else{ }}
  622. <span style="color: #cccccc;">无</span>
  623. {{# } }}
  624. </script>
  625. <script type="text/html" id="source">
  626. {{# if(d.source){ }}
  627. <span>{{d.source.source}}</span>
  628. {{# }else{ }}
  629. <span style="color: #cccccc;">无</span>
  630. {{# } }}
  631. </script>
  632. <script type="text/html" id="status">
  633. {{# if(d.state=="待确认"){ }}
  634. <div class="unstatusbox" lay-event="unstatus">
  635. <input type="checkbox" class="redconfirm">
  636. <span class="statusbox">{{d.time_status?d.time_status:'-'}}</span>
  637. </div>
  638. {{# }else if(d.visit_log_count==0){ }}
  639. <span style="color: #cccccc;">-</span>
  640. {{# }else { }}
  641. <span>{{d.time_status}}</span>
  642. {{# } }}
  643. </script>
  644. <script type="text/html" id="editbox">
  645. {{# if(d.state=="待确认" && d.is_followup == 1){ }}
  646. <a style="display:inline-block;" lay-event="edit" href="javascript:void(0);">编辑</a>
  647. {{# }else { }}
  648. {{# if(d.is_followup == 1){ }}
  649. <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>
  650. {{# } }}
  651. {{# } }}
  652. </script>
  653. <script type="text/html" id="designer_nametpl">
  654. {{# if(d.designer){ }}
  655. <span>{{d.designer.name}}</span>
  656. {{# }else{ }}
  657. <span style="color: #cccccc;">无</span>
  658. {{# } }}
  659. </script>
  660. <script type="text/html" id="employee_nametpl">
  661. {{# if(d.employee){ }}
  662. <span>{{d.employee.name}}</span>
  663. {{# }else{ }}
  664. <span style="color: #cccccc;">无</span>
  665. {{# } }}
  666. </script>
  667. <script type="text/html" id="phone">
  668. <div>
  669. {{# if(d.phone){ }}
  670. <div>{{d.phone}}</div>
  671. {{# } }}
  672. {{# if(d.phone1){ }}
  673. <p>{{d.phone1}}</p>
  674. {{# } }}
  675. {{# if(d.phone2){ }}
  676. <p>{{d.phone2}}</p>
  677. {{# } }}
  678. </div>
  679. </script>
  680. <script type="text/html" id="stateTpl">
  681. {{# if(d.allstate){ }}
  682. <span>{{d.allstate}}</span>
  683. {{# }else{ }}
  684. <span style="color: #cccccc;">无</span>
  685. {{# } }}
  686. </script>
  687. <script type="text/html" id="level">
  688. {{# if(d.level){ }}
  689. <span>{{d.level}}</span>
  690. {{# }else{ }}
  691. <span style="color: #cccccc;">无</span>
  692. {{# } }}
  693. </script>
  694. <script type="text/html" id="last_contact_date">
  695. {{# if(d.last_contact_date){ }}
  696. <span>{{d.last_contact_date}}</span>
  697. {{# }else{ }}
  698. <span style="color: #cccccc;">无</span>
  699. {{# } }}
  700. </script>
  701. <script type="text/html" id="revisit_time">
  702. {{# if(d.revisit_time){ }}
  703. {{# if(d.revisit_time =='0000-00-00'){ }}
  704. <span style="color: #cccccc;">无</span>
  705. {{# }else{ }}
  706. <span>{{d.revisit_time}}</span>
  707. {{# } }}
  708. {{# }else{ }}
  709. <span style="color: #cccccc;">无</span>
  710. {{# } }}
  711. </script>
  712. <script type="text/html" id="protectTpl">
  713. {{# if(d.protected_to){ }}
  714. <span>{{d.protected_to}}</span>
  715. {{# }else{ }}
  716. <span style="color: #cccccc;">无</span>
  717. {{# } }}
  718. </script>
  719. <script type="text/javascript">
  720. var reload = null, resizefun = null;
  721. layui.config({
  722. base: '__LAYUI__/',
  723. urlbase: '/sys'
  724. }).extend({
  725. index: 'lib/index' //主入口模块
  726. }).use(['table', 'laydate'], function () {
  727. var table = layui.table,
  728. laydate = layui.laydate,
  729. $ = layui.$;
  730. form = layui.form,
  731. fType = 1;
  732. var field = {};
  733. // if (is_manager != 1) {
  734. // $('.totalBox').addClass('layui-hide');
  735. // $('.topStyle1').removeClass('layui-hide');
  736. // $('.topStyle2').addClass('layui-hide');
  737. // }
  738. // form.on('submit(search)', function (data) {
  739. // var source_id = $('[name=source_id]').val();
  740. // var designer_id = $('[name=designer_id]').val();
  741. // var level = $('[name=level]').val();
  742. // var keyname = $('[name=keyname]').val();
  743. // var state = $('[name=state]').val();
  744. // var addtime = $('[name=addtime]').val();
  745. // var followtime = $('[name=followtime]').val();
  746. // var employee_id = $('[name=employee_id]').val();
  747. // field['keyname'] = keyname;
  748. // field['source_id'] = source_id;
  749. // field['designer_id'] = designer_id;
  750. // field['level'] = level;
  751. // field['state'] = state;
  752. // field['addtime'] = addtime;
  753. // field['followtime'] = followtime;
  754. // field['employee_id'] = employee_id;
  755. // //执行重载
  756. // table.reload('crmsearchlist', {
  757. // where: field
  758. // , page: { curr: 1 }
  759. // });
  760. // // if (is_manager == 1) {
  761. // // getStatistics();
  762. // // getStatisticsMore();
  763. // // }
  764. // });
  765. $('#searchbtn').click(function () {
  766. var keyword = $("#keyword").val();
  767. var org_id = $("#org_id").val();
  768. let sDate = $("#sDate").val();
  769. let option = {
  770. where: {
  771. keyword: keyword,
  772. org_id: org_id,
  773. start_date: sDate
  774. },
  775. page: {
  776. curr: 1,
  777. },
  778. };
  779. //执行重载
  780. table.reload("crmsearchlist", option);
  781. });
  782. //重置
  783. $("#resetbtn").click(function () {
  784. $("#keyword").val("");
  785. $("#sDate").val("");
  786. $("#org_id").val("");
  787. $('#reset_form')[0].reset();
  788. layui.form.render();
  789. let option = {
  790. where: { keyword: "", start_date: "", org_id: "" },
  791. page: {
  792. curr: 1,
  793. },
  794. };
  795. table.reload("crmsearchlist", option);
  796. });
  797. $("#addWechatTime").click(function () {
  798. $(".selectDateBox").toggleClass("layui-hide");
  799. $(".selecstDateBox").addClass("layui-hide");
  800. });
  801. $("#sDate").click(function () {
  802. $(".selecstDateBox").toggleClass("layui-hide");
  803. $(".selectDateBox").addClass("layui-hide");
  804. });
  805. laydate.render({
  806. elem: "#select_date",
  807. type: "date",
  808. range: true,
  809. format: "yyyy/MM/dd",
  810. trigger: "click", //呼出事件改成click
  811. done: function (value, date, endDate) {
  812. $(".selectDateBox").addClass("layui-hide");
  813. $("#addWechatTime").val(value);
  814. },
  815. });
  816. laydate.render({
  817. elem: "#select_sDate", //指定元素
  818. type: "date",
  819. format: "yyyy/MM/dd",
  820. range: true,
  821. trigger: "click", //呼出事件改成click
  822. done: function (value, date, endDate) {
  823. $(".selecstDateBox").addClass("layui-hide");
  824. $("#sDate").val(value);
  825. },
  826. });
  827. var dateObj = {};
  828. setDate();
  829. function setDate() {
  830. let date = new Date();
  831. let year = date.getFullYear();
  832. let month = date.getMonth() + 1;
  833. let day = date.getDate();
  834. let lastDate = new Date(new Date().getTime() - 1 * 24 * 60 * 60 * 1000);
  835. let lastYear = lastDate.getFullYear();
  836. let lastMonth = lastDate.getMonth() + 1;
  837. let lastDay = lastDate.getDate();
  838. let weekObj = getMondayAndSunday();
  839. let monthObj = getMonthFirstDayAndLastDay();
  840. dateObj = {
  841. today: `${year}/${month}/${day}`,
  842. yesterday: `${lastYear}/${lastMonth}/${lastDay}`,
  843. ...weekObj,
  844. ...monthObj,
  845. };
  846. }
  847. $(".date-flex div").click(function () {
  848. let type = $(this).prop("dataset").type;
  849. if (type == "today") {
  850. $("#select_date").val(`${dateObj.today} - ${dateObj.today}`);
  851. $("#addWechatTime").val(`${dateObj.today} - ${dateObj.today}`);
  852. } else if (type == "yesterday") {
  853. $("#select_date").val(`${dateObj.yesterday} - ${dateObj.yesterday}`);
  854. $("#addWechatTime").val(`${dateObj.yesterday} - ${dateObj.yesterday}`);
  855. } else if (type == "week") {
  856. $("#select_date").val(
  857. `${dateObj.thisWeekMonday} - ${dateObj.thisWeekSunday}`
  858. );
  859. $("#addWechatTime").val(
  860. `${dateObj.thisWeekMonday} - ${dateObj.thisWeekSunday}`
  861. );
  862. } else if (type == "lastWeek") {
  863. $("#select_date").val(
  864. `${dateObj.lastWeekMonday} - ${dateObj.lastWeekSunday}`
  865. );
  866. $("#addWechatTime").val(
  867. `${dateObj.lastWeekMonday} - ${dateObj.lastWeekSunday}`
  868. );
  869. } else if (type == "month") {
  870. $("#select_date").val(
  871. `${dateObj.thisMonthFirstDay} - ${dateObj.thisMonthLastDay}`
  872. );
  873. $("#addWechatTime").val(
  874. `${dateObj.thisMonthFirstDay} - ${dateObj.thisMonthLastDay}`
  875. );
  876. } else if (type == "lastMonth") {
  877. $("#select_date").val(
  878. `${dateObj.lastMonthFirstDay} - ${dateObj.lastMonthLastDay}`
  879. );
  880. $("#addWechatTime").val(
  881. `${dateObj.lastMonthFirstDay} - ${dateObj.lastMonthLastDay}`
  882. );
  883. } else {
  884. $("#select_date").val("");
  885. $("#sDate").val("");
  886. $("#addWechatTime").val("");
  887. }
  888. $(".selectDateBox").addClass("layui-hide");
  889. });
  890. $(".date-flex1 div").click(function () {
  891. let type = $(this).prop("dataset").type;
  892. if (type == "today") {
  893. $("#select_sDate").val(`${dateObj.today} - ${dateObj.today}`);
  894. $("#sDate").val(`${dateObj.today} - ${dateObj.today}`);
  895. } else if (type == "yesterday") {
  896. $("#select_sDate").val(`${dateObj.yesterday} - ${dateObj.yesterday}`);
  897. $("#sDate").val(`${dateObj.yesterday} - ${dateObj.yesterday}`);
  898. } else if (type == "week") {
  899. $("#select_sDate").val(
  900. `${dateObj.thisWeekMonday} - ${dateObj.thisWeekSunday}`
  901. );
  902. $("#sDate").val(
  903. `${dateObj.thisWeekMonday} - ${dateObj.thisWeekSunday}`
  904. );
  905. } else if (type == "lastWeek") {
  906. $("#select_sDate").val(
  907. `${dateObj.lastWeekMonday} - ${dateObj.lastWeekSunday}`
  908. );
  909. $("#sDate").val(
  910. `${dateObj.lastWeekMonday} - ${dateObj.lastWeekSunday}`
  911. );
  912. } else if (type == "month") {
  913. $("#select_sDate").val(
  914. `${dateObj.thisMonthFirstDay} - ${dateObj.thisMonthLastDay}`
  915. );
  916. $("#sDate").val(
  917. `${dateObj.thisMonthFirstDay} - ${dateObj.thisMonthLastDay}`
  918. );
  919. } else if (type == "lastMonth") {
  920. $("#select_sDate").val(
  921. `${dateObj.lastMonthFirstDay} - ${dateObj.lastMonthLastDay}`
  922. );
  923. $("#sDate").val(
  924. `${dateObj.lastMonthFirstDay} - ${dateObj.lastMonthLastDay}`
  925. );
  926. } else {
  927. $("#select_sDate").val("");
  928. $("#sDate").val("");
  929. }
  930. $(".selecstDateBox").addClass("layui-hide");
  931. });
  932. function getMondayAndSunday() {
  933. var today = new Date();
  934. //构建当前日期,格式:2022-08-22 00:00:00
  935. var year = today.getFullYear(); //本年
  936. var month = today.getMonth() + 1; //本月
  937. var day = today.getDate(); //本日
  938. var newDate = new Date(year + "/" + month + "/" + day + " 00:00:00"); //年月日拼接
  939. var nowTime = newDate.getTime(); //当前的时间戳
  940. var weekDay = newDate.getDay(); //当前星期 0.1.2.3.4.5.6 【0 = 周日】
  941. var oneDayTime = 24 * 60 * 60 * 1000; //一天的总ms
  942. // 当前星期减去天数,如今天为周五,则本周一为周五的时间戳减去4天的时间戳。但周日特殊,周一至周六是周几的到的weekDay就是几,但是周日的到的为0,需特殊处理
  943. var thisWeekMondayTime = (1 - weekDay) * oneDayTime + nowTime; //本周一的时间戳
  944. if (weekDay == 0) {
  945. // weekDay = 0 为周日,此时本周一时间为周日减去6天的时间
  946. thisWeekMondayTime = nowTime - 6 * oneDayTime;
  947. }
  948. var thisWeekSundayTime = thisWeekMondayTime + 6 * 24 * 60 * 60 * 1000; // 本周日
  949. var lastWeekMondayTime = thisWeekMondayTime - 7 * oneDayTime; // 上周一
  950. var lastWeekSundayTime = thisWeekMondayTime - oneDayTime; // 上周日
  951. var res = {
  952. thisWeekMonday: dateToYYYYMMDD(thisWeekMondayTime),
  953. thisWeekSunday: dateToYYYYMMDD(thisWeekSundayTime),
  954. lastWeekMonday: dateToYYYYMMDD(lastWeekMondayTime),
  955. lastWeekSunday: dateToYYYYMMDD(lastWeekSundayTime),
  956. };
  957. return res;
  958. }
  959. function getMonthFirstDayAndLastDay() {
  960. var date = new Date();
  961. // 值得注意的是,如果day取值为0,意味着取的是date时间的上一个月的最后一天,简单理解:date当前月的第一天,再减去一天
  962. var thisMonthFirstDay = date.setDate(1); // 本月第一天
  963. var thisMonthLastDay = new Date(
  964. date.getFullYear(),
  965. date.getMonth() + 1,
  966. 0
  967. ); // 本月最后一天
  968. var lastMonthFirstDay = new Date(
  969. date.getFullYear(),
  970. date.getMonth() - 1,
  971. 1
  972. ); // 上月第一天
  973. var lastMonthLastDay = date.setDate(0); // 上月最后一天
  974. // var day = new Date(date.getFullYear(), date.getMonth(), 0).getDate()
  975. // var lastMonthLastDay = new Date(date.getFullYear(), date.getMonth() - 1, day) // 上月最后一天
  976. var res = {
  977. thisMonthFirstDay: dateToYYYYMMDD(thisMonthFirstDay),
  978. thisMonthLastDay: dateToYYYYMMDD(thisMonthLastDay),
  979. lastMonthFirstDay: dateToYYYYMMDD(lastMonthFirstDay),
  980. lastMonthLastDay: dateToYYYYMMDD(lastMonthLastDay),
  981. };
  982. return res;
  983. }
  984. function dateToYYYYMMDD(date) {
  985. var time = new Date(date);
  986. var y = time.getFullYear();
  987. var m = time.getMonth() + 1;
  988. m = m > 9 ? m : "0" + m;
  989. var d = time.getDate();
  990. d = d > 9 ? d : "0" + d;
  991. return y + "/" + m + "/" + d;
  992. }
  993. ajaxlist();
  994. function ajaxlist() {
  995. $.ajax({
  996. type: "post",
  997. url: '{:url("empcrm/poolFieldsList")}',
  998. data: {
  999. type: 3
  1000. },
  1001. success: function (res) {
  1002. if(res.code == 403){
  1003. $(".exitbtn").trigger("click");
  1004. }
  1005. data = res.data;
  1006. tableData = data;
  1007. var cols = [[]];
  1008. $.each(data, function (key, val) {
  1009. if (val['show'] == 1) {
  1010. cols[0].push({ field: key, title: val['name'], width: val['width'], align: 'center', show: val['show'] })
  1011. }
  1012. })
  1013. cols[0].push({ title: '', width: 30, align: 'center', fixed: "right" })
  1014. let url = '{:url("ManagerEmp/manageStatistics")}';
  1015. var keyword = $("#keyword").val();
  1016. var org_id = $("#org_id").val();
  1017. let sDate = $("#sDate").val();
  1018. table.render({
  1019. elem: '#crmsearchlist',
  1020. url: url,
  1021. cols: cols,
  1022. where: {
  1023. keyword: keyword,
  1024. org_id: org_id,
  1025. start_date: sDate
  1026. },
  1027. page: true,
  1028. limits: [17],
  1029. limit: 17, //每页默认显示的数量,
  1030. height: 'full-120',
  1031. text: '对不起,加载出现异常!',
  1032. done: function (res, curr, count) {
  1033. // res.data.forEach(function (item, index) {
  1034. // if (item.fresh > 0) {
  1035. // $('.layui-table').find('tr[data-index="' + index + '"]').addClass('novisitlog');
  1036. // }
  1037. // });
  1038. }
  1039. });
  1040. }
  1041. });
  1042. }
  1043. $('.lay-setting').click(function () {
  1044. let arr = [];
  1045. $.each(data, function (key, val) {
  1046. arr.push({ ...val, field: key });
  1047. })
  1048. renderTableSwitch(arr, 3);
  1049. $('.lay-mask').removeClass('layui-hide');
  1050. })
  1051. $('.layui-icon-close').click(function () {
  1052. $('.lay-mask').addClass('layui-hide');
  1053. })
  1054. $('.lay-block').click(function (e) {
  1055. e.stopPropagation();
  1056. })
  1057. $('.lay-mask').click(function () {
  1058. $(this).addClass('layui-hide');
  1059. })
  1060. function renderTableSwitch(data, types) {
  1061. let htmls = data.map((item, index) => {
  1062. return `<div class="lay-item sort_time">
  1063. <div class="sort_lis01">
  1064. <img style="display:${types == 5 ? 'none' : 'block'}" src="__STATIC__/img/sorticon.png" width="16px" alt="">
  1065. <span>${item.name}</span>
  1066. </div>
  1067. <div class="sort_lis02">
  1068. <input type="checkbox" lay-filter="tableSort" ${item.show == 1 ? 'checked' : ''} name="${item.field}" lay-skin="switch">
  1069. </div>
  1070. </div>`;
  1071. }).join('');
  1072. $('.layui-content').html(htmls);
  1073. setTimeout(() => {
  1074. form.render();
  1075. var check = '';
  1076. var names = '';
  1077. form.on('switch(tableSort)', function (data) {
  1078. getdatalist(types);
  1079. })
  1080. new Sortable($('.layui-content')[0], {
  1081. handle: '.lay-item', // handle's class
  1082. animation: 150,
  1083. // 结束拖拽
  1084. onEnd: function (/**Event*/evt) {
  1085. getdatalist(types, 0);
  1086. },
  1087. });
  1088. }, 300)
  1089. }
  1090. function getdatalist(types) {
  1091. let getCheckedField = $('.sort_time');
  1092. let itemArr = [];
  1093. let check;
  1094. getCheckedField.each(function (i) {
  1095. let ischeck = $(this).find('input').prop("checked");
  1096. if (ischeck) {
  1097. check = 1
  1098. } else {
  1099. check = 0
  1100. }
  1101. let names = $(this).find('input').attr('name');
  1102. itemArr.push({ name: names, show: check, sort: i + 1 });
  1103. })
  1104. var datajson = JSON.stringify(itemArr);
  1105. $.ajax({
  1106. type: "post",
  1107. url: '{:url("empcrm/poolFieldsSet")}',
  1108. data: {
  1109. type: types,
  1110. content: datajson
  1111. },
  1112. success: function (res) {
  1113. if(res.code == 403){
  1114. $(".exitbtn").trigger("click");
  1115. }
  1116. ajaxlist()
  1117. }
  1118. })
  1119. }
  1120. resizefun = function () {
  1121. table.resize('crmsearchlist');
  1122. };
  1123. reload = function () {
  1124. table.reload('crmsearchlist', { where: field }, true);
  1125. };
  1126. var flag = true;
  1127. table.on('tool(crmsearchlist)', function (result) {
  1128. let event = result.event;
  1129. let row = result.data;
  1130. flag = true;
  1131. if (event === "unstatus") {
  1132. flag = false;
  1133. if (confirm('是否确认为有效线索?')) {
  1134. $.ajax({
  1135. url: '{:url("empcrm/validation")}'
  1136. , data: {
  1137. customer_id: row.id,// (客户id)
  1138. state: '未到访',
  1139. }
  1140. , type: 'post'
  1141. , success: function (res) {
  1142. if (res.code == 0) {
  1143. $(result.tr).children('td').children('div').children('div').children('.redconfirm')[0].checked = true;
  1144. $(result.tr).children('td').children('div').children('div').children('.redconfirm')[0].disabled = true;
  1145. if (row.visit_log_count == 0) {
  1146. $(result.tr).children('td[data-field="time_status"]').children('div').html('<span style="color: #cccccc;">-</span>');
  1147. } else {
  1148. $(result.tr).children('td[data-field="time_status"]').children('div').html('<span' + row.time_status + '</span>');
  1149. }
  1150. row.state = "未到访";
  1151. alert('成功:更改成功,线索为有效状态!!!');
  1152. }else if(res.code == 403){
  1153. $(".exitbtn").trigger("click");
  1154. } else {
  1155. alert(res.msg)
  1156. }
  1157. }
  1158. });
  1159. } else {
  1160. $(result.tr).children('td').children('div').children('div').children('.redconfirm')[0].checked = false;
  1161. $(result.tr).children('td').children('div').children('div').children('.redconfirm')[0].disabled = false;
  1162. $(result.tr).children('td').children('div').children('div').children('.layui-unselect').removeClass('layui-form-checked');
  1163. }
  1164. return false;
  1165. } else if (event === "edit") {
  1166. flag = false;
  1167. window.parent.editcrmsg(result.data.id)
  1168. return false;
  1169. } else if (event === "editstate") {
  1170. flag = false;
  1171. window.parent.statemsg(result.data.id, 'list.html');
  1172. return false;
  1173. } else {
  1174. flag = true;
  1175. }
  1176. flag = true;
  1177. })
  1178. // $('.crmsearchlist').on('click', 'td', function (e) {
  1179. // var _event = $(this).find('[lay-event]').attr('lay-event');
  1180. // var _obj = table.cache.crmsearchlist[parseInt($(this).parent('tr').attr('data-index'))];
  1181. // switch (_event) {
  1182. // case 'unstatus':
  1183. // break;
  1184. // case 'edit':
  1185. // break;
  1186. // case 'editstate':
  1187. // break;
  1188. // default:
  1189. // flag = true;
  1190. // $('#customer_detail')[0].src = "/empcrm/empcrm/addlog.html?cid=" + _obj.id;
  1191. // $('.crmbox').addClass('rightbox');
  1192. // $('#customer_detail').show();
  1193. // resizefun();
  1194. // }
  1195. // return false; //阻止事件冒泡
  1196. // })
  1197. // table.on('row(crmsearchlist)', function (obj) {
  1198. // var data = obj.data;
  1199. // if (flag) {
  1200. // $('#customer_detail')[0].src = "/empcrm/empcrm/addlog.html?cid=" + data.id;
  1201. // $('.crmbox').addClass('rightbox');
  1202. // $('#customer_detail').show();
  1203. // for (let i = 0; i < $('.crmsearchlist .layui-table-view .layui-table-box .layui-table tr').length; i++) {
  1204. // $($('.crmsearchlist .layui-table-view .layui-table-box .layui-table tr')[i]).removeClass('onclickbg');
  1205. // }
  1206. // $(obj.tr).addClass('onclickbg');
  1207. // resizefun();
  1208. // }
  1209. // });
  1210. $('.searchbtn').click(function () {
  1211. window.parent.addcrmmsg('list.html')
  1212. })
  1213. })
  1214. function removealog(params) {
  1215. $('#customer_detail').hide();
  1216. $('.crmbox').removeClass('rightbox');
  1217. }
  1218. </script>
  1219. {/block}