<?php
namespace addons\TinyShop\common\enums;
use common\enums\BaseEnum;
/**
* 订单状态
*
* Class OrderStatusEnum
* @package addons\TinyShop\common\enums
* @author jianyan74 <751393839@qq.com>
*/
class OrderStatusEnum extends BaseEnum
{
const NOT_PAY = 0;
const PAY = 1;
const SHIPMENTS = 2;
const SING = 3;
const ACCOMPLISH = 4;
const RETUREN_APPLY = -1;
const RETUREN_ING = -2;
const RETUREN = -3;
const REPEAL = -4;
const REPEAL_APPLY = -5;
/**
* @return array
*/
public static function getMap(): array
{
return [
self::NOT_PAY => '待付款',
self::PAY => '待发货', // 已付款
self::SHIPMENTS => '已发货',
self::SING => '已收货',
self::ACCOMPLISH => '已完成',
self::REPEAL => '已关闭',
self::RETUREN_APPLY => '退货申请',
self::RETUREN_ING => '退款中',
self::RETUREN => '已退货',
self::REPEAL_APPLY => '撤销申请',
];
}
/**
* @return array
*/
public static function getBackendMap(): array
{
return [
self::NOT_PAY => '待付款',
self::PAY => '待发货', // 已付款
self::SHIPMENTS => '已发货',
self::SING => '已收货',
self::ACCOMPLISH => '已完成',
self::REPEAL => '已关闭',
self::RETUREN_ING => '退款中',
];
}
/**
* 已下单的状态未被关闭的
*
* @return array
*/
public static function haveBought()
{
return array_keys([
self::NOT_PAY => '待付款',
self::PAY => '待发货', // 已付款
self::SHIPMENTS => '已发货',
self::SING => '已收货',
self::ACCOMPLISH => '已完成',
self::RETUREN_APPLY => '退货申请',
self::RETUREN_ING => '退款中',
self::RETUREN => '已退货',
self::REPEAL_APPLY => '撤销申请',
]);
}
public static function common()
{
}
/**
* 获取实物订单所有可能的订单状态
*/
public static function getOrderCommonStatus()
{
$status = [
[
'status_id' => '0',
'name' => '待付款',
'is_refund' => 0, // 是否可以申请退款
'operation' => [
'0' => [
'no' => 'pay',
'name' => '线下支付',
'color' => '#FF9800'
],
'1' => [
'no' => 'close',
'color' => '#E61D1D',
'name' => '交易关闭'
],
'2' => [
'no' => 'adjust_price',
'color' => '#4CAF50',
'name' => '修改价格'
],
'3' => [
'no' => 'seller_memo',
'color' => '#666666',
'name' => '备注'
]
],
'member_operation' => [
'0' => [
'no' => 'pay',
'name' => '去支付',
'color' => '#F15050'
],
'1' => [
'no' => 'close',
'name' => '关闭订单',
'color' => '#999999'
]
]
],
[
'status_id' => '1',
'name' => '待发货',
'is_refund' => 1,
'operation' => [
'0' => [
'no' => 'delivery',
'color' => 'green',
'name' => '发货'
],
'1' => [
'no' => 'seller_memo',
'color' => '#666666',
'name' => '备注'
],
'2' => [
'no' => 'update_address',
'color' => '#51A351',
'name' => '修改地址'
]
],
'member_operation' => []
],
[
'status_id' => '2',
'name' => '已发货',
'is_refund' => 1,
'operation' => [
'0' => [
'no' => 'seller_memo',
'color' => '#666666',
'name' => '备注'
],
'1' => [
'no' => 'logistics',
'color' => '#666666',
'name' => '查看物流'
],
'2' => [
'no' => 'getdelivery',
'name' => '确认收货',
'color' => '#FF6600'
]
],
'member_operation' => [
'0' => [
'no' => 'getdelivery',
'name' => '确认收货',
'color' => '#FF6600'
],
'1' => [
'no' => 'logistics',
'color' => '#cccccc',
'name' => '查看物流'
]
]
],
[
'status_id' => '3',
'name' => '已收货',
'is_refund' => 0,
'operation' => [
'0' => [
'no' => 'seller_memo',
'color' => '#666666',
'name' => '备注'
],
'1' => [
'no' => 'logistics',
'color' => '#666666',
'name' => '查看物流'
]
],
'member_operation' => [
'0' => [
'no' => 'logistics',
'color' => '#cccccc',
'name' => '查看物流'
]
]
],
[
'status_id' => '4',
'name' => '已完成',
'is_refund' => 0,
'operation' => [
'0' => [
'no' => 'seller_memo',
'color' => '#666666',
'name' => '备注'
],
'1' => [
'no' => 'logistics',
'color' => '#666666',
'name' => '查看物流'
]
],
'member_operation' => [
'0' => [
'no' => 'logistics',
'color' => '#cccccc',
'name' => '查看物流'
]
]
],
[
'status_id' => '5',
'name' => '已关闭',
'is_refund' => 0,
'operation' => [
'0' => [
'no' => 'seller_memo',
'color' => '#666666',
'name' => '备注'
],
'1' => [
'no' => 'delete_order',
'color' => '#ff0000',
'name' => '删除订单'
]
],
'member_operation' => [
'0' => [
'no' => 'delete_o