ReservationServiceOrder.php 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  1. <?php
  2. namespace addons\ReservationService\common\models;
  3. use addons\Store\common\models\Store;
  4. use addons\Store\common\models\StoreGoodsReserve;
  5. use common\enums\StatusEnum;
  6. use common\models\goods\Goods;
  7. use common\models\order\Order;
  8. use common\models\order\OrderDetail;
  9. use common\models\order\OrderReserve;
  10. use common\models\user\User;
  11. use Yii;
  12. /**
  13. * This is the model class for table "qimall_addons_reservation_service_order".
  14. *
  15. * @property int $id ID
  16. * @property int $created_at 创建时间
  17. * @property int $updated_at 更新时间
  18. * @property int $mall_id 商城ID
  19. * @property int $store_id 商城ID
  20. * @property int $status 状态0禁用,-1删除,1正常
  21. * @property int $user_id 用户ID
  22. * @property int $staff_user_id 技师用户ID
  23. * @property int $order_id 订单ID
  24. * @property int $service_status 服务状态
  25. * @property string $order_no 订单编号
  26. * @property int $service_start_at 服务开始时间
  27. * @property int $service_end_at 服务结束时间
  28. * @property int $order_detail_id 服务结束时间
  29. * @property int $goods_id 服务结束时间
  30. * @property int $refund_at 服务结束时间
  31. * @property int $is_refund 服务结束时间
  32. * @property string|null $remark 备注信息
  33. * @property float $commission 佣金信息
  34. * @property int $secondary_card_id 次卡id
  35. * @property string $secondary_card_no 次卡号
  36. * @property int $reservation_model 预约模式:1:预约门店;2:预约服务人
  37. * @property int $server_status 服务状态
  38. * @property int $at_store_time 预约到店时间
  39. * @property int $service_type 预约服务类型:1:上门服务;2:到店服务
  40. * @property int $create_type 创建方式:1:线上下单;2:系统创建
  41. * @property int $goods_reserve_sku_id 服务sku_id
  42. * @property int $is_match 服务sku_id
  43. * @property string $reject_reason 拒绝理由
  44. */
  45. class ReservationServiceOrder extends \common\models\base\BaseActiveRecord
  46. {
  47. /**
  48. * {@inheritdoc}
  49. */
  50. public static function tableName()
  51. {
  52. return 'qimall_addons_reservation_service_order';
  53. }
  54. /**
  55. * {@inheritdoc}
  56. */
  57. public function rules()
  58. {
  59. return [
  60. [['created_at', 'updated_at', 'mall_id', 'status', 'user_id', 'staff_user_id', 'order_id',
  61. 'service_status', 'service_start_at', 'service_end_at', 'order_detail_id', 'goods_id', 'store_id', 'refund_at', 'is_refund',
  62. 'secondary_card_id','reservation_model',
  63. 'server_status', 'at_store_time','service_type','create_type','goods_reserve_sku_id', 'is_match'], 'integer'],
  64. [['mall_id'], 'required'],
  65. [['remark'], 'string'],
  66. [['commission'], 'number'],
  67. [['order_no'], 'string', 'max' => 50],
  68. [['secondary_card_no', 'reject_reason'], 'string', 'max' => 255],
  69. ];
  70. }
  71. /**
  72. * {@inheritdoc}
  73. */
  74. public function attributeLabels()
  75. {
  76. return [
  77. 'id' => 'ID',
  78. 'created_at' => 'Created At',
  79. 'updated_at' => 'Updated At',
  80. 'mall_id' => 'Mall ID',
  81. 'status' => 'Status',
  82. 'user_id' => 'User ID',
  83. 'staff_user_id' => 'Staff User ID',
  84. 'order_id' => 'Order ID',
  85. 'service_status' => 'Service Status',
  86. 'order_no' => 'Order No',
  87. 'service_start_at' => 'Service Start At',
  88. 'service_end_at' => 'Service End At',
  89. 'remark' => 'Remark',
  90. 'commission' => 'Commission',
  91. 'secondary_card_id' => '次卡id',
  92. 'secondary_card_no' => '次卡号',
  93. 'reservation_model' => '预约模式:1:预约门店;2:预约服务人',
  94. 'server_status' => '服务状态:1:已预约;2:已到店;3:待验收;4:已完成;5:已取消',
  95. 'at_store_time'=>'at_store_time',
  96. 'service_type'=>'service_type',
  97. 'create_type'=>'create_type',
  98. ];
  99. }
  100. public function getUser()
  101. {
  102. return $this->hasOne(User::class, ['id' => 'user_id'])->select('id, nickname, mobile, avatar_url');
  103. }
  104. public function getStaff()
  105. {
  106. return $this->hasOne(ReservationServiceUser::class, ['user_id' => 'staff_user_id'])->andWhere(['status' => StatusEnum::ENABLED]);
  107. }
  108. public function getOrder()
  109. {
  110. return $this->hasOne(Order::class, ['id' => 'order_id']);
  111. }
  112. public function getGoods()
  113. {
  114. return $this->hasOne(Goods::class, ['id' => 'goods_id']);
  115. }
  116. public function getOrderDetail()
  117. {
  118. return $this->hasOne(OrderDetail::class, ['id' => 'order_detail_id']);
  119. }
  120. public function getReserveOrder()
  121. {
  122. return $this->hasOne(OrderReserve::class, ['order_id' => 'order_id']);
  123. }
  124. public function getStore()
  125. {
  126. return $this->hasOne(Store::class, ['id' => 'store_id']);
  127. }
  128. public function getGoodsReserve()
  129. {
  130. return $this->hasOne(StoreGoodsReserve::class, ['goods_id' => 'goods_id']);
  131. }
  132. }