|
|
@@ -544,6 +544,8 @@ class StatSaleClass extends BaseClass
|
|
|
$unitPrice = $orderItem->unitPrice ?? 0;
|
|
|
$refundNum = $orderItem->refundNum ?? 0;
|
|
|
$num = $orderItem->num ?? 0;
|
|
|
+ $productId = $orderItem->itemId ?? 0;
|
|
|
+ $name = $orderItem->name ?? '';
|
|
|
$remainNum = bcsub($num, $refundNum);
|
|
|
$amount = bcmul($remainNum, $unitPrice, 2);
|
|
|
$className = $classList[$classId]['name'] ?? '未知';
|
|
|
@@ -555,6 +557,15 @@ class StatSaleClass extends BaseClass
|
|
|
$arr[$classId]['expend'] = 0;
|
|
|
$arr[$classId]['income'] = $amount;
|
|
|
}
|
|
|
+ $belongCost = $orderItem->belongCost ?? 0;
|
|
|
+ if ($belongCost == 1) {
|
|
|
+ if (isset($tbSaleIncome[$productId])) {
|
|
|
+ $tbSaleIncome[$productId]['num'] = bcadd($tbSaleIncome[$productId]['num'], $remainNum);
|
|
|
+ $tbSaleIncome[$productId]['price'] = bcadd($tbSaleIncome[$productId]['price'], $amount, 2);
|
|
|
+ } else {
|
|
|
+ $tbSaleIncome[$productId] = ['name' => $name, 'num' => $remainNum, 'price' => $amount];
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
if ($tkPrice > 0) {
|
|
|
$refundList = HdRefundClass::getAllByCondition(['orderSn' => $orderSn], null, '*', null, true);
|