Browse Source

订单打单不能删

sunhao 5 years ago
parent
commit
02fbba9532

+ 8 - 3
app/Console/Commands/SyncMjOrderStatus.php

@@ -29,8 +29,11 @@ class SyncMjOrderStatus extends Command {
29 29
         foreach($orders as $k=>$order){
30 30
             $result = $this->getMjOrder($order['id'], $order['outerCode']);
31 31
            
32
-            if( !empty($result) ){
32
+            if( !empty($result) ){             
33 33
                 $data = array();
34
+                if( isset($result['expressCode']) && !empty($result['expressCode']) ){
35
+                    $data['is_cannot_del'] = 1;
36
+                }
34 37
                 $status = $result['status'];
35 38
                 if($status == '已发货' || $status == '已完成'){
36 39
                     $data['status'] = 3;
@@ -49,9 +52,11 @@ class SyncMjOrderStatus extends Command {
49 52
                         #更新order_sku
50 53
                         OrderGoodsSkus::where('order_id', $order['id'])->where('sku_id', $sku_id)->update(['send_num'=>$quantity]);
51 54
                     }
52
-                    Order::where('id', $order['id'])->update($data);
53 55
                 }elseif($status == '已取消'){
54
-                    $data['is_del'] = 1;
56
+                    $data['is_del'] = 1;                   
57
+                }
58
+
59
+                if(!empty($data)){
55 60
                     Order::where('id', $order['id'])->update($data);
56 61
                 }
57 62
             }

+ 193 - 2
app/Http/Controllers/Admin/TemplateController.php

@@ -594,6 +594,197 @@ class TemplateController extends Controller
594 594
         exit(json_encode($result));
595 595
     }
596 596
 
597
+    /**
598
+     * 销售引流模板分配月报
599
+     */
600
+    public function templateLogMonthReport(Request $request){
601
+        $admin_id = (int)$request->input('admin_id');
602
+        $team_id = (int)$request->input('team_id');
603
+        $stime = $request->input('stime');
604
+        $etime = $request->input('etime');
605
+
606
+        //假如有团队筛选,检索销售队员
607
+        $sale_ids = null;
608
+        if($team_id>0){
609
+            $sale_ids = DB::table('admin')->where('team_id', $team_id)->lists('id');
610
+        }
611
+
612
+        $page = (int)$request->input('page');
613
+        $pageSize = 20;
614
+        if($page<=0){
615
+            $page = 1;
616
+        }
617
+
618
+        $offset = ($page-1) * $pageSize;
619
+
620
+        $mstime = '';
621
+        $metime = '';
622
+        if($stime){
623
+            $mstime = date('Y-m-1', strtotime($stime));
624
+        }
625
+        if($etime){
626
+            $metime = date('Y-m-1', strtotime($etime.' +1 month'));
627
+        }
628
+        $_start = '2019-11-01';
629
+        $count = TemplatesLog::select(DB::raw('left(create_time,7) as month,admin_id'))->where('create_time', '>', $_start)->where(function($query) use($admin_id, $mstime, $metime, $sale_ids){
630
+            if($admin_id>0) $query->where('admin_id', $admin_id);
631
+            if($mstime) $query->where('create_time', '>=', $mstime);
632
+            if($metime) $query->where('create_time', '<', $metime);
633
+            if($sale_ids !== null) $query->whereIn('admin_id', $sale_ids);
634
+        })->groupBy('month')->groupBy('admin_id')->get();
635
+        $count = count($count);
636
+        if ($count > 1) {
637
+            // 总页数
638
+            $pages = ceil($count/$pageSize);
639
+        }else{
640
+            // 总页数
641
+            $pages = 1;
642
+        }
643
+
644
+        $result = TemplatesLog::select(DB::raw('left(create_time,7) as month,admin_id,count(1) as tcount, count(if(type=1,true,null)) as pv_count'))->where('create_time', '>', $_start)->where(function($query) use($admin_id, $mstime, $metime, $sale_ids){
645
+            if($admin_id>0) $query->where('admin_id', $admin_id);
646
+            if($mstime) $query->where('create_time', '>=', $mstime);
647
+            if($metime) $query->where('create_time', '<', $metime);
648
+            if($sale_ids !== null) $query->whereIn('admin_id', $sale_ids);
649
+        })->groupBy('month')->groupBy('admin_id')->orderBy('month', 'desc')->offset($offset)->limit($pageSize)->get();
650
+        $result = json_decode(json_encode($result), true);
651
+        foreach($result as $k=>&$v){
652
+            //起止时间
653
+            $s_time = date('Y-m-1', strtotime($v['month']));
654
+            $e_time = date('Y-m-1', strtotime($v['month'].' +1 month'));
655
+            //获取销售当月加粉情况
656
+            $custDetail = CustDetail::select(DB::raw('sum(fan_add) as fan_add'))->whereRaw('left(dtime,7)="'.$v['month'].'"')->where('admin_id', $v['admin_id'])->where('is_del', 0)->first();
657
+            if(!empty($custDetail)){
658
+                $v['fan_add'] = $custDetail->fan_add;
659
+            }else{
660
+                $v['fan_add'] = '';                
661
+            }
662
+            $v['admin_name'] = DB::table('admin')->where('id', $v['admin_id'])->pluck('realname');
663
+            $v['long_count'] = $v['tcount'] - $v['pv_count'];
664
+
665
+            //点击率
666
+            //$v['click_rate'] = $v['pv_count']>0 && $v['long_count']>0 ? round( $v['long_count'] / $v['pv_count'], 4 ) * 100 . '%' : '';
667
+            $v['change_rate'] = $v['long_count']>0 && $v['fan_add']>0 ? round( $v['fan_add'] / $v['long_count'], 4 ) * 100 . '%' : '';
668
+
669
+            //1.获取当月新粉
670
+            $phones = DB::table('customers')->whereRaw('left(fanTime,7)="'.$v['month'].'"')->lists('phone');
671
+            $order = Order::select(DB::raw('count(1) as order_count, count(distinct(receiverMobile)) as cust_count, sum(receivedAmount) as order_amount'))->where('admin_id', $v['admin_id'])->whereIn('receiverMobile', $phones)->whereRaw('left(creatTime,7)="'.$v['month'].'"')->where('is_del', 0)->first();
672
+            //当月新粉下单单数
673
+            $v['order_count'] = $order->order_count;
674
+            //当月新粉下单人数
675
+            $v['cust_count'] = $order->cust_count;
676
+            //当月粉丝复购单数
677
+            $v['fugou_order_count'] = $order->order_count - $order->cust_count;
678
+            //当月粉丝总销售额
679
+            $v['order_amount'] = $order->order_amount;
680
+            //新粉下单率
681
+            $v['new_order_rate'] = $v['fan_add']>0 ? round($v['cust_count'] / $v['fan_add'], 4) * 100 . '%' : '';
682
+            //新粉复购率
683
+            //复购用户数 = 下单超过一单的用户数
684
+            $order_cust_fugou = Order::select(DB::raw('count(1) as counts,receiverMobile'))->where('admin_id', $v['admin_id'])->whereIn('receiverMobile', $phones)->where('is_del', 0)->whereRaw('left(creatTime,7)="'.$v['month'].'"')->groupBy('receiverMobile')->having('counts', '>', 1)->get();
685
+            $customer_fugou_count = count($order_cust_fugou);
686
+            $v['cust_fugou_rate'] = $v['cust_count']>0 ? round($customer_fugou_count / $v['cust_count'], 4) * 100 . '%' : '';
687
+            //新粉订单复购率
688
+            $v['order_fugou_rate'] = $order->cust_count>0 ? round($v['fugou_order_count'] / $order->cust_count, 4) * 100 . '%' : '';
689
+            //当月粉丝人均销售额
690
+            $v['avg_amount'] = $v['fan_add']>0 ? round($order->order_amount / $v['fan_add'], 2) : '';
691
+
692
+        }
693
+
694
+        $teamList = DB::table('teams')->select('id', 'name')->get();
695
+        $teamList = json_decode(json_encode($teamList), true);
696
+        $adminList = DB::table('admin')->select('id', 'realname', 'username')->where('id','>', 1)->get();
697
+        $adminList = json_decode(json_encode($adminList), true);
698
+
699
+        return view('template/templateLogMonthReport', ['result'=>$result,
700
+            'page'              =>$page,
701
+            'count'             =>$count,
702
+            'pages'             =>$pages,  
703
+            'teamlist'          =>$teamList,  
704
+            'adminlist'         =>$adminList,  
705
+            'team_id'           =>$team_id,  
706
+            'admin_id'          =>$admin_id,  
707
+            'stime'             =>$stime,  
708
+            'etime'             =>$etime,  
709
+        ]);
710
+    }
711
+
712
+    /**
713
+     * 销售引流模板分配月报
714
+     */
715
+    public function templateLogMonthReport_export(Request $request){
716
+        $admin_id = (int)$request->input('admin_id');
717
+        $team_id = (int)$request->input('team_id');
718
+        $stime = $request->input('stime');
719
+        $etime = $request->input('etime');
720
+
721
+        //假如有团队筛选,检索销售队员
722
+        $sale_ids = null;
723
+        if($team_id>0){
724
+            $sale_ids = DB::table('admin')->where('team_id', $team_id)->lists('id');
725
+        }
726
+
727
+        $mstime = '';
728
+        $metime = '';
729
+        if($stime){
730
+            $mstime = date('Y-m-1', strtotime($stime));
731
+        }
732
+        if($etime){
733
+            $metime = date('Y-m-1', strtotime($etime.' +1 month'));
734
+        }
735
+        $_start = '2019-11-01';
736
+        $result = TemplatesLog::select(DB::raw('left(create_time,7) as month,admin_id,count(1) as tcount, count(if(type=1,true,null)) as pv_count'))->where('create_time', '>', $_start)->where(function($query) use($admin_id, $mstime, $metime, $sale_ids){
737
+            if($admin_id>0) $query->where('admin_id', $admin_id);
738
+            if($mstime) $query->where('create_time', '>=', $mstime);
739
+            if($metime) $query->where('create_time', '<', $metime);
740
+            if($sale_ids !== null) $query->whereIn('admin_id', $sale_ids);
741
+        })->groupBy('month')->groupBy('admin_id')->orderBy('month', 'desc')->get();
742
+        $result = json_decode(json_encode($result), true);
743
+        foreach($result as $k=>&$v){
744
+            //获取销售当月加粉情况
745
+            $custDetail = CustDetail::select(DB::raw('sum(fan_add) as fan_add'))->whereRaw('left(dtime,7)="'.$v['month'].'"')->where('admin_id', $v['admin_id'])->where('is_del', 0)->first();
746
+            if(!empty($custDetail)){
747
+                $v['fan_add'] = $custDetail->fan_add;
748
+            }else{
749
+                $v['fan_add'] = '';                
750
+            }
751
+            $v['admin_name'] = DB::table('admin')->where('id', $v['admin_id'])->pluck('realname');
752
+            $v['long_count'] = $v['tcount'] - $v['pv_count'];
753
+
754
+            //点击率
755
+            //$v['click_rate'] = $v['pv_count']>0 && $v['long_count']>0 ? round( $v['long_count'] / $v['pv_count'], 4 ) * 100 . '%' : '';
756
+            $v['change_rate'] = $v['long_count']>0 && $v['fan_add']>0 ? round( $v['fan_add'] / $v['long_count'], 4 ) * 100 . '%' : '';
757
+
758
+            //1.获取当月新粉
759
+            $phones = DB::table('customers')->whereRaw('left(fanTime,7)="'.$v['month'].'"')->lists('phone');
760
+            $order = Order::select(DB::raw('count(1) as order_count, count(distinct(receiverMobile)) as cust_count, sum(receivedAmount) as order_amount'))->where('admin_id', $v['admin_id'])->whereIn('receiverMobile', $phones)->whereRaw('left(creatTime,7)="'.$v['month'].'"')->where('is_del', 0)->first();
761
+            //当月新粉下单单数
762
+            $v['order_count'] = $order->order_count;
763
+            //当月新粉下单人数
764
+            $v['cust_count'] = $order->cust_count;
765
+            //当月粉丝复购单数
766
+            $v['fugou_order_count'] = $order->order_count - $order->cust_count;
767
+            //当月粉丝总销售额
768
+            $v['order_amount'] = $order->order_amount;
769
+            //新粉下单率
770
+            $v['new_order_rate'] = $v['fan_add']>0 ? round($v['cust_count'] / $v['fan_add'], 4) * 100 . '%' : '';
771
+            //新粉复购率
772
+            //复购用户数 = 下单超过一单的用户数
773
+            $order_cust_fugou = Order::select(DB::raw('count(1) as counts,receiverMobile'))->where('admin_id', $v['admin_id'])->whereIn('receiverMobile', $phones)->where('is_del', 0)->whereRaw('left(creatTime,7)="'.$v['month'].'"')->groupBy('receiverMobile')->having('counts', '>', 1)->get();
774
+            $customer_fugou_count = count($order_cust_fugou);
775
+            $v['cust_fugou_rate'] = $v['cust_count']>0 ? round($customer_fugou_count / $v['cust_count'], 4) * 100 . '%' : '';
776
+            //新粉订单复购率
777
+            $v['order_fugou_rate'] = $order->cust_count>0 ? round($v['fugou_order_count'] / $order->cust_count, 4) * 100 . '%' : '';
778
+            //当月粉丝人均销售额
779
+            $v['avg_amount'] = $v['fan_add']>0 ? round($order->order_amount / $v['fan_add'], 2) : '';
780
+
781
+        }
782
+
783
+        $indexKey = ['month','admin_name','pv_count','long_count','fan_add','cust_count','order_count','fugou_order_count','order_amount','change_rate','new_order_rate','cust_fugou_rate','order_fugou_rate','avg_amount'];
784
+        $title = ['月份', '销售名', '当月PV量', '当月长按次数', '当月上报加粉数', '当月新粉下单人数', '新粉下单单数', '当月粉丝复购单数', '当月粉丝总销售额', '粉丝转化率', '新粉下单率', '新粉复购率', '新粉订单复购率', '当月粉丝人均销售额'];
785
+        $filename = 'daofenyuebao_'.date('Y-m-d_H').'.xlsx';
786
+        return Order::export_excel($result, $filename, $indexKey, $title);  
787
+    }
788
+
597 789
 
598
-}
599
- 
790
+}

