<?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('agent_orders', function (Blueprint $table) {
            $table->id();
            $table->integer('user_id')->unsigned()->comment("用户id");
            $table->string('name',50)->nullable()->comment("姓名");
            $table->string('mobile',20)->nullable()->comment("手机号");
            $table->string('trade_no')->comment("订单号");
            $table->decimal('origin_price',8)->default(0)->comment("原价");
            $table->decimal('price',8)->default(0)->comment("支付金额");
            $table->boolean('is_online')->default(1)->comment("是否线上订单，0:否，1：是");
            $table->enum('pay_type', ['wechat', 'free'])->comment("支付方式 free:免费，wechat:微信");
            $table->enum('pay_status', ['UNPAID',"PAID"])->comment("订单状态");
            $table->integer('shop_id')->unsigned()->comment("商品id");
            $table->integer('sku_id')->unsigned()->comment("规格id");
            $table->text("shop_info")->nullable()->comment("商品信息");
            $table->integer('num')->unsigned()->comment("数量");
            $table->integer('contract_id')->unsigned()->nullable()->comment("合同id");
            $table->integer('from_user_id')->unsigned()->nullable()->comment("分享人id");
            $table->timestamps();
        });
    }

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