|
@@ -6,6 +6,7 @@
|
|
|
*/
|
|
*/
|
|
|
namespace bizGhs\order\classes;
|
|
namespace bizGhs\order\classes;
|
|
|
|
|
|
|
|
|
|
+use biz\shop\classes\ShopClass;
|
|
|
use bizGhs\custom\classes\CustomClass;
|
|
use bizGhs\custom\classes\CustomClass;
|
|
|
use bizGhs\custom\services\GhsRechargeSettleService;
|
|
use bizGhs\custom\services\GhsRechargeSettleService;
|
|
|
use bizGhs\product\classes\ProductClass;
|
|
use bizGhs\product\classes\ProductClass;
|
|
@@ -330,7 +331,8 @@ class NextDayRefundClass
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
- * GHS 侧隔天通过:累计 nextDayTkPrice;余额/挂账原路加余额并 hasReturn=1;线上/线下现金等留给通道或人工。
|
|
|
|
|
|
|
+ * GHS 侧隔天通过:累计 nextDayTkPrice(不改 actPrice);扣 buyAmount;
|
|
|
|
|
+ * 余额/挂账原路加回客户余额;线上付扣门店可提现余额(与当天售后一致,必须在 ghs 端做)。
|
|
|
* @return string 当前客户余额
|
|
* @return string 当前客户余额
|
|
|
*/
|
|
*/
|
|
|
public static function applyGhsAmountAndFund($refund, $order)
|
|
public static function applyGhsAmountAndFund($refund, $order)
|
|
@@ -345,6 +347,7 @@ class NextDayRefundClass
|
|
|
if (empty($custom)) {
|
|
if (empty($custom)) {
|
|
|
util::fail('没有找到客户');
|
|
util::fail('没有找到客户');
|
|
|
}
|
|
}
|
|
|
|
|
+ // 累计消费与是否当天无关:退了就要从 buyAmount 扣掉
|
|
|
$buyAmount = bcsub((string)($custom->buyAmount ?? '0'), $refundPrice, 2);
|
|
$buyAmount = bcsub((string)($custom->buyAmount ?? '0'), $refundPrice, 2);
|
|
|
if (bccomp($buyAmount, '0', 2) < 0) {
|
|
if (bccomp($buyAmount, '0', 2) < 0) {
|
|
|
$buyAmount = '0.00';
|
|
$buyAmount = '0.00';
|
|
@@ -361,8 +364,21 @@ class NextDayRefundClass
|
|
|
self::syncRefundFundFlags($refund, ['hasReturn' => self::FLAG_YES]);
|
|
self::syncRefundFundFlags($refund, ['hasReturn' => self::FLAG_YES]);
|
|
|
$custom = CustomClass::getById($customId, true);
|
|
$custom = CustomClass::getById($customId, true);
|
|
|
$balance = bcadd((string)($custom->balance ?? '0'), '0', 2);
|
|
$balance = bcadd((string)($custom->balance ?? '0'), '0', 2);
|
|
|
|
|
+ } elseif (self::isOnlinePayOrder($refund) || self::isOnlinePayOrder($order)) {
|
|
|
|
|
+ // 线上付收款时加过门店可提现余额,隔天售后也要在 ghs 端扣回(拉卡拉原路仍在采购侧发起)
|
|
|
|
|
+ $shopId = intval($order->shopId ?? ($refund->shopId ?? 0));
|
|
|
|
|
+ $mainId = intval($order->mainId ?? ($refund->mainId ?? 0));
|
|
|
|
|
+ $shop = ShopClass::getLockById($shopId);
|
|
|
|
|
+ if (empty($shop)) {
|
|
|
|
|
+ util::fail('没有找到门店');
|
|
|
|
|
+ }
|
|
|
|
|
+ $main = MainClass::getLockById($mainId);
|
|
|
|
|
+ if (empty($main)) {
|
|
|
|
|
+ util::fail('没有main信息');
|
|
|
|
|
+ }
|
|
|
|
|
+ ShopClass::saleRefundReduceBalance($main, $shop, $refund, $refundPrice);
|
|
|
}
|
|
}
|
|
|
- // 线上原路在采购侧发起;现金/银行卡等线下原路等人工 markHasReturn
|
|
|
|
|
|
|
+ // 现金/银行卡等线下原路等人工 markHasReturn
|
|
|
return $balance;
|
|
return $balance;
|
|
|
}
|
|
}
|
|
|
|
|
|