@@ -90,4 +90,14 @@ class OrderModel extends BaseModel
->where(['mark' => 1])
->select(['id', 'order_no', 'goods_id', 'confirm_at', 'status']);
}
+
+ /**
+ * 子单
+ * @return \Illuminate\Database\Eloquent\Relations\HasMany
+ */
+ public function subOrders()
+ {
+ return $this->hasMany(OrderModel::class, 'main_no', 'order_no')
+ ->where(['mark' => 1]);
+ }
@@ -63,6 +63,15 @@ class OrderService extends BaseService
$query = $this->model->where('mark', 1);
// 企业筛选
+ if (isset($params['type']) && $params['type'] > 0) {
+ $query->where('type', $params['type']);
+ if($params['type'] == 9){
+ $query->with(['subOrders']);
+ // 企业筛选
if (isset($params['store_id']) && $params['store_id'] > 0) {
$query->where('store_id', $params['store_id']);