2022-08-06 15:25:13 +08:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
namespace App\Models;
|
|
|
|
|
|
2023-04-03 21:10:03 +08:00
|
|
|
use App\Models\traits\Filter;
|
|
|
|
|
|
2022-08-06 15:25:13 +08:00
|
|
|
class BusinessOrder extends Model
|
|
|
|
|
{
|
2023-04-03 21:10:03 +08:00
|
|
|
use Filter;
|
|
|
|
|
|
2023-04-03 15:41:14 +08:00
|
|
|
public $fieldSearchable = [
|
|
|
|
|
'participate_no',
|
2023-04-03 21:42:57 +08:00
|
|
|
'shop_id',
|
|
|
|
|
'activity_no',
|
|
|
|
|
'shipping_status',
|
|
|
|
|
'is_supplier',
|
|
|
|
|
'cancel_status',
|
|
|
|
|
'after_sales_status',
|
2023-04-03 15:41:14 +08:00
|
|
|
];
|
|
|
|
|
|
2022-08-09 16:56:52 +08:00
|
|
|
protected $fillable = [
|
|
|
|
|
'shop_id',
|
|
|
|
|
'receiver_address_detail',
|
|
|
|
|
'receiver_address_province',
|
|
|
|
|
'self_pick_site_no',
|
|
|
|
|
'discount_amount',
|
|
|
|
|
'theoretical_refund_amount',
|
|
|
|
|
'receiver_address_district',
|
|
|
|
|
'verification_status',
|
|
|
|
|
'inner_transaction_id',
|
|
|
|
|
'is_supplier',
|
|
|
|
|
'service_amount',
|
|
|
|
|
'supply_participate_no',
|
|
|
|
|
'updated_at',
|
|
|
|
|
'order_amount',
|
|
|
|
|
'receiver_address_city',
|
|
|
|
|
'receiver_name',
|
|
|
|
|
'business_note',
|
|
|
|
|
'buyer_memo',
|
|
|
|
|
'logistics_type',
|
|
|
|
|
'help_sell_nickname',
|
|
|
|
|
'activity_title',
|
|
|
|
|
'after_sales_status',
|
|
|
|
|
'mall_activity_type',
|
|
|
|
|
'transaction_id',
|
|
|
|
|
'activity_no',
|
|
|
|
|
'confirm_at',
|
|
|
|
|
'platform_discount_amount',
|
|
|
|
|
'participate_no',
|
|
|
|
|
'receiver_mobile',
|
|
|
|
|
'shipping_status',
|
|
|
|
|
'shipping_amount',
|
|
|
|
|
'cancel_status',
|
|
|
|
|
'nick_name',
|
|
|
|
|
'order_sn',
|
|
|
|
|
];
|
2022-08-10 23:45:03 +08:00
|
|
|
|
2023-04-03 21:42:57 +08:00
|
|
|
public function getConfirmAtAttribute($value)
|
|
|
|
|
{
|
|
|
|
|
return date('Y-m-d H:i:s', $value / 1000);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function getShippingStatusAttribute($value)
|
|
|
|
|
{
|
|
|
|
|
$map = ['未发货', '已发货', '部分发货'];
|
|
|
|
|
|
|
|
|
|
return $map[$value];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function getIsSupplierAttribute($value)
|
|
|
|
|
{
|
|
|
|
|
$map = ['帮忙团订单', '自卖团订单'];
|
|
|
|
|
|
|
|
|
|
return $map[$value];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function getCancelStatusAttribute($value)
|
|
|
|
|
{
|
|
|
|
|
$map = ['未取消', '已取消'];
|
|
|
|
|
|
|
|
|
|
return $map[$value];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function getAfterSalesStatusAttribute($value)
|
|
|
|
|
{
|
2023-04-04 15:28:56 +08:00
|
|
|
return empty($value) ? '未售后' : '有售后';
|
2023-04-03 21:42:57 +08:00
|
|
|
}
|
|
|
|
|
|
2022-08-10 23:45:03 +08:00
|
|
|
public function items()
|
|
|
|
|
{
|
|
|
|
|
return $this->hasMany(BusinessOrderItem::class, 'business_order_id');
|
|
|
|
|
}
|
2023-04-03 15:41:14 +08:00
|
|
|
|
|
|
|
|
public function shop()
|
|
|
|
|
{
|
|
|
|
|
return $this->belongsTo(Shop::class, 'shop_id', 'id');
|
|
|
|
|
}
|
2022-08-06 15:25:13 +08:00
|
|
|
}
|