Browse Source

完善功能

gorden 10 months ago
parent
commit
836ab65324

+ 34 - 0
app/admin/controller/order/RefundController.php

@@ -77,6 +77,23 @@ class RefundController extends Curd
         return $model;
     }
 
+    public function afterQuery($items)
+    {
+        foreach ($items as &$item){
+            if (!empty($item['order_return_apply_json'])){
+                $json = json_decode($item['order_return_apply_json'],true);
+                $item['order_return_apply_json'] = $json['apply'];
+            }
+            if (!empty($item['order_return_recharge_json'])){
+                $json = json_decode($item['order_return_recharge_json'],true);
+                $item['order_return_recharge_json'] = $json['change'];
+            }
+
+        }
+
+        return $items;
+    }
+
     protected function updateInput(Request $request): array
     {
         $primary_key = $this->model->getKeyName();
@@ -89,6 +106,12 @@ class RefundController extends Curd
         if (empty($model->order_return_accept_datetimes) && $model->order_return_status == 'PENDING' && $data['order_return_status'] == 'DOING'){
             $data['order_return_accept_datetimes'] = date('Y-m-d H:i:s');
         }
+        if (!empty($data['order_return_apply_json'])){
+            $data['order_return_apply_json'] = json_encode(['apply'=>$data['order_return_apply_json']]);
+        }
+        if (!empty($data['order_return_recharge_json'])){
+            $data['order_return_recharge_json'] = json_encode(['change'=>$data['order_return_recharge_json']]);
+        }
 
         unset($data[$primary_key]);
         return [$id, $data];
@@ -141,6 +164,17 @@ class RefundController extends Curd
 
                 $item['goods']['components'] = $goodsArr;
             }
+
+            if (!empty($item['refund'])){
+                if (!empty($item['refund']['order_return_apply_json'])){
+                    $json = json_decode($item['refund']['order_return_apply_json'],true);
+                    $item['refund']['order_return_apply_json'] = $json['apply'];
+                }
+                if (!empty($item['refund']['order_return_recharge_json'])){
+                    $json = json_decode($item['refund']['order_return_recharge_json'],true);
+                    $item['refund']['order_return_recharge_json'] = $json['change'];
+                }
+            }
         }
 
         $order = Order::where('order_id', $orderId)->first();

+ 5 - 5
app/admin/validate/order/ReturnValidate.php

@@ -12,12 +12,12 @@ class ReturnValidate extends Validate
         'join_return_order_id' => 'require|alphaDash',
         'order_return_status|退单状态' => 'require|in:PENDING,DOING,DONE',
         'order_return_apply_datetimes|申请时间' => 'date',
-        'order_return_apply_json|申请信息' => 'isJson',
+//        'order_return_apply_json|申请信息' => 'isJson',
         'order_return_accept_datetimes|受理时间' => 'date',
-        'order_return_recharge_json|退款处理' => 'isJson',
-        'order_return_regoods_json|退货处理' => 'isJson',
-        'order_return_change_json|换货处理' => 'isJson',
-        'order_return_task_json|工单处理' => 'isJson',
+//        'order_return_recharge_json|退款处理' => 'isJson',
+//        'order_return_regoods_json|退货处理' => 'isJson',
+//        'order_return_change_json|换货处理' => 'isJson',
+//        'order_return_task_json|工单处理' => 'isJson',
     ];
 
     protected $scene = [