GoodsEnum.php 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188
  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. public static function getSalesShowTypeMap()
  42. {
  43. return [
  44. self::SALES_SHOW_TYPE_EXACT => '精确的',
  45. self::SALES_SHOW_TYPE_SKETCHY => '粗略的',
  46. ];
  47. }
  48. public static function getSalesShowTypeText($salesShowType)
  49. {
  50. return self::getSalesShowTypeMap()[$salesShowType] ?? '未知';
  51. }
  52. public static function getStockShowTypeMap()
  53. {
  54. return [
  55. self::STOCK_SHOW_TYPE_EXACT => '精确的',
  56. self::STOCK_SHOW_TYPE_SKETCHY => '粗略的',
  57. ];
  58. }
  59. public static function getStockShowTypeText($stockShowType)
  60. {
  61. return self::getStockShowTypeMap()[$stockShowType] ?? '未知';
  62. }
  63. public static function getGoodsTypeMap()
  64. {
  65. return [
  66. self::TYPE_REAL => '普通商品',
  67. self::TYPE_CARD => '卡密/网盘',
  68. self::TYPE_VIRTUAL => '虚拟商品',
  69. self::TYPE_CARD_NEXT => '次卡商品',
  70. ];
  71. }
  72. public static function getGoodsTypeText($type)
  73. {
  74. return self::getGoodsTypeMap()[$type] ?? '未知';
  75. }
  76. public static function getGoodsTypeList()
  77. {
  78. return [
  79. self::TYPE_REAL,
  80. // self::TYPE_CARD,
  81. // self::TYPE_VIRTUAL,
  82. // self::TYPE_CARD_NEXT,
  83. ];
  84. }
  85. public static function getGoodsStatusMap()
  86. {
  87. return [
  88. self::STATUS_IN_STORAGE => '仓库中(未上架)',
  89. self::STATUS_ON_SALE => '销售中(已上架)',
  90. self::STATUS_SOLD_OUT => '已售罄',
  91. self::STATUS_OFF_SALE => '已下架',
  92. ];
  93. }
  94. public static function getGoodsStatusText($status)
  95. {
  96. return self::getGoodsStatusMap()[$status] ?? '未知';
  97. }
  98. public static function getSpecTypeMap()
  99. {
  100. return [
  101. self::SPEC_TYPE_SINGLE => '单规格',
  102. self::SPEC_TYPE_MULTI => '多规格',
  103. ];
  104. }
  105. public static function getSpecTypeText($specType)
  106. {
  107. return self::getSpecTypeMap()[$specType] ?? '未知';
  108. }
  109. public static function getDeliveryTypeMap()
  110. {
  111. return [
  112. self::DELIVERY_TYPE_EXPRESS => '物流配送',
  113. // self::DELIVERY_TYPE_CITY => '同城配送',
  114. // self::DELIVERY_TYPE_SELF => '门店自提',
  115. ];
  116. }
  117. public static function getDeliveryTypeText($deliveryType)
  118. {
  119. return self::getDeliveryTypeMap()[$deliveryType] ?? '未知';
  120. }
  121. public static function getExpressTypeMap()
  122. {
  123. return [
  124. self::EXPRESS_TYPE_FREE => '包邮',
  125. self::EXPRESS_TYPE_UNIFIED => '统一运费',
  126. self::EXPRESS_TYPE_TEMPLATE => '运费模板',
  127. ];
  128. }
  129. public static function getExpressTypeText($expressType)
  130. {
  131. return self::getExpressTypeMap()[$expressType] ?? '未知';
  132. }
  133. public static function getOnlineTypeMap()
  134. {
  135. return [
  136. self::ONLINE_TYPE_IMMEDIATE => '立即上架',
  137. self::ONLINE_TYPE_NOT_NOW => '暂不上架',
  138. self::ONLINE_TYPE_SCHEDULED => '定时上架',
  139. ];
  140. }
  141. public static function getOnlineTypeText($onlineType)
  142. {
  143. return self::getOnlineTypeMap()[$onlineType] ?? '未知';
  144. }
  145. public static function getOfflineTypeMap()
  146. {
  147. return [
  148. self::OFFLINE_TYPE_NONE => '不自动下架',
  149. self::OFFLINE_TYPE_AUTO => '自动下架',
  150. ];
  151. }
  152. public static function getOfflineTypeText($offlineType)
  153. {
  154. return self::getOfflineTypeMap()[$offlineType] ?? '未知';
  155. }
  156. }