截流自动化的商城平台
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

OrderEnum.php 7.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | likeshop开源商城系统
  4. // +----------------------------------------------------------------------
  5. // | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
  6. // | gitee下载:https://gitee.com/likeshop_gitee
  7. // | github下载:https://github.com/likeshop-github
  8. // | 访问官网:https://www.likeshop.cn
  9. // | 访问社区:https://home.likeshop.cn
  10. // | 访问手册:http://doc.likeshop.cn
  11. // | 微信公众号:likeshop技术社区
  12. // | likeshop系列产品在gitee、github等公开渠道开源版本可免费商用,未经许可不能去除前后端官方版权标识
  13. // | likeshop系列产品收费版本务必购买商业授权,购买去版权授权后,方可去除前后端官方版权标识
  14. // | 禁止对系统程序代码以任何目的,任何形式的再发布
  15. // | likeshop团队版权所有并拥有最终解释权
  16. // +----------------------------------------------------------------------
  17. // | author: likeshop.cn.team
  18. // +----------------------------------------------------------------------
  19. namespace app\common\enum;
  20. use app\common\model\order\Order;
  21. /**
  22. * 订单相关 枚举类型
  23. * Class OrderEnum
  24. * @Author FZR
  25. * @package app\common\enum
  26. */
  27. class OrderEnum
  28. {
  29. const ORDER_CANCEL = 1; //直接退款
  30. const ORDER_AFTERSALE_CANCEL = 0; //售后退款退款(未退款也是0)
  31. //来源
  32. const ORDER_SOURCE_APPLET = 1;//小程序来源
  33. const ORDER_SOURCE_H5 = 2;//h5来源
  34. const ORDER_SOURCE_IOS = 3;//ios来源
  35. const ORDER_SOURCE_ANDROID = 4;//安卓来源
  36. //订单状态order_status
  37. const ORDER_STATUS_NO_PAID = 0;//待支付
  38. const ORDER_STATUS_DELIVERY = 1;//待发货
  39. const ORDER_STATUS_GOODS = 2;//待收货
  40. const ORDER_STATUS_COMPLETE = 3;//已完成
  41. const ORDER_STATUS_DOWN = 4;//已关闭
  42. // 是否可修改物流单号的状态
  43. const CAN_CHANGE_INVOICE_NO_ARR = [
  44. self::ORDER_STATUS_GOODS,
  45. ];
  46. //支付状态pay_status
  47. const PAY_STATUS_NO_PAID = 0;//待支付
  48. const PAY_STATUS_PAID = 1;//已支付
  49. const PAY_STATUS_REFUND = 2;//已退款
  50. const PAY_STATUS_REFUSE_REFUND = 3;//拒绝退款
  51. //配送方式delivery_type
  52. const DELIVERY_TYPE_EXPRESS = 0;//快递配送
  53. const DELIVERY_TYPE_VIRTUAL = 1;//虚拟发货
  54. const DELIVERY_TYPE_SELF = 2;//线下自提
  55. const DELIVERY_TYPES = [
  56. self::DELIVERY_TYPE_EXPRESS,
  57. self::DELIVERY_TYPE_VIRTUAL,
  58. self::DELIVERY_TYPE_SELF,
  59. ];
  60. //售后状态aftersale_status
  61. const AFTERSALE_STATUS_NO_SALE = 0;//不在售后中
  62. const AFTERSALE_STATUS_SALEING = 1;//售后中
  63. //退款状态refund_status
  64. const REFUND_STATUS_NO_REFUND = 0;//未退款
  65. const REFUND_STATUS_PART_REFUND = 1;//部分退款
  66. const REFUND_STATUS_ALL_REFUND = 2;//全部退款
  67. //订单类型
  68. const NORMAL_ORDER = 0;//普通订单
  69. const SECKILL_ORDER = 1;//秒杀订单
  70. const TEAM_ORDER = 2;//拼团订单
  71. const BARGAIN_ORDER = 3;//砍价订单
  72. //结算状态
  73. const SETTLE_WAIT = 0; //待结算
  74. const SETTLE_FINISH = 1; //已结算
  75. //发货状态
  76. const SHIPPING_NO = 0; //未发货
  77. const SHIPPING_FINISH = 1; //已发货
  78. //标识子订单的退款
  79. const IS_CANCEL_NO = 0; //售后退款或未退款
  80. const IS_CANCEL_FINISH = 1; //直接退款
  81. //核销状态
  82. const NOT_WRITTEN_OFF = 0;//待核销
  83. const WRITTEN_OFF = 1;//已核销
  84. //订单赠送积分场景
  85. const ORDER_PAY = 1;//订单付款
  86. const ORDER_DELIVERY = 2;//订单发货
  87. const ORDER_FINISH = 3;//订单完成
  88. const ORDER_AFTER_SALE_OVER = 4;//订单超过售后期
  89. public static function getPayWay($log)
  90. {
  91. $desc = [
  92. OrderLogEnum::USER_ADD_ORDER => '会员提交订单',
  93. OrderLogEnum::USER_CANCEL_ORDER => '会员取消订单',
  94. OrderLogEnum::USER_DEL_ORDER => '会员删除订单',
  95. OrderLogEnum::USER_CONFIRM_ORDER => '会员确认收货',
  96. OrderLogEnum::USER_PAID_ORDER => '会员支付订单',
  97. ];
  98. if ($log === true) {
  99. return $desc;
  100. }
  101. return isset($desc[$log]) ? $desc[$log] : $log;
  102. }
  103. /**
  104. * @notes 订单赠送积分场景
  105. * @param $log
  106. * @return mixed|string|string[]
  107. * @author ljj
  108. * @date 2022/2/18 4:01 下午
  109. */
  110. public static function getOrderAward($log)
  111. {
  112. $desc = [
  113. self::ORDER_PAY => '订单付款',
  114. self::ORDER_DELIVERY => '订单发货',
  115. self::ORDER_FINISH => '订单完成',
  116. self::ORDER_AFTER_SALE_OVER => '订单超过售后期',
  117. ];
  118. if ($log === true) {
  119. return $desc;
  120. }
  121. return isset($desc[$log]) ? $desc[$log] : $log;
  122. }
  123. /**
  124. * @Notes: 订单状态
  125. * @Author: 张无忌
  126. * @param bool $type
  127. * @return array|mixed|string
  128. */
  129. public static function getOrderStatus($type=true)
  130. {
  131. $desc = [
  132. self::ORDER_STATUS_NO_PAID => '待支付',
  133. self::ORDER_STATUS_DELIVERY => '待发货',
  134. self::ORDER_STATUS_GOODS => '待收货',
  135. self::ORDER_STATUS_COMPLETE => '已完成',
  136. self::ORDER_STATUS_DOWN => '已关闭'
  137. ];
  138. if ($type === true) {
  139. return $desc;
  140. }
  141. return $desc[$type] ?? '未知来源';
  142. }
  143. /**
  144. * @Notes: 支付状态
  145. * @Author: 张无忌
  146. * @param bool $type
  147. * @return array|mixed|string
  148. */
  149. public static function getPayStatus($type=true)
  150. {
  151. $desc = [
  152. self::PAY_STATUS_NO_PAID => '待支付',
  153. self::PAY_STATUS_PAID => '已支付',
  154. self::PAY_STATUS_REFUND => '已退款',
  155. self::PAY_STATUS_REFUSE_REFUND => '拒绝退款'
  156. ];
  157. if ($type === true) {
  158. return $desc;
  159. }
  160. return $desc[$type] ?? '未知来源';
  161. }
  162. /**
  163. * @Notes: 退款状态
  164. * @Author: 张无忌
  165. * @param bool $type
  166. * @return array|mixed|string
  167. */
  168. public static function getRefundStatus($type=true)
  169. {
  170. $desc = [
  171. self::REFUND_STATUS_NO_REFUND => '未退款',
  172. self::REFUND_STATUS_PART_REFUND => '部分退款',
  173. self::REFUND_STATUS_ALL_REFUND => '全部退款',
  174. ];
  175. if ($type === true) {
  176. return $desc;
  177. }
  178. return $desc[$type] ?? '未知来源';
  179. }
  180. /**
  181. * @notes 核销状态描述
  182. * @param bool $value
  183. * @return string|string[]
  184. * @author 段誉
  185. * @date 2022/11/2 14:08
  186. */
  187. public static function getVerificationStatusDesc($value = true)
  188. {
  189. $data = [
  190. self::NOT_WRITTEN_OFF => '待核销',
  191. self::WRITTEN_OFF => '已核销',
  192. ];
  193. if (true === $value) {
  194. return $data;
  195. }
  196. return $data[$value];
  197. }
  198. static function getChangeDeliveryTypeItem($goods_delivery_type)
  199. {
  200. switch ($goods_delivery_type) {
  201. case GoodsEnum::DELIVERY_EXPRESS:
  202. return static::DELIVERY_TYPE_EXPRESS;
  203. break;
  204. case GoodsEnum::DELIVERY_VIRTUAL:
  205. return static::DELIVERY_TYPE_VIRTUAL;
  206. break;
  207. case GoodsEnum::DELIVERY_SELF:
  208. return static::DELIVERY_TYPE_SELF;
  209. break;
  210. default:
  211. break;
  212. }
  213. return static::DELIVERY_TYPE_EXPRESS;
  214. }
  215. }