<?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_earnings', function (Blueprint $table) {
            $table->id();
            $table->integer('user_id')->unsigned()->comment("代理用户id");
            $table->integer('shop_id')->unsigned()->comment("商品id");
            $table->integer('order_id')->unsigned()->comment("用户订单id");
            $table->decimal('total', 9)->default(0)->comment("总金额");
            $table->decimal('amount', 9)->default(0)->comment("收益");
            $table->decimal('wechat_fee',9)->default(0)->comment("微信手续费");
            $table->decimal('ufutx_fee', 9)->default(0)->comment("平台费");
            $table->timestamps();
        });
    }

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