Browse Source

只能使用自己充值卡

sunhao 5 years ago
parent
commit
b41ac6bf0a

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

@@ -625,9 +625,9 @@ class OrderController extends Controller
625 625
        
626 626
         //充值卡验证余额
627 627
         if($order['payment_type'] == 4){
628
-            $deposit_phone = $request->input('deposit_phone');
628
+            $deposit_phone = $order['receiverMobile'];//$request->input('deposit_phone'); //暂且只能使用自己充值卡
629 629
             $customerInfo = CustomerInfo::where('phone', $deposit_phone)->first();
630
-            $balance = $customerInfo->balance;
630
+            $balance = isset($customerInfo->balance) ? $customerInfo->balance : 0;
631 631
             if($balance < $order['receivedAmount']){
632 632
                 //余额不足
633 633
                 return redirect('/admin/order/index')->with('info', '充值卡余额不足');
@@ -756,6 +756,8 @@ class OrderController extends Controller
756 756
         $adminList = json_decode(json_encode($adminList), true);
757 757
         $order = Order::findOrFail($id);
758 758
         $order = json_decode(json_encode($order), true);
759
+        // 临时处理,只能用自己充值卡
760
+        $order['deposit_phone'] = $order['receiverMobile'];
759 761
         $order['receiverMobile'] = substr($order['receiverMobile'], 0, 3).'****'.substr($order['receiverMobile'], 7);
760 762
         $order['goods'] = '';
761 763
         $order_skus = DB::table('order_goods_skus')->where('is_del', 0)->where('order_id', $id)->lists('num','sku_id');

+ 12 - 2
resources/views/order/ordercreate.blade.php

@@ -206,15 +206,24 @@
206 206
                     <label for="status-0">充值卡支付</label>
207 207
                 </div>
208 208
             </div>
209
-            <div class="row cl" style="display: none" id='deposit_div'>
209
+            <!--div class="row cl" style="display: none" id='deposit_div'>
210 210
                 <label class="form-label col-xs-4 col-sm-2">
211 211
                     <font color='red'> </font>充值卡号:</label>
212 212
                 <div class="formControls col-xs-6 col-sm-6">
213 213
                     <input id='deposit_phone' type="text" class="input-text" onkeyup="getBalance()" value="{{old('deposit_phone')}}" placeholder="" name="deposit_phone">
214 214
                     <font color='red' id='vip_pay'></font>
215 215
                 </div>
216
-            </div>
216
+            </div-->
217 217
 
218
+            <div class="row cl" style="display: none" id='deposit_div'>
219
+                <label class="form-label col-xs-4 col-sm-2">
220
+                    <font color='red'> </font>充值卡号:</label>
221
+                <div class="formControls col-xs-6 col-sm-6">
222
+                    <input id='deposit_phone_i' type="text" class="input-text" value="{{old('deposit_phone')}}" placeholder="*默认收货人手机号" disabled name="deposit_phone_i">
223
+                    <input id='deposit_phone' type="hidden" class="input-text" value="{{old('deposit_phone')}}" placeholder="" name="deposit_phone">
224
+                    <font color='red' id='vip_pay'></font>
225
+                </div>
226
+            </div>
218 227
 
219 228
             <div class="row cl">
220 229
                 <label class="form-label col-xs-4 col-sm-2">
@@ -367,6 +376,7 @@
367 376
                 if(payment_type==4){
368 377
                     var phone = $("input[name=receiverMobile]").val();
369 378
                     $("#deposit_phone").val(phone);
379
+                    $("#deposit_phone_i").val(phone);
370 380
                     $("#deposit_div").show();
371 381
                     //获取充值卡余额
372 382
                     var reg = /^1\d{10}$/

+ 18 - 2
resources/views/order/orderedit.blade.php

@@ -260,7 +260,8 @@
260 260
                 <label class="form-label col-xs-4 col-sm-2">
261 261
                     <font color='red'> </font>充值卡号:</label>
262 262
                 <div class="formControls col-xs-6 col-sm-6">
263
-                    <input id='deposit_phone' type="text" class="input-text" onkeyup="getBalance()" value="{{old('deposit_phone')}}" placeholder="" name="deposit_phone">
263
+                    <input id='deposit_phone_i' type="text" class="input-text" value="{{old('deposit_phone')}}" placeholder="*默认收货人手机号" disabled name="deposit_phone_i">
264
+                    <input id='deposit_phone' type="hidden" class="input-text" value="{{old('deposit_phone')}}" placeholder="" name="deposit_phone">
264 265
                     <font color='red' id='vip_pay'></font>
265 266
                 </div>
266 267
             </div>
@@ -413,7 +414,22 @@
413 414
             $('input[type=radio][name=payment_type]').change(function () {
414 415
                 var payment_type = $("input[type='radio'][name='payment_type']:checked").val();
415 416
                 if(payment_type==4){
416
-                    var phone = $("input[name=receiverMobile]").val();
417
+                    var phone = "{{$order['deposit_phone']}}";
418
+                    $("#deposit_phone").val(phone);
419
+                    $("#deposit_phone_i").val(phone);
420
+                    //获取充值卡余额
421
+                    var reg = /^1\d{10}$/
422
+                    if(!reg.test(phone)){
423
+                        return false;
424
+                    }
425
+                    $.ajax({
426
+                        'url':'/admin/cust/getBalance/'+phone,
427
+                        'type': 'get',
428
+                        'success' : function(data){
429
+                            var str = '【充值卡余额为:'+data+'元】';
430
+                            $("#vip_pay").html(str);
431
+                        }
432
+                    });
417 433
                     $("#deposit_div").show();
418 434
                 }else{
419 435
                     $("#deposit_div").hide();