123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222 |
- <?php
- namespace app\common\Enum;
- class OrderEnum
- {
- /**
- * 订单状态
- */
- const STATUS_CREATE = 101;
- const STATUS_PAY = 201;
- // 验货后 在发货
- const STATUS_INSPECTION = 210;
- // 验货通过
- const STATUS_INSPECTION_PASS = 211;
- // 验货不通过
- const STATUS_INSPECTION_FAIL = 212;
- // 发货
- const STATUS_SHIP = 301;
- const STATUS_CONFIRM = 401;
- const STATUS_COMMENT = 501;
- const STATUS_CANCEL = 102;
- const STATUS_AUTO_CANCEL = 103;
- const STATUS_ADMIN_CANCEL = 104;
- const STATUS_REFUND = 202;
- const STATUS_REFUND_CONFIRM = 203;
- const STATUS_GROUPON_TIMEOUT = 204;
- const STATUS_AUTO_CONFIRM = 402;
-
- // 订单类型
- const TYPE_NORMAL = 1; // 普通订单
- const TYPE_GROUP = 2; // 拼团订单
- const TYPE_SECKILL = 3; // 秒杀订单
- const TYPE_PRESALE = 4; // 预售订单
- // 发货方式
- const DELIVERY_TYPE_EXPRESS = 1; // 快递配送
- const DELIVERY_TYPE_PICKUP = 2; // 门店自提
- const DELIVERY_TYPE_LOCAL = 3; // 同城配送
- const DELIVERY_TYPE_VIRTUAL = 4; // 无需配送
- // 发票状态
- const INVOICE_STATUS_UNAVAILABLE = -1; // 不可开具
- const INVOICE_STATUS_NOT_APPLIED = 0; // 未申请
- const INVOICE_STATUS_APPLIED = 1; // 已申请
- const INVOICE_STATUS_ISSUED = 2; // 已开具
- // 活动类型
- const ACTIVITY_TYPE_NORMAL = 'normal'; // 普通活动
- const ACTIVITY_TYPE_SECKILL = 'seckill'; // 秒杀活动
- const ACTIVITY_TYPE_GROUP = 'group'; // 拼团活动
- const ACTIVITY_TYPE_PRESALE = 'presale'; // 预售活动
- const ACTIVITY_TYPE_DISCOUNT = 'discount'; // 折扣活动
- public static function getOrderTypeList()
- {
- return [
- self::TYPE_NORMAL => '普通订单',
- self::TYPE_GROUP => '拼团订单',
- self::TYPE_SECKILL => '秒杀订单',
- self::TYPE_PRESALE => '预售订单',
- ];
- }
- public static function getOrderTypeText($type)
- {
- return self::getOrderTypeList()[$type] ?? '未知类型';
- }
- public static function getDeliveryTypeList()
- {
- return [
- self::DELIVERY_TYPE_EXPRESS => '快递配送',
- self::DELIVERY_TYPE_PICKUP => '门店自提',
- self::DELIVERY_TYPE_LOCAL => '同城配送',
- self::DELIVERY_TYPE_VIRTUAL => '无需配送',
- ];
- }
- public static function getDeliveryTypeText($deliveryType)
- {
- return self::getDeliveryTypeList()[$deliveryType] ?? '未知';
- }
- public static function getInvoiceStatusList()
- {
- return [
- self::INVOICE_STATUS_UNAVAILABLE => '不可开具',
- self::INVOICE_STATUS_NOT_APPLIED => '未申请',
- self::INVOICE_STATUS_APPLIED => '已申请',
- self::INVOICE_STATUS_ISSUED => '已开具',
- ];
- }
- public static function getInvoiceStatusText($invoiceStatus)
- {
- return self::getInvoiceStatusList()[$invoiceStatus] ?? '未知';
- }
- const STATUS_TEXT_MAP = [
- self::STATUS_CREATE => '未付款',
- self::STATUS_CANCEL => "已取消",
- self::STATUS_AUTO_CANCEL => "已取消(系统)",
- self::STATUS_ADMIN_CANCEL => "已取消(管理员)",
- self::STATUS_INSPECTION => "待验货",
- self::STATUS_INSPECTION_PASS => "待发货",
- self::STATUS_INSPECTION_FAIL => "验货不通过",
- self::STATUS_PAY => "待验收",
- // self::STATUS_REFUND => "订单取消,退款中",
- // self::STATUS_REFUND_CONFIRM => "已退款",
- // self::STATUS_GROUPON_TIMEOUT => "已超时团购",
- self::STATUS_SHIP => "待收货",
- self::STATUS_CONFIRM => "已完成",
- self::STATUS_AUTO_CONFIRM => "已收货(系统)",
- self::STATUS_COMMENT => "已评价",
- ];
- const STATUS_TIME_MAP = [
- self::STATUS_CREATE => 'createtime',
- self::STATUS_PAY => 'pay_time',
- self::STATUS_SHIP => 'shipping_time',
- self::STATUS_CONFIRM => 'receive_time',
- self::STATUS_AUTO_CONFIRM => 'receive_time',
- self::STATUS_COMMENT => 'evaluate_time',
- self::STATUS_REFUND => 'refund_time',
- self::STATUS_REFUND_CONFIRM => 'refund_time',
- self::STATUS_AUTO_CANCEL => 'expire_time',
- self::STATUS_CANCEL => 'cancel_time',
- self::STATUS_INSPECTION => 'inspection_time',
- self::STATUS_INSPECTION_PASS => 'inspection_time',
- self::STATUS_INSPECTION_FAIL => 'inspection_time',
- ];
- public static function isValidOrderStatus($status)
- {
- return isset(self::STATUS_TEXT_MAP[$status]);
- }
- public static function getOrderStatusList()
- {
- return self::STATUS_TEXT_MAP;
- }
- public static function getOrderStatusText($status)
- {
- return self::STATUS_TEXT_MAP[$status] ?? '未知';
- }
- ####### 用户前端传的参数
- const SHOW_TYPE_ALL = 0;//全部订单
- const SHOW_TYPE_WAIT_PAY = 1;//待付款订单
- const SHOW_TYPE_WAIT_DELIVERY = 2;//待发货订单
- const SHOW_TYPE_WAIT_RECEIPT = 3;//待收货订单
- const SHOW_TYPE_WAIT_COMMENT = 4;//待评价订单
- const SHOW_TYPE_WAIT_INSPECT = 5;//待验货订单
- const SHOW_TYPE_STATUS_MAP = [
- self::SHOW_TYPE_ALL => [
- self::STATUS_CANCEL,
- self::STATUS_AUTO_CANCEL,
- self::STATUS_ADMIN_CANCEL,
- self::STATUS_CREATE,
- self::STATUS_PAY,
- self::STATUS_SHIP,
- self::STATUS_CONFIRM,
- self::STATUS_COMMENT,
- ],
- self::SHOW_TYPE_WAIT_PAY => [
- self::STATUS_CREATE
- ],
- self::SHOW_TYPE_WAIT_DELIVERY => [
- self::STATUS_INSPECTION_PASS,
- ],
- self::SHOW_TYPE_WAIT_RECEIPT => [
- self::STATUS_SHIP
- ],
- self::SHOW_TYPE_WAIT_COMMENT => [
- self::STATUS_CONFIRM
- ],
- self::SHOW_TYPE_WAIT_INSPECT => [
- self::STATUS_PAY,
- self::STATUS_INSPECTION,
- self::STATUS_INSPECTION_FAIL,
- ],
- ];
- const SHOW_TYPE_WAIT_INSPECTION = 1;//待验收订单
- const SHOW_TYPE_WAIT_INSPECTION_SHIP = 2;//待发货订单
- const SHOW_TYPE_WAIT_INSPECTION_CONFIRM = 3;//待收货订单
- // 验货端 前端传的参数
- const SHOW_INSPECTION_TYPE_STATUS_MAP = [
- self::SHOW_TYPE_WAIT_INSPECTION => [
- self::STATUS_PAY,
- self::STATUS_INSPECTION,
- self::STATUS_INSPECTION_PASS,
- self::STATUS_INSPECTION_FAIL,
- ],
- self::SHOW_TYPE_WAIT_INSPECTION_SHIP => [
- self::STATUS_INSPECTION_PASS
- ],
- self::SHOW_TYPE_WAIT_INSPECTION_CONFIRM => [
- self::STATUS_SHIP
- ],
- ];
- const STATUS_TEXT_MAP_INSPECTION = [
- self::STATUS_INSPECTION => "待验货",
- self::STATUS_INSPECTION_PASS => "验货通过",
- self::STATUS_INSPECTION_FAIL => "验货不通过",
- self::STATUS_PAY => "待验货",
- self::STATUS_SHIP => "待收货",
- ];
- }
|