|
|
@@ -104,13 +104,13 @@ class PurchaseClearClass extends BaseClass
|
|
|
$ghs->debt = $currentAmount > 0 ? 2 : 1;
|
|
|
$ghs->save();
|
|
|
|
|
|
+ $shopId = $ghs->shopId;
|
|
|
+ $shop = ShopClass::getLockById($shopId);
|
|
|
+ if (empty($shop)) {
|
|
|
+ util::fail('没有找到供货商门店');
|
|
|
+ }
|
|
|
//供货商的门店余额增加
|
|
|
if ($payWay == dict::getDict('payWay', 'wxPay')) {
|
|
|
- $shopId = $ghs->shopId;
|
|
|
- $shop = ShopClass::getLockById($shopId);
|
|
|
- if (empty($shop)) {
|
|
|
- util::fail('没有找到门店');
|
|
|
- }
|
|
|
$balance = bcadd($shop->balance, $order->actPrice, 2);
|
|
|
$txBalance = bcadd($shop->txBalance, $order->actPrice, 2);
|
|
|
$shop->balance = $balance;
|
|
|
@@ -134,6 +134,10 @@ class PurchaseClearClass extends BaseClass
|
|
|
];
|
|
|
ShopYeChangeClass::addChange($change, true);
|
|
|
}
|
|
|
+ //供货商的门店应收客户款减少
|
|
|
+ $currentGathering = bcsub($shop->mayGathering, $order->actPrice, 2);
|
|
|
+ $shop->mayGathering = $currentGathering;
|
|
|
+ $shop->save();
|
|
|
|
|
|
if (empty($arr)) {
|
|
|
$msg = "结算订单 orderSn:{$orderSn} 支付成功,回调处理,没有找到采购订单";
|
|
|
@@ -168,6 +172,16 @@ class PurchaseClearClass extends BaseClass
|
|
|
$custom->debtNum -= count($arr);
|
|
|
$custom->isDebt = $remain > 0 ? 1 : 0;
|
|
|
$custom->save();
|
|
|
+
|
|
|
+ //客户门店应付供货商款减少
|
|
|
+ $customShopId = $custom->shopId;
|
|
|
+ $customShop = ShopClass::getLockById($customShopId);
|
|
|
+ if (empty($customShop)) {
|
|
|
+ util::fail('没有找到客户门店');
|
|
|
+ }
|
|
|
+ $currentMayPay = bcsub($customShop->mayPay, $order->actPrice, 2);
|
|
|
+ $customShop->mayPay = $currentMayPay;
|
|
|
+ $customShop->save();
|
|
|
}
|
|
|
|
|
|
}
|