123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537 |
- {extend name="public/layout" /} {block name="title"}素材库{/block} {block name="body"}
- <link rel="stylesheet" href="__STATIC__/css/csspc.css">
- <link rel="stylesheet" href="__STATIC__/css/font.css">
- <link rel="stylesheet" " href=" __STATIC__/css/common.css">
- <style type="text/css">
- html,body{
- background: #f5f5f5;
- font-size: 12px;
- padding-bottom: 60px;
- }
- .toptitbox{
- display: block;
- width: 900px;
- padding: 15px 10px;
- border: 1px solid #F0F0F0;
- background: #FCFCFC;
- margin-bottom: 10px;
- position: relative;
- line-height: 28px;
- }
- .golastbtn{
- display: block;
- margin-right: 21px;
- color: #000;
- background: url(__STATIC__/img/btn_bg.gif) repeat-x;
- border: 1px solid #C0C0C0;
- padding: 0 12px;
- *padding: 0 6px;
- height: 28px;
- cursor: pointer;
- }
- .mainbox{
- display: block;
- width: 900px;
- height:100%;
- padding-top: 20px;
- margin: 0 auto;
- }
- .bodys{
- height: calc(100% - 20px);
- padding: 25px;
- background-color: #fff;
- }
- .layui-icon {
- font-size: 18px !important;
- line-height: 38px;
- }
- .layui-table-view .layui-table th,
- .layui-table-view .layui-table td {
- text-align: center;
- border-color: #B6CADE;
- }
- .upload-img .area i {
- font-size: 50px;
- color: #009688;
- }
- .evi-block {
- float: left;
- margin-right: 10px;
- }
- /*///*/
- .addImages {
- display: inline-block;
- width: 140px;
- height: 125px;
- -webkit-box-sizing: border-box;
- -moz-box-sizing: border-box;
- box-sizing: border-box;
- border: 1px dashed darkgray;
- background: #f8f8f8;
- position: relative;
- overflow: hidden;
- }
- .text-detail {
- margin-top: 40px;
- text-align: center;
- }
- .text-detail>span {
- font-size: 40px;
- }
- .imageDiv div {
- width: 100%;
- height: 100%;
- position: absolute;
- top: 0px;
- background-color: #e6e6e600;
- }
- .imageDiv div i {
- display: none;
- font-size: 31px;
- position: absolute;
- top: 37%;
- left: 40%;
- }
- .imageDiv div:hover {
- background-color: #e6e6e680;
- }
- .imageDiv div:hover i {
- display: block;
- cursor: pointer;
- }
- .layui-card-header p a:hover {
- text-decoration-line: underline;
- }
- .clearfix::after {
- clear: both;
- content: ' ';
- display: table;
- }
- .clearfix::before {
- content: ' ';
- display: table;
- }
- .left {
- float: left;
- }
- .templetbox {
- display: block;
- width: 80px;
- height: 80px;
- border:unset;
- text-align: center;
- background-color: #fff;
- box-shadow: 0 0 10px 6px rgba(209,205,205,0.2);
- cursor: pointer;
- }
- .templetbox img {
- display: block;
- width: 40px;
- margin: 14px auto 4px;
- }
- .templetbox span,
- .templetbox button {
- display: block;
- width: 100%;
- text-align: center;
- font-size: 12px;
- color: #384855;
- height: 20px;
- background-color: transparent;
- line-height: 20px;
- }
- .leftextbox {
- color: #249efb;
- font-size: 14px;
- line-height: 88px;
- margin-right: 32px;
- }
- .uploadbox {
- margin-left: 40px;
- }
- .noticebox {
- margin-top: 40px;
- }
- .sourcebox {
- margin-top: 40px;
- }
- .sourcebtn {
- padding-left: 0;
- width: auto;
- }
- .sourceinput {
- margin-left: 84px;
- }
- .width33_3{
- width: 33.333%;
- }
- .resultbox{
- display: block;
- border: 1px solid #e6e6e6;
- margin-top: 24px;
- padding: 16px 0;
- }
- .everyresultbox{
- height: 48px;
- border-right: 1px solid #e6e6e6;
- box-sizing: border-box;
- text-align: center;
- line-height: 48px;
- }
- .resultbox .everyresultbox:last-child{
- border: unset;
- }
- .numbox{
- height: 18px;
- font-size: 12px;
- padding: 0 2px;
- background-color: #249efb;
- color: #fff;
- line-height: 18px;
- margin-right: 4px;
- border-radius: 4px;
- }
- .sourcebox .layui-form-select{width:50%;display: inline-block;}
- .layui-form-select dl{max-height: 200px;}
- </style>
- <body>
- <div class="mainbox">
- <div class="clearfix toptitbox">
- <div class="left">您当前的操作 · <b>资源库添加</b></div>
- <div class="right">
- <div class="left">点击这里返回列表:</div>
- <button class="left golastbtn" type="button">返回列表</button>
- </div>
- </div>
- <div class="bodys wpsr">
- <div class="layui-fluid">
- <div class="layui-card">
- <div class="layui-card-body">
- <form class="layui-form">
- <div class="layui-upload">
- <div class="clearfix">
- <div class="left clearfix">
- <div class="left leftextbox">资源模板</div>
- <a class="left templetbox" href="../../static/templist.xlsx" download>
- <img src="__STATIC__/img/file.png" />
- <span>下载模板</span>
- </a>
- </div>
- <div class="left uploadbox">
- <div class="left leftextbox">资源分配</div>
- <!--<button type="button" class="left templetbox" id="excelfile">
- <img src="__STATIC__/img/upload.png" />
- <span>上传文档</span>
- </button>-->
- <div class="left templetbox" id="excelfile" style="cursor: pointer;" href>
- <img src="__STATIC__/img/upload.png" />
- <span>上传文档</span>
- <input type="file" hidden id="xlsx-file" accept=".xls,.xlsx" />
- </div>
- <span class="layui-inline layui-upload-choose filename" style="line-height: 80px;"></span>
- </div>
- </div>
- <p class="noticebox" style="color:red"><span>注意:
- <br/>
- 1、客户姓名最长20个字符以内,超过20个字符不再显示
- <br/>
- 2、客户重要等级仅限A/B/C/D,未按要求上传则不记录客户重要等级
- <br/>
- 3、仅支持xlsx、xls格式,若未按照规范,则可能造成导入失败(单次限制3000条数据)</span></p>
- <div class="layui-form-item sourcebox">
- <label class="layui-form-label sourcebtn"><span style="color:red">*</span>来源渠道:</label>
- <div class="layui-input-block sourceinput">
-
- <!--<input type="text" name="" id="sourcelist" required lay-verify="required" placeholder="请输入来源渠道" autocomplete="off" class="layui-input layui-qd">-->
- <select name="from">
- {volist name='source' id='v'}
- <option value="{$v.id}" {eq name="$old_source" value="$v.id" }selected{/eq}>{$v.source}</option>
- {/volist}
- </select>
- <!--<a href="javascript:void(0)" class="layui-btn layui-btn-primary" id="cate_add" data-type="source">添加客户来源</a>-->
- <i class="layui-icon layui-icon-add-circle adding"
- style="font-size: 32px;margin-left:5px;cursor: pointer;" id="cate_add" data-type="source"></i>
- </div>
- </div>
- </div>
-
- <div class="layui-form-item ">
- <button class="layui-btn submitbox" lay-submit style="float:right" lay-filter="submit">开始上传</button>
- </div>
- </form>
- </div>
- </div>
- <div class="resultbox clearfix" style="display:none;">
- <div class="left width33_3 everyresultbox">
- <span class="numbox badphone">0</span>
- <span>无效线索数</span>
- </div>
- <div class="left width33_3 everyresultbox">
- <span class="numbox avaliable">0</span>
- <span>有效线索数</span>
- </div>
- <div class="left width33_3 everyresultbox">
- <span class="numbox repeat">0</span>
- <span>重复数</span>
- </div>
- </div>
- <div id="loadings" hidden><span style="color:black;margin: 43%;">上传中请稍后...</span></div>
- </div>
- </div>
- </div>
-
- </body>
- {/block} {block name="js"}
- <script src="__STATIC__/js/xlsx.core.min.js"></script>
- <!-- <script type="text/javascript" src="__STATIC__/js/plupload/js/plupload.full.min.js"></script> -->
- <script>
- layui.config({
- base: '__LAYUI__/' //静态资源所在路径
- ,
- urlbase: '/sys'
- }).extend({
- index: 'lib/index' //主入口模块
- }).use(['index', 'form', 'upload'], function () {
- var $ = layui.$,
- form = layui.form,
- upload = layui.upload,
- isloading = false;
- $('#sourcelist').on('click', function () {
- layer.open({
- type:2,
- title:'来源渠道',
- content:'{:url("crm/sourcelist")}',
- area:['1000px', '600px']
- });
- });
-
- $('#cate_add').click(function () {
- var title = '添加客户来源';
- layer.prompt({ title: [title, 'color:#333333;background-color:#D8E6F1;'], }, function (value, index) {
- var data = {};
- data['source'] = value;
- edit(data);
- layer.close(index);
- });
- });
-
-
- var edit = function (data) {
- requestAjax('{:url("crm/apisourceadding")}', data)
- }
- var requestAjax = function (url, data) {
- $.post(url, data, function (res) {
- if (res.code === 0) {
- layer.msg(res.msg, {
- icon: 1,
- time: 2000
- }, function () {
- location.reload();
- });
- } else {
- layer.msg(res.msg, {
- icon: 0,
- time: 2000
- });
- }
- })
- }
-
- function isPhoneNum(phone) {
- var myreg =/^(((13[0-9]{1})|(14[0-9]{1})|(15[0-9]{1})|(16[0-9]{1})|(17[0-9]{1})|(18[0-9]{1})|(19[0-9]{1}))+\d{8})$/;
- if (!myreg.test(phone)) {
- return false;
- }
- return true;
- }
- function uniqueArray(arr) {
- const newArr = [];
- var repeat = 0;
- const tmp = new Map();
- for (let i = 0; i < arr.length; i++) {
- if (!tmp.get(arr[i].phone)) {
- tmp.set(arr[i].phone, 1);
- newArr.push(arr[i])
- } else {
- repeat++;
- }
- }
- return [newArr,repeat];
- }
- $('.golastbtn').click(function () {
- window.parent.backresourcefun(window.location.search.split('?')[1], '{:url("manager_emp/importing")}', 'add1');
- })
- $('#excelfile').click(function(){
- $('#xlsx-file')[0].click()
- })
- var fileobj='';
- $('#xlsx-file').change(function(e) {
- fileobj = e.target.files;
- var fileReader = new FileReader();
- $('.filename').html(fileobj[0].name);
- fileReader.readAsDataURL(document.querySelector('#xlsx-file').files[0])
- fileReader.onload = function(ev) {
- try {
- // console.log( ev.target.result)
- } catch (e) {
- console.log('文件类型不正确');
- return;
- }
- };
- });
-
- var log_id='',allnum=0,invalidnum=0,repeatnum=0;
- form.on('submit(submit)', function (obj) {
- if(!fileobj){
- layer.msg("数据不能为空!", {time: 1000});
- return false;
- }
- if (isloading) {
- return false;
- }
- isloading = true;
- $(obj.elem).addClass('layui-btn layui-btn-disabled');
- var myMsg = layer.msg("数据上传中...", {
- icon: 16,
- time: -1,
- shade: 0.01
- })
- let formData = new FormData();
- formData.append('file_name', fileobj[0].name);
- formData.append('source', $('.sourceinput select')[0].value);
- formData.append('file', fileobj[0]);
- $.ajax({
- type: 'post',
- url: '{:url("manager_emp/importLog")}',
- data: formData,
- processData: false,
- contentType: false,
- success: function (data) {
- layer.close(myMsg);//手动关闭
- if (data.code === 0) {
- log_id=data.data;
- layer.msg(data.msg);
- setTimeout(() => {
- isloading = false;
- window.parent.backresourcefun(window.location.search.split('?')[1], '{:url("manager_emp/importing")}', 'add1');
- }, 1500)
- }else if(data.code == 403){
- $(".exitbtn").trigger("click");
- } else {
- layer.msg(data.msg, {
- anim: 6
- , time: 2000
- }, function() {
- isloading = false;
- });
- }
- }
- })
- return false;
- })
- function crmsourceadd(num,persons,myMsg){
- if (!persons.length) {
- layer.msg('Excel数据为空,请检查导入数据内容', {
- anim: 6
- , time: 2000
- });
- return;
- }
- // var index = parent.layer.getFrameIndex(window.name);
- let n= num*40,nextnum= (num*1+1) * 40-1;
- var arr=[];
- for(var i= n;i<= nextnum;i++){
- arr.push(persons[i]);
- }
- if(arr.length==0){
- return false;
- }
-
- $.ajax({
- type: 'post',
- url: '{:url("manager_emp/add")}',
- data: {
- log_id: log_id,
- source_id: $('.sourceinput select')[0].value,
- customers: arr
- },
- dataType: 'json',
- success: function (data) {
-
- if(persons.length- (num*1+1) * 40 <= 0){
- layer.close(myMsg);//手动关闭
- repeatnum = repeatnum * 1 + data.data.repeat * 1;
- invalidnum = invalidnum * 1 + data.data.error * 1;
- if(data.code === 0){
- layer.msg(data.msg, {
- anim: 0
- , time: 2000
- }, function () {
- window.parent.backresourcefun(window.location.search.split('?')[1], '{:url("manager_emp/importing")}','add');
-
- // 关掉本页面,打开上一个页面
- // parent.layui.table.reload('pool_customer_table'); //重载表格
- // parent.layer.close(index); //再执行关闭
- });
- } else {
- layer.msg(data.msg, {
- anim: 6
- , time: 2000
- });
-
- }
- if(data){
- $('.resultbox').show();
- $('.avaliable').html(persons.length);
- $('.badphone').html(invalidnum);
- $('.repeat').html(repeatnum);
- }
- }else{
- repeatnum = repeatnum * 1 + data.data.repeat * 1;
- invalidnum = invalidnum * 1 + data.data.error * 1;
- crmsourceadd(num * 1 + 1, persons, myMsg)
-
-
- }
-
-
- }
- })
- }
-
- });
- </script>
- {/block}
|