调整优惠券类型

This commit is contained in:
luofei 2024-02-19 14:57:49 +08:00
parent cd83ab0ccd
commit a2e92c6a43
4 changed files with 8 additions and 8 deletions

View File

@ -48,6 +48,8 @@ class StoreCouponRepository extends BaseRepository
const TYPE_STORE_ALL = 0; const TYPE_STORE_ALL = 0;
//店铺商品券 //店铺商品券
const TYPE_STORE_PRODUCT = 1; const TYPE_STORE_PRODUCT = 1;
//店铺现金抵扣券
const TYPE_STORE_COUPON = 2;
//平台券 //平台券
const TYPE_PLATFORM_ALL = 10; const TYPE_PLATFORM_ALL = 10;
//平台分类券 //平台分类券
@ -56,8 +58,6 @@ class StoreCouponRepository extends BaseRepository
const TYPE_PLATFORM_STORE = 12; const TYPE_PLATFORM_STORE = 12;
//平台购物卡,可全额抵扣,可结余 //平台购物卡,可全额抵扣,可结余
const TYPE_PLATFORM_CARD = 13; const TYPE_PLATFORM_CARD = 13;
//平台抵扣券,按比例部分抵扣,可结余
const TYPE_PLATFORM_COUPON = 14;
//获取方式 //获取方式
const GET_COUPON_TYPE_RECEIVE = 0; const GET_COUPON_TYPE_RECEIVE = 0;
@ -231,8 +231,9 @@ class StoreCouponRepository extends BaseRepository
Elm::input('title', '优惠券名称:')->placeholder('请输入优惠卷名称')->required(), Elm::input('title', '优惠券名称:')->placeholder('请输入优惠卷名称')->required(),
Elm::radio('type', '优惠券类型:', 0) Elm::radio('type', '优惠券类型:', 0)
->setOptions([ ->setOptions([
['value' => 0, 'label' => '店铺券'], ['value' => self::TYPE_STORE_ALL, 'label' => '店铺券'],
['value' => 1, 'label' => '商品券'], ['value' => self::TYPE_STORE_PRODUCT, 'label' => '商品券'],
['value' => self::TYPE_STORE_COUPON, 'label' => '现金抵扣券'],
])->control([ ])->control([
[ [
'value' => 1, 'value' => 1,
@ -397,7 +398,6 @@ class StoreCouponRepository extends BaseRepository
['value' => self::TYPE_PLATFORM_CATE, 'label' => '品类券'], ['value' => self::TYPE_PLATFORM_CATE, 'label' => '品类券'],
['value' => self::TYPE_PLATFORM_STORE, 'label' => '跨店券'], ['value' => self::TYPE_PLATFORM_STORE, 'label' => '跨店券'],
['value' => self::TYPE_PLATFORM_CARD, 'label' => '购物卡'], ['value' => self::TYPE_PLATFORM_CARD, 'label' => '购物卡'],
['value' => self::TYPE_PLATFORM_COUPON, 'label' => '抵扣券'],
])->control([ ])->control([
[ [
'value' => self::TYPE_PLATFORM_CATE, 'value' => self::TYPE_PLATFORM_CATE,

View File

@ -243,7 +243,7 @@ class Coupon extends BaseController
} else unset($data['use_start_time']); } else unset($data['use_start_time']);
unset($data['range_date']); unset($data['range_date']);
if ($data['is_limited'] == 0) $data['total_count'] = 0; 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('请选择有效的优惠券类型'); throw new ValidateException('请选择有效的优惠券类型');
} }
$data['mer_id'] = $this->request->merId(); $data['mer_id'] = $this->request->merId();

View File

@ -125,7 +125,7 @@ class Coupon extends BaseController
} else unset($data['use_start_time']); } else unset($data['use_start_time']);
unset($data['range_date']); unset($data['range_date']);
if ($data['is_limited'] == 0) $data['total_count'] = 0; 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('请选择有效的优惠券类型'); throw new ValidateException('请选择有效的优惠券类型');
} }
return $data; return $data;

View File

@ -29,7 +29,7 @@ class StoreCouponValidate extends Validate
'use_start_time|有效期限' => 'requireIf:coupon_type,1|array|>:2', 'use_start_time|有效期限' => 'requireIf:coupon_type,1|array|>:2',
'sort|排序' => 'require|integer', 'sort|排序' => 'require|integer',
'status|状态' => 'require|in:0,1', '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', 'product_id|商品' => 'requireIf:type,1|array|>:0',
'send_type|类型' => 'require|in:0,1,2,3,4,5', 'send_type|类型' => 'require|in:0,1,2,3,4,5',
'full_reduction|满赠金额' => 'requireIf:send_type,1|float|>=:0', 'full_reduction|满赠金额' => 'requireIf:send_type,1|float|>=:0',