gorden 2 months ago
parent
commit
e2c7ae79b6
1 changed files with 19 additions and 4 deletions
  1. 19 4
      app/admin/controller/order/KangyangCityController.php

+ 19 - 4
app/admin/controller/order/KangyangCityController.php

@@ -351,8 +351,11 @@ class KangyangCityController extends Curd
                     $paidOrder->order_is_complete = 'Y';
                     $paidOrder->order_status_system = 'DONE';
                     $paidOrder->order_status_payment = 'SUCCESS';
+                    // 更新sheet
+                    OrderSheet::where('join_sheet_order_id', $paidOrder->order_id)->update(['order_sheet_status'=>'DONE']);
                 }
                 $paidOrder->save();
+
             }
             // 支付记录
             $this->insertPayDetail($params);
@@ -522,9 +525,13 @@ class KangyangCityController extends Curd
 
             // sheet
             if ($order->order_status_payment == 'SUCCESS') {
-                OrderSheet::where('join_sheet_order_id', $params['order_id'])->update([
-                    'order_sheet_status' => $systemStatus,
-                ]);
+                $data = [
+                    'order_sheet_status'=>$systemStatus
+                ];
+                if (floatval($order->order_amount_paid) < $order->order_amount_total){
+                    $data['order_sheet_status'] = 'BEING';
+                }
+                OrderSheet::where('join_sheet_order_id', $params['order_id'])->update($data);
             }
             // payDetail
             $payData = [
@@ -685,12 +692,20 @@ class KangyangCityController extends Curd
                 if (isset($params['submit_goods_classify']) && $params['submit_goods_classify'] == 'MEALS') {
                     $extendJson['table'] = null;
                 }
+                $orderSheetStatus = 'PAYING';
+                if ($params['settlement_now'] == 'Y' && $params['order_status_payment'] == 'SUCCESS'){
+                    if (floatval($params['order_amount_pay']) >= floatval($params['order_amount_total'])){
+                        $orderSheetStatus = 'DONE';
+                    }else{
+                        $orderSheetStatus = 'BEING';
+                    }
+                }
                 $data = [
                     'join_sheet_member_id' => $params['join_order_member_id'],
                     'join_sheet_order_id' => $params['orderId'],
                     'join_sheet_goods_id' => $goods['goods_id'],
                     'join_sheet_goods_sku_id' => $goods['sku_id'],
-                    'order_sheet_status' => $params['settlement_now'] == 'Y' && $params['order_status_payment'] == 'SUCCESS' ? 'DONE' : 'PAYING',
+                    'order_sheet_status' =>  $orderSheetStatus,
                     'order_sheet_category' => (isset($params['submit_goods_classify']) && $params['submit_goods_classify'] == 'MEALS') ? 'DISHES' : 'NORMAL',
                     'order_sheet_num' => $goods['nbr'],
                     'order_sheet_price' => $goods['goods_sales_price'],