|
|
|
@ -12,23 +12,23 @@ declare (strict_types=1); |
|
|
|
|
|
|
|
|
|
namespace app\common\model; |
|
|
|
|
|
|
|
|
|
use app\common\enum\order\DeliveryStatus as DeliveryStatusEnum; |
|
|
|
|
use app\common\enum\order\DeliveryType; |
|
|
|
|
use app\common\enum\order\DeliveryType as DeliveryTypeEnum; |
|
|
|
|
use app\common\enum\order\OrderStatus as OrderStatusEnum; |
|
|
|
|
use app\common\enum\order\PayStatus as PayStatusEnum; |
|
|
|
|
use app\common\enum\order\ReceiptStatus as ReceiptStatusEnum; |
|
|
|
|
use app\common\enum\payment\Method; |
|
|
|
|
use cores\BaseModel; |
|
|
|
|
use app\common\library\helper; |
|
|
|
|
use app\common\model\store\shop\Order as ShopOrder; |
|
|
|
|
use app\common\service\Order as OrderService; |
|
|
|
|
use app\common\service\order\Shipping as ShippingService; |
|
|
|
|
use app\common\service\order\Complete as OrderCompleteService; |
|
|
|
|
use app\common\service\order\Shipping as ShippingService; |
|
|
|
|
use app\common\service\order\source\Factory as OrderSourceFactory; |
|
|
|
|
use app\common\enum\order\PayStatus as PayStatusEnum; |
|
|
|
|
use app\common\enum\order\OrderStatus as OrderStatusEnum; |
|
|
|
|
use app\common\enum\order\DeliveryType as DeliveryTypeEnum; |
|
|
|
|
use app\common\enum\order\ReceiptStatus as ReceiptStatusEnum; |
|
|
|
|
use app\common\enum\order\DeliveryStatus as DeliveryStatusEnum; |
|
|
|
|
use app\common\library\helper; |
|
|
|
|
use think\model\relation\HasOne; |
|
|
|
|
use think\model\relation\HasMany; |
|
|
|
|
use cores\BaseModel; |
|
|
|
|
use think\model\relation\BelongsTo; |
|
|
|
|
use think\model\relation\HasMany; |
|
|
|
|
use think\model\relation\HasOne; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 订单模型 |
|
|
|
@ -111,6 +111,12 @@ class Order extends BaseModel |
|
|
|
|
return $this->belongsTo("app\\{$module}\\model\\store\\Shop", 'extract_shop_id'); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//TransferRecordModel |
|
|
|
|
public function transfer(): HasOne |
|
|
|
|
{ |
|
|
|
|
return $this->hasOne(TransferRecord::class, 'order_id'); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 关联门店店员表 |
|
|
|
|
* @return BelongsTo |
|
|
|
@ -399,19 +405,19 @@ class Order extends BaseModel |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public function getPayMethodTextAttr($value,$data): string |
|
|
|
|
public function getPayMethodTextAttr($value, $data): string |
|
|
|
|
{ |
|
|
|
|
return !empty(Method::data()[$data['pay_method']])?Method::data()[$data['pay_method']]['name']:'';//支付方式 |
|
|
|
|
return !empty(Method::data()[$data['pay_method']]) ? Method::data()[$data['pay_method']]['name'] : '';//支付方式 |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public function getDeliveryTypeTextAttr($value,$data): string |
|
|
|
|
public function getDeliveryTypeTextAttr($value, $data): string |
|
|
|
|
{ |
|
|
|
|
return !empty(DeliveryType::data()[$data['delivery_type']])? DeliveryType::data()[$data['delivery_type']]['name']: '';//配送方式 |
|
|
|
|
return !empty(DeliveryType::data()[$data['delivery_type']]) ? DeliveryType::data()[$data['delivery_type']]['name'] : '';//配送方式 |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public function getTimeTextAttr($value, $data) : int |
|
|
|
|
public function getTimeTextAttr($value, $data): int |
|
|
|
|
{ |
|
|
|
|
$diffTime = 60*60*24;//24小时倒计时 |
|
|
|
|
$diffTime = 60 * 60 * 24;//24小时倒计时 |
|
|
|
|
// 付款状态 |
|
|
|
|
if ($data['pay_status'] == PayStatusEnum::PENDING) { |
|
|
|
|
return (($data['create_time'] + $diffTime) - time()) * 1000; |
|
|
|
@ -424,7 +430,8 @@ class Order extends BaseModel |
|
|
|
|
return 0; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public function getStorePhoneAttr($value,$data) { |
|
|
|
|
public function getStorePhoneAttr($value, $data) |
|
|
|
|
{ |
|
|
|
|
return Store::get($data['store_id'])->phone ?: ''; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|