|
|
@@ -12,6 +12,7 @@ use bizHd\order\classes\OrderClass as HdOrderClass;
|
|
|
use bizHd\order\classes\PsMethodClass;
|
|
|
use bizHd\order\classes\WholeOrderDiscountClass;
|
|
|
use bizHd\refund\classes\HdRefundClass;
|
|
|
+use bizHd\refund\classes\HdRefundMallClass;
|
|
|
use bizHd\hb\classes\HbClass;
|
|
|
use bizHd\hb\classes\HbScopeClass;
|
|
|
use bizHd\homePageConfig\classes\HomePageModuleClass;
|
|
|
@@ -1985,7 +1986,7 @@ class OrderController extends BaseController
|
|
|
util::complete('提交成功');
|
|
|
}
|
|
|
|
|
|
- //订单详情 ssh 2019.12.16
|
|
|
+ // 订单详情:含 canApplyRefund / refundApplyId,供底部申请售后、查看申请
|
|
|
public function actionDetail()
|
|
|
{
|
|
|
$id = Yii::$app->request->get('id', 0);
|
|
|
@@ -2009,9 +2010,19 @@ class OrderController extends BaseController
|
|
|
$detail['balance'] = $balance;
|
|
|
|
|
|
$detail['rechargeWeal'] = $this->shop->rechargeWeal; //是否开启余额支付
|
|
|
- // 与 RefundController::canApplyRefund 对齐,供详情页「申请售后」显隐
|
|
|
+ // 与 RefundController::canApplyRefund 对齐;最新申请供详情页「查看申请」入口
|
|
|
$detail['distOrderSettled'] = DistributionOrderClass::isDistOrderSettled((int)$id) ? 1 : 0;
|
|
|
- $detail['canApplyRefund'] = $this->canApplyRefundForDetail($detail) ? 1 : 0;
|
|
|
+ $apply = HdRefundClass::getLatestByOrderId((int)$id);
|
|
|
+ $detail['canApplyRefund'] = $this->canApplyRefundForDetail($detail, $apply) ? 1 : 0;
|
|
|
+ $detail['refundApplyId'] = 0;
|
|
|
+ $detail['refundApplyStatus'] = '';
|
|
|
+ $detail['refundApplyStatusText'] = '';
|
|
|
+ // 有顾客申请才给入口;商家即时售后 userId=0 不展示「查看申请」
|
|
|
+ if (!empty($apply) && !empty($apply['id'])) {
|
|
|
+ $detail['refundApplyId'] = (int)$apply['id'];
|
|
|
+ $detail['refundApplyStatus'] = (int)($apply['status'] ?? 0);
|
|
|
+ $detail['refundApplyStatusText'] = HdRefundMallClass::statusText($apply['status'] ?? 0);
|
|
|
+ }
|
|
|
// 配送方式名称:xhPsMethod.name(style = 订单 sendType)
|
|
|
$detail['psMethodName'] = $this->resolvePsMethodName($detail);
|
|
|
util::success($detail);
|
|
|
@@ -2042,9 +2053,10 @@ class OrderController extends BaseController
|
|
|
/**
|
|
|
* 订单详情是否可申请售后(与 mall RefundController::canApplyRefund 规则一致)
|
|
|
* @param array $order 订单详情
|
|
|
+ * @param array|null $apply 最新顾客申请,避免详情里重复查
|
|
|
* @return bool
|
|
|
*/
|
|
|
- protected function canApplyRefundForDetail($order)
|
|
|
+ protected function canApplyRefundForDetail($order, $apply = null)
|
|
|
{
|
|
|
if ((int)($order['payStatus'] ?? 0) !== 1) {
|
|
|
return false;
|
|
|
@@ -2056,7 +2068,9 @@ class OrderController extends BaseController
|
|
|
if ((int)($order['forward'] ?? 0) === 1) {
|
|
|
return false;
|
|
|
}
|
|
|
- $apply = HdRefundClass::getLatestByOrderId((int)($order['id'] ?? 0));
|
|
|
+ if ($apply === null) {
|
|
|
+ $apply = HdRefundClass::getLatestByOrderId((int)($order['id'] ?? 0));
|
|
|
+ }
|
|
|
if (!empty($apply) && (int)($apply['status'] ?? -1) === HdRefundClass::STATUS_PENDING) {
|
|
|
return false;
|
|
|
}
|