6
0
Fork 0

添加订单是否换货单标记

release
vine_liutk 2021-12-25 09:52:20 +08:00
parent d52fbb7ac8
commit 8e75b26beb
3 changed files with 39 additions and 0 deletions

View File

@ -53,6 +53,7 @@ class Order extends Model
'pay_at' => 'datetime',
'completed_at' => 'datetime',
'status' => 'int',
'is_change' => 'bool',
];
/**
@ -80,6 +81,7 @@ class Order extends Model
'shipping_state',
'status',
'completed_at',
'is_change',
];
/**

View File

@ -355,6 +355,9 @@ class AfterSaleService
$changeOrder->consignee_telephone = $order->consignee_telephone;
$changeOrder->consignee_zone = $order->consignee_zone;
$changeOrder->consignee_address = $order->consignee_address;
//标记是换货单
$changeOrder->is_change = true;
$changeOrder->save();
OrderProduct::create([

View File

@ -0,0 +1,34 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class AddIsChangeToOrdersTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('orders', function (Blueprint $table) {
//
$table->unsignedTinyInteger('is_change')->default(0)->comment('是否是换货后生成的新订单');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('orders', function (Blueprint $table) {
//
$table->dropColumn('is_change');
});
}
}