|
|
@@ -16,6 +16,7 @@ use bizHd\order\services\OrderService;
|
|
|
use bizHd\product\classes\ProductClass;
|
|
|
use bizHd\purchase\classes\PurchaseClass;
|
|
|
use bizHd\saas\services\RegionService;
|
|
|
+use bizHd\shop\classes\MainClass;
|
|
|
use bizHd\shop\classes\ShopClass;
|
|
|
use bizHd\user\services\UserService;
|
|
|
use bizHd\work\classes\WorkClass;
|
|
|
@@ -940,6 +941,33 @@ class OrderController extends BaseController
|
|
|
$id = Yii::$app->request->get('id', 0);
|
|
|
$detail = OrderClass::getFullInfo($id);
|
|
|
OrderService::valid($detail, $this->mainId);
|
|
|
+
|
|
|
+ //0表示按正常流程售后,1表示开负数订单售后
|
|
|
+ $addMinusOrderRefund = 0;
|
|
|
+ //只能开负数订单的几种情况:0、开的欠款单,并且已经全部或者部分结清,1、可售后时间到了
|
|
|
+ $addMinusOrderReason = 0;
|
|
|
+ if ($detail['payWay'] == 3) {
|
|
|
+ if ($detail['debtPrice'] > $detail['remainDebtPrice']) {
|
|
|
+ $addMinusOrderRefund = 1;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ $mainId = $this->mainId;
|
|
|
+ $main = MainClass::getById($mainId, true);
|
|
|
+ $refundLimit = $main->refundLimit ?? 0;
|
|
|
+ if ($refundLimit > 0) {
|
|
|
+ $payTime = $main->payTime;
|
|
|
+ $currentPayTime = strtotime($payTime);
|
|
|
+ $addDateTime = $refundLimit * 86400;
|
|
|
+ $refundDeadTime = $currentPayTime + $addDateTime;
|
|
|
+ $now = time();
|
|
|
+ if ($now > $refundDeadTime) {
|
|
|
+ $addMinusOrderRefund = 1;
|
|
|
+ $addMinusOrderReason = 1;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ $detail['addMinusOrderRefund'] = $addMinusOrderRefund;
|
|
|
+ $detail['addMinusOrderReason'] = $addMinusOrderReason;
|
|
|
+
|
|
|
util::success($detail);
|
|
|
}
|
|
|
|