GoodsEnum.php 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223
  1. <?php
  2. namespace app\common\Enum;
  3. /**
  4. * 全局状态枚举
  5. */
  6. class GoodsEnum
  7. {
  8. const TYPE_REAL = 1; // 普通商品(物流发货)
  9. const TYPE_CARD = 2; // 卡密/网盘(自动发货)
  10. const TYPE_VIRTUAL = 3; // 虚拟商品(虚拟发货)
  11. const TYPE_CARD_NEXT = 4; // 次卡商品(到店核销)
  12. //商品状态:0-仓库中(未上架),1-销售中(已上架),2-已售罄,3-已下架
  13. const STATUS_IN_STORAGE = 0; // 仓库中(未上架)
  14. const STATUS_ON_SALE = 1; // 销售中(已上架)
  15. const STATUS_SOLD_OUT = 2; // 已售罄
  16. const STATUS_OFF_SALE = 3; // 已下架
  17. // 规格类型:0=单规格,1=多规格
  18. const SPEC_TYPE_SINGLE = 0; // 单规格
  19. const SPEC_TYPE_MULTI = 1; // 多规格
  20. // 配送方式 快递 同城 、自提
  21. const DELIVERY_TYPE_EXPRESS = "EXPRESS"; // 快递
  22. const DELIVERY_TYPE_CITY = "LOCAL_DELIVERY"; // 同城
  23. const DELIVERY_TYPE_SELF = "SELF_PICKUP"; // 自提
  24. // 快递运费类型
  25. const EXPRESS_TYPE_FREE = 1; // 包邮
  26. const EXPRESS_TYPE_UNIFIED = 2; // 统一运费
  27. const EXPRESS_TYPE_TEMPLATE = 3; // 运费模板
  28. // 上架时间类型
  29. const ONLINE_TYPE_IMMEDIATE = 1; // 立即上架
  30. const ONLINE_TYPE_NOT_NOW = 2; // 暂不上架
  31. const ONLINE_TYPE_SCHEDULED = 3; // 定时上架
  32. // 下架类型
  33. const OFFLINE_TYPE_NONE = 0; // 不自动下架
  34. const OFFLINE_TYPE_AUTO = 1; // 自动下架
  35. // 库存显示类型:exact=精确的,sketchy=粗略的
  36. const STOCK_SHOW_TYPE_EXACT = 'EXACT'; // 精确的
  37. const STOCK_SHOW_TYPE_SKETCHY = 'SKETCHY'; // 粗略的
  38. //销量显示类型:exact=精确的,sketchy=粗略的
  39. const SALES_SHOW_TYPE_EXACT = 'EXACT'; // 精确的
  40. const SALES_SHOW_TYPE_SKETCHY = 'SKETCHY'; // 粗略的
  41. // 售后状态 sale_status
  42. const SALE_STATUS_NONE = 0; // 无售后
  43. const SALE_STATUS_APPLIED = 1; // 已申请
  44. const SALE_STATUS_REFUNDING = 2; // 退款中
  45. const SALE_STATUS_RETURNING = 3; // 退货中
  46. const SALE_STATUS_REFUNDED = 4; // 已退款
  47. const SALE_STATUS_RETURNED = 5; // 已退货退款
  48. const SALE_STATUS_REJECTED = 6; // 已拒绝
  49. public static function getSalesShowTypeMap()
  50. {
  51. return [
  52. self::SALES_SHOW_TYPE_EXACT => '精确的',
  53. self::SALES_SHOW_TYPE_SKETCHY => '粗略的',
  54. ];
  55. }
  56. public static function getSalesShowTypeText($salesShowType)
  57. {
  58. return self::getSalesShowTypeMap()[$salesShowType] ?? '未知';
  59. }
  60. public static function getStockShowTypeMap()
  61. {
  62. return [
  63. self::STOCK_SHOW_TYPE_EXACT => '精确的',
  64. self::STOCK_SHOW_TYPE_SKETCHY => '粗略的',
  65. ];
  66. }
  67. public static function getStockShowTypeText($stockShowType)
  68. {
  69. return self::getStockShowTypeMap()[$stockShowType] ?? '未知';
  70. }
  71. public static function getGoodsTypeMap()
  72. {
  73. return [
  74. self::TYPE_REAL => '普通商品',
  75. // self::TYPE_CARD => '卡密/网盘',
  76. // self::TYPE_VIRTUAL => '虚拟商品',
  77. // self::TYPE_CARD_NEXT => '次卡商品',
  78. ];
  79. }
  80. public static function getGoodsTypeText($type)
  81. {
  82. return self::getGoodsTypeMap()[$type] ?? '未知';
  83. }
  84. public static function getGoodsTypeList()
  85. {
  86. return [
  87. self::TYPE_REAL,
  88. // self::TYPE_CARD,
  89. // self::TYPE_VIRTUAL,
  90. // self::TYPE_CARD_NEXT,
  91. ];
  92. }
  93. public static function getGoodsStatusMap()
  94. {
  95. return [
  96. self::STATUS_IN_STORAGE => '仓库中(未上架)',
  97. self::STATUS_ON_SALE => '销售中(已上架)',
  98. self::STATUS_SOLD_OUT => '已售罄',
  99. self::STATUS_OFF_SALE => '已下架',
  100. ];
  101. }
  102. public static function getGoodsStatusText($status)
  103. {
  104. return self::getGoodsStatusMap()[$status] ?? '未知';
  105. }
  106. public static function getSpecTypeMap()
  107. {
  108. return [
  109. self::SPEC_TYPE_SINGLE => '单规格',
  110. self::SPEC_TYPE_MULTI => '多规格',
  111. ];
  112. }
  113. public static function getSpecTypeText($specType)
  114. {
  115. return self::getSpecTypeMap()[$specType] ?? '未知';
  116. }
  117. public static function getDeliveryTypeMap()
  118. {
  119. return [
  120. self::DELIVERY_TYPE_EXPRESS => '物流配送',
  121. // self::DELIVERY_TYPE_CITY => '同城配送',
  122. // self::DELIVERY_TYPE_SELF => '门店自提',
  123. ];
  124. }
  125. public static function getDeliveryTypeList()
  126. {
  127. return [
  128. self::DELIVERY_TYPE_EXPRESS,
  129. // self::DELIVERY_TYPE_CITY,
  130. // self::DELIVERY_TYPE_SELF,
  131. ];
  132. }
  133. public static function getDeliveryTypeText($deliveryType)
  134. {
  135. return self::getDeliveryTypeMap()[$deliveryType] ?? '未知';
  136. }
  137. public static function getExpressTypeMap()
  138. {
  139. return [
  140. self::EXPRESS_TYPE_FREE => '包邮',
  141. // self::EXPRESS_TYPE_UNIFIED => '统一运费',
  142. // self::EXPRESS_TYPE_TEMPLATE => '运费模板',
  143. ];
  144. }
  145. public static function getExpressTypeText($expressType)
  146. {
  147. return self::getExpressTypeMap()[$expressType] ?? '未知';
  148. }
  149. public static function getOnlineTypeMap()
  150. {
  151. return [
  152. self::ONLINE_TYPE_IMMEDIATE => '立即上架',
  153. self::ONLINE_TYPE_NOT_NOW => '暂不上架',
  154. self::ONLINE_TYPE_SCHEDULED => '定时上架',
  155. ];
  156. }
  157. public static function getOnlineTypeText($onlineType)
  158. {
  159. return self::getOnlineTypeMap()[$onlineType] ?? '未知';
  160. }
  161. public static function getOfflineTypeMap()
  162. {
  163. return [
  164. self::OFFLINE_TYPE_NONE => '不自动下架',
  165. self::OFFLINE_TYPE_AUTO => '自动下架',
  166. ];
  167. }
  168. public static function getOfflineTypeText($offlineType)
  169. {
  170. return self::getOfflineTypeMap()[$offlineType] ?? '未知';
  171. }
  172. public static function getSaleStatusMap()
  173. {
  174. return [
  175. self::SALE_STATUS_NONE => '无',
  176. self::SALE_STATUS_APPLIED => '已申请',
  177. self::SALE_STATUS_REFUNDING => '退款中',
  178. self::SALE_STATUS_RETURNING => '退货中',
  179. self::SALE_STATUS_REFUNDED => '已退款',
  180. self::SALE_STATUS_RETURNED => '已退货退款',
  181. self::SALE_STATUS_REJECTED => '已拒绝',
  182. ];
  183. }
  184. public static function getSaleStatusText($saleStatus)
  185. {
  186. return self::getSaleStatusMap()[$saleStatus] ?? '未知';
  187. }
  188. }