Browse Source

设为退款

sunhao 5 years ago
parent
commit
6916d9aa97

+ 50 - 2
app/Http/Controllers/Admin/OrderController.php

@@ -110,6 +110,7 @@ class OrderController extends Controller
110 110
             1 => '待审核',
111 111
             2 => '已审核',
112 112
             3 => '已发货',
113
+            4 => '已退款'
113 114
         );
114 115
 
115 116
         foreach($result as $k=>&$v){
@@ -165,7 +166,7 @@ class OrderController extends Controller
165 166
             $overtime['list'] = json_decode(json_encode($order_overtime), true);
166 167
             $overtime['count'] = count($order_overtime);           
167 168
         }
168
-        
169
+      
169 170
         #销售筛选
170 171
         //$saler_ids = DB::table('admin_role')->where('role_name', '销售')->lists('user_id');
171 172
         $adminList = DB::table('admin')->select('id', 'realname', 'username')->where(function($query) use($team_id){
@@ -266,6 +267,7 @@ class OrderController extends Controller
266 267
             1 => '待审核',
267 268
             2 => '已审核',
268 269
             3 => '已发货',
270
+            4 => '已退款',
269 271
         );
270 272
         foreach($result as $k=>&$v){
271 273
             
@@ -397,6 +399,7 @@ class OrderController extends Controller
397 399
             1 => '待审核',
398 400
             2 => '已审核',
399 401
             3 => '已发货',
402
+            4 => '已退款'
400 403
         );
401 404
         foreach($result as $k=>&$v){
402 405
             //获取商品信息
@@ -1025,6 +1028,48 @@ class OrderController extends Controller
1025 1028
         //return redirect('/admin/order/index')->with('info', '删除成功');
1026 1029
     }
1027 1030
 
1031
+    /**
1032
+     * 设为退款状态操作
1033
+     * @param Request $request
1034
+     * @return \Illuminate\Http\RedirectResponse
1035
+     */
1036
+    public function set_refund($id)
1037
+    {
1038
+        $order = Order::find($id);
1039
+        $order->status = 4;
1040
+        DB::beginTransaction();
1041
+        try{
1042
+            if ($order ->save()){
1043
+                //假如删除订单在卖家云,同步为取消状态
1044
+                if($order->orderCode>0 && $order->warehouse==3){
1045
+                    $del = array();
1046
+                    $del['eshopCode'] = $order->eshopCode;
1047
+                    $del['outerCode'] = $order->outerCode;
1048
+                    $del['code'] = $order->orderCode;
1049
+                    $mj_del = Order::mjOrderDel($del);
1050
+                    if( $mj_del == false ){
1051
+                        throw new Exception("订单同步到卖家云失败");
1052
+                    }
1053
+                }
1054
+                #记录操作日志
1055
+                $self_id = session('admin_id');
1056
+                $self_name = session('real_name');            
1057
+                $context = "订单设为退款";
1058
+                $type = 0; 
1059
+                $tables = 'order';
1060
+                $data_id = $id;
1061
+                Oplog::addLog($self_id, $self_name, $context, $type, $tables, $data_id);
1062
+            }
1063
+
1064
+            DB::commit();
1065
+        }catch (Exception $e){
1066
+            Log::errorLog('',['error'=>$e->getMessage()],"order/set_refund",0,['id'=>$id]);
1067
+            DB::rollback();
1068
+        }
1069
+        exit('<script>window.location.replace(document.referrer)</script>');
1070
+        //return redirect('/admin/order/index')->with('info', '删除成功');
1071
+    }
1072
+
1028 1073
     public function setrefund($id){
1029 1074
         $order = Order::find($id);
1030 1075
         $order->order_status = 2;
@@ -1069,6 +1114,7 @@ class OrderController extends Controller
1069 1114
                     1 => '待审核',
1070 1115
                     2 => '已审核',
1071 1116
                     3 => '已发货',
1117
+                    4 => '已退款'
1072 1118
                 );
1073 1119
                 $self_id = session('admin_id');
1074 1120
                 $self_name = session('real_name');
@@ -1267,6 +1313,7 @@ class OrderController extends Controller
1267 1313
             1 => '待审核',
1268 1314
             2 => '已审核',
1269 1315
             3 => '已发货',
1316
+            4 => '已退款'
1270 1317
         );
