ANG YU 4 лет назад
Родитель
Сommit
b73ab21485

+ 1 - 0
app/Http/Controllers/SettlementBillStoreOutFeeDetailController.php

@@ -52,6 +52,7 @@ class SettlementBillStoreOutFeeDetailController extends Controller implements Se
             $query->whereIn('id', explode(',', $request['data']));
         }
         $details = $query->get();
+        $this->service->buildPriceRemarks($details);
         $json = $this->service->buildExport($details);
         $row = ['作业时间', '作业名称', '上游单号', '订单号', '商品条码', '商品名称', '商品数量', '价格', '合计'];
         return Export::make($row, $json, "出库费明细");

+ 24 - 16
app/Http/Controllers/SettlementBillStoreOutFeeReportController.php

@@ -44,13 +44,14 @@ class SettlementBillStoreOutFeeReportController extends Controller implements Se
             'counting_month' => $counting_month,
             'type' => $this->service::TYPE,
         ]);
+
         $owner = Owner::query()->selectRaw("name,id")->find($owner_id);
         $owners = Owner::query()->selectRaw("id,name")->whereIn('id', $permittingOwnerIds)->get();
         $isArchived = $this->archiveService->isArchived($counting_month, $owner_id, $this->service::TYPE);
         $request = $this->buildRequest($request, $counting_month);
-
+        $work_name_fee_total = collect($this->buildWorkNameFeeTotal($reports, $work_name_fee_total));
         return view('finance.settlementBills.storeOutFee.report.index',
-            compact('reports', 'owners', 'owner', 'isArchived', 'request', 'reports', 'work_name_fee_total', 'fee_total'));
+            compact('owners', 'owner', 'isArchived', 'request', 'work_name_fee_total', 'fee_total'));
     }
 
     public function confirmBill(Request $request): RedirectResponse
@@ -93,23 +94,30 @@ class SettlementBillStoreOutFeeReportController extends Controller implements Se
             'type' => $this->service::TYPE,
         ]);
         $json = [];
-        foreach ($reports as $report) {
-            $fee = '';
-            foreach ($work_name_fee_total as $item) {
-                if ($item['work_name'] == $report['work_name']) {
-                    $fee = $item['fee'];
-                    continue;
-                }
+        $work_name_fee_total = collect($this->buildWorkNameFeeTotal($reports, $work_name_fee_total));
+        foreach ($work_name_fee_total as $work_name_fee_total_item) {
+            foreach ($work_name_fee_total_item['data'] as $data_item) {
+                $json[] = [
+                    $work_name_fee_total_item['name'],
+                    $data_item['step'],
+                    $data_item['unit_price'],
+                    $data_item['amount'],
+                    $work_name_fee_total_item['fee'],
+                ];
             }
-            $json[] = [
-                $report['work_name'],
-                $report['step'],
-                $report['unit_price'] . '元/' . $report['unit']['name'] ?? '',
-                $report['amount'],
-                $fee,
-            ];
         }
         $row = ['作业名称', '阶梯', '单价', '数量', '合计',];
         return Export::make($row, $json, "出库费合计");
     }
+
+    private function buildWorkNameFeeTotal($reports, $work_name_fee_total)
+    {
+        $result = [];
+        $reports_grouped = $reports->groupBy('owner_price_operation_id');
+        foreach ($work_name_fee_total as $work_name_fee_total_item) {
+            $work_name_fee_total_item['data'] = $reports_grouped[$work_name_fee_total_item['id']];
+            $result[] = $work_name_fee_total_item;
+        }
+        return $result;
+    }
 }

+ 20 - 0
app/Http/Controllers/TestController.php

@@ -84,6 +84,7 @@ use App\Services\OwnerBillTotalService;
 use App\Services\OwnerLogisticFeeDetailService;
 use App\Services\OwnerLogisticFeeReportService;
 use App\Services\OwnerStoreFeeReportService;
