Browse Source

充值方式编辑

sunhao 5 years ago
parent
commit
92954ae086

+ 29 - 0
app/Http/Controllers/Admin/CustomerDepositController.php

107
         $result = json_decode(json_encode($result),true);
107
         $result = json_decode(json_encode($result),true);
108
         foreach($result as $k=>&$v){
108
         foreach($result as $k=>&$v){
109
             $v['phone'] = substr($v['phone'],0,3).'****'.substr($v['phone'],7);
109
             $v['phone'] = substr($v['phone'],0,3).'****'.substr($v['phone'],7);
110
+            if($v['payment_type'] == 1){
111
+                $v['payment_type'] = '微信支付';
112
+            }elseif($v['payment_type'] == 3){
113
+                $v['payment_type'] = '个体户支付';
114
+            }else{
115
+                $v['payment_type'] = '';
116
+            }
117
+            
110
         }
118
         }
111
         return view('deposit/index', ['result' =>$result,
119
         return view('deposit/index', ['result' =>$result,
112
             'page'              =>$page,
120
             'page'              =>$page,
305
             ]);
313
             ]);
306
     }
314
     }
307
 
315
 
316
+    /**
317
+     * 编辑充值方式
318
+     */
319
+    public function editPayType(Request $request){
320
+        $id = (int)$request->input('id');
321
+        $payment_type = $request->input('payment_type');
322
+
323
+        $data = array();
324
+        if(isset($payment_type)){
325
+            if(empty($payment_type)){
326
+                $payment_type = null;                
327
+            }
328
+            $data['payment_type'] = (int)$payment_type;
329
+        }
330
+        if($id>0 && !empty($data)){
331
+            $res = CustomerDeposit::where('id', $id)->update($data);
332
+        }
333
+
334
+        return 1;
335
+    }
336
+
308
 }
337
 }

+ 2 - 0
app/Http/routes.php

264
         Route::get('deposit/del/{id}', 'Admin\CustomerDepositController@delete');
264
         Route::get('deposit/del/{id}', 'Admin\CustomerDepositController@delete');
265
         //获取余额
265
         //获取余额
266
         Route::get('cust/getBalance/{phone}', 'Admin\CustomerDepositController@getBalance');
266
         Route::get('cust/getBalance/{phone}', 'Admin\CustomerDepositController@getBalance');
267
+        //编辑充值方式
268
+        Route::get('deposit/editPayType', 'Admin\CustomerDepositController@editPayType');
267
 
269
 
268
         //用户订单统计
270
         //用户订单统计
269
         Route::get('statistics/customerOrder','Admin\StatisticsController@customerOrder');
271
         Route::get('statistics/customerOrder','Admin\StatisticsController@customerOrder');

+ 53 - 0
resources/views/deposit/index.blade.php

17
                     <th width="10%">支付金额</th>
17
                     <th width="10%">支付金额</th>
18
                     <th width="10%">使用套餐</th>
18
                     <th width="10%">使用套餐</th>
19
                     <th width="10%">实充金额</th>
19
                     <th width="10%">实充金额</th>
20
+                    <th width="10%">充值方式</th>
20
                     <th width="10%">充值时间</th>
21
                     <th width="10%">充值时间</th>
21
                 </tr>
22
                 </tr>
22
                 </thead>
23
                 </thead>
29
                         <td class="text-c">{{$a['pay_amount']}}</td>
30
                         <td class="text-c">{{$a['pay_amount']}}</td>
30
                         <td class="text-c">{{$a['note']}}</td>
31
                         <td class="text-c">{{$a['note']}}</td>
31
                         <td class="text-c">{{$a['deposit_amount']}}</td>
32
                         <td class="text-c">{{$a['deposit_amount']}}</td>
33
+                        
34
+                        <td class ="change_logistics_id"> 
35
+                            <p id="payment_type_1{{$a['id']}}">{{$a['payment_type']}}</p> 
36
+                            <select id="payment_type_2{{$a['id']}}" style="display: none" name='payment_type' value="{{$a['payment_type']}}" onchange="change_payment_type({{$a['id']}})">
37
+                                <option value='0'>-请选择-</option>
38
+                                <option value='1'>微信支付</option>
39
+                                <option value='3'>个体户支付</option>
40
+                            </select>
41
+                            <span class="sort_icon" hidden  onClick='change_payment_type_click("{{$a['id']}}")' style="cursor:pointer"><i class="Hui-iconfont">&#xe647;</i></span>
42
+                        </td>
43
+                        
32
                         <td class="text-c">{{$a['pay_time']}}</td>
44
                         <td class="text-c">{{$a['pay_time']}}</td>
33
                         
45
                         
34
                     </tr>
46
                     </tr>
66
             location.href = '/admin/deposit/index?phone='+phone;
78
             location.href = '/admin/deposit/index?phone='+phone;
67
         }
79
         }
68
 
80
 
81
+        function change_payment_type_click(id){
82
+            $("#payment_type_1"+id).hide();
83
+            $("#payment_type_2"+id).show();
84
+            $("#payment_type_2"+id).focus();
85
+        }
86
+
87
+        function change_payment_type(id){
88
+            var payment_type = $("#payment_type_2"+id).val();
89
+            $.ajax({
90
+                url: '/admin/deposit/editPayType?id='+id+'&payment_type='+payment_type,
91
+                type: 'get',
92
+                dateType: 'json',
93
+                success:function(msg){
94
+                    if(payment_type==1){
95
+                        payment_type = '微信支付';
96
+                    }
97
+                    if(payment_type==3){
98
+                        payment_type = '个体户支付';
99
+                    }
100
+                    if(payment_type==0){
101
+                        payment_type = '';
102
+                    }
103
+                    $("#payment_type_1"+id).html(payment_type);
104
+                    $("#payment_type_1"+id).show();
105
+                    $("#payment_type_2"+id).hide();
106
+                }
107
+            });
108
+        }
109
+
110
+        $(".change_logistics_id").mouseover(
111
+            function(){
112
+                $(this).children("span").show();
113
+                $(this).children("span").addClass('f-18 c-success');
114
+                $(this).mouseout(
115
+                    function(){
116
+                        $(this).children("span").hide();
117
+                    }
118
+                );
119
+            }
120
+        );
121
+
69
 
122
 
70
         $("#page").paging({ 
123
         $("#page").paging({ 
71
             pageNo:{{$page}},
124
             pageNo:{{$page}},