diff --git a/app/common/repositories/store/coupon/StoreCouponRepository.php b/app/common/repositories/store/coupon/StoreCouponRepository.php index d6a2f6a0..d77856ae 100644 --- a/app/common/repositories/store/coupon/StoreCouponRepository.php +++ b/app/common/repositories/store/coupon/StoreCouponRepository.php @@ -48,6 +48,8 @@ class StoreCouponRepository extends BaseRepository const TYPE_STORE_ALL = 0; //店铺商品券 const TYPE_STORE_PRODUCT = 1; + //店铺现金抵扣券 + const TYPE_STORE_COUPON = 2; //平台券 const TYPE_PLATFORM_ALL = 10; //平台分类券 @@ -56,8 +58,6 @@ class StoreCouponRepository extends BaseRepository const TYPE_PLATFORM_STORE = 12; //平台购物卡,可全额抵扣,可结余 const TYPE_PLATFORM_CARD = 13; - //平台抵扣券,按比例部分抵扣,可结余 - const TYPE_PLATFORM_COUPON = 14; //获取方式 const GET_COUPON_TYPE_RECEIVE = 0; @@ -231,8 +231,9 @@ class StoreCouponRepository extends BaseRepository Elm::input('title', '优惠券名称:')->placeholder('请输入优惠卷名称')->required(), Elm::radio('type', '优惠券类型:', 0) ->setOptions([ - ['value' => 0, 'label' => '店铺券'], - ['value' => 1, 'label' => '商品券'], + ['value' => self::TYPE_STORE_ALL, 'label' => '店铺券'], + ['value' => self::TYPE_STORE_PRODUCT, 'label' => '商品券'], + ['value' => self::TYPE_STORE_COUPON, 'label' => '现金抵扣券'], ])->control([ [ 'value' => 1, @@ -397,7 +398,6 @@ class StoreCouponRepository extends BaseRepository ['value' => self::TYPE_PLATFORM_CATE, 'label' => '品类券'], ['value' => self::TYPE_PLATFORM_STORE, 'label' => '跨店券'], ['value' => self::TYPE_PLATFORM_CARD, 'label' => '购物卡'], - ['value' => self::TYPE_PLATFORM_COUPON, 'label' => '抵扣券'], ])->control([ [ 'value' => self::TYPE_PLATFORM_CATE, diff --git a/app/controller/admin/store/Coupon.php b/app/controller/admin/store/Coupon.php index 6cc82e39..2851d752 100644 --- a/app/controller/admin/store/Coupon.php +++ b/app/controller/admin/store/Coupon.php @@ -243,7 +243,7 @@ class Coupon extends BaseController } else unset($data['use_start_time']); unset($data['range_date']); if ($data['is_limited'] == 0) $data['total_count'] = 0; - if (!in_array($data['type'], [10, 11, 12, 13, 14])) { + if (!in_array($data['type'], [10, 11, 12, 13])) { throw new ValidateException('请选择有效的优惠券类型'); } $data['mer_id'] = $this->request->merId(); diff --git a/app/controller/merchant/store/coupon/Coupon.php b/app/controller/merchant/store/coupon/Coupon.php index fa1c96af..d1e737eb 100644 --- a/app/controller/merchant/store/coupon/Coupon.php +++ b/app/controller/merchant/store/coupon/Coupon.php @@ -125,7 +125,7 @@ class Coupon extends BaseController } else unset($data['use_start_time']); unset($data['range_date']); if ($data['is_limited'] == 0) $data['total_count'] = 0; - if (!in_array($data['type'], [0, 1])) { + if (!in_array($data['type'], [0, 1, 2])) { throw new ValidateException('请选择有效的优惠券类型'); } return $data; diff --git a/app/validate/merchant/StoreCouponValidate.php b/app/validate/merchant/StoreCouponValidate.php index 670b5d8f..550e3b5c 100644 --- a/app/validate/merchant/StoreCouponValidate.php +++ b/app/validate/merchant/StoreCouponValidate.php @@ -29,7 +29,7 @@ class StoreCouponValidate extends Validate 'use_start_time|有效期限' => 'requireIf:coupon_type,1|array|>:2', 'sort|排序' => 'require|integer', 'status|状态' => 'require|in:0,1', - 'type|优惠券类型' => 'require|in:0,1,10,11,12,13,14', + 'type|优惠券类型' => 'require|in:0,1,10,11,12,13', 'product_id|商品' => 'requireIf:type,1|array|>:0', 'send_type|类型' => 'require|in:0,1,2,3,4,5', 'full_reduction|满赠金额' => 'requireIf:send_type,1|float|>=:0',