<?php

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

return new class extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('shop_orders', function (Blueprint $table) {
            $table->id();
            $table->integer('user_id')->unsigned()->comment("用户id");
            $table->integer('shop_id')->unsigned()->comment("商品id");
            $table->integer('sku_id')->unsigned()->comment("规格id");
            $table->text("shop_info")->nullable()->comment("商品信息");
            $table->decimal("origin_price",9)->default(0)->comment("原价");
            $table->decimal("price", 9)->default(0)->comment("价格");
            $table->integer('num')->unsigned()->default(1)->comment("数量");
            $table->enum("pay_type", ['free', 'wechat'])->default("wechat")->comment("支付类型");
            $table->enum("pay_status", ["UNPAID", "PAID", "REFUND", "SEND", "SIGNED","PROBLEM"])->comment("订单状态");
            $table->enum("problem_status", ["NO_PROCESSED", "PROCESSED", "BEING_PROCESSED"])->nullable()->comment("问题状态");
            $table->string('trade_no')->nullable()->comment("订单号");
            $table->string('name')->nullable()->comment("联系人");
            $table->string('mobile')->nullable()->comment("手机号");
            $table->string("address")->nullable()->comment("地址");
            $table->string("express")->nullable()->comment("快递公司");
            $table->string("express_trade_no")->nullable()->comment("凯迪单号");
            $table->timestamps();
        });
    }

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