+ 3 - 0
app/Http/routes.php

@@ -229,6 +229,9 @@ Route::group(['prefix' => 'admin'], function(){
229 229
         //每日汇总数据
230 230
         Route::get('statistics/dayGrandTotal',   'Admin\StatisticsController@dayGrandTotal');
231 231
         Route::get('statistics/dayGrandTotal_export',   'Admin\StatisticsController@dayGrandTotal_export');
232
+        //按月统计销售加粉下单情况
233
+        Route::get('template/templateLogMonthReport',   'Admin\TemplateController@templateLogMonthReport');
234
+        Route::get('template/templateLogMonthReport_export',   'Admin\TemplateController@templateLogMonthReport_export');
232 235
 
233 236
     });
234 237
     

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

@@ -133,7 +133,10 @@
133 133
                    
134 134
                     <ul>                       
135 135
                         <li @if(!isset($res['statistics/districtRoi'])) style="display:none;list-style-type:none;" @endif><a data-href="{{url('admin/statistics/districtRoi7day')}}" data-title="滚动地域ROI" href="javascript:void(0)">滚动地域ROI</a></li> 
136
-                        <li @if(!isset($res['template/templateLogReport'])) style="display:none;list-style-type:none;" @endif><a data-href="{{url('admin/template/templateLogReport')}}" data-title="销售模板导粉报表" href="javascript:void(0)">销售模板导粉报表</a></li> 
136
+                        <li @if(!isset($res['template/templateLogReport'])) style="display:none;list-style-type:none;" @endif><a data-href="{{url('admin/template/templateLogReport')}}" data-title="销售模板导粉报表" href="javascript:void(0)">销售模板导粉报表</a></li>
137
+
138
+                        <li @if(!isset($res['template/templateLogReport'])) style="display:none;list-style-type:none;" @endif><a data-href="{{url('admin/template/templateLogMonthReport')}}" data-title="销售模板导粉月报" href="javascript:void(0)">销售模板导粉月报</a></li> 
139
+
137 140
                         <li @if(!isset($res['statistics/salerOrderFugou'])) style="display:none;list-style-type:none;" @endif><a data-href="{{url('admin/statistics/salerOrderFugou')}}" data-title="销售粉丝复购报表" href="javascript:void(0)">销售粉丝复购报表</a></li> 
