wanghousheng 9 months ago
parent 2ccae36c19
commit cea284153f
  1. 29
      app/common/model/Order.php
  2. 16
      app/store/model/Order.php

@ -12,23 +12,23 @@ declare (strict_types=1);
namespace app\common\model; namespace app\common\model;
use app\common\enum\order\DeliveryStatus as DeliveryStatusEnum;
use app\common\enum\order\DeliveryType; 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 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\model\store\shop\Order as ShopOrder;
use app\common\service\Order as OrderService; 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\Complete as OrderCompleteService;
use app\common\service\order\Shipping as ShippingService;
use app\common\service\order\source\Factory as OrderSourceFactory; use app\common\service\order\source\Factory as OrderSourceFactory;
use app\common\enum\order\PayStatus as PayStatusEnum; use cores\BaseModel;
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 think\model\relation\BelongsTo; 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'); 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 * @return BelongsTo
@ -424,7 +430,8 @@ class Order extends BaseModel
return 0; return 0;
} }
public function getStorePhoneAttr($value,$data) { public function getStorePhoneAttr($value, $data)
{
return Store::get($data['store_id'])->phone ?: ''; return Store::get($data['store_id'])->phone ?: '';
} }
} }

@ -13,18 +13,17 @@ declare (strict_types=1);
namespace app\store\model; namespace app\store\model;
use app\api\service\User as UserService; use app\api\service\User as UserService;
use app\common\enum\payment\Method;
use app\common\model\Order as OrderModel;
use app\common\service\Order as OrderService;
use app\common\service\order\Refund as RefundService;
use app\common\service\order\Printer as PrinterService;
use app\common\enum\order\{DataType as DataTypeEnum, use app\common\enum\order\{DataType as DataTypeEnum,
DeliveryStatus as DeliveryStatusEnum,
DeliveryType, DeliveryType,
PayStatus as PayStatusEnum,
OrderStatus as OrderStatusEnum, OrderStatus as OrderStatusEnum,
ReceiptStatus as ReceiptStatusEnum, PayStatus as PayStatusEnum,
DeliveryStatus as DeliveryStatusEnum}; ReceiptStatus as ReceiptStatusEnum};
use app\common\library\helper; use app\common\library\helper;
use app\common\model\Order as OrderModel;
use app\common\service\Order as OrderService;
use app\common\service\order\Printer as PrinterService;
use app\common\service\order\Refund as RefundService;
use cores\exception\BaseException; use cores\exception\BaseException;
/** /**
@ -135,6 +134,7 @@ class Order extends OrderModel
->leftJoin('order_address address', 'address.order_id = order.order_id') ->leftJoin('order_address address', 'address.order_id = order.order_id')
->where($dataTypeFilter) ->where($dataTypeFilter)
->where($filter) ->where($filter)
->with(['transfer'])
->where('order.is_delete', '=', 0); ->where('order.is_delete', '=', 0);
if (!empty($filterOr)) { if (!empty($filterOr)) {
// $query = $query->whereOr($filterOr); // $query = $query->whereOr($filterOr);

Loading…
Cancel
Save