+use App\Services\OwnerStoreOutFeeReportService;
 use App\Services\RejectedBillService;
 use App\Services\StorageService;
 use App\Services\StoreItemService;
@@ -1756,4 +1757,23 @@ TEXT;
         }
         return $owner_price_operation_fees;
     }
+
+    public function test_store_out_record()
+    {
+        /**@var $service OwnerStoreOutFeeReportService */
+        $service = app('OwnerStoreOutFeeReportService');
+        $service->recordReport();
+    }
+
+    public function test_store_out_get()
+    {
+        /**@var $service OwnerStoreOutFeeReportService */
+        $service = app('OwnerStoreOutFeeReportService');
+        $result = $service->get([
+            'owner_id' => 3,
+            'counting_month' => now()->subMonth()->startOfMonth()->toDateString(),
+            'type' => $service::TYPE,
+        ]);
+        return $result;
+    }
 }

+ 1 - 1
app/OwnerPriceOperationItem.php

@@ -28,7 +28,7 @@ class OwnerPriceOperationItem extends Model
 
     public function unit()
     {   //单位
-        return $this->hasOne(Unit::class,"id","unit_id");
+        return $this->belongsTo(Unit::class);
     }
     public function ownerPriceOperation()
     {   //作业计费

+ 17 - 1
app/OwnerStoreOutFeeDetail.php

@@ -11,7 +11,18 @@ class OwnerStoreOutFeeDetail extends Model
 {
     use ModelLogChanging;
 
-    public $fillable = ['owner_fee_detail_id', 'commodity_id', 'owner_id', 'source_bill', 'work_name', 'unit_price', 'unit_id', 'remark', 'step', 'amount',];
+    public $fillable = [
+        'owner_fee_detail_id',//
+        'commodity_id',//
+        'owner_id',//
+        'source_bill', // 上游单号
+        'owner_price_operation_id', //
+        'unit_price', //价格
+        'unit_id', //
+        'amount',//数量
+        'step',//阶梯
+        'price_remark',//价格描述
+        ];
 
     public function ownerFeeDetail(): BelongsTo
     {
@@ -32,4 +43,9 @@ class OwnerStoreOutFeeDetail extends Model
     {
         return $this->belongsTo(Unit::class);
     }
+
+    public function ownerPriceOperation(): BelongsTo
+    {
+        return $this->belongsTo(OwnerPriceOperation::class);
+    }
 }

+ 1 - 1
app/OwnerStoreOutFeeReport.php

@@ -11,7 +11,7 @@ class OwnerStoreOutFeeReport extends Model
 {
     use ModelLogChanging;
 
-    public $fillable = ['owner_bill_report_id', 'owner_price_operation_id', 'counting_month', 'step', 'unit_id', 'unit_price', 'amount', 'fee', 'owner_id', 'work_name'];
+    public $fillable = ['owner_bill_report_id', 'owner_price_operation_id', 'counting_month', 'step', 'unit_id', 'unit_price', 'amount', 'fee', 'owner_id'];
 
     public $timestamps = false;
 

+ 0 - 12
app/Services/OwnerBillTotalService.php

@@ -10,18 +10,6 @@ class OwnerBillTotalService
     use ServiceAppAop;
 
     protected $modelClass = OwnerBillTotal::class;
-    const FEE_NAMES = [
-        '仓储费',
-        '入库费',
-        '出库费',
-        '配送费',
-        '库内加工',
-        '系统使用费',
-        '杂项费',
-        '理赔费',
-        '税费',
-    ];
-
     /**
      * 生成统计数据
      * @param string|null $counting_month string 统计月份默认为上一个月

+ 37 - 5
app/Services/OwnerStoreOutFeeDetailService.php

@@ -25,14 +25,18 @@ class OwnerStoreOutFeeDetailService implements SettlementBillDetailInterface
      */
     public function get(array $kvPairs): LengthAwarePaginator
     {
-        return $this->getSql($kvPairs['owner_id'],$kvPairs['counting_month'])->paginate($kvPairs['paginateParams']['paginate']??50);
+        return $this->getSql($kvPairs['owner_id'], $kvPairs['counting_month'])->paginate($kvPairs['paginateParams']['paginate'] ?? 50);
     }
 
     public function getSql($owner_id, $counting_month): Builder
     {
-       list($start, $end) = $this->getStartAndEnd($counting_month);
+        list($start, $end) = $this->getStartAndEnd($counting_month);
         return OwnerStoreOutFeeDetail::query()
-            ->with(['commodity:id,name,sku', 'ownerFeeDetail:id,worked_at,operation_bill,work_fee'])
+            ->with([
+                'commodity:id,name,sku',
+                'ownerFeeDetail:id,worked_at,operation_bill,work_fee',
+                'ownerPriceOperation.items.unit',
+            ])
             ->where('owner_id', $owner_id)
             ->whereBetween('created_at', [$start, $end]);
     }
@@ -49,13 +53,13 @@ class OwnerStoreOutFeeDetailService implements SettlementBillDetailInterface
         foreach ($details as $detail) {
             $result[] = [
                 $detail->ownerFeeDetail->worked_at,
-                $detail->work_name,
+                $detail->ownerPriceOperation->name ?? '',
                 $detail->source_bill,
                 $detail->ownerFeeDetail->operation_bill,
                 $detail->commodity->sku,
                 $detail->commodity->name,
                 $detail->amount,
-                $detail->remark,
+                $detail->price_remark,
                 $detail->ownerFeeDetail->work_fee,
             ];
         }
@@ -66,4 +70,32 @@ class OwnerStoreOutFeeDetailService implements SettlementBillDetailInterface
     {
         // TODO: Implement add() method.
     }
+
+
+//    public function buildPriceRemarks(&$storeOutFeeDetails)
+//    {
+//        foreach ($storeOutFeeDetails as &$ownerStoreOutFeeDetail) {
+//            //起步: 3 件 / 2.7000元  (满减单价: 0-19999 单(2.7元) , 20000-49999 单(2.5元) , 50000-99999 单(2元) , 100000+ 单(1.6元) )
+//            //默认续费: 1 件 / 0.5000元  (满减单价: 0-19999 单(0.5元) , 20000-49999 单(0.4元) , 50000-99999 单(0.3元) , 100000+ 单(0.2元) )
+//            $discount_counts = explode(',', $ownerStoreOutFeeDetail->ownerPriceOperation->discount_count);
+//            $priceRemarks = [];
+//            foreach ($ownerStoreOutFeeDetail->ownerPriceOperation->items as $operationItem) {
+//                $discount_prices = explode(',', $operationItem->discount_price);
+//                $strategy = $operationItem->strategy == '起步' ? '起步' : '默认续费';
+//                $priceRemark = "{$strategy}: {$operationItem->amount} {$operationItem->unit->name}/{$operationItem->unit_price}元";
+//                if (!empty($discount_prices)) {
+//                    $priceRemark .= "(满减单价:";
+//                    for ($i = 0; $i < count($discount_counts) - 1; $i++) {
+//                        $next_discount_count = $discount_counts[$i + 1] ?? '+';
+//                        $discount_count = $discount_counts[$i] ?? '';
+//                        $discount_price = $discount_prices[$i] ?? '';
+//                        $priceRemark .= "{$discount_count}-{$next_discount_count} {$operationItem->unit->name} {$discount_price}元,";
+//                    }
+//                    $priceRemark .= ")";
+//                }
+//                $priceRemarks[] = $priceRemark;
+//            }
+//            $ownerStoreOutFeeDetail['price_remarks'] = $priceRemarks;
+//        }
+//    }
 }

+ 33 - 14
app/Services/OwnerStoreOutFeeReportService.php

@@ -36,13 +36,26 @@ class OwnerStoreOutFeeReportService implements SettlementBillReportInterface
         $end = Carbon::parse($this->reportDate)->endOfMonth()->toDateString();
         $details =
             DB::table('owner_store_out_fee_details')
-                ->leftJoin('owner_fee_details', 'owner_fee_detail_id', '=', 'owner_fee_details.id')
-                ->selectRaw("DATE_FORMAT(owner_store_out_fee_details.created_at,'%Y-%m') as counting_month,
-                owner_store_out_fee_details.work_name,unit_id,unit_price,sum(amount) as amounts ,
-                owner_store_out_fee_details.owner_id,owner_fee_detail_id,
-                sum(owner_fee_details.work_fee) as work_fee,step")
+                ->leftJoin('owner_fee_details', 'owner_store_out_fee_details.owner_fee_detail_id', '=', 'owner_fee_details.id')
+                ->leftJoin('owner_price_operations', 'owner_store_out_fee_details.owner_price_operation_id', '=', 'owner_price_operations.id')
+                ->selectRaw("
+                DATE_FORMAT(owner_store_out_fee_details.created_at,'%Y-%m') as counting_month,
+                owner_store_out_fee_details.unit_id,
+                owner_store_out_fee_details.unit_price,
+                sum(owner_store_out_fee_details.amount) as amounts ,
+                owner_store_out_fee_details.owner_id,
+                owner_store_out_fee_details.owner_fee_detail_id,
+                owner_store_out_fee_details.owner_price_operation_id,
+                owner_store_out_fee_details.step,
+                sum(owner_fee_details.work_fee) as work_fee,
+                owner_price_operations.name
+                ")
                 ->whereBetween('owner_store_out_fee_details.created_at', [$start, $end])
-                ->groupBy('counting_month', 'owner_store_out_fee_details.owner_id', 'owner_store_out_fee_details.work_name', 'unit_id', 'unit_price', 'step')
+                ->groupBy('counting_month',
+                    'owner_store_out_fee_details.owner_id',
+                    'owner_store_out_fee_details.step',
+                    'owner_price_operations.id'
+                )
                 ->get();
         $reports = [];
         foreach ($details as $detail) {
@@ -53,18 +66,19 @@ class OwnerStoreOutFeeReportService implements SettlementBillReportInterface
                 ->where('counting_month', $counting_month)->first();
             $reports[] = [
                 'owner_bill_report_id' => $ownerBillReport->id ?? null,
-                'owner_price_operation_id' => null,//$detail->ownerFeeDetail->ownerPriceOperation->id??null,
+                'owner_price_operation_id' => $detail->owner_price_operation_id,
                 'owner_id' => $detail->owner_id,
                 'counting_month' => $counting_month,
                 'step' => $detail->step,
                 'unit_id' => $detail->unit_id,
                 'unit_price' => $detail->unit_price,
                 'amount' => $detail->amounts,
-                'work_name' => $detail->work_name,
                 'fee' => $detail->work_fee,
             ];
         }
-        OwnerStoreOutFeeReport::query()->insertOrIgnore($reports);
+        foreach (array_chunk($reports, 1000) as $reports_chunked) {
+            OwnerStoreOutFeeReport::query()->insertOrIgnore($reports_chunked);
+        }
     }
 
     public function getSql($owner_id, $counting_month): Builder
@@ -95,17 +109,22 @@ class OwnerStoreOutFeeReportService implements SettlementBillReportInterface
             $fee_total = $archived->information['fee_total'];
         } else {
             $reports = OwnerStoreOutFeeReport::query()
-                ->with('unit')
+                ->with(['unit:id,name'])
                 ->where('owner_id', $kvPairs['owner_id'])
                 ->where('counting_month', $kvPairs['counting_month'])
-                ->orderBy('work_name')
+                ->orderBy('owner_price_operation_id')
                 ->get();
 
-            $work_name_fee_total = DB::table('owner_store_out_fee_reports')
-                ->selectRaw("work_name,sum(fee) as fee")
+            $work_name_fee_total = OwnerStoreOutFeeReport::query()
+                ->leftJoin('owner_price_operations', 'owner_store_out_fee_reports.owner_price_operation_id', '=', 'owner_price_operations.id')
+                ->selectRaw("
+                sum(owner_store_out_fee_reports.fee) as fee,
+                owner_price_operations.name,
+                owner_price_operations.id
+                ")
                 ->where('owner_id', $kvPairs['owner_id'])
                 ->where('counting_month', $kvPairs['counting_month'])
-                ->groupBy('work_name')
+                ->groupBy('owner_price_operations.name')
                 ->get();
 
             $fee_total = OwnerStoreOutFeeReport::query()

+ 21 - 0
database/factories/OwnerPriceOperationItemFactory.php

@@ -0,0 +1,21 @@
+<?php
+
+/** @var \Illuminate\Database\Eloquent\Factory $factory */
+
+use App\OwnerPriceOperationItem;
+use Faker\Generator as Faker;
+
+$factory->define(OwnerPriceOperationItem::class, function (Faker $faker) {
+    $strategy = ['起步', '默认', '特征'];
+    return [
+        "owner_price_operation_id"=>random_int(1,100),         //作业计费ID
+        "strategy"=>$faker->randomElement($strategy),                         //子策略
+        "amount"=>random_int(1,100),                           //起步数
+        "unit_id"=>random_int(1,7),                          //单位ID
+        "unit_price"=>random_int(1,100),                       //单价
+        "feature"=>random_int(1,100),                          //特征
+        "priority"=>random_int(1,100),                         //优先级 值越大越高
+        "discount_price"=>random_int(1,100),                   //减免单价
+        "odd_price"=>random_int(1,100),                        //零头价
+    ];
+});

+ 0 - 18
database/factories/OwnerPriceOperationItemService.php

@@ -1,18 +0,0 @@
-<?php
-
-/** @var \Illuminate\Database\Eloquent\Factory $factory */
-
-use App\OwnerPriceOperationItem;
-use Faker\Generator as Faker;
-
-$factory->define(OwnerPriceOperationItem::class, function (Faker $faker) {
-    $strategy = ['默认','特征'];
-    return [
-//        "owner_price_operation_id"          => factory(\App\OwnerPriceOperation::class),         //作业计费ID
-        "strategy"                          =>$strategy[array_rand($strategy)],         //策略
-        "amount"                            =>mt_rand(0,100),                           //起步数
-//        "unit_id"                           => factory(\App\Unit::class),//单位ID
-        "unit_price"                        =>mt_rand(10,100) / 12,                       //单价
-        "feature"                           =>\Illuminate\Support\Str::random(6),                          //特征
-    ];
-});

+ 4 - 3
database/factories/OwnerStoreOutFeeDetailFactory.php

@@ -6,6 +6,7 @@ use App\OwnerStoreOutFeeDetail;
 use Faker\Generator as Faker;
 
 $factory->define(OwnerStoreOutFeeDetail::class, function (Faker $faker) {
+    $step = ['0-20000', '20000-50000', '50000-100000'];
     return [
         'owner_fee_detail_id' => random_int(1, 100),
 
@@ -15,7 +16,7 @@ $factory->define(OwnerStoreOutFeeDetail::class, function (Faker $faker) {
 
         'source_bill' => $faker->uuid,
 
-        'work_name' => $faker->title,
+        'owner_price_operation_id' => random_int(1, 100),
 
         'unit_price' => random_int(1, 100),
 
@@ -24,9 +25,9 @@ $factory->define(OwnerStoreOutFeeDetail::class, function (Faker $faker) {
 
         'amount' => random_int(1, 100),
 
-        'remark' => $faker->sentence,
+        'step' => $faker->randomElement($step),
 
-        'step' => $faker->title,
+        'price_remark' => '起步费:2.2元(5件以内),续费:0.2元/件',
         'created_at' => now()->subMonth()->startOfMonth()->addDays(random_int(0, 28)),
         'updated_at' => now()->subMonth()->startOfMonth()->addDays(random_int(0, 28)),
     ];

+ 0 - 2
database/factories/OwnerStoreOutFeeReportFactory.php

@@ -24,7 +24,5 @@ $factory->define(OwnerStoreOutFeeReport::class, function (Faker $faker) {
         'fee'=>random_int(1,100),
 
         'owner_id'=>random_int(1,100),
-
-        'work_name'=>$faker->title,
     ];
 });

+ 36 - 0
database/migrations/2021_07_02_092716_add_owner_price_operation_id_to_owner_store_out_fee_details.php

@@ -0,0 +1,36 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+class AddOwnerPriceOperationIdToOwnerStoreOutFeeDetails extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up()
+    {
+        Schema::table('owner_store_out_fee_details', function (Blueprint $table) {
+            $table->integer('owner_price_operation_id')->comment('计费模型');
+            $table->string('price_remark')->comment('费用描述');
+            $table->string('step')->comment('阶梯');
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down()
+    {
+        Schema::table('owner_store_out_fee_details', function (Blueprint $table) {
+            $table->dropColumn('owner_price_operation_id');
+            $table->dropColumn('work_name');
+            $table->dropColumn('step');
+        });
+    }
+}

+ 32 - 0
database/migrations/2021_07_02_170300_drop_work_name_to_owner_store_out_fee_reports.php

@@ -0,0 +1,32 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+class DropWorkNameToOwnerStoreOutFeeReports extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up()
+    {
+        Schema::table('owner_store_out_fee_reports', function (Blueprint $table) {
+            $table->dropColumn('work_name');
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down()
+    {
+        Schema::table('owner_store_out_fee_reports', function (Blueprint $table) {
+            $table->string('work_name');
+        });
+    }
+}

+ 22 - 3
database/seeds/OwnerStoreOutFeeDetailSeeder.php

@@ -2,6 +2,8 @@
 
 use App\Commodity;
 use App\OwnerFeeDetail;
+use App\OwnerPriceOperation;
+use App\OwnerPriceOperationItem;
 use App\OwnerStoreOutFeeDetail;
 use Illuminate\Database\Seeder;
 
@@ -14,14 +16,31 @@ class OwnerStoreOutFeeDetailSeeder extends Seeder
      */
     public function run()
     {
-        //
         OwnerStoreOutFeeDetail::query()->truncate();
-//        OwnerFeeDetail::query()->truncate();
+        OwnerFeeDetail::query()->truncate();
         Commodity::query()->truncate();
+        OwnerPriceOperation::query()->truncate();
+        OwnerPriceOperationItem::query()->truncate();
 
         $owners = \App\Owner::query()->limit(10)->get();
         foreach ($owners as $owner) {
-            factory(OwnerStoreOutFeeDetail::class)->times(100)->create(['owner_id'=>$owner->id]);
+            $priceOperations =  factory(\App\OwnerPriceOperation::class)->times(2)->create([
+                'operation_type' => '出库',
+                'discount_count'=>"0,30000,60000"
+            ]);
+            foreach ($priceOperations as $item) {
+                factory(OwnerPriceOperationItem::class)->times(2)->create([
+                    'owner_price_operation_id' => $item->id,
+                    'discount_price' => "2.5,2.2,1.6",
+                ]);
+            }
+            for ($i=0;$i<100;$i++) {
+                factory(OwnerStoreOutFeeDetail::class)->create([
+                    'owner_id'=>$owner->id,
+                    'owner_price_operation_id' => $priceOperations->random(1)->first()->id,
+                ]);
+            }
+
             factory(OwnerFeeDetail::class)->times(100)->create(['owner_id'=>$owner->id]);
             factory(Commodity::class)->times(100)->create(['owner_id'=>$owner->id]);
         }

+ 2 - 2
resources/views/finance/settlementBills/storeOutFee/detail/index.blade.php

@@ -57,13 +57,13 @@
                     <td><input class="checkItem" type="checkbox" :value="detail.id"></td>
                     <td>@{{ i+1 }}</td>
                     <td>@{{ detail.owner_fee_detail.worked_at }}</td>
-                    <td>@{{ detail.work_name }}</td>
+                    <td>@{{ detail.owner_price_operation.name }}</td>
                     <td>@{{ detail.source_bill }}</td>
                     <td>@{{ detail.owner_fee_detail.operation_bill }}</td>
                     <td>@{{ detail.commodity.sku }}</td>
                     <td>@{{ detail.commodity.name }}</td>
                     <td>@{{ detail.amount}}</td>
-                    <td>@{{ detail.remark }}</td>
+                    <td>@{{ detail.price_remark}}</td>
                     <td>@{{ detail.owner_fee_detail.work_fee }}</td>
                 </tr>
             </table>

+ 29 - 21
resources/views/finance/settlementBills/storeOutFee/report/index.blade.php

@@ -75,19 +75,33 @@
                 <tr v-for="(report,i) in reports"
                     @click="selectTr===i+1?selectTr=0:selectTr=i+1"
                     :class="selectTr===i+1?'focusing' : ''">
-                    <td class="text-center pt-4 bg-light"
-                        v-for="work_name in work_names"
-                        :rowspan="calRowspan(work_name)"
-                        v-if="(i==0 || report.work_name!== reports[i-1].work_name)&&report.work_name===work_name"
-                    >@{{ report.work_name }}</td>
-                    <td>@{{ report.step }}</td>
-                    <td>@{{ report.unit_price }}元/@{{ report.unit.name }}</td>
-                    <td>@{{ report.amount }}</td>
-                    <td class="text-center pt-4 bg-light"
-                        v-for="work_name in work_names"
-                        :rowspan="calRowspan(work_name)"
-                        v-if="(i==0 || report.work_name!== reports[i-1].work_name)&&report.work_name===work_name"
-                    >@{{ findWorkNameFee(report.work_name) }}</td>
+                    <td>
+                        @{{ report.name }}
+                    </td>
+                    <td class="m-0 p-0">
+                        <table class="table table-striped table-sm m-0 p-0">
+                            <tr v-for="item in report.data">
+                                <td>@{{ item.step }}</td>
+                            </tr>
+                        </table>
+                    </td>
+                    <td class="m-0 p-0">
+                        <table class="table table-striped table-sm m-0 p-0">
+                            <tr v-for="item in report.data">
+                                <td>@{{ item.unit_price }}</td>
+                            </tr>
+                        </table>
+                    </td>
+                    <td class="m-0 p-0">
+                        <table class="table table-striped table-sm m-0 p-0">
+                            <tr v-for="item in report.data">
+                                <td>@{{ item.amount }}</td>
+                            </tr>
+                        </table>
+                    </td>
+                    <td>
+                        @{{ report.fee }}
+                    </td>
                 </tr>
             </table>
         </div>
@@ -102,14 +116,11 @@
             el: "#list",
             data: {
                 owner: {!! $owner !!},
-                reports: {!! $reports !!},
-                work_name_fee_total: {!! $work_name_fee_total !!},
+                reports: {!! $work_name_fee_total !!},
                 owners: [@foreach($owners as $owner){name: '{{ $owner->id }}', value: '{{ $owner->name}}'},@endforeach],
                 isArchived: {!! $isArchived !!},
                 request: {!! $request !!},
                 selectTr: 0,
-                work_names: [],
-                _reports: null
             },
             created() {
             },
@@ -186,8 +197,6 @@
                     appendDom: 'btn'
                 });
                 _this.form.init();
-
-                this.work_names = Array.from(new Set(this.reports.map(obj => obj.work_name)));
             },
             methods: {
                 findWorkNameFee(value) {
@@ -211,8 +220,7 @@
                 },
             },
             computed: {},
-            filters: {
-            },
+            filters: {},
         });
     </script>
 @endsection