|
|
@@ -402,6 +402,7 @@ class OrderService extends BaseService
|
|
|
|
|
|
/**门店资产变化**/
|
|
|
$amount = $order->actPrice ?? 0.00;
|
|
|
+ $realPrice = $order->realPrice ?? 0.00;
|
|
|
$currentShopId = $order->shopId ?? 0;
|
|
|
$shop = ShopClass::getLockById($currentShopId);
|
|
|
if (empty($shop)) {
|
|
|
@@ -415,7 +416,7 @@ class OrderService extends BaseService
|
|
|
$shop->totalIncome = $currentTotalIncome;
|
|
|
if ($payWay == dict::getDict('payWay', 'debtPay')) {
|
|
|
//客户欠款支付会增加【应收客户款】
|
|
|
- $currentGathering = bcadd($shop->mayGathering, $amount, 2);
|
|
|
+ $currentGathering = bcadd($shop->mayGathering, $realPrice, 2);
|
|
|
$shop->mayGathering = $currentGathering;
|
|
|
//客户第一次欠款的增加一个欠款客户
|
|
|
if ($custom->debtNum == 0) {
|
|
|
@@ -450,11 +451,15 @@ class OrderService extends BaseService
|
|
|
];
|
|
|
ShopCapitalClass::addCapital($capital);
|
|
|
|
|
|
- //客户采购引起的开单,会增加余额,会增加收入
|
|
|
+ //客户采购,会增加余额,会增加收入
|
|
|
if ($isPurchase == true) {
|
|
|
//余额支付和微信支付会增加余额
|
|
|
if ($payWay == dict::getDict('payWay', 'wxPay') || $payWay == dict::getDict('payWay', 'balancePay')) {
|
|
|
- ShopClass::customKdAddBalance($shop, $amount, $order, $capitalType);
|
|
|
+ ShopClass::customKdAddBalance($shop, $realPrice, $order, $capitalType);
|
|
|
+ }
|
|
|
+ if (isset($order->discountType) && $order->discountType == dict::getDict('discountType', 'usePtCoupon')) {
|
|
|
+ //客户使用优惠券增加的余额
|
|
|
+ ShopClass::customKdUseCouponAddBalance($shop, $order, $capitalType);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -477,9 +482,9 @@ class OrderService extends BaseService
|
|
|
|
|
|
/**客户资产变化**/
|
|
|
if ($payWay == dict::getDict('payWay', 'debtPay')) {
|
|
|
- //欠款支付
|
|
|
+ //欠款金额
|
|
|
$custom->isDebt = CustomClass::IS_DEBT_YES;
|
|
|
- $custom->debtAmount = bcadd($custom->debtAmount, $amount, 2);
|
|
|
+ $custom->debtAmount = bcadd($custom->debtAmount, $realPrice, 2);
|
|
|
$custom->debtNum += 1;
|
|
|
}
|
|
|
$custom->buyNum += 1;
|