12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355 |
- {extend name="public/layout"}
- {block name="body"}
- <link rel="stylesheet" href="__LAYUI__/layui/css/layui.css" media="all">
- <link rel="stylesheet" href=" /static/css/common.css">
- <script src="/static/js/jquery.min.js"></script>
- <style>
- body {
- padding-bottom: 40px;
- }
- .searchtitlebox {
- display: block;
- padding: 15px 10px;
- border: 1px solid #F0F0F0;
- background: #FCFCFC;
- margin-top: 5px;
- margin-bottom: 10px;
- /* position: relative; */
- min-width: 800px;
- }
- .searchbox {
- display: block;
- margin-top: 8px;
- text-align: center;
- }
- .searchbox input {
- display: inline-block;
- height: 26px;
- line-height: 26px;
- padding-left: 3px;
- vertical-align: middle;
- border: 2px solid #4479ba;
- }
- body {
- font-size: 12px;
- font-family: "宋体";
- }
- .searchbox .searchbtn {
- display: inline-block;
- float: right;
- border: none;
- width: 98px;
- height: 30px;
- color: #fff;
- font-size: 14px;
- font-weight: bold;
- text-align: center;
- background: url(__STATIC__/img/icon-sub.png) no-repeat;
- cursor: pointer;
- vertical-align: middle;
- }
- .selectbox {
- float: left;
- }
- .leftselect {
- float: left;
- height: 26px;
- line-height: 26px;
- }
- .selectbox select {
- float: left;
- height: 26px;
- }
- .searchtext {
- border: 1px solid #ccc;
- background: #fff url(__STATIC__/img/icon071402.png) no-repeat;
- padding: 1px 2px;
- height: 24px;
- line-height: 24px;
- vertical-align: middle;
- text-indent: 3px;
- margin-left: 4px;
- }
- .searchbtn1 {
- margin-left: 4px;
- cursor: pointer;
- color: #000;
- background: url(__STATIC__/img/btn_bg.gif) repeat-x;
- border: 1px solid #C0C0C0;
- padding: 0 12px;
- *padding: 0 6px;
- height: 26px;
- }
- .layui-table td,
- .layui-table th {
- font-size: 12px;
- }
- .layui-table th {
- font-weight: bold;
- }
- .dingjingorder {
- height: 25px;
- width: 40px;
- background-color: #65c001;
- color: #FFF;
- text-align: center;
- line-height: 25px;
- z-index: 100;
- display: block;
- position: absolute;
- top: 1px;
- right: 3px;
- border-radius: 11px;
- font-size: 12px;
- }
- .addvx {
- position: absolute;
- top: -5px;
- right: 1px;
- height: 14px;
- line-height: 14px;
- font-size: 16px;
- color: #666;
- font-family: "宋体";
- }
- .statebox {
- width: 40px;
- text-align: center;
- z-index: 100;
- display: block;
- position: absolute;
- font-size: 12px;
- top: -5px;
- right: 0px;
- border-radius: 0px;
- background: #4285f4;
- color: #efefef;
- height: 20px;
- line-height: 20px;
- }
- .layui-table-cell {
- overflow: initial;
- }
- #customer_detail {
- display: block;
- width: 435px;
- height: 100%;
- position: fixed;
- top: 0;
- left: 0;
- bottom: 0;
- }
- .rightbox {
- display: block;
- width: calc(100% - 435px);
- margin-left: 435px;
- }
- .unstatusbox {
- display: block;
- position: absolute;
- top: -5px;
- left: 0;
- width: 100%;
- height: 37px;
- background-color: #FF6600;
- text-align: center;
- color: #FFF;
- }
- .statusbox {
- position: absolute;
- top: 0px;
- right: 0px;
- color: #666;
- text-align: right;
- z-index: 100;
- display: block;
- font-size: 12px;
- }
- .layui-table-view .layui-form-checkbox {
- width: 16px;
- height: 16px;
- line-height: 16px;
- padding-right: 0;
- }
- .layui-table-view .layui-form-checkbox i {
- height: 16px;
- width: 16px;
- font-size: 14px;
- }
- .novisitlog {
- background-color: #9139db !important;
- color: #FFF;
- }
- .novisitlog a {
- color: #FFF;
- }
- .crmsearchlist {
- max-height: 760px;
- cursor: pointer;
- }
- .tablebox .layui-form.layui-border-box.layui-table-view {
- max-height: 760px !important;
- height: auto !important;
- }
- .layui-table-body {
- /* max-height: 670px !important; */
- height: auto !important;
- }
- .layui-table-view .layui-table td {
- cursor: pointer;
- overflow: hidden;
- }
- .layui-form-checked {
- background-color: #37AF6E;
- }
- .layui-table-view .layui-form-checked i {
- color: #fff;
- }
- .layui-table-cell {
- overflow: hidden;
- }
- .searchbox .layui-form-select {
- float: left;
- width: 130px;
- }
- .searchbox input {
- border: 1px solid #e6e6e6 !important;
- }
- .totalBox {
- width: 100%;
- height: 100px;
- border: 1px solid #f2f2f2;
- display: flex;
- align-items: center;
- }
- .totalBox>div {
- flex: 1;
- display: flex;
- flex-direction: column;
- align-items: center;
- justify-content: center;
- }
- .totalName {
- font-size: 16px;
- color: #999999;
- }
- .totalNum {
- font-size: 20px;
- font-weight: 600;
- }
- .totalline {
- flex: none !important;
- width: 1px !important;
- height: 50px !important;
- background-color: #f2f2f2;
- }
- .ml5 {
- margin-left: 5px;
- }
- .cursor {
- cursor: pointer;
- margin-bottom: 8px;
- position: relative;
- }
- .cursor>.layui-form-select {
- width: 115px;
- display: inline-block;
- }
- .cursor>.layui-form-select>.layui-select-title {
- border: none;
- }
- .cursor>.layui-form-select>.layui-select-title>input {
- border: none;
- color: #333333;
- font-weight: 600;
- }
- /* .layui-table-fixed-r .layui-table-body {
- overflow: hidden !important;
- } */
- .relative {
- position: relative;
- }
- .lay-setting {
- position: absolute;
- right: 10px;
- top: 10px;
- z-index: 999 !important;
- cursor: pointer;
- }
- .lay-mask {
- width: 100%;
- height: 100%;
- background-color: rgba(0, 0, 0, 0.3);
- position: fixed;
- top: 0px;
- left: 0px;
- z-index: 9999 !important;
- }
- .lay-block {
- width: 400px;
- height: 100%;
- background-color: #fff;
- position: absolute;
- right: 0px;
- top: 0px;
- box-sizing: border-box;
- padding: 10px 10px 30px 10px;
- overflow: auto;
- }
- .lay-title {
- width: 100%;
- height: 40px;
- display: flex;
- align-items: center;
- justify-content: space-between;
- }
- .lay-title>span {
- font-size: 16px;
- color: #333333;
- font-weight: 600;
- }
- .lay-title>i {
- font-weight: 600;
- cursor: pointer;
- }
- .layui-content {
- width: 100%;
- height: auto;
- }
- .lay-item {
- width: 100%;
- height: 50px;
- /* display: flex;
- align-items: center;
- justify-content: space-between; */
- }
- .lay-item>div {
- display: flex;
- align-items: center;
- }
- .lay-item>div>span {
- margin-left: 6px;
- }
- .sort_lis01 {
- float: left;
- }
- .sort_lis02 {
- float: right;
- }
- .sort_time {
- overflow: hidden;
- }
- .layui-form-switch i {
- top: 2px !important;
- }
- .relative {
- position: relative;
- }
- .selectDateBox {
- position: absolute;
- width: 330px;
- height: 100px;
- box-shadow: 0 2px 4px rgb(0 0 0 / 12%);
- background-color: #fff;
- z-index: 99999 !important;
- top: 45px;
- box-sizing: border-box;
- padding: 5px 8px;
- }
- .selecstDateBox {
- position: absolute;
- width: 330px;
- height: 100px;
- box-shadow: 0 2px 4px rgb(0 0 0 / 12%);
- background-color: #fff;
- z-index: 99999 !important;
- top: 45px;
- right: 0;
- box-sizing: border-box;
- padding: 5px 8px;
- }
- .date-flex,
- .date-flex1 {
- display: flex;
- align-items: center;
- }
- .date-box {
- padding: 15px 0px 10px;
- }
- .line-middle {
- width: 10px;
- height: 100%;
- margin: 0px 10px;
- }
- .line {
- width: 10px;
- height: 2px;
- background-color: #999999;
- }
- .mb0 {
- margin-bottom: 0px;
- }
- .layui-btn {
- background-color: #fff;
- color: #555;
- border: 1px solid #c9c9c9;
- }
- .layui-btn:hover {
- background-color: #fff;
- color: #555;
- border: 1px solid #249efb;
- }
- .layui-btn-primary,
- .sBtn {
- background-color: #249efb;
- color: #fff;
- border: 1px solid #249efb;
- }
- .layui-btn-primary:hover {
- background-color: #249efb;
- color: #fff;
- border: 1px solid #249efb;
- }
- .sBtn:hover {
- background-color: #249efb;
- color: #fff;
- border: 1px solid #249efb;
- }
- .flex-row,
- .row {
- display: flex;
- }
- .align-center {
- align-items: center;
- }
- .ml10 {
- margin-left: 10px;
- }
- .mt10 {
- margin-top: 10px;
- }
- .padding-tlr {
- padding: 15px 15px 0px;
- }
- .layui-input-block {
- margin-left: 0px;
- }
- .justify-between {
- justify-content: space-between;
- }
- .qdtj_m {
- padding: 0 15px;
- width: 100%;
- box-sizing: border-box;
- margin: 20px 0 10px;
- }
- .qdtj_ul {
- overflow: hidden;
- border: 1px solid #94d0ff;
- padding: 15px 0;
- background-color: #fbfdff;
- }
- .qdtj_ul li {
- float: left;
- position: relative;
- text-align: center;
- width: 10%;
- }
- .qdtj_1 {
- font-size: 20px;
- font-weight: 400;
- }
- .qdtj_2 {
- font-size: 14px;
- color: #888;
- margin-top: 5px;
- }
- .qdtj_r_x {
- height: 40px;
- width: 1px;
- background: #d8d8d9;
- position: absolute;
- right: 0;
- top: 50%;
- margin-top: -20px;
- }
- ::-webkit-scrollbar {
- width: auto;
- height: auto;
- }
- ::-webkit-scrollbar-thumb {
- border-radius: 10px;
- -webkit-box-shadow: inset 0 0 2px rgba(0, 0, 0, 0.2);
- background: #DFDFDF;
- }
- ::-webkit-scrollbar-track {
- -webkit-box-shadow: inset 0 0 2px rgba(0, 0, 0, 0.2);
- border-radius: 10px;
- background: #f5f5f5;
- }
- </style>
- <body class="clearfix">
- <iframe id="customer_detail" style="display: none;" src=""></iframe>
- <div class="crmbox">
- <div class="search-form layui-form padding-tlr" style="margin-bottom: 10px;">
- <!-- <div class="flex-row align-center justify-between" style="overflow: hidden;"> -->
- <form id="reset_form">
- <div class="" style="">
- <div class="flex-row align-center" style="float:left;">
- <div class="layui-input-block">
- <input type="text" class="layui-input" id="keyword" autocomplete="off" name="keyword"
- placeholder="请输入员工名称" />
- </div>
- <div class="layui-input-inline layui-form ml10">
- <select name="org_id" class="type_id" id="org_id" lay-search>
- <option value="">请选择部门</option>
- {volist name="org" id="i"}
- <option value="{$i.id}">{$i.name}</option>
- {/volist}
- </select>
- </div>
- <div class="layui-input-inline layui-form ml10" style="display: inline-block">
- <!-- <label class="layui-form-label" style="width: 60px;">跟进时间</label> -->
- <div class="layui-input-inline select-date relative">
- <!-- 注意:这一层元素并不是必须的 -->
- <input type="text" class="layui-input" id="sDate" name="start_date"
- placeholder="开始日期 - 结束日期" autocomplete="off" />
- <div data-type="" class="selecstDateBox layui-hide">
- <div data-type="" class="date-flex1">
- <div data-type="today"
- class="layui-btn layui-btn-primary layui-border-blue layui-btn-xs">
- 今日
- </div>
- <div data-type="yesterday"
- class="layui-btn layui-btn-primary layui-border-blue layui-btn-xs">
- 昨日
- </div>
- <div data-type="week"
- class="layui-btn layui-btn-primary layui-border-blue layui-btn-xs">
- 本周
- </div>
- <div data-type="lastWeek"
- class="layui-btn layui-btn-primary layui-border-blue layui-btn-xs">
- 上周
- </div>
- <div data-type="month"
- class="layui-btn layui-btn-primary layui-border-blue layui-btn-xs">
- 本月
- </div>
- <div data-type="lastMonth"
- class="layui-btn layui-btn-primary layui-border-blue layui-btn-xs">
- 上月
- </div>
- <div data-type="all"
- class="layui-btn layui-btn-primary layui-border-blue layui-btn-xs">
- 累计
- </div>
- </div>
- <div data-type="" class="date-box">
- <input data-type="" type="text" id="select_sDate" placeholder="选择开始时间 - 结束时间"
- readonly autocomplete="off" class="layui-input" />
- </div>
- </div>
- </div>
- </div>
- </div>
- <div style="float:right;">
- <button class="layui-btn sBtn ml10 submitbtn" id="searchbtn" type="button"
- lay-filter="table-search">
- 筛选
- </button>
- <button type="reset" class="layui-btn sBtn ml10" id="resetbtn">重置</button>
- </div>
- </div>
- </form>
- <div style="clear: both;"></div>
- </div>
- <div class="crmsearchlist relative">
- <i class="layui-icon layui-icon-set-fill lay-setting"></i>
- <table lay-filter="crmsearchlist" id="crmsearchlist"></table>
- </div>
- </div>
- <!-- -->
- <div class="lay-mask layui-hide">
- <div class="lay-block">
- <div class="lay-title">
- <span>表格显示设置</span>
- <i class="layui-icon layui-icon-close"></i>
- </div>
- <div class="layui-content layui-form">
- </div>
- </div>
- </div>
- </body>
- <script src="__LAYUI__/layui/layui.js"></script>
- <script type="text/javascript" src="__STATIC__/js/Sortable.js"></script>
- {/block}{block name="js"}
- <script type="text/html" id="crmname">
- {{d.name?d.name:'未知'}}
- {{# if(d.jiaoding_time){ }}
- <span class="dingjingorder">定金</span>
- {{# }else{ }}
- {{# } }}
- </script>
- <script type="text/html" id="empname">
- {{# if(d.employee){ }}
- {{d.employee.name}}
- {{# if(d.add_wechat=='是'){ }}
- <span class="addvx">v</span>
- {{# }else{ }}
- {{# } }}
- {{# }else{ }}
- <span style="color: #cccccc;">无</span>
- {{# if(d.add_wechat=='是'){ }}
- <span class="addvx">v</span>
- {{# }else{ }}
- {{# } }}
- {{# } }}
- </script>
- <script type="text/html" id="square">
- {{# if(d.square>200){ }}
- <span style="font-weight: bold;color: #ff6600;">{{d.square}}</span>
- {{# }else if(d.square){ }}
- <span >{{d.square}}</span>
- {{# }else{ }}
- <span style="color: #cccccc;">无</span>
- {{# } }}
- </script>
- <script type="text/html" id="designer_name">
- {{# if(d.designer){ }}
- <span>{{d.designer.name}}</span>
- {{# }else{ }}
- <span style="color: #cccccc;">无</span>
- {{# } }}
- </script>
- <script type="text/html" id="source">
- {{# if(d.source){ }}
- <span>{{d.source.source}}</span>
- {{# }else{ }}
- <span style="color: #cccccc;">无</span>
- {{# } }}
- </script>
- <script type="text/html" id="status">
- {{# if(d.state=="待确认"){ }}
- <div class="unstatusbox" lay-event="unstatus">
- <input type="checkbox" class="redconfirm">
- <span class="statusbox">{{d.time_status?d.time_status:'-'}}</span>
- </div>
- {{# }else if(d.visit_log_count==0){ }}
- <span style="color: #cccccc;">-</span>
- {{# }else { }}
- <span>{{d.time_status}}</span>
- {{# } }}
- </script>
- <script type="text/html" id="editbox">
- {{# if(d.state=="待确认" && d.is_followup == 1){ }}
- <a style="display:inline-block;" lay-event="edit" href="javascript:void(0);">编辑</a>
- {{# }else { }}
- {{# if(d.is_followup == 1){ }}
- <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>
- {{# } }}
- {{# } }}
- </script>
- <script type="text/html" id="designer_nametpl">
- {{# if(d.designer){ }}
- <span>{{d.designer.name}}</span>
- {{# }else{ }}
- <span style="color: #cccccc;">无</span>
- {{# } }}
- </script>
- <script type="text/html" id="employee_nametpl">
- {{# if(d.employee){ }}
- <span>{{d.employee.name}}</span>
- {{# }else{ }}
- <span style="color: #cccccc;">无</span>
- {{# } }}
- </script>
- <script type="text/html" id="phone">
- <div>
- {{# if(d.phone){ }}
- <div>{{d.phone}}</div>
- {{# } }}
- {{# if(d.phone1){ }}
- <p>{{d.phone1}}</p>
- {{# } }}
- {{# if(d.phone2){ }}
- <p>{{d.phone2}}</p>
- {{# } }}
- </div>
- </script>
- <script type="text/html" id="stateTpl">
- {{# if(d.allstate){ }}
- <span>{{d.allstate}}</span>
- {{# }else{ }}
- <span style="color: #cccccc;">无</span>
- {{# } }}
- </script>
- <script type="text/html" id="level">
- {{# if(d.level){ }}
- <span>{{d.level}}</span>
- {{# }else{ }}
- <span style="color: #cccccc;">无</span>
- {{# } }}
- </script>
- <script type="text/html" id="last_contact_date">
- {{# if(d.last_contact_date){ }}
- <span>{{d.last_contact_date}}</span>
- {{# }else{ }}
- <span style="color: #cccccc;">无</span>
- {{# } }}
- </script>
- <script type="text/html" id="revisit_time">
- {{# if(d.revisit_time){ }}
- {{# if(d.revisit_time =='0000-00-00'){ }}
- <span style="color: #cccccc;">无</span>
- {{# }else{ }}
- <span>{{d.revisit_time}}</span>
- {{# } }}
- {{# }else{ }}
- <span style="color: #cccccc;">无</span>
- {{# } }}
- </script>
- <script type="text/html" id="protectTpl">
- {{# if(d.protected_to){ }}
- <span>{{d.protected_to}}</span>
- {{# }else{ }}
- <span style="color: #cccccc;">无</span>
- {{# } }}
- </script>
- <script type="text/javascript">
- var reload = null, resizefun = null;
- layui.config({
- base: '__LAYUI__/',
- urlbase: '/sys'
- }).extend({
- index: 'lib/index' //主入口模块
- }).use(['table', 'laydate'], function () {
- var table = layui.table,
- laydate = layui.laydate,
- $ = layui.$;
- form = layui.form,
- fType = 1;
- var field = {};
- // if (is_manager != 1) {
- // $('.totalBox').addClass('layui-hide');
- // $('.topStyle1').removeClass('layui-hide');
- // $('.topStyle2').addClass('layui-hide');
- // }
- // form.on('submit(search)', function (data) {
- // var source_id = $('[name=source_id]').val();
- // var designer_id = $('[name=designer_id]').val();
- // var level = $('[name=level]').val();
- // var keyname = $('[name=keyname]').val();
- // var state = $('[name=state]').val();
- // var addtime = $('[name=addtime]').val();
- // var followtime = $('[name=followtime]').val();
- // var employee_id = $('[name=employee_id]').val();
- // field['keyname'] = keyname;
- // field['source_id'] = source_id;
- // field['designer_id'] = designer_id;
- // field['level'] = level;
- // field['state'] = state;
- // field['addtime'] = addtime;
- // field['followtime'] = followtime;
- // field['employee_id'] = employee_id;
- // //执行重载
- // table.reload('crmsearchlist', {
- // where: field
- // , page: { curr: 1 }
- // });
- // // if (is_manager == 1) {
- // // getStatistics();
- // // getStatisticsMore();
- // // }
- // });
- $('#searchbtn').click(function () {
- var keyword = $("#keyword").val();
- var org_id = $("#org_id").val();
- let sDate = $("#sDate").val();
- let option = {
- where: {
- keyword: keyword,
- org_id: org_id,
- start_date: sDate
- },
- page: {
- curr: 1,
- },
- };
- //执行重载
- table.reload("crmsearchlist", option);
- });
- //重置
- $("#resetbtn").click(function () {
- $("#keyword").val("");
- $("#sDate").val("");
- $("#org_id").val("");
- $('#reset_form')[0].reset();
- layui.form.render();
- let option = {
- where: { keyword: "", start_date: "", org_id: "" },
- page: {
- curr: 1,
- },
- };
- table.reload("crmsearchlist", option);
- });
- $("#addWechatTime").click(function () {
- $(".selectDateBox").toggleClass("layui-hide");
- $(".selecstDateBox").addClass("layui-hide");
- });
- $("#sDate").click(function () {
- $(".selecstDateBox").toggleClass("layui-hide");
- $(".selectDateBox").addClass("layui-hide");
- });
- laydate.render({
- elem: "#select_date",
- type: "date",
- range: true,
- format: "yyyy/MM/dd",
- trigger: "click", //呼出事件改成click
- done: function (value, date, endDate) {
- $(".selectDateBox").addClass("layui-hide");
- $("#addWechatTime").val(value);
- },
- });
- laydate.render({
- elem: "#select_sDate", //指定元素
- type: "date",
- format: "yyyy/MM/dd",
- range: true,
- trigger: "click", //呼出事件改成click
- done: function (value, date, endDate) {
- $(".selecstDateBox").addClass("layui-hide");
- $("#sDate").val(value);
- },
- });
- var dateObj = {};
- setDate();
- function setDate() {
- let date = new Date();
- let year = date.getFullYear();
- let month = date.getMonth() + 1;
- let day = date.getDate();
- let lastDate = new Date(new Date().getTime() - 1 * 24 * 60 * 60 * 1000);
- let lastYear = lastDate.getFullYear();
- let lastMonth = lastDate.getMonth() + 1;
- let lastDay = lastDate.getDate();
- let weekObj = getMondayAndSunday();
- let monthObj = getMonthFirstDayAndLastDay();
- dateObj = {
- today: `${year}/${month}/${day}`,
- yesterday: `${lastYear}/${lastMonth}/${lastDay}`,
- ...weekObj,
- ...monthObj,
- };
- }
- $(".date-flex div").click(function () {
- let type = $(this).prop("dataset").type;
- if (type == "today") {
- $("#select_date").val(`${dateObj.today} - ${dateObj.today}`);
- $("#addWechatTime").val(`${dateObj.today} - ${dateObj.today}`);
- } else if (type == "yesterday") {
- $("#select_date").val(`${dateObj.yesterday} - ${dateObj.yesterday}`);
- $("#addWechatTime").val(`${dateObj.yesterday} - ${dateObj.yesterday}`);
- } else if (type == "week") {
- $("#select_date").val(
- `${dateObj.thisWeekMonday} - ${dateObj.thisWeekSunday}`
- );
- $("#addWechatTime").val(
- `${dateObj.thisWeekMonday} - ${dateObj.thisWeekSunday}`
- );
- } else if (type == "lastWeek") {
- $("#select_date").val(
- `${dateObj.lastWeekMonday} - ${dateObj.lastWeekSunday}`
- );
- $("#addWechatTime").val(
- `${dateObj.lastWeekMonday} - ${dateObj.lastWeekSunday}`
- );
- } else if (type == "month") {
- $("#select_date").val(
- `${dateObj.thisMonthFirstDay} - ${dateObj.thisMonthLastDay}`
- );
- $("#addWechatTime").val(
- `${dateObj.thisMonthFirstDay} - ${dateObj.thisMonthLastDay}`
- );
- } else if (type == "lastMonth") {
- $("#select_date").val(
- `${dateObj.lastMonthFirstDay} - ${dateObj.lastMonthLastDay}`
- );
- $("#addWechatTime").val(
- `${dateObj.lastMonthFirstDay} - ${dateObj.lastMonthLastDay}`
- );
- } else {
- $("#select_date").val("");
- $("#sDate").val("");
- $("#addWechatTime").val("");
- }
- $(".selectDateBox").addClass("layui-hide");
- });
- $(".date-flex1 div").click(function () {
- let type = $(this).prop("dataset").type;
- if (type == "today") {
- $("#select_sDate").val(`${dateObj.today} - ${dateObj.today}`);
- $("#sDate").val(`${dateObj.today} - ${dateObj.today}`);
- } else if (type == "yesterday") {
- $("#select_sDate").val(`${dateObj.yesterday} - ${dateObj.yesterday}`);
- $("#sDate").val(`${dateObj.yesterday} - ${dateObj.yesterday}`);
- } else if (type == "week") {
- $("#select_sDate").val(
- `${dateObj.thisWeekMonday} - ${dateObj.thisWeekSunday}`
- );
- $("#sDate").val(
- `${dateObj.thisWeekMonday} - ${dateObj.thisWeekSunday}`
- );
- } else if (type == "lastWeek") {
- $("#select_sDate").val(
- `${dateObj.lastWeekMonday} - ${dateObj.lastWeekSunday}`
- );
- $("#sDate").val(
- `${dateObj.lastWeekMonday} - ${dateObj.lastWeekSunday}`
- );
- } else if (type == "month") {
- $("#select_sDate").val(
- `${dateObj.thisMonthFirstDay} - ${dateObj.thisMonthLastDay}`
- );
- $("#sDate").val(
- `${dateObj.thisMonthFirstDay} - ${dateObj.thisMonthLastDay}`
- );
- } else if (type == "lastMonth") {
- $("#select_sDate").val(
- `${dateObj.lastMonthFirstDay} - ${dateObj.lastMonthLastDay}`
- );
- $("#sDate").val(
- `${dateObj.lastMonthFirstDay} - ${dateObj.lastMonthLastDay}`
- );
- } else {
- $("#select_sDate").val("");
- $("#sDate").val("");
- }
- $(".selecstDateBox").addClass("layui-hide");
- });
- function getMondayAndSunday() {
- var today = new Date();
- //构建当前日期,格式:2022-08-22 00:00:00
- var year = today.getFullYear(); //本年
- var month = today.getMonth() + 1; //本月
- var day = today.getDate(); //本日
- var newDate = new Date(year + "/" + month + "/" + day + " 00:00:00"); //年月日拼接
- var nowTime = newDate.getTime(); //当前的时间戳
- var weekDay = newDate.getDay(); //当前星期 0.1.2.3.4.5.6 【0 = 周日】
- var oneDayTime = 24 * 60 * 60 * 1000; //一天的总ms
- // 当前星期减去天数,如今天为周五,则本周一为周五的时间戳减去4天的时间戳。但周日特殊,周一至周六是周几的到的weekDay就是几,但是周日的到的为0,需特殊处理
- var thisWeekMondayTime = (1 - weekDay) * oneDayTime + nowTime; //本周一的时间戳
- if (weekDay == 0) {
- // weekDay = 0 为周日,此时本周一时间为周日减去6天的时间
- thisWeekMondayTime = nowTime - 6 * oneDayTime;
- }
- var thisWeekSundayTime = thisWeekMondayTime + 6 * 24 * 60 * 60 * 1000; // 本周日
- var lastWeekMondayTime = thisWeekMondayTime - 7 * oneDayTime; // 上周一
- var lastWeekSundayTime = thisWeekMondayTime - oneDayTime; // 上周日
- var res = {
- thisWeekMonday: dateToYYYYMMDD(thisWeekMondayTime),
- thisWeekSunday: dateToYYYYMMDD(thisWeekSundayTime),
- lastWeekMonday: dateToYYYYMMDD(lastWeekMondayTime),
- lastWeekSunday: dateToYYYYMMDD(lastWeekSundayTime),
- };
- return res;
- }
- function getMonthFirstDayAndLastDay() {
- var date = new Date();
- // 值得注意的是,如果day取值为0,意味着取的是date时间的上一个月的最后一天,简单理解:date当前月的第一天,再减去一天
- var thisMonthFirstDay = date.setDate(1); // 本月第一天
- var thisMonthLastDay = new Date(
- date.getFullYear(),
- date.getMonth() + 1,
- 0
- ); // 本月最后一天
- var lastMonthFirstDay = new Date(
- date.getFullYear(),
- date.getMonth() - 1,
- 1
- ); // 上月第一天
- var lastMonthLastDay = date.setDate(0); // 上月最后一天
- // var day = new Date(date.getFullYear(), date.getMonth(), 0).getDate()
- // var lastMonthLastDay = new Date(date.getFullYear(), date.getMonth() - 1, day) // 上月最后一天
- var res = {
- thisMonthFirstDay: dateToYYYYMMDD(thisMonthFirstDay),
- thisMonthLastDay: dateToYYYYMMDD(thisMonthLastDay),
- lastMonthFirstDay: dateToYYYYMMDD(lastMonthFirstDay),
- lastMonthLastDay: dateToYYYYMMDD(lastMonthLastDay),
- };
- return res;
- }
- function dateToYYYYMMDD(date) {
- var time = new Date(date);
- var y = time.getFullYear();
- var m = time.getMonth() + 1;
- m = m > 9 ? m : "0" + m;
- var d = time.getDate();
- d = d > 9 ? d : "0" + d;
- return y + "/" + m + "/" + d;
- }
- ajaxlist();
- function ajaxlist() {
- $.ajax({
- type: "post",
- url: '{:url("empcrm/poolFieldsList")}',
- data: {
- type: 3
- },
- success: function (res) {
- if(res.code == 403){
- $(".exitbtn").trigger("click");
- }
- data = res.data;
- tableData = data;
- var cols = [[]];
- $.each(data, function (key, val) {
- if (val['show'] == 1) {
- cols[0].push({ field: key, title: val['name'], width: val['width'], align: 'center', show: val['show'] })
- }
- })
- cols[0].push({ title: '', width: 30, align: 'center', fixed: "right" })
- let url = '{:url("ManagerEmp/manageStatistics")}';
- var keyword = $("#keyword").val();
- var org_id = $("#org_id").val();
- let sDate = $("#sDate").val();
- table.render({
- elem: '#crmsearchlist',
- url: url,
- cols: cols,
- where: {
- keyword: keyword,
- org_id: org_id,
- start_date: sDate
- },
- page: true,
- limits: [17],
- limit: 17, //每页默认显示的数量,
- height: 'full-120',
- text: '对不起,加载出现异常!',
- done: function (res, curr, count) {
- // res.data.forEach(function (item, index) {
- // if (item.fresh > 0) {
- // $('.layui-table').find('tr[data-index="' + index + '"]').addClass('novisitlog');
- // }
- // });
- }
- });
- }
- });
- }
- $('.lay-setting').click(function () {
- let arr = [];
- $.each(data, function (key, val) {
- arr.push({ ...val, field: key });
- })
- renderTableSwitch(arr, 3);
- $('.lay-mask').removeClass('layui-hide');
- })
- $('.layui-icon-close').click(function () {
- $('.lay-mask').addClass('layui-hide');
- })
- $('.lay-block').click(function (e) {
- e.stopPropagation();
- })
- $('.lay-mask').click(function () {
- $(this).addClass('layui-hide');
- })
- function renderTableSwitch(data, types) {
- let htmls = data.map((item, index) => {
- return `<div class="lay-item sort_time">
- <div class="sort_lis01">
- <img style="display:${types == 5 ? 'none' : 'block'}" src="__STATIC__/img/sorticon.png" width="16px" alt="">
- <span>${item.name}</span>
- </div>
- <div class="sort_lis02">
- <input type="checkbox" lay-filter="tableSort" ${item.show == 1 ? 'checked' : ''} name="${item.field}" lay-skin="switch">
- </div>
- </div>`;
- }).join('');
- $('.layui-content').html(htmls);
- setTimeout(() => {
- form.render();
- var check = '';
- var names = '';
- form.on('switch(tableSort)', function (data) {
- getdatalist(types);
- })
- new Sortable($('.layui-content')[0], {
- handle: '.lay-item', // handle's class
- animation: 150,
- // 结束拖拽
- onEnd: function (/**Event*/evt) {
- getdatalist(types, 0);
- },
- });
- }, 300)
- }
- function getdatalist(types) {
- let getCheckedField = $('.sort_time');
- let itemArr = [];
- let check;
- getCheckedField.each(function (i) {
- let ischeck = $(this).find('input').prop("checked");
- if (ischeck) {
- check = 1
- } else {
- check = 0
- }
- let names = $(this).find('input').attr('name');
- itemArr.push({ name: names, show: check, sort: i + 1 });
- })
- var datajson = JSON.stringify(itemArr);
- $.ajax({
- type: "post",
- url: '{:url("empcrm/poolFieldsSet")}',
- data: {
- type: types,
- content: datajson
- },
- success: function (res) {
- if(res.code == 403){
- $(".exitbtn").trigger("click");
- }
- ajaxlist()
- }
- })
- }
- resizefun = function () {
- table.resize('crmsearchlist');
- };
- reload = function () {
- table.reload('crmsearchlist', { where: field }, true);
- };
- var flag = true;
- table.on('tool(crmsearchlist)', function (result) {
- let event = result.event;
- let row = result.data;
- flag = true;
- if (event === "unstatus") {
- flag = false;
- if (confirm('是否确认为有效线索?')) {
- $.ajax({
- url: '{:url("empcrm/validation")}'
- , data: {
- customer_id: row.id,// (客户id)
- state: '未到访',
- }
- , type: 'post'
- , success: function (res) {
- if (res.code == 0) {
- $(result.tr).children('td').children('div').children('div').children('.redconfirm')[0].checked = true;
- $(result.tr).children('td').children('div').children('div').children('.redconfirm')[0].disabled = true;
- if (row.visit_log_count == 0) {
- $(result.tr).children('td[data-field="time_status"]').children('div').html('<span style="color: #cccccc;">-</span>');
- } else {
- $(result.tr).children('td[data-field="time_status"]').children('div').html('<span' + row.time_status + '</span>');
- }
- row.state = "未到访";
- alert('成功:更改成功,线索为有效状态!!!');
- }else if(res.code == 403){
- $(".exitbtn").trigger("click");
- } else {
- alert(res.msg)
- }
- }
- });
- } else {
- $(result.tr).children('td').children('div').children('div').children('.redconfirm')[0].checked = false;
- $(result.tr).children('td').children('div').children('div').children('.redconfirm')[0].disabled = false;
- $(result.tr).children('td').children('div').children('div').children('.layui-unselect').removeClass('layui-form-checked');
- }
- return false;
- } else if (event === "edit") {
- flag = false;
- window.parent.editcrmsg(result.data.id)
- return false;
- } else if (event === "editstate") {
- flag = false;
- window.parent.statemsg(result.data.id, 'list.html');
- return false;
- } else {
- flag = true;
- }
- flag = true;
- })
- // $('.crmsearchlist').on('click', 'td', function (e) {
- // var _event = $(this).find('[lay-event]').attr('lay-event');
- // var _obj = table.cache.crmsearchlist[parseInt($(this).parent('tr').attr('data-index'))];
- // switch (_event) {
- // case 'unstatus':
- // break;
- // case 'edit':
- // break;
- // case 'editstate':
- // break;
- // default:
- // flag = true;
- // $('#customer_detail')[0].src = "/empcrm/empcrm/addlog.html?cid=" + _obj.id;
- // $('.crmbox').addClass('rightbox');
- // $('#customer_detail').show();
- // resizefun();
- // }
- // return false; //阻止事件冒泡
- // })
- // table.on('row(crmsearchlist)', function (obj) {
- // var data = obj.data;
- // if (flag) {
- // $('#customer_detail')[0].src = "/empcrm/empcrm/addlog.html?cid=" + data.id;
- // $('.crmbox').addClass('rightbox');
- // $('#customer_detail').show();
- // for (let i = 0; i < $('.crmsearchlist .layui-table-view .layui-table-box .layui-table tr').length; i++) {
- // $($('.crmsearchlist .layui-table-view .layui-table-box .layui-table tr')[i]).removeClass('onclickbg');
- // }
- // $(obj.tr).addClass('onclickbg');
- // resizefun();
- // }
- // });
- $('.searchbtn').click(function () {
- window.parent.addcrmmsg('list.html')
- })
- })
- function removealog(params) {
- $('#customer_detail').hide();
- $('.crmbox').removeClass('rightbox');
- }
- </script>
- {/block}
|