|
|
@@ -3,6 +3,7 @@
|
|
|
namespace bizHd\cg\services;
|
|
|
|
|
|
use biz\ghs\classes\GhsClass;
|
|
|
+use biz\hb\classes\HbClass;
|
|
|
use biz\shop\classes\ShopCapitalClass;
|
|
|
use biz\shop\classes\ShopClass;
|
|
|
use biz\wx\classes\WxMessageClass;
|
|
|
@@ -48,7 +49,7 @@ class CgRefundService extends BaseService
|
|
|
$post['cgId'] = $cg->id;
|
|
|
$refundPrice = $post['price'] ?? 0;
|
|
|
if (is_numeric($refundPrice) == false || $refundPrice < 0) {
|
|
|
- util::fail('退款金额有问题。');
|
|
|
+ util::fail('退款金额有问题');
|
|
|
}
|
|
|
$post['refundPrice'] = $refundPrice;
|
|
|
|
|
|
@@ -58,7 +59,18 @@ class CgRefundService extends BaseService
|
|
|
util::fail('没有找到门店');
|
|
|
}
|
|
|
|
|
|
- //--------start-----花材处理逻辑 linqh 2021.6.28------
|
|
|
+ //退款金额和采购单金额一样,有使用红包则原路退回
|
|
|
+ $actPrice = $cg->actPrice ?? 0;
|
|
|
+ if (floatval($actPrice) == floatval($refundPrice)) {
|
|
|
+ $hbId = $cg->hbId ?? 0;
|
|
|
+ if (!empty($hbId)) {
|
|
|
+ $hbInfo = HbClass::getById($hbId, true);
|
|
|
+ $hbInfo->status = HbClass::STATUS_UN_USE;
|
|
|
+ $hbInfo->take = HbClass::TAKE_UN;
|
|
|
+ $hbInfo->save();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
$ghsItemInfo = $post['product'] ?? '';
|
|
|
$data = [];
|
|
|
$data['status'] = CgRefundClass::STATUS_COMPLETE;
|
|
|
@@ -107,7 +119,6 @@ class CgRefundService extends BaseService
|
|
|
StockRecordClass::addRecordByOrder($orderData, StockRecordClass::STOCK_RECORD_TYPE_REFUND);
|
|
|
|
|
|
}
|
|
|
- //--------end-----花材处理逻辑 linqh 2021.6.28------
|
|
|
|
|
|
//门店总收入增加
|
|
|
$currentTotalIncome = bcadd($shop->totalIncome, $refundPrice, 2);
|
|
|
@@ -236,7 +247,7 @@ class CgRefundService extends BaseService
|
|
|
} elseif ($payWay == dict::getDict('payWay', 'balancePay')) {
|
|
|
|
|
|
//门店余额增加
|
|
|
- ShopClass::cgRefundAddBalance($shop, $refundPrice, $cgRefund,$ghs);
|
|
|
+ ShopClass::cgRefundAddBalance($shop, $refundPrice, $cgRefund, $ghs);
|
|
|
|
|
|
} else {
|
|
|
util::fail('支付方式没有找到哦!');
|