diff --git a/app/Domains/Company/Http/Controllers/OrderController.php b/app/Domains/Company/Http/Controllers/OrderController.php index 930ca782..26133567 100644 --- a/app/Domains/Company/Http/Controllers/OrderController.php +++ b/app/Domains/Company/Http/Controllers/OrderController.php @@ -96,6 +96,13 @@ class OrderController extends Controller $order->transaction_status = $order->transaction_status; $order->transaction_status_name = $transactionStatuses[$order->transaction_status]; + $order->extends = [ + 'cancel_remark' => $order->extends['cancel_remark'] ?? '', + 'refund_channel' => $order->extends['refund_channel'] ?? '', + 'refund_account' => $order->extends['refund_account'] ?? '', + 'refund_remark' => $order->extends['refund_remark'] ?? '', + ]; + return res($order, '订单详情', 201); } diff --git a/app/Domains/Virtual/Http/Controllers/OrderController.php b/app/Domains/Virtual/Http/Controllers/OrderController.php index 67fcbe93..3354eb2a 100644 --- a/app/Domains/Virtual/Http/Controllers/OrderController.php +++ b/app/Domains/Virtual/Http/Controllers/OrderController.php @@ -87,6 +87,13 @@ class OrderController extends Controller $order->transaction_status_name = $transactionStatuses[$order->transaction_status]; $order->logistics_company_name = $logistics[$order->logistics_company] ?? ''; + $order->extends = [ + 'cancel_remark' => $order->extends['cancel_remark'] ?? '', + 'refund_channel' => $order->extends['refund_channel'] ?? '', + 'refund_account' => $order->extends['refund_account'] ?? '', + 'refund_remark' => $order->extends['refund_remark'] ?? '', + ]; + return res($order, '订单详情', 201); } diff --git a/app/Domains/Virtual/Services/OrderService.php b/app/Domains/Virtual/Services/OrderService.php index df2420ce..6ab2ad5d 100644 --- a/app/Domains/Virtual/Services/OrderService.php +++ b/app/Domains/Virtual/Services/OrderService.php @@ -88,6 +88,7 @@ class OrderService extends Service 'address' => ['max:255'], 'order_status' => ['in:0,1,2,3,4'], 'transaction_status' => ['in:0,1,2'], + 'extends' => ['array'], ]; $message = [ @@ -141,6 +142,8 @@ class OrderService extends Service throw new NotExistException('订单不存在或已删除'); } + $node->extends = array_merge($node->extends, $attributes['extends']); + $this->orderRepository->setModel($node)->update($attributes); } diff --git a/app/Models/Virtual/Order.php b/app/Models/Virtual/Order.php index 79c2b920..afe64dd4 100644 --- a/app/Models/Virtual/Order.php +++ b/app/Models/Virtual/Order.php @@ -9,6 +9,10 @@ class Order extends Model { protected $table = 'virtual_orders'; + protected $casts = [ + 'extends' => 'array', + ]; + public function cards() { return $this->hasMany(OrderCard::class, 'order_id', 'id'); diff --git a/database/migrations/2018_12_12_170419_create_virtual_orders_table.php b/database/migrations/2018_12_12_170419_create_virtual_orders_table.php index f122fac4..c634e37f 100644 --- a/database/migrations/2018_12_12_170419_create_virtual_orders_table.php +++ b/database/migrations/2018_12_12_170419_create_virtual_orders_table.php @@ -35,9 +35,9 @@ class CreateVirtualOrdersTable extends Migration $table->string('logistics_no', 64)->default('')->comment('物流单号'); $table->tinyInteger('order_status')->unsigned()->default(0)->after('mobile')->comment('订单状态(0:已下单 1:已取消 2:已出库 3:已发货 4:已签收)'); $table->tinyInteger('transaction_status')->unsigned()->default(0)->after('order_status')->comment('收款状态(0:未收款 1:已收款 2:已退款)'); - $table->text('cancel_remark')->nullable()->comment('取消备注'); $table->text('logistics_remark')->nullable()->comment('物流备注'); $table->text('remark')->nullable()->comment('订单备注'); + $table->text('extends')->nullable()->comment('扩展信息(cancel_remark:取消备注 refund_channel:退款频道 refund_account:退款账号 refund_remark:退款备注)'); $table->timestamps(); $table->softDeletes(); diff --git a/database/migrations/2018_12_21_134548_create_tests_table.php b/database/migrations/2018_12_21_134548_create_tests_table.php deleted file mode 100644 index 27edb0f2..00000000 --- a/database/migrations/2018_12_21_134548_create_tests_table.php +++ /dev/null @@ -1,37 +0,0 @@ -increments('id'); - $table->string('sn', 32)->default('')->comment('编号'); - $table->softDeletes(); - - $table->unique(['sn', 'deleted_at']); - - $table->comment('测试'); - $table->setIncrement(100); - }); - } - - /** - * Reverse the migrations. - * - * @return void - */ - public function down() - { - Schema::dropIfExists('tests'); - } -} diff --git a/frontend/src/views/virtual/orders/detail.vue b/frontend/src/views/virtual/orders/detail.vue index 06176bc3..1bfe6c97 100644 --- a/frontend/src/views/virtual/orders/detail.vue +++ b/frontend/src/views/virtual/orders/detail.vue @@ -60,6 +60,11 @@ +
  • +
    取消理由:
    +
    {{data.extends.cancel_remark}}
    +
  • +
  • 支付状态:
    @@ -67,7 +72,17 @@
  • + +
  • +
    退款方式:
    +
    {{data.extends.refund_channel}}
    +
    退款账号:
    +
    {{data.extends.refund_account}}
    +
    退款备注:
    +
    {{data.extends.refund_remark}}
    +
  • + 物流信息