|
|
@@ -2,7 +2,9 @@
|
|
|
|
|
|
namespace bizGhs\order\services;
|
|
|
|
|
|
+use biz\shop\classes\ShopCapitalClass;
|
|
|
use biz\shop\classes\ShopClass;
|
|
|
+use biz\stat\classes\StatOutClass;
|
|
|
use bizGhs\base\services\BaseService;
|
|
|
use bizGhs\custom\classes\CustomClass;
|
|
|
use bizGhs\order\classes\RefundOrderClass;
|
|
|
@@ -79,6 +81,28 @@ class RefundOrderService extends BaseService
|
|
|
if (empty($shop)) {
|
|
|
util::fail('没有找到门店');
|
|
|
}
|
|
|
+ $currentTotalExpend = bcadd($shop->totalExpend, $refundPrice, 2);
|
|
|
+ $shop->totalExpend = $currentTotalExpend;
|
|
|
+ $shop->save();
|
|
|
+
|
|
|
+ //支出流水
|
|
|
+ $thisType = dict::getDict('capitalType', 'saleRefund', 'id');
|
|
|
+ $sjId = $order->sjId ?? 0;
|
|
|
+ $shopId = $order->shopId ?? 0;
|
|
|
+ $event = '销售退款';
|
|
|
+ $capitalData = [
|
|
|
+ 'capitalType' => $thisType,
|
|
|
+ 'io' => 0,
|
|
|
+ 'totalExpend' => $currentTotalExpend,
|
|
|
+ 'payWay' => 0,
|
|
|
+ 'amount' => $refundPrice,
|
|
|
+ 'sjId' => $sjId,
|
|
|
+ 'shopId' => $shopId,
|
|
|
+ 'event' => $event,
|
|
|
+ ];
|
|
|
+ ShopCapitalClass::addCapital($capitalData);
|
|
|
+ //当天和当月支出统计
|
|
|
+ StatOutClass::updateOrInsert($shop, $refundPrice);
|
|
|
|
|
|
if ($payWay == dict::getDict('payWay', 'wxPay')) {
|
|
|
//门店余额减少
|