|
@@ -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();
|