|
@@ -1389,6 +1389,25 @@ class OrderController extends Controller
|
1389
|
1389
|
CustomerInfo::where('phone', $consum->phone)->update(['balance'=>$balance]);
|
1390
|
1390
|
}
|
1391
|
1391
|
|
|
1392
|
+ //假如删除订单使用了优惠券,礼品
|
|
1393
|
+ if($order->use_coupon == 1){
|
|
1394
|
+ DB::table('customer_coupons')->where('order_id', $id)->update(['is_use'=>0]);
|
|
1395
|
+ }
|
|
1396
|
+ #查询本单使用赠礼
|
|
1397
|
+ $order_gifts = DB::table('order_goods_skus')->where('is_del', 0)->where('order_id', $id)->where('gift_id','>',0)->lists('gift_id');
|
|
1398
|
+ if(!empty($order_gifts)){
|
|
1399
|
+ $order_m_gift_id = DB::table('customer_month_gift')->whereIn('id', $order_gifts)->where('type', 0)->pluck('id');
|
|
1400
|
+ $order_b_gift_id = DB::table('customer_month_gift')->whereIn('id', $order_gifts)->where('type', 1)->pluck('id');
|
|
1401
|
+ if($order_m_gift_id>0){
|
|
1402
|
+ DB::table('order_goods_skus')->where('gift_id', $order_m_gift_id)->where('order_id', $id)->update(['is_del'=>1]);
|
|
1403
|
+ DB::table('customer_gift_receives')->where('order_id', $id)->where('gift_id', $order_m_gift_id)->update(['is_del'=>1]);
|
|
1404
|
+ }
|
|
1405
|
+ if($order_b_gift_id>0){
|
|
1406
|
+ DB::table('order_goods_skus')->where('gift_id', $order_b_gift_id)->where('order_id', $id)->update(['is_del'=>1]);
|
|
1407
|
+ DB::table('customer_gift_receives')->where('order_id', $id)->where('gift_id', $order_b_gift_id)->update(['is_del'=>1]);
|
|
1408
|
+ }
|
|
1409
|
+ }
|
|
1410
|
+
|
1392
|
1411
|
#记录操作日志
|
1393
|
1412
|
$self_id = session('admin_id');
|
1394
|
1413
|
$self_name = session('real_name');
|
|
@@ -1455,6 +1474,25 @@ class OrderController extends Controller
|
1455
|
1474
|
$balance = $cust->balance + $order->receivedAmount;
|
1456
|
1475
|
CustomerInfo::where('phone', $consum->phone)->update(['balance'=>$balance]);
|
1457
|
1476
|
}
|
|
1477
|
+
|
|
1478
|
+ //假如删除订单使用了优惠券,礼品
|
|
1479
|
+ if($order->use_coupon == 1){
|
|
1480
|
+ DB::table('customer_coupons')->where('order_id', $id)->update(['is_use'=>0]);
|
|
1481
|
+ }
|
|
1482
|
+ #查询本单使用赠礼
|
|
1483
|
+ $order_gifts = DB::table('order_goods_skus')->where('is_del', 0)->where('order_id', $id)->where('gift_id','>',0)->lists('gift_id');
|
|
1484
|
+ if(!empty($order_gifts)){
|
|
1485
|
+ $order_m_gift_id = DB::table('customer_month_gift')->whereIn('id', $order_gifts)->where('type', 0)->pluck('id');
|
|
1486
|
+ $order_b_gift_id = DB::table('customer_month_gift')->whereIn('id', $order_gifts)->where('type', 1)->pluck('id');
|
|
1487
|
+ if($order_m_gift_id>0){
|
|
1488
|
+ DB::table('order_goods_skus')->where('gift_id', $order_m_gift_id)->where('order_id', $id)->update(['is_del'=>1]);
|
|
1489
|
+ DB::table('customer_gift_receives')->where('order_id', $id)->where('gift_id', $order_m_gift_id)->update(['is_del'=>1]);
|
|
1490
|
+ }
|
|
1491
|
+ if($order_b_gift_id>0){
|
|
1492
|
+ DB::table('order_goods_skus')->where('gift_id', $order_b_gift_id)->where('order_id', $id)->update(['is_del'=>1]);
|
|
1493
|
+ DB::table('customer_gift_receives')->where('order_id', $id)->where('gift_id', $order_b_gift_id)->update(['is_del'=>1]);
|
|
1494
|
+ }
|
|
1495
|
+ }
|
1458
|
1496
|
|
1459
|
1497
|
#记录操作日志
|
1460
|
1498
|
$self_id = session('admin_id');
|