138 141
                         <li @if(!isset($res['statistics/dayGrandTotal'])) style="display:none;list-style-type:none;" @endif><a data-href="{{url('admin/statistics/dayGrandTotal')}}" data-title="每日数据累计汇总报表" href="javascript:void(0)">每日数据累计汇总报表</a></li>                        
139 142
                     </ul>

+ 4 - 2
resources/views/order/orderlist.blade.php

@@ -257,9 +257,11 @@
257 257
                                 <a style="text-decoration:none" onClick='order_edit("编辑","{{$a['id']}}")' href="javascript:;" title="编辑"><span class="btn btn-primary radius">编辑</span></a> 
258 258
                                 @endif
259 259
 
260
-                                @if($a['status'] >= 2 && $self_role !='超级管理员' && $self_role !='售后管理员')
260
+                                @if($a['status'] == 3 || $a['is_cannot_del'] == 1)
261 261
 
262
-                                @else   
262
+                                @elseif($a['status'] == 2 && $self_role !='超级管理员' && $self_role !='售后管理员')
263
+                                   
264
+                                @else
263 265
                                 <a style="text-decoration:none" onClick='order_del("删除","{{$a['id']}}")' href="javascript:;" title="删除"><span class="btn btn-danger radius">删除</span></a>
264 266
                                 @endif
