From 918374fcfe3d49cf51ebed8ca95538f0b46c05c0 Mon Sep 17 00:00:00 2001 From: devil_gong Date: Tue, 28 May 2019 16:39:37 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AE=A2=E5=8D=95=E9=80=80=E6=AC=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../index/view/default/order/index.html | 11 +++- application/service/OrderAftersaleService.php | 51 ++++++++----------- 2 files changed, 32 insertions(+), 30 deletions(-) diff --git a/application/index/view/default/order/index.html b/application/index/view/default/order/index.html index 7a3668f0c..eb3648a03 100755 --- a/application/index/view/default/order/index.html +++ b/application/index/view/default/order/index.html @@ -187,7 +187,16 @@ {{if in_array($order['status'], [2,3,4])}} - 申请售后 + + {{switch $order.status}} + {{case 2|3}} + 退款/退货 + {{/case}} + {{case 4}} + 申请售后 + {{/case}} + {{/switch}} + {{/if}} {{if $keys eq 0}} diff --git a/application/service/OrderAftersaleService.php b/application/service/OrderAftersaleService.php index 5db13df4d..9d0c24f00 100644 --- a/application/service/OrderAftersaleService.php +++ b/application/service/OrderAftersaleService.php @@ -751,9 +751,28 @@ class OrderAftersaleService // 手动处理 case 2 : - $ret = DataReturn('操作成功', 0); + $ret = DataReturn('退款成功', 0); break; } + + // 退款成功 + if($ret['code'] == 0) + { + // 更新退款状态 + $upd_data = [ + 'status' => 3, + 'audit_time' => time(), + 'upd_time' => time(), + ]; + if(Db::name('OrderAftersale')->where(['id'=>$aftersale['id'])->update($upd_data)) + { + // 消息通知 + $detail = '订单退款成功,金额'.PriceBeautify($aftersale['price']).'元'; + MessageService::MessageAdd($aftersale['user_id'], '订单退款', $detail, 1, $order['data']['id']); + + return DataReturn('退款成功', 0); + } + } return $ret; } @@ -802,7 +821,7 @@ class OrderAftersaleService 'order_id' => $order['id'], 'total_price' => $order['total_price'], 'trade_no' => isset($ret['data']['trade_no']) ? $ret['data']['trade_no'] : '', - 'buyer_user' => isset($ret['data']['buyer_user']) ? $ret['data']['buyer_user'] : '', + 'buyer_user' => isset($ret['data']['buyer_user_id']) ? $ret['data']['buyer_user_id'] : '', 'refund_price' => $aftersale['price'], 'msg' => $pay_params['refund_reason'], 'payment' => $pay_log['payment'], @@ -811,33 +830,7 @@ class OrderAftersaleService 'return_params' => $ret['data'], ]; RefundLogService::RefundLogInsert($refund_log); - - // 更新退款状态 - return self::OrderAftersaleSuccess($aftersale['id']); - } - - /** - * 订单售后审核完成 - * @author Devil - * @blog http://gong.gg/ - * @version 1.0.0 - * @date 2019-05-28 - * @desc description - * @param [int] $aftersale_id [订单售后id] - */ - private static function OrderAftersaleSuccess($aftersale_id) - { - // 更新退款状态 - $upd_data = [ - 'status' => 3, - 'audit_time' => time(), - 'upd_time' => time(), - ]; - if(Db::name('OrderAftersale')->where(['id'=>$aftersale_id])->update($upd_data)) - { - return DataReturn('退款成功', 0); - } - return DataReturn('退款失败', -100); + return $ret; } /** -- GitLab