|
|
@@ -25,6 +25,7 @@ use bizGhs\base\classes\BaseClass;
|
|
|
class RefundOrderClass extends BaseClass
|
|
|
{
|
|
|
use OrderTrait;
|
|
|
+
|
|
|
public static $baseFile = '\bizGhs\order\models\RefundOrder';
|
|
|
|
|
|
const STATUS_UN_COMPLETE = 0; //待审核
|
|
|
@@ -164,13 +165,18 @@ class RefundOrderClass extends BaseClass
|
|
|
}
|
|
|
$oneItem->refundNum = bcadd($refundNum, $num);
|
|
|
$oneItem->save();
|
|
|
-print_r($refundSingle->attributes);
|
|
|
-die;
|
|
|
- $smallNum = 0;
|
|
|
- $bigNum = $num;
|
|
|
+
|
|
|
+ if ($refundSingle->xhUnitType == 1) {
|
|
|
+ $smallNum = $num;
|
|
|
+ $bigNum = 0;
|
|
|
+ } else {
|
|
|
+ $smallNum = 0;
|
|
|
+ $bigNum = $num;
|
|
|
+ }
|
|
|
+ $itemNum = $refundSingle->itemNum;
|
|
|
|
|
|
//大单位退款才变库存,小单位不变化库存!!
|
|
|
- if ($bigNum > 0) {
|
|
|
+ if ($bigNum > 0 || $smallNum > 0) {
|
|
|
//退货加库存
|
|
|
$stockInfo = ProductClass::addStock($productId, $bigNum, $smallNum);
|
|
|
$oldStock = $stockInfo['oldStock'] ?? 0;
|
|
|
@@ -178,7 +184,7 @@ die;
|
|
|
//库存变动记录
|
|
|
$recordData = [];
|
|
|
$recordData['relateName'] = $customName;
|
|
|
- $recordData['itemNum'] = $bigNum;
|
|
|
+ $recordData['itemNum'] = $itemNum;
|
|
|
$recordData['sjId'] = $sjId;
|
|
|
$recordData['shopId'] = $shopId;
|
|
|
$recordData['mainId'] = $mainId;
|