<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateOwnerFeeDetailsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('owner_fee_details', function (Blueprint $table) {
            $table->id();
            $table->bigInteger('owner_id')->index()->comment('外键货主');
            $table->date('worked_at')->index()->comment('作业时间');
            $table->enum('type',["发货","收货","增值服务"])->index()->comment('类型');
            $table->bigInteger('shop_id')->nullable()->index()->comment('外键店铺');
            $table->string('operation_bill')->nullable()->comment('发/收/退货单号');
            $table->string('consignee_name')->nullable()->comment('收货人');
            $table->string('consignee_phone')->nullable()->comment('收货人电话');
            $table->string('commodity_amount')->nullable()->comment('商品数量');
            $table->string('logistic_bill')->nullable()->comment('快递单号');
            $table->decimal('volume',8,3)->nullable()->comment('体积');
            $table->decimal('weight',8,3)->nullable()->comment('重量');
            $table->bigInteger("logistic_id")->nullable()->index()->comment("快递公司");
            $table->bigInteger('process_method_id')->nullable()->index()->comment('外键加工类型');
            $table->decimal('work_fee',8,4)->nullable()->comment('作业费');
            $table->decimal('logistic_fee',8,4)->nullable()->comment('物流费');
            $table->timestamp('created_at')->nullable()->comment('创建时间');
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('owner_fee_details');
    }
}
