multi-store/app/common/enum/OrderEnum.php
2024-06-08 09:43:24 +08:00

193 lines
4.5 KiB
PHP

<?php
namespace app\common\enum;
class OrderEnum
{
/**
* 流水类型
* @USER_ORDER_PAY 用户订单支付
* @CASHIER_ORDER_PAY 收银台支付
* @CASHIER_CASH_ORDER_PAY 收银台现金支付
* @MERCHANT_ORDER_OBTAINS 商户订单获得
* @ORDER_HANDLING_FEES 订单手续费
* @MERCHANT_ORDER_PAY 商户订单支付
* @PLATFORM_ORDER_OBTAINS 平台订单获得
* @SUPPLIER_ORDER_OBTAINS 供应链订单获得
* @PLATFORM_ORDER_PAY 平台订单支付
* @SYSTEM_SET 系统设置
*/
const USER_ORDER_PAY = 1;
const MERCHANT_ORDER_OBTAINS = 2;
const ORDER_HANDLING_FEES = 3;
const MERCHANT_ORDER_PAY = 4;
const PLATFORM_ORDER_OBTAINS = 5;
const SUPPLIER_ORDER_OBTAINS = 6;
const PLATFORM_ORDER_PAY = 7;
const SYSTEM_SET = 8;
const CASHIER_ORDER_PAY = 9;
const CASHIER_CASH_ORDER_PAY = 10;
/**
* 收入支出类型
* @EXPENDITURE 支出
* @INCOME 收入
*/
const EXPENDITURE = 0;
const INCOME = 1;
//-----------------------物流状态-----------------------//
/**
* @RECEIVED_GOODS 已收货
*/
const RECEIVED_GOODS = 2;
/**
* @WAIT_EVALUATION 待评价
*/
const WAIT_EVALUATION = 3;
/**
* @WAIT_DELIVERY 待发货
*/
const WAIT_DELIVERY = 0;
/**
* @WAIT_RECEIVING 待收货
*/
const WAIT_RECEIVING = 1;
/**
* @ALREADY_REFUND 申请退款
*/
const ALREADY_REFUND = -1;
/**
* @RETURN_SUCCESS 退款成功
*/
const RETURN_SUCCESS = -2;
/**
* 核销
* @IS_OK 已核销
*/
const IS_OK = 1;
/**
* 回调订单相关
* @PAY 支付
* @IBACK 退款
*/
const PAY = 1;
const BACK = 0;
/**
* 账户类型
* @USER 用户
* @MERCHANT 商户
* @PLATFORM 平台
* @SUPPLIER 供应链
* @SYSTEM 系统
*/
const USER = 0;
const MERCHANT = 1;
const PLATFORM = 2;
const SUPPLIER = 3;
const SYSTEM = 4;
/**
* 订单状态
* @CANCEL_ORDER 取消售后
*/
const CANCEL_ORDER = 5;
//退款状态
const REFUND_STATUS_NO = 0;
const REFUND_STATUS_YES = 1;
const REFUND_STATUS_FINISH = 2;
const CANCEL_SALE = 3;
/**
* @notes 获取支付类型
* @param bool $value
* @return string|string[]
* @author 段誉
* @date 2023/2/23 15:36
*/
public static function getFinancialType($value = true)
{
$data = [
self::USER_ORDER_PAY => '用户订单支付',
self::MERCHANT_ORDER_PAY => '商户订单支付',
self::PLATFORM_ORDER_PAY => '平台订单支付',
self::MERCHANT_ORDER_OBTAINS => '商户订单获得',
self::ORDER_HANDLING_FEES => '订单手续费',
self::PLATFORM_ORDER_OBTAINS => '平台订单获得',
self::SUPPLIER_ORDER_OBTAINS => '供应商订单获得',
self::SYSTEM_SET => '平台设置',
];
if ($value === true) {
return $data;
}
return $data[$value] ?? '';
}
/**
* @notes 获取订单状态类型
*/
public static function getOrderType($value = true)
{
$data = [
self::RECEIVED_GOODS => '已收货',
self::WAIT_EVALUATION => '待评价',
self::WAIT_DELIVERY => '待发货',
self::WAIT_RECEIVING => '待收货',
self::RETURN_SUCCESS => '退货成功',
self::ALREADY_REFUND => '已退款',
];
if ($value === true) {
return $data;
}
return $data[$value] ?? '';
}
/**
* @notes 获取订单状态类型
*/
public static function refundStatus($value = true)
{
$data = [
self::REFUND_STATUS_NO => '未退款',
self::REFUND_STATUS_YES => '退款中',
self::REFUND_STATUS_FINISH => '已退款',
];
if ($value === true) {
return $data;
}
return $data[$value] ?? '';
}
/**
* @notes 获取订单状态类型
*/
public static function refundType($value = true)
{
$data = [
1 => '仅退款',
2 => '退款退货',
3 => '拒绝退款',
4 => '商品待退货',
5 => '退货待收货',
6 => '已退款',
];
if ($value === true) {
return $data;
}
return $data[$value] ?? '';
}
}