265 267
                                 @endif

+ 164 - 0
resources/views/template/templateLogMonthReport.blade.php

@@ -0,0 +1,164 @@
1
+@extends('admin/master')
2
+@section('content')
3
+    <body>
4
+    <div class="page-container">
5
+        <div>
6
+            <div>
7
+                <input class="input-text" style="width:6%;text-align:center" type="text" value="所属团队"/> 
8
+                <select style="width:10%;text-align:center" id='team_id' name="team_id">
9
+                    <option value="0" @if($team_id=='') selected @endif>-- 选择团队 --</option>
10
+                    @foreach($teamlist as $v)
11
+                        <option value="{{$v['id']}}" @if($team_id==$v['id']) selected @endif>{{$v['name']}}</option>
12
+                    @endforeach
13
+                </select>  
14
+                <input class="input-text" style="width:6%;text-align:center" type="text" value="所属销售"/>
15
+                <select style="width:8%;text-align:center" id='admin_id' name="admin_id">
16
+                    <option value="0" @if($admin_id=='') selected @endif>-- 选择销售 --</option>
17
+                    @foreach($adminlist as $v)
18
+                        <option value="{{$v['id']}}" @if($admin_id==$v['id']) selected @endif>{{$v['realname']}}</option>
19
+                    @endforeach
20
+                </select>                        
21
+                <input class="input-text" style="width:6%;text-align:center" type="text" value="开始时间"/>
22
+                <input id="stime" type="text" onfocus="WdatePicker({ dateFmt:'yyyy-MM' })" class="input-text Wdate" style="width:12%;text-align:center;margin-left: -5px" name="stime" value="{{$stime?$stime:''}}">
23
+                <input class="input-text" style="width:6%;text-align:center" type="text" value="结束时间"/>
24
+                <input id="etime"type="text" onfocus="WdatePicker({ dateFmt:'yyyy-MM' })" class="input-text Wdate" style="width:12%;text-align:center;margin-left: -5px" name="etime" value="{{$etime?$etime:''}}">
25
+               
26
+                
27
+                <a class="btn btn-primary radius"  style="margin-left: 5px" onclick="user_search()" href="javascript:;">搜索</a>   
28
+                <a class="btn btn-primary radius" onclick="statistics_export()" href="javascript:;"><i class="Hui-iconfont"></i> 导出数据</a>
29
+                
30
+            </div>
31
+        </div>
32
+        
33
+        <div class="mt-20">
34
+            <table class="table table-border table-bordered table-bg table-hover table-sort">
35
+                <thead>
36
+                <tr class="text-c">
37
+                    <th width="5%">月份</th>
38
+                    <th width="5%">销售名</th>
39
+                    <th width="5%">当月PV量</th>
40
+                    <th width="5%">当月长按次数</th>
41
+                    <th width="5%">当月上报加粉数</th>
42
+                    <th width="5%">当月新粉下单人数</th>
43
+                    <th width="5%">新粉下单单数</th>
44
+                    <th width="5%">当月粉丝复购单数</th>
45
+                    <th width="5%">当月粉丝总销售额</th>
46
+                    <th width="5%">粉丝转化率</th>                                                
47
+                    <th width="5%">新粉下单率</th>                                                
48
+                    <th width="5%">新粉复购率</th>                                                
49
+                    <th width="5%">新粉订单复购率</th>                                                
50
+                    <th width="5%">当月粉丝人均销售额</th>                                                                                            
51
+                                              
52
+                </tr>
53
+                </thead>
54
+                <tbody>
55
+                @if($result)
56
+                    @foreach($result as $a)
57
+                        <tr class="text-c" style=" text-align:center;">                           
58
+                            <td>{{$a['month']}}</td>                                                                                   
59
+                            <td>{{$a['admin_name']}}</td>                                                                                   
60
+                            <td>{{$a['pv_count']}}</td>                                                                                   
61
+                            <td>{{$a['long_count']}}</td>                                                                                   
62
+                            <td>{{$a['fan_add']}}</td>                                                                                   
63
+                            <td>{{$a['cust_count']}}</td>                                                                                   
64
+                            <td>{{$a['order_count']}}</td>                                                                                   
65
+                            <td>{{$a['fugou_order_count']}}</td>                                                                                   
66
+                            <td>{{$a['order_amount']}}</td>                                                                                   
67
+                            <td>{{$a['change_rate']}}</td>                                                                                   
68
+                            <td>{{$a['new_order_rate']}}</td>                                                                                   
69
+                            <td>{{$a['cust_fugou_rate']}}</td>                                                                                   
70
+                            <td>{{$a['order_fugou_rate']}}</td>                                                                                   
71
+                            <td>{{$a['avg_amount']}}</td>                                                                                   
72
+                           
73
+                        </tr>
74
+                    @endforeach
75
+                @endif
76
+                </tbody>
77
+            </table>
78
+        </div>
79
+        <div id="page" class="page_div"></div>
80
+    </div>
81
+    
82
+    <!--_footer 作为公共模版分离出去-->
83
+    <script type="text/javascript" src="/admin/lib/jquery/1.9.1/jquery.min.js"></script>
84
+    <script type="text/javascript" src="/admin/lib/layer/2.4/layer.js"></script>
85
+    <script type="text/javascript" src="/admin/static/h-ui/js/H-ui.min.js"></script>
86
+    <script type="text/javascript" src="/admin/static/h-ui.admin/js/H-ui.admin.js"></script>
87
+    <script type="text/javascript" src="/admin/lib/page/paging.js"></script>
88
+    <script type="text/javascript" src="/admin/lib/My97DatePicker/4.8/WdatePicker.js"></script>
89
+    <!--/_footer 作为公共模版分离出去-->
90
+    <!--/_footer 作为公共模版分离出去-->
91
+     <script type="text/javascript">
92
+        function user_search(){
93
+            var stime = $('#stime').val();
94
+            var etime = $('#etime').val();
95
+            var team_id = $('#team_id').val();
96
+            var admin_id = $('#admin_id').val();
97
+
98
+            location.href = 'templateLogMonthReport?stime='+stime+'&etime='+etime+'&team_id='+team_id+'&admin_id='+admin_id;
99
+        }
100
+        //导出
101
+        function statistics_export(){
102
+            var stime = $('#stime').val();
103
+            var etime = $('#etime').val();
104
+            var team_id = $('#team_id').val();
105
+            var admin_id = $('#admin_id').val();
106
+
107
+            location.href = 'templateLogMonthReport_export?stime='+stime+'&etime='+etime+'&team_id='+team_id+'&admin_id='+admin_id;
108
+        }
109
+       
110
+        /*分页*/
111
+            
112
+        $("#page").paging({
113
+            pageNo:{{$page}},
114
+            totalPage: {{$pages}},
115
+            totalSize: {{$count}},
116
+            callback: function(num) {
117
+                var stime = $('#stime').val();
118
+                var etime = $('#etime').val();
119
+                var team_id = $('#team_id').val();
120
+                var admin_id = $('#admin_id').val();
121
+                
122
+                location.href='templateLogMonthReport?page='+num+'&stime='+stime+'&etime='+etime+'&team_id='+team_id+'&admin_id='+admin_id;
123
+            }
124
+        })
125
+
126
+        $(function(){
127
+            getsale();
128
+        })
129
+
130
+        $('#team_id').change(function(){
131
+            getsale();            
132
+        })
133
+
134
+        function getsale(){
135
+            team = $('#team_id').val();
136
+            if(team=='0'){
137
+                return false;
138
+            }else{
139
+                $.ajax({
140
+                    'url':'/admin/order/teamAdmins/'+team,
141
+                    'type': 'get',
142
+                    'dataType':'json',
143
+                    'success' : function(data){
144
+                        admin_id = '{{$admin_id}}';
145
+                        str = '<option value=\'0\'>-- 选择销售 --<\/option>';
146
+                        $.each(data, function(i, va){
147
+                            sele = '';
148
+                            if(va.id == admin_id){
149
+                                sele = 'selected';
150
+                            }
151
+                            str += '<option value="'+va.id+'" '+sele+'>' + va.realname +'<\/option>';
152
+                        })
153
+                        
154
+                        $('#admin_id').html(str);
155
+                    }
156
+                });
157
+            }
158
+        }
159
+        
160
+    </script>
161
+   
162
+    </body>
163
+
164
+@endsection