账单导出
This commit is contained in:
@@ -5,6 +5,8 @@ namespace App\Services;
|
||||
use App\Models\BillModel;
|
||||
use App\Models\ProductModel;
|
||||
use App\Models\StoreOrderItemModel;
|
||||
use Illuminate\Contracts\Container\BindingResolutionException;
|
||||
use Illuminate\Contracts\Container\CircularDependencyException;
|
||||
use Illuminate\Support\Collection;
|
||||
|
||||
/**
|
||||
@@ -16,7 +18,10 @@ class BillDetailService
|
||||
* 合并后的商品明细:按商品聚合账单关联的全部订单明细
|
||||
* 单价为加权平均口径(Σ金额÷Σ数量),保证 单价×数量=金额;附商品首图
|
||||
*
|
||||
* @return array<int, array{product_id: int, product_name: string, product_spec: string, unit: string, price: string, quantity: int, weight: string, amount: string, image: string}>
|
||||
* @param BillModel $bill
|
||||
* @return array<int, array{product_id: int, product_name: string, product_spec: string, unit: string, price: string, quantity: int, weight: string, amount: string, spec: string, price_unit: string, image: string}>
|
||||
* @throws BindingResolutionException
|
||||
* @throws CircularDependencyException
|
||||
*/
|
||||
public function mergedItems(BillModel $bill): array
|
||||
{
|
||||
@@ -34,7 +39,9 @@ class BillDetailService
|
||||
* 首图取明细快照 image_ids 批量解析,按「分类sort → 商品sort」排序
|
||||
*
|
||||
* @param Collection<int, StoreOrderItemModel> $items
|
||||
* @return array<int, array{product_id: int, product_name: string, product_spec: string, unit: string, price: string, quantity: int, weight: string, amount: string, image: string}>
|
||||
* @return array<int, array{product_id: int, product_name: string, product_spec: string, unit: string, price: string, quantity: int, weight: string, amount: string, spec: string, price_unit: string, image: string}>
|
||||
* @throws BindingResolutionException
|
||||
* @throws CircularDependencyException
|
||||
*/
|
||||
private function aggregateItems(Collection $items): array
|
||||
{
|
||||
|
||||
@@ -19,9 +19,9 @@ class WeightEstimator
|
||||
}
|
||||
|
||||
/**
|
||||
* 单个计价单位折算重量(斤)
|
||||
* 单个计价单位折算重量(斤);规格无法解析时返回 '0'
|
||||
*/
|
||||
private static function perUnitJin(string $spec, string $unit): string
|
||||
public static function perUnitJin(string $spec, string $unit): string
|
||||
{
|
||||
// 按重量计价的单位:订货量本身就是重量
|
||||
$unitWeight = self::toJin('1', $unit);
|
||||
|
||||
Reference in New Issue
Block a user