123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215 |
- <?php
- namespace app\common\Enum;
- /**
- * 全局状态枚举
- */
- class GoodsEnum
- {
- const TYPE_REAL = 1; // 普通商品(物流发货)
- const TYPE_CARD = 2; // 卡密/网盘(自动发货)
- const TYPE_VIRTUAL = 3; // 虚拟商品(虚拟发货)
- const TYPE_CARD_NEXT = 4; // 次卡商品(到店核销)
- //商品状态:0-仓库中(未上架),1-销售中(已上架),2-已售罄,3-已下架
- const STATUS_IN_STORAGE = 0; // 仓库中(未上架)
- const STATUS_ON_SALE = 1; // 销售中(已上架)
- const STATUS_SOLD_OUT = 2; // 已售罄
- const STATUS_OFF_SALE = 3; // 已下架
- // 规格类型:0=单规格,1=多规格
- const SPEC_TYPE_SINGLE = 0; // 单规格
- const SPEC_TYPE_MULTI = 1; // 多规格
-
- // 配送方式 快递 同城 、自提
- const DELIVERY_TYPE_EXPRESS = "EXPRESS"; // 快递
- const DELIVERY_TYPE_CITY = "LOCAL_DELIVERY"; // 同城
- const DELIVERY_TYPE_SELF = "SELF_PICKUP"; // 自提
- // 快递运费类型
- const EXPRESS_TYPE_FREE = 1; // 包邮
- const EXPRESS_TYPE_UNIFIED = 2; // 统一运费
- const EXPRESS_TYPE_TEMPLATE = 3; // 运费模板
- // 上架时间类型
- const ONLINE_TYPE_IMMEDIATE = 1; // 立即上架
- const ONLINE_TYPE_NOT_NOW = 2; // 暂不上架
- const ONLINE_TYPE_SCHEDULED = 3; // 定时上架
- // 下架类型
- const OFFLINE_TYPE_NONE = 0; // 不自动下架
- const OFFLINE_TYPE_AUTO = 1; // 自动下架
- // 库存显示类型:exact=精确的,sketchy=粗略的
- const STOCK_SHOW_TYPE_EXACT = 'EXACT'; // 精确的
- const STOCK_SHOW_TYPE_SKETCHY = 'SKETCHY'; // 粗略的
- //销量显示类型:exact=精确的,sketchy=粗略的
- const SALES_SHOW_TYPE_EXACT = 'EXACT'; // 精确的
- const SALES_SHOW_TYPE_SKETCHY = 'SKETCHY'; // 粗略的
- // 售后状态 sale_status
- const SALE_STATUS_NONE = 0; // 无售后
- const SALE_STATUS_APPLIED = 1; // 已申请
- const SALE_STATUS_REFUNDING = 2; // 退款中
- const SALE_STATUS_RETURNING = 3; // 退货中
- const SALE_STATUS_REFUNDED = 4; // 已退款
- const SALE_STATUS_RETURNED = 5; // 已退货退款
- const SALE_STATUS_REJECTED = 6; // 已拒绝
- public static function getSalesShowTypeMap()
- {
- return [
- self::SALES_SHOW_TYPE_EXACT => '精确的',
- self::SALES_SHOW_TYPE_SKETCHY => '粗略的',
- ];
- }
- public static function getSalesShowTypeText($salesShowType)
- {
- return self::getSalesShowTypeMap()[$salesShowType] ?? '未知';
- }
- public static function getStockShowTypeMap()
- {
- return [
- self::STOCK_SHOW_TYPE_EXACT => '精确的',
- self::STOCK_SHOW_TYPE_SKETCHY => '粗略的',
- ];
- }
- public static function getStockShowTypeText($stockShowType)
- {
- return self::getStockShowTypeMap()[$stockShowType] ?? '未知';
- }
- public static function getGoodsTypeMap()
- {
- return [
- self::TYPE_REAL => '普通商品',
- self::TYPE_CARD => '卡密/网盘',
- self::TYPE_VIRTUAL => '虚拟商品',
- self::TYPE_CARD_NEXT => '次卡商品',
- ];
- }
- public static function getGoodsTypeText($type)
- {
- return self::getGoodsTypeMap()[$type] ?? '未知';
- }
- public static function getGoodsTypeList()
- {
- return [
- self::TYPE_REAL,
- // self::TYPE_CARD,
- // self::TYPE_VIRTUAL,
- // self::TYPE_CARD_NEXT,
- ];
- }
- public static function getGoodsStatusMap()
- {
- return [
- self::STATUS_IN_STORAGE => '仓库中(未上架)',
- self::STATUS_ON_SALE => '销售中(已上架)',
- self::STATUS_SOLD_OUT => '已售罄',
- self::STATUS_OFF_SALE => '已下架',
- ];
- }
- public static function getGoodsStatusText($status)
- {
- return self::getGoodsStatusMap()[$status] ?? '未知';
- }
- public static function getSpecTypeMap()
- {
- return [
- self::SPEC_TYPE_SINGLE => '单规格',
- self::SPEC_TYPE_MULTI => '多规格',
- ];
- }
- public static function getSpecTypeText($specType)
- {
- return self::getSpecTypeMap()[$specType] ?? '未知';
- }
- public static function getDeliveryTypeMap()
- {
- return [
- self::DELIVERY_TYPE_EXPRESS => '物流配送',
- // self::DELIVERY_TYPE_CITY => '同城配送',
- // self::DELIVERY_TYPE_SELF => '门店自提',
- ];
- }
- public static function getDeliveryTypeText($deliveryType)
- {
- return self::getDeliveryTypeMap()[$deliveryType] ?? '未知';
- }
- public static function getExpressTypeMap()
- {
- return [
- self::EXPRESS_TYPE_FREE => '包邮',
- self::EXPRESS_TYPE_UNIFIED => '统一运费',
- self::EXPRESS_TYPE_TEMPLATE => '运费模板',
- ];
- }
- public static function getExpressTypeText($expressType)
- {
- return self::getExpressTypeMap()[$expressType] ?? '未知';
- }
- public static function getOnlineTypeMap()
- {
- return [
- self::ONLINE_TYPE_IMMEDIATE => '立即上架',
- self::ONLINE_TYPE_NOT_NOW => '暂不上架',
- self::ONLINE_TYPE_SCHEDULED => '定时上架',
- ];
- }
- public static function getOnlineTypeText($onlineType)
- {
- return self::getOnlineTypeMap()[$onlineType] ?? '未知';
- }
- public static function getOfflineTypeMap()
- {
- return [
- self::OFFLINE_TYPE_NONE => '不自动下架',
- self::OFFLINE_TYPE_AUTO => '自动下架',
- ];
- }
- public static function getOfflineTypeText($offlineType)
- {
- return self::getOfflineTypeMap()[$offlineType] ?? '未知';
- }
- public static function getSaleStatusMap()
- {
- return [
- self::SALE_STATUS_NONE => '无',
- self::SALE_STATUS_APPLIED => '已申请',
- self::SALE_STATUS_REFUNDING => '退款中',
- self::SALE_STATUS_RETURNING => '退货中',
- self::SALE_STATUS_REFUNDED => '已退款',
- self::SALE_STATUS_RETURNED => '已退货退款',
- self::SALE_STATUS_REJECTED => '已拒绝',
- ];
- }
- public static function getSaleStatusText($saleStatus)
- {
- return self::getSaleStatusMap()[$saleStatus] ?? '未知';
- }
- }
|