1271 1318
         foreach($result as $k=>&$v){
1272 1319
             #加粉时间
@@ -1550,7 +1597,7 @@ class OrderController extends Controller
1550 1597
 
1551 1598
     /**
1552 1599
      * 订单状态机制,获取可变更状态
1553
-     * @param status:0已录入 1提交审核 2已审核 3已发货
1600
+     * @param status:0已录入 1提交审核 2已审核 3已发货 4已退款
1554 1601
      */
1555 1602
     public function getEnableStatus($status){
1556 1603
         $status_arr = [
@@ -1558,6 +1605,7 @@ class OrderController extends Controller
1558 1605
             1 => ['status'=>1, 'name'=>'提交审核'],
1559 1606
             2 => ['status'=>2, 'name'=>'审核通过'],
1560 1607
             3 => ['status'=>3, 'name'=>'设为发货'],
1608
+            4 => ['status'=>4, 'name'=>'设为退款']
1561 1609
         ];
1562 1610
         $status = (int)$status;
1563 1611
         $result = array();

+ 2 - 1
app/Http/routes.php

@@ -83,7 +83,8 @@ Route::group(['prefix' => 'admin'], function(){
83 83
         Route::get('/order/categoods/{category}', 'Admin\OrderController@categoods');
84 84
         Route::get('/order/teamAdmins/{team_id}', 'Admin\OrderController@teamAdmins');
85 85
         Route::get('/order/editLogisticsId', 'Admin\OrderController@editLogisticsId');
86
-        Route::get('/order/setrefund/{id}', 'Admin\OrderController@setrefund');  //设为退货
86
+        Route::get('/order/setrefund/{id}', 'Admin\OrderController@setrefund');  //设为退货 弃用
87
+        Route::get('/order/set_refund/{id}', 'Admin\OrderController@set_refund');  //设为退货 用于c仓同步到卖家取消订单,不删除单子
87 88
         Route::get('/order/setverify/{id}', 'Admin\OrderController@setverify');  //设为已审核
88 89
         Route::get('/order/setverifymore', 'Admin\OrderController@setverifymore');  //设为已审核
89 90
 

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

@@ -32,6 +32,7 @@
32 32
                     <option value="1" @if($status==1) selected @endif>待审核</option>
33 33
                     <option value="2" @if($status==2) selected @endif>已审核</option>
34 34
                     <option value="3" @if($status==3) selected @endif>已发货</option>
35
+                    <option value="4" @if($status==4) selected @endif>已退款</option>
35 36
 
36 37
                 </select> 
37 38
                 <input class="input-text" style="width:5%;text-align:center" type="text" value="发货仓库"/>
@@ -251,13 +252,13 @@
251 252
 
252 253
                                 @else
253 254
 
254
-                                @if($self_role !='超级管理员' && $self_role !='售后管理员' && $a['status']>1 || $a['status']==3)
255
+                                @if($self_role !='超级管理员' && $self_role !='售后管理员' && $a['status']>1 || $a['status']==4)
255 256
 
256 257
                                 @else
257 258
                                 <a style="text-decoration:none" onClick='order_edit("编辑","{{$a['id']}}")' href="javascript:;" title="编辑"><span class="btn btn-primary radius">编辑</span></a> 
258 259
                                 @endif
259 260
 
260
-                                @if($a['status'] == 3)
261
+                                @if($a['status'] >= 3)
261 262
 
262 263
                                 @elseif($a['status'] == 2 && $self_role !='超级管理员' && $self_role !='售后管理员')
263 264
 
@@ -265,6 +266,14 @@
265 266
                                 <a style="text-decoration:none" onClick='order_del("删除","{{$a['id']}}","{{$a['is_cannot_del']}}")' href="javascript:;" title="删除"><span class="btn btn-danger radius">删除</span></a>
266 267
                                 @endif
267 268
                                 @endif
269
+
270
+                                @if($a['warehouse']==3 && $a['status']>=2 && $a['status']<4 && ($self_role=='超级管理员' || $self_role=='售后管理员'))
271
+                                    <a style="text-decoration:none" onClick='set_refund("{{$a['id']}}")' href="javascript:;" title="设为已退款"><span class="btn btn-danger radius">设为已退款</span></a>
272
+                                @endif
273
+
274
+                                @if($a['status'] == 4)
275
+                                    已退款订单
276
+                                @endif
268 277
                             </td> 
269 278
                                                         
270 279
                         </tr>
@@ -338,6 +347,14 @@
338 347
                 location.href='/admin/order/delete/'+id;
339 348
             });
340 349
         }
350
+
351
+        /*广告-移除*/
352
+        function set_refund(id){
353
+            var msg = '确认要设为退款吗?';          
354
+            layer.confirm(msg,function(index){
355
+                location.href='/admin/order/set_refund/'+id;
356
+            });
357
+        }
341 358
         /*广告-设为首页隐藏*/
342 359
         function down(obj,id){
343 360
             layer.confirm('确认要设为首页隐藏吗?',function(index){

+ 4 - 23
resources/views/order/predictorderlist.blade.php

@@ -73,11 +73,11 @@
73 73
                     <th width="4%">所属销售</th> 
74 74
                     <th width="4%">订单状态</th>                  
75 75
                     @if($self_role =='销售' )<th width="5%">驳回原因</th>@endif                  
76
-                    <th width="3%">是否退款</th>                  
76
+                                   
77 77
                     <th width="5%">买家备注</th>                  
78 78
                     <th width="5%">卖家备注</th>                                                        
79 79
                     <th width="5%">发货备注</th>                                                        
80
-                    <th width="5%">操作</th>                 
80
+                                    
81 81
                 </tr>
82 82
                 </thead>
83 83
                 <tbody>
@@ -148,7 +148,7 @@
148 148
                             <td id="order_verify{{$a['id']}}">{{$a['status_name']}}</td>
149 149
                             @if($self_role =='销售' ) <td>@if($a['status'] == 0)<font color='red'> {{$a['refuse_reason']}} </font> @endif</td> @endif
150 150
                            
151
-                            <td id="refund{{$a['id']}}">@if($a['order_status']==2) <span class="btn btn-danger radius">退款</span> @else 正常<br><span class="btn btn-primary radius" onclick="order_refund({{$a['id']}})">设为退款</span> @endif</td> 
151
+                            
152 152
                             @if(($self_role =='销售' || $self_role =='管理员') && $a['status']>0)
153 153
                             <td>{{$a['buyerMemo']}}</td> 
154 154
                             <td>{{$a['sellerMemo']}}</td> 
@@ -172,26 +172,7 @@
172 172
                                 <span class="sort_icon" hidden  onClick='change_send_note_click("{{$a['id']}}","{{$a['send_note']}}")' style="cursor:pointer"><i class="Hui-iconfont">&#xe647;</i></span>
173 173
                             </td>  
174 174
                             @endif                                                                                                  
175
-                            <td>
176
-                                @if($a['enable_status'])
177
-                                    @foreach($a['enable_status'] as $item)
178
-                                        @if($item['status'] == 0)
179
-                                            <a id="verify_refuse" style="text-decoration:none" onClick='refuse_reason("{{$a['id']}}")' href="javascript:;" title="审核驳回"><span class="btn btn-danger radius">审核驳回</span></a>
180
-                                        @else
181
-                                            <a id="verify" style="text-decoration:none" onClick='order_verify("{{$a['id']}}", "{{$item['status']}}", "{{$item['name']}}")' href="javascript:;" title="{{$item['name']}}"><span class="btn btn-primary radius">{{$item['name']}}</span></a>
182
-                                        @endif
183
-                                    @endforeach
184
-                                @endif
185
-
186
-                                @if(($self_role =='销售' || $self_role =='管理员') && $a['status']>0)
187
-
188
-                                @else
189
-                                <a style="text-decoration:none" onClick='order_edit("编辑","{{$a['id']}}")' href="javascript:;" title="编辑"><span class="btn btn-primary radius">编辑</span></a>   
190
-                                @if( $a['status'] < 3)                                                        
191
-                                <a style="text-decoration:none" onClick='order_del("删除","{{$a['id']}}")' href="javascript:;" title="删除"><span class="btn btn-danger radius">删除</span></a>
192
-                                @endif
193
-                                @endif
194
-                            </td> 
175
+                            
195 176
                                                         
196 177
                         </tr>
197 178
                     @endforeach