chenhao 4 years ago
parent
commit
5692ddd338

+ 14 - 2
application/admin/controller/Customer.php

@@ -205,6 +205,8 @@ class Customer extends Base
                 // 找到这个用户相同公司的人员,然后把这个公司的所有客户都放到此业务员下
                 if (!empty($v['company'])) {
                     CustomerModel::where('company', $v['company'])->update(['spread_id' => $param['id'], 'status' => 2, 'follow_time' => time()]);
+                } else {
+                    CustomerModel::where('id',$v['id'])->update(['spread_id' => $param['id'], 'status' => 2, 'follow_time' => time()]);
                 }
                 $ranking = new RankingModel();
                 $ranking->set_chengjiao($v['id']); // 修改记录表
@@ -230,7 +232,10 @@ class Customer extends Base
                 // 找到这个用户相同公司的人员,然后把这个公司的所有客户都放到此业务员下
                 if (!empty($v['company'])) {
                     CustomerModel::where('company', $v['company'])->update(['spread_id' => $param['id'], 'status' => 1, 'follow_time' => time()]);
+                } else {
+                    CustomerModel::where('id',$v['id'])->update(['spread_id' => $param['id'], 'status' => 1, 'follow_time' => time()]);
                 }
+
                 $ranking = new RankingModel();
                 $ranking->set_huifu($v['id']); // 修改记录表
             }
@@ -261,6 +266,8 @@ class Customer extends Base
                 CustomerModel::where('id', $v['id'])->update(['spread_id' => $customer['spread_id'], 'follow_time' => time(), 'status' => 3, 'guanlianid' => $param['id']]);
                 if(!empty($v['company'])) {
                     CustomerModel::where('company',$v['company'])->update(['spread_id' => $customer['spread_id']]);
+                } else {
+                    CustomerModel::where('id',$v['id'])->update(['spread_id' => $param['id']]);
                 }
                 $ranking = new RankingModel();
                 $ranking->setGuanlian($v['id']); // 修改记录表
@@ -269,9 +276,14 @@ class Customer extends Base
         }
         $ids = input('id');
         $this->assign('ids', $ids);
-        $guanlian = CustomerModel::where('status', 2)->where('giveup', 0)->select();
+        $guanlian = Db::name('customer')->where('status', 2)->where('giveup', 0)->select();
+        foreach ($guanlian as &$v) {
+            $website = explode('##',$v['website']);
+            $v['website'] = $website[0];
+            unset($website);
+        }
         $this->assign('guanlian', $guanlian);
