Bladeren bron

会员用户录入修改

shensong 5 jaren geleden
bovenliggende
commit
3d0ea02661

+ 32 - 8
app/Http/Controllers/Admin/CustomerDepositController.php

@@ -353,9 +353,6 @@ class CustomerDepositController extends Controller
353 353
         $team_id = (int)$request->input('team_id');
354 354
 
355 355
         $self_role = session('role_name');
356
-        if($self_role == '销售' || $self_role == '分销销售'){
357
-            $admin_id = session('admin_id');
358
-        }
359 356
 
360 357
         if($self_role == '管理员'){
361 358
             //只能看自己团队的
@@ -428,7 +425,20 @@ class CustomerDepositController extends Controller
428 425
      * @param Request $request
429 426
      */
430 427
     public function addVipCustomer(Request $request) {
431
-        return view('customer/vipCustomerCreate');
428
+        $self_role = session('role_name');
429
+        $team_id = null;
430
+        if($self_role == '管理员'){
431
+            //只能看自己团队的
432
+            $self_id = session('admin_id');
433
+            $team_id = DB::table('admin')->where('id', $self_id)->pluck('team_id');
434
+        }
435
+        $adminList = DB::table('admin')->select('id', 'realname', 'username')->where(function($query) use($team_id, $self_role){
436
+            if($self_role == '管理员') $query->where('team_id', $team_id);
437
+        })->where('id','>', 1)->get();
438
+        $adminList = json_decode(json_encode($adminList), true);
439
+        return view('customer/vipCustomerCreate',[
440
+            'adminlist' => $adminList,
441
+        ]);
432 442
     }
433 443
 
434 444
     /**
@@ -436,7 +446,7 @@ class CustomerDepositController extends Controller
436 446
      * @param Request $request
437 447
      */
438 448
     public function storeVipCustomer(Request $request) {
439
-        $self_id = session('admin_id');
449
+
440 450
         $this->validate($request, [
441 451
             'phone' => 'required',
442 452
             'birthday' => 'required',
@@ -449,7 +459,7 @@ class CustomerDepositController extends Controller
449 459
         $customerVip = new CustomerVip();
450 460
         $customerVip->phone = $request->input('phone');
451 461
         $customerVip->name = $request->input('name');
452
-        $customerVip->admin_id = $self_id;
462
+        $customerVip->admin_id = $request->input('admin_id');
453 463
         $customerVip->level = 1;
454 464
         $customerVip->discount = 95;
455 465
         $customerVip->create_time = date('Y-m-d H:i:s',time());
@@ -479,8 +489,22 @@ class CustomerDepositController extends Controller
479 489
      */
480 490
     public function editVipCustomer(Request $request) {
481 491
         $id = $request->input('id');
492
+        $self_role = session('role_name');
493
+        $team_id = null;
494
+        if($self_role == '管理员'){
495
+            //只能看自己团队的
496
+            $self_id = session('admin_id');
497
+            $team_id = DB::table('admin')->where('id', $self_id)->pluck('team_id');
498
+        }
482 499
         $customer = CustomerVip::findOrFail($id);
483
-        return view('customer/vipCustomerEdit',['info'=>$customer]);
500
+        $adminList = DB::table('admin')->select('id', 'realname', 'username')->where(function($query) use($team_id, $self_role){
501
+            if($self_role == '管理员') $query->where('team_id', $team_id);
502
+        })->where('id','>', 1)->get();
503
+        $adminList = json_decode(json_encode($adminList), true);
504
+        return view('customer/vipCustomerEdit',[
505
+            'info'=>$customer,
506
+            'adminlist' => $adminList,
507
+            ]);
484 508
     }
485 509
 
486 510
     /**
@@ -488,13 +512,13 @@ class CustomerDepositController extends Controller
488 512
      * @param Request $request
489 513
      */
490 514
     public function updateVipCustomer(Request $request) {
491
-        $self_id = session('admin_id');
492 515
         $id = $request->input('id');
493 516
 
494 517
         //修改vip用户信息
495 518
         $customerVip = CustomerVip::findOrFail($id);
496 519
         $customerVip->name = $request->input('name');
497 520
         $customerVip->birthday = $request->input('birthday');
521
+        $customerVip->admin_id = $request->input('admin_id');
498 522
         if($customerVip->save()){
499 523
             return redirect('/admin/customer/vipList')->with('info', '编辑成功');
500 524
         } else {

+ 1 - 1
resources/views/admin/index.blade.php

@@ -75,7 +75,7 @@
75 75
                         <li @if(!isset($res['custreport/detail'])) style="display:none;list-style-type:none;" @endif><a data-href="{{url('admin/custreport/detailindex')}}" data-title="销售上报加粉数据" href="javascript:void(0)">销售上报加粉数据</a></li>
76 76
                         <li @if(!isset($res['custreport/disCostList'])) style="display:none;list-style-type:none;" @endif><a data-href="{{url('admin/custreport/disCostList')}}" data-title="上报地域投入数据" href="javascript:void(0)">上报地域投入数据</a></li>
77 77
                         <li @if(!isset($res['admin/qrcode'])) style="display:none;list-style-type:none;" @endif><a data-href="{{url('admin/admin/uploadQrcodeEdit')}}" data-title="微信二维码上传" href="javascript:void(0)">微信二维码上传</a></li>
78
-                        <li @if(!isset($res['customer/vipList'])) style="display:none;list-style-type:none;" @endif><a data-href="{{url('admin/customer/vipList')}}" data-title="vip用户录入" href="javascript:void(0)">vip用户录入</a></li>
78
+                        <li @if(!isset($res['customer/vipList'])) style="display:none;list-style-type:none;" @endif><a data-href="{{url('admin/customer/vipList')}}" data-title="会员用户录入" href="javascript:void(0)">会员用户录入</a></li>
79 79
                     </ul>
80 80
                 </dd>
81 81
             </dl>

+ 7 - 0
resources/views/customer/customerGiftAdd.blade.php

@@ -105,6 +105,13 @@
105 105
         });
106 106
 
107 107
         function add_goods(goods_id,sku_id,name,props_name,price,is_weigh){
108
+            //只可以选择一种商品
109
+            var length = $('#goods_o').children().length;
110
+            if(length > 0){
111
+                alert('只可以添加一个商品,请先移除现有商品');
112
+                return false;
113
+            }
114
+
108 115
             var gnum = $("#gnum"+sku_id).val();
109 116
             var weigh_unit = '数量';
110 117
             var weigh_note = '';

File diff suppressed because it is too large
+ 6 - 1
resources/views/customer/customerGiftEdit.blade.php


+ 0 - 0
resources/views/customer/customerInformationQuery.blade.php


+ 11 - 0
resources/views/customer/vipCustomerCreate.blade.php

@@ -35,6 +35,17 @@
35 35
                 </div>
36 36
             </div>
37 37
             <div class="row cl">
38
+                <label for="" class="form-label col-xs-4 col-sm-2">选择销售:</label>
39
+                <div class="formControls col-xs-6 col-sm-6">
40
+                    <select style="text-align:center" id='admin_id' class="select-box" name="admin_id">
41
+                        <option value="0" selected class="select-option">-- 选择销售 --</option>
42
+                        @foreach($adminlist as $v)
43
+                            <option value="{{$v['id']}}" @if(old('admin_id')==$v['id']) selected @endif class="select-option">{{$v['realname']}}</option>
44
+                        @endforeach
45
+                    </select>
46
+                </div>
47
+            </div>
48
+            <div class="row cl">
38 49
                 <div class="col-9 col-offset-2">
39 50
                     <button class="btn btn-primary radius" type="submit" value="&nbsp;&nbsp;提交&nbsp;&nbsp;">&nbsp;&nbsp;提交&nbsp;&nbsp;</button>&nbsp;
40 51
                     <button class="btn btn-default" type="reset" onclick="return_index();">&nbsp;&nbsp;返回&nbsp;&nbsp;</button>&nbsp;

+ 10 - 2
resources/views/customer/vipCustomerEdit.blade.php

@@ -37,8 +37,6 @@
37 37
                         <input type="text" class="input-text" value="{{$info['name']}}" placeholder="请输入用户姓名" name="name">
38 38
                     </div>
39 39
                 </div>
40
-
41
-
42 40
                 <div class="row cl">
43 41
                     <label class="form-label col-xs-4 col-sm-2">
44 42
                         生日:</label>
@@ -47,6 +45,16 @@
47 45
                     </div>
48 46
                 </div>
49 47
             <div class="row cl">
48
+                <label for="" class="form-label col-xs-4 col-sm-2">选择销售:</label>
49
+                <div class="formControls col-xs-6 col-sm-6">
50
+                    <select style="text-align:center" id='admin_id' class="select-box" name="admin_id">
51
+                        @foreach($adminlist as $v)
52
+                            <option value="{{$v['id']}}" @if($info['admin_id'] == $v['id']) selected @endif class="select-option">{{$v['realname']}}</option>
53
+                        @endforeach
54
+                    </select>
55
+                </div>
56
+            </div>
57
+            <div class="row cl">
50 58
                 <div class="col-9 col-offset-2">
51 59
                     <button class="btn btn-primary radius" type="button" onclick="to_submit()" value="&nbsp;&nbsp;提交&nbsp;&nbsp;">&nbsp;&nbsp;提交&nbsp;&nbsp;</button>&nbsp;
52 60
                     <button class="btn btn-default" type="reset" onclick="return_index();">&nbsp;&nbsp;返回&nbsp;&nbsp;</button>&nbsp;