<?php

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

class CreatePartnerOfflineOrdersTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('partner_offline_orders', function (Blueprint $table) {
            $table->increments('id');
            $table->integer('order_id')->index()->comment('订单id');
            $table->integer('partner_id')->comment('合伙人id');
            $table->string('name')->default('')->comment('客户名');
            $table->string('mobile')->default('')->comment('客户手机号');
            $table->string('contract_no')->comment('合同编号');
            $table->tinyInteger('pay_type')->default('1')->comment('支付方式,1银行,2支付宝,3微信');
            $table->string('bank_name')->nullable()->comment('银行卡姓名');
            $table->string('bank_num')->nullable()->comment('银行卡号');
            $table->decimal('price', 7,2)->comment('价格');
            $table->tinyInteger('subcommission_type')->nullable()->default('1')->comment('分佣类型,1为比例,2为固定金额');
            $table->decimal('subcommission_val',7,2)->nullable()->comment('分佣比例/固定金额金额');
            $table->decimal('commission_amount',7,2)->nullable()->comment('佣金');
            $table->timestamps();

            $table->comment('合伙人-线下订单表');
        });
    }

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