| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221 |
- <?php
- namespace addons\Store\common\enums;
- use common\enums\BaseEnum;
- /**
- * Class AddonsCouponEnum
- * @package addons\Coupon\common\enums
- */
- class CouponEnum extends BaseEnum
- {
- const DISCOUNT = 1;
- const FULL_MINUS = 2;
- const EXCHANGE = 3;
- const GIVING = 1;
- const GIVING_N = 0;
- const IS_USE0= 0;
- const IS_USE1= 1;
- const EXPIRE_TYPE1 = 1;
- const EXPIRE_TYPE2 = 2;
- const EXPIRE_TYPE3 = 3;
- const APPOINT_TYPE1 = 1;
- const APPOINT_TYPE2 = 2;
- const APPOINT_TYPE3 = 3;
- const APPOINT_TYPE5 = 5;//指定商户
- // 领取方式
- const SEND_FROM1 = 1;
- const SEND_FROM2 = 2;
- const SEND_FROM3 = 3;
- const SEND_FROM4 = 4;
- const SEND_FROM5 = 5;
- const SEND_FROM6 = 6;
- const SEND_FROM7 = 7;
- const SEND_FROM8 = 8;
- const SEND_FROM9 = 9;
- const SEND_FROM10 = 10;
- const SEND_FROM11 = 11;
- const SEND_FROM12 = 12;
- const SEND_FROM13 = 13;
- const SEND_FROM14 = 14;
- const SEND_FROM15 = 15;
- const SEND_FROM16 = 16;
- // 渠道来源
- const REVC_TYPE_H5 = 'h5';
- const REVC_TYPE_WECHAT = 'wechat';
- const REVC_TYPE_MPWX = 'mp-wx';
- const REVC_TYPE_APP = 'app';
- const REVC_TYPE_WORK_WX = 'work-wx';
- /* 优惠券状态 */
- // 未开始
- const STATUS_NOT_BEGIN = 1;
- // 领取中
- const STATUS_RECEIVING = 2;
- // 已过期
- const STATUS_EXPIRED = 3;
- // 已失效
- const STATUS_FAILURE = 4;
- // 优惠券奖励方式
- const REWARD_TYPE_GIVING = 1;
- const REWARD_TYPE_CONSUME = 2;
- // 优惠券奖励类型
- const REWARD_TYPE1 = 1; // 余额
- const REWARD_TYPE2 = 2; // 红包
- const REWARD_TYPE3 = 3; // 积分
- const REWARD_TYPE4 = 4; // 系统虚拟货币
- //0:未转赠,1:转赠中,2:已被领取(转赠完成
- const GIVING_STATUS0 = 0;
- const GIVING_STATUS1 = 1;
- const GIVING_STATUS2 = 2;
- /**
- * 优惠券来源
- * @Author: lun
- * @DateTime: 2021/12/17 0017 18:28
- * @Copyright: copyright (c) 2021 广东七件事集团
- * @param null $form
- */
- public static function getSendFromMap($form = null)
- {
- $data = [
- self::SEND_FROM1 => '商城发放',
- self::SEND_FROM2 => '购买商品奖励',
- self::SEND_FROM3 => '商品详情处领取',
- self::SEND_FROM4 => '领券中心领取',
- self::SEND_FROM5 => '签到',
- self::SEND_FROM6 => '好友转赠',
- self::SEND_FROM7 => '云库存-提货到线下奖励',
- self::SEND_FROM8 => '升级礼包赠送',
- self::SEND_FROM9 => '九宫格中奖',
- self::SEND_FROM10 => '刮刮卡中奖',
- self::SEND_FROM11 => '充值赠送',
- self::SEND_FROM12 => '会员礼包赠送',
- self::SEND_FROM13 => '消费礼包赠送',
- self::SEND_FROM14 => '推三返一赠送',
- self::SEND_FROM15 => '推荐有礼赠送',
- self::SEND_FROM16 => '收银台订单赠送',
- ];
- if(isset($data[$form])) return $data[$form];
- return $data;
- }
- /**
- * @return array
- */
- public static function getMap(): array
- {
- return [];
- }
- public static function getTypeMap(): array
- {
- return [
- self::DISCOUNT => '折扣',
- self::FULL_MINUS => '满减',
- self::EXCHANGE => '兑换',
- ];
- }
- public static function getExpireTypeMap(): array
- {
- return [
- self::EXPIRE_TYPE1 => '领取后N天过期',
- self::EXPIRE_TYPE2 => '指定有效期',
- self::EXPIRE_TYPE3 => '领取后N天生效,生效后M天过期',
- ];
- }
- public static function getAppointTypeMap(): array
- {
- return [
- self::APPOINT_TYPE1 => '指定分类',
- self::APPOINT_TYPE2 => '指定商品',
- self::APPOINT_TYPE3 => '全场通用',
- ];
- }
- public static function getGivingStatusMap(): array
- {
- return [
- self::GIVING_STATUS0 => '未转赠',
- self::GIVING_STATUS1 => '转赠中',
- self::GIVING_STATUS2 => '已被领取',
- ];
- }
- public static function getIsGivingMap()
- {
- return [
- self::GIVING => '是',
- self::GIVING_N => '否',
- ];
- }
- public static function getReceiveTypeMap(int $revc_type = 0)
- {
- $revc_type_map = [
- self::REVC_TYPE_H5 => 'h5',
- self::REVC_TYPE_WECHAT => '微信',
- self::REVC_TYPE_MPWX => '微信小程序',
- self::REVC_TYPE_APP => 'app',
- self::REVC_TYPE_WORK_WX => '企业微信',
- ];
- if ($revc_type) {
- return $revc_type_map[$revc_type];
- } else {
- return $revc_type_map;
- }
- }
- public static function getCouponStatusMap(int $status = 0, bool $is_user_coupon = false)
- {
- $status_map = [
- self::STATUS_NOT_BEGIN => '未开始',
- self::STATUS_RECEIVING => '领取中',
- self::STATUS_EXPIRED => '已过期',
- self::STATUS_FAILURE => '已失效',
- ];
- if ($is_user_coupon) {
- $status_map[self::STATUS_RECEIVING] = '正常使用';
- }
- if ($status) {
- return $status_map[$status];
- } else {
- return $status_map;
- }
- }
- public static function getRewardScenariosMap(int $reward_type = 0)
- {
- $reward_type_map = [
- self::REWARD_TYPE_CONSUME => '使用奖励',
- self::REWARD_TYPE_GIVING => '转赠奖励',
- ];
- if ($reward_type) {
- return $reward_type_map[$reward_type];
- } else {
- return $reward_type_map;
- }
- }
- public static function getRewardTypeMap(int $reward_type)
- {
- $reward_type_map = [
- self::REWARD_TYPE1 => '余额',
- self::REWARD_TYPE2 => '红包',
- self::REWARD_TYPE3 => '积分',
- self::REWARD_TYPE4 => '系统虚拟货币',
- ];
- if ($reward_type) {
- return $reward_type_map[$reward_type];
- } else {
- return $reward_type_map;
- }
- }
- }
|