-        return $this->fetch('customer/admin/to_guanlian');
+        return $this->fetch('customer/admin/to_guanlian1');
     }
 
     /**

+ 6 - 2
application/admin/controller/Upload.php

@@ -655,15 +655,19 @@ class Upload extends Base
             $num['success_num'] = count($success);
             $num['zong'] = count($excel_array);
             if ($num['success_num'] > 0) {
-                Db::name('serialize')->insert(['text' => $serialize, 'uni' => $uni, 'status' => 2, 'admin_id' => session('uid'), 'excel_name' => $fileName, 'time' => $serializeTime,'now_status' => 2]);
                 $customer = new CustomerModel();
                 $customer->add_all($success,session('uid')); // 保存处理所有数据;
                 Db::name("import_success")->insertAll($import_success);
             }
             if ($num['error_num'] > 0) {
-                Db::name('serialize')->insert(['text' => $serialize, 'uni' => $uni, 'status' => 3, 'admin_id' => session('uid'), 'excel_name' => $fileName, 'time' => $serializeTime,'now_status' => 2]);
                 Db::name('import_error')->insertAll($error);
             }
+            if ($num['error_num'] == count($excel_array) ) {
+                Db::name('serialize')->insert(['text' => $serialize, 'uni' => $uni, 'status' => 3, 'admin_id' => session('uid'), 'excel_name' => $fileName, 'time' => $serializeTime,'now_status' => 2]);
+            } else {
+                Db::name('serialize')->insert(['text' => $serialize, 'uni' => $uni, 'status' => 2, 'admin_id' => session('uid'), 'excel_name' => $fileName, 'time' => $serializeTime,'now_status' => 2]);
+            }
+
             $tableSerialize = Db::name('serialize')->where('admin_id',session('uid'))->select();
             return json(['code' => 200, 'uni' => $uni, 'msg' => '完成导入', 'success_num' => $num['success_num'], 'error_num' => $num['error_num'],'data' => $tableSerialize]);
         } else {

+ 2 - 2
application/admin/view/customer/admin/to_guanlian.html

@@ -10,8 +10,8 @@
                     <label class="layui-form-label" style="height: 20px;background-color:#C2C5D3;text-align: center ">已成交客户</label>
                     <div class="layui-input-block">
                         <select name="id" lay-verify="required" lay-search="">
-                            {foreach name="guanlian" item="vo"}
-                            <option value="{$vo.id}">{$vo.name}</option>
+                             {foreach name="guanlian" item="vo"}
+                                 <option value="{$vo.id}">{$vo.name}</option>
                             {/foreach}
                         </select>
                     </div>

+ 100 - 0
application/admin/view/customer/admin/to_guanlian1.html

@@ -0,0 +1,100 @@
+{include file="public/header" /}
+<body class="gray-bg">
+<div class="layui-fluid layui-col-md12">
+    <div class="layui-card">
+        <div class="layui-card-body layui-form">
+            <div class="layui-row layui-col-space10 layui-form-item ">
+                <input type="hidden" name = 'ids' value="{$ids}">
+                <div style="margin-left: 30%;font-size: 15px"><strong>关联客户将与成交客户关联在一起</strong></div>
+                <div class="layui-form-item layui-col-md-offset1 layui-col-md8">
+                    <label class="layui-form-label" style="height: 20px;background-color:#C2C5D3;text-align: center ">已成交客户</label>
+                    <div class="layui-input-block">
+                        <select name="id" lay-verify="required" lay-search="">
+                            {foreach name="guanlian" item="vo"}
+                            <option value="{$vo.id}">{$vo.website}</option>
+                            {/foreach}
+                        </select>
+                    </div>
+                </div>
+
+                <div class="layui-form-item layui-col-md-offset1 layui-col-md8" style='text-align:center'>
+                    <div class="layui-input-block">
+                        <button class="layui-btn layui-btn-normal" lay-submit="" lay-filter="component-form-element">保存
+                        </button>
+
+                    </div>
+                </div>
+            </div>
+        </div>
+    </div>
+</div>
+
+{include file="public/footer" /}
+<script type="text/javascript" src="__JS__/plugins/cropper/Crop.js"></script>
+<script>
+    //裁剪后的处理
+    $("#sureCut").on("click",function () {
+        if ($("#tailoringImg").attr("src") == null ){
+            layer.msg('请先选择头像',{anim:6})
+        }else{
+            var cas = $('#tailoringImg').cropper('getCroppedCanvas');//获取被裁剪后的canvas
+            var base64url = cas.toDataURL('image/png'); //转换为base64地址形式
+            $("#img_data").attr('src',base64url).show();
+            $('#data_photo').val(base64url);
+            //关闭裁剪框
+            layer.closeAll();
+        }
+    });
+</script>
+<script>
+    layui.use(['form'], function() {
+        var form = layui.form;
+        // form.verify({
+        //     username:function(value,item){
+        //         if(!/^[\S]{2,10}$/.test(value)){
+        //             return '名称必须2到10字符,且不能出现空格';
+        //         }
+        //         var checkResult = "";
+        //         $.ajax({
+        //             url:"{:url('User/checkName')}",
+        //             type:'post',
+        //             data:"username="+value,
+        //             async: false,//必须同步
+        //             success:function(res){
+        //                 if(res.code == 100){
+        //                     checkResult = "该名称已存在";
+        //                 }
+        //             }
+        //         })
+        //         return checkResult;
+        //     },
+        //     pass: [/^[\S]{6,16}$/,'密码必须6到16位,且不能出现空格'],
+        //     // headCrop:[/^[\S]$/,'头像不能为空'],
+        //     // headCrop:function(value,item){
+        //     //     if(value == ""){
+        //     //         return '头像不能为空';
+        //     //     }
+        //     // },
+        //     realname:[/^[\S]{2,10}$/,'真实姓名必须2到10字符,且不能出现空格']
+        //
+        // });
+        form.on('submit(component-form-element)', function (data) {
+            $('.layui-btn').addClass('layui-disabled').attr('disabled','disabled');
+            $.ajax({
+                url:"{:url('to_guanlian')}",
+                type:'post',
+                dataType:'json',
+                data:data.field,
+                success:function(res){
+                    if (res.code == 200) {
+                        wk.success(res.msg,'wk.layer_close()');
+                    } else {
+                        wk.error(res.msg,'$(".layui-btn").removeClass(\'layui-disabled\').removeAttr(\'disabled\')');
+                    }
+                }
+            })
+        });
+    });
+</script>
+</body>
+</html>

+ 1 - 2
application/admin/view/customer/customer/customer_index_2.html

@@ -244,8 +244,7 @@
 						wk.msg('请至少选择一项');
 						return false;
 					}
-					wk.layer_show('', '{:url('
-						admin / EmailSend / add ')}?id=' + ids);
+					wk.layer_show('', '{:url('admin/EmailSend/add')}?id=' + ids);
 					//成交
 					// wk.chengJiao(getIds(),"{:url('admin/customer/to_chengjiao')}");
 				},