OrderEnum.php 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222
  1. <?php
  2. namespace app\common\Enum;
  3. class OrderEnum
  4. {
  5. /**
  6. * 订单状态
  7. */
  8. const STATUS_CREATE = 101;
  9. const STATUS_PAY = 201;
  10. // 验货后 在发货
  11. const STATUS_INSPECTION = 210;
  12. // 验货通过
  13. const STATUS_INSPECTION_PASS = 211;
  14. // 验货不通过
  15. const STATUS_INSPECTION_FAIL = 212;
  16. // 发货
  17. const STATUS_SHIP = 301;
  18. const STATUS_CONFIRM = 401;
  19. const STATUS_COMMENT = 501;
  20. const STATUS_CANCEL = 102;
  21. const STATUS_AUTO_CANCEL = 103;
  22. const STATUS_ADMIN_CANCEL = 104;
  23. const STATUS_REFUND = 202;
  24. const STATUS_REFUND_CONFIRM = 203;
  25. const STATUS_GROUPON_TIMEOUT = 204;
  26. const STATUS_AUTO_CONFIRM = 402;
  27. // 订单类型
  28. const TYPE_NORMAL = 1; // 普通订单
  29. const TYPE_GROUP = 2; // 拼团订单
  30. const TYPE_SECKILL = 3; // 秒杀订单
  31. const TYPE_PRESALE = 4; // 预售订单
  32. // 发货方式
  33. const DELIVERY_TYPE_EXPRESS = 1; // 快递配送
  34. const DELIVERY_TYPE_PICKUP = 2; // 门店自提
  35. const DELIVERY_TYPE_LOCAL = 3; // 同城配送
  36. const DELIVERY_TYPE_VIRTUAL = 4; // 无需配送
  37. // 发票状态
  38. const INVOICE_STATUS_UNAVAILABLE = -1; // 不可开具
  39. const INVOICE_STATUS_NOT_APPLIED = 0; // 未申请
  40. const INVOICE_STATUS_APPLIED = 1; // 已申请
  41. const INVOICE_STATUS_ISSUED = 2; // 已开具
  42. // 活动类型
  43. const ACTIVITY_TYPE_NORMAL = 'normal'; // 普通活动
  44. const ACTIVITY_TYPE_SECKILL = 'seckill'; // 秒杀活动
  45. const ACTIVITY_TYPE_GROUP = 'group'; // 拼团活动
  46. const ACTIVITY_TYPE_PRESALE = 'presale'; // 预售活动
  47. const ACTIVITY_TYPE_DISCOUNT = 'discount'; // 折扣活动
  48. public static function getOrderTypeList()
  49. {
  50. return [
  51. self::TYPE_NORMAL => '普通订单',
  52. self::TYPE_GROUP => '拼团订单',
  53. self::TYPE_SECKILL => '秒杀订单',
  54. self::TYPE_PRESALE => '预售订单',
  55. ];
  56. }
  57. public static function getOrderTypeText($type)
  58. {
  59. return self::getOrderTypeList()[$type] ?? '未知类型';
  60. }
  61. public static function getDeliveryTypeList()
  62. {
  63. return [
  64. self::DELIVERY_TYPE_EXPRESS => '快递配送',
  65. self::DELIVERY_TYPE_PICKUP => '门店自提',
  66. self::DELIVERY_TYPE_LOCAL => '同城配送',
  67. self::DELIVERY_TYPE_VIRTUAL => '无需配送',
  68. ];
  69. }
  70. public static function getDeliveryTypeText($deliveryType)
  71. {
  72. return self::getDeliveryTypeList()[$deliveryType] ?? '未知';
  73. }
  74. public static function getInvoiceStatusList()
  75. {
  76. return [
  77. self::INVOICE_STATUS_UNAVAILABLE => '不可开具',
  78. self::INVOICE_STATUS_NOT_APPLIED => '未申请',
  79. self::INVOICE_STATUS_APPLIED => '已申请',
  80. self::INVOICE_STATUS_ISSUED => '已开具',
  81. ];
  82. }
  83. public static function getInvoiceStatusText($invoiceStatus)
  84. {
  85. return self::getInvoiceStatusList()[$invoiceStatus] ?? '未知';
  86. }
  87. const STATUS_TEXT_MAP = [
  88. self::STATUS_CREATE => '未付款',
  89. self::STATUS_CANCEL => "已取消",
  90. self::STATUS_AUTO_CANCEL => "已取消(系统)",
  91. self::STATUS_ADMIN_CANCEL => "已取消(管理员)",
  92. self::STATUS_INSPECTION => "待验货",
  93. self::STATUS_INSPECTION_PASS => "待发货",
  94. self::STATUS_INSPECTION_FAIL => "验货不通过",
  95. self::STATUS_PAY => "待验收",
  96. // self::STATUS_REFUND => "订单取消,退款中",
  97. // self::STATUS_REFUND_CONFIRM => "已退款",
  98. // self::STATUS_GROUPON_TIMEOUT => "已超时团购",
  99. self::STATUS_SHIP => "待收货",
  100. self::STATUS_CONFIRM => "已完成",
  101. self::STATUS_AUTO_CONFIRM => "已收货(系统)",
  102. self::STATUS_COMMENT => "已评价",
  103. ];
  104. const STATUS_TIME_MAP = [
  105. self::STATUS_CREATE => 'createtime',
  106. self::STATUS_PAY => 'pay_time',
  107. self::STATUS_SHIP => 'shipping_time',
  108. self::STATUS_CONFIRM => 'receive_time',
  109. self::STATUS_AUTO_CONFIRM => 'receive_time',
  110. self::STATUS_COMMENT => 'evaluate_time',
  111. self::STATUS_REFUND => 'refund_time',
  112. self::STATUS_REFUND_CONFIRM => 'refund_time',
  113. self::STATUS_AUTO_CANCEL => 'expire_time',
  114. self::STATUS_CANCEL => 'cancel_time',
  115. self::STATUS_INSPECTION => 'inspection_time',
  116. self::STATUS_INSPECTION_PASS => 'inspection_time',
  117. self::STATUS_INSPECTION_FAIL => 'inspection_time',
  118. ];
  119. public static function isValidOrderStatus($status)
  120. {
  121. return isset(self::STATUS_TEXT_MAP[$status]);
  122. }
  123. public static function getOrderStatusList()
  124. {
  125. return self::STATUS_TEXT_MAP;
  126. }
  127. public static function getOrderStatusText($status)
  128. {
  129. return self::STATUS_TEXT_MAP[$status] ?? '未知';
  130. }
  131. ####### 用户前端传的参数
  132. const SHOW_TYPE_ALL = 0;//全部订单
  133. const SHOW_TYPE_WAIT_PAY = 1;//待付款订单
  134. const SHOW_TYPE_WAIT_DELIVERY = 2;//待发货订单
  135. const SHOW_TYPE_WAIT_RECEIPT = 3;//待收货订单
  136. const SHOW_TYPE_WAIT_COMMENT = 4;//待评价订单
  137. const SHOW_TYPE_WAIT_INSPECT = 5;//待验货订单
  138. const SHOW_TYPE_STATUS_MAP = [
  139. self::SHOW_TYPE_ALL => [
  140. self::STATUS_CANCEL,
  141. self::STATUS_AUTO_CANCEL,
  142. self::STATUS_ADMIN_CANCEL,
  143. self::STATUS_CREATE,
  144. self::STATUS_PAY,
  145. self::STATUS_SHIP,
  146. self::STATUS_CONFIRM,
  147. self::STATUS_COMMENT,
  148. ],
  149. self::SHOW_TYPE_WAIT_PAY => [
  150. self::STATUS_CREATE
  151. ],
  152. self::SHOW_TYPE_WAIT_DELIVERY => [
  153. self::STATUS_INSPECTION_PASS,
  154. ],
  155. self::SHOW_TYPE_WAIT_RECEIPT => [
  156. self::STATUS_SHIP
  157. ],
  158. self::SHOW_TYPE_WAIT_COMMENT => [
  159. self::STATUS_CONFIRM
  160. ],
  161. self::SHOW_TYPE_WAIT_INSPECT => [
  162. self::STATUS_PAY,
  163. self::STATUS_INSPECTION,
  164. self::STATUS_INSPECTION_FAIL,
  165. ],
  166. ];
  167. const SHOW_TYPE_WAIT_INSPECTION = 1;//待验收订单
  168. const SHOW_TYPE_WAIT_INSPECTION_SHIP = 2;//待发货订单
  169. const SHOW_TYPE_WAIT_INSPECTION_CONFIRM = 3;//待收货订单
  170. // 验货端 前端传的参数
  171. const SHOW_INSPECTION_TYPE_STATUS_MAP = [
  172. self::SHOW_TYPE_WAIT_INSPECTION => [
  173. self::STATUS_PAY,
  174. self::STATUS_INSPECTION,
  175. self::STATUS_INSPECTION_PASS,
  176. self::STATUS_INSPECTION_FAIL,
  177. ],
  178. self::SHOW_TYPE_WAIT_INSPECTION_SHIP => [
  179. self::STATUS_INSPECTION_PASS
  180. ],
  181. self::SHOW_TYPE_WAIT_INSPECTION_CONFIRM => [
  182. self::STATUS_SHIP
  183. ],
  184. ];
  185. const STATUS_TEXT_MAP_INSPECTION = [
  186. self::STATUS_INSPECTION => "待验货",
  187. self::STATUS_INSPECTION_PASS => "验货通过",
  188. self::STATUS_INSPECTION_FAIL => "验货不通过",
  189. self::STATUS_PAY => "待验货",
  190. self::STATUS_SHIP => "待收货",
  191. ];
  192. }