diff --git a/backend/crmeb/utils/FormBuilder.php b/backend/crmeb/utils/FormBuilder.php index a6e46723e..5dd10048a 100644 --- a/backend/crmeb/utils/FormBuilder.php +++ b/backend/crmeb/utils/FormBuilder.php @@ -95,26 +95,34 @@ class FormBuilder extends Form } /** - * 优惠券标签选择器(form-create 自定义组件) + * 优惠券标签选择器(form-create 自定义组件 · 契约组件) * * 前端 SchemaForm 已注册 type=SchemaCoupon 的自定义组件: * el-tag 标签展示已选优惠券(可删除),弹窗打开系统选择优惠券页回填 * (/admin/marketing.Coupon/list.html,弹窗页脚确定/取消触发回填)。 * 值为对象数组 [{id, title, coupon_price, use_min_price}], * 发券消费端(userFirstSubGiveCoupon)已兼容该格式。 + * ⚠️ 契约组件:改前端只能向后兼容扩展(新增可选 props、默认行为不变)。 + * 已支持 props: + * - receiveType:筛选发送方式(1 用户领取 / 3 系统赠送),默认 '' 不限; + * 新人礼等系统赠送场景应显式传 3。 * * @param string $field 字段名 * @param string $title 字段标题 * @param array $value 已选优惠券对象数组 + * @param array $props 组件 props 覆盖:receiveType 等 * @return \FormBuilder\Driver\CustomComponent */ - public static function couponSelect($field, $title, $value = []) + public static function couponSelect($field, $title, $value = [], array $props = []) { return self::createComponent('SchemaCoupon') ->field($field) ->title($title) ->value((array)$value) - ->props(['field' => $field]); + ->props(array_merge([ + 'field' => $field, + 'receiveType' => '', + ], $props)); } /** diff --git a/frontend/admin/src/components/SchemaPage/components/SchemaCoupon.vue b/frontend/admin/src/components/SchemaPage/components/SchemaCoupon.vue index 847d181ca..cd028a662 100644 --- a/frontend/admin/src/components/SchemaPage/components/SchemaCoupon.vue +++ b/frontend/admin/src/components/SchemaPage/components/SchemaCoupon.vue @@ -8,13 +8,23 @@ 选择优惠券 - + @@ -27,20 +37,30 @@ + + diff --git a/frontend/admin/src/components/couponSelect/index.vue b/frontend/admin/src/components/couponSelect/index.vue index c8dd90586..3ffd37e38 100644 --- a/frontend/admin/src/components/couponSelect/index.vue +++ b/frontend/admin/src/components/couponSelect/index.vue @@ -1,5 +1,5 @@ - + - - - + + + {{ scope.row.title }} - + 品类券 商品券 @@ -41,36 +41,37 @@ 通用券 - + {{ scope.row.coupon_price }}元 - + - {{ scope.row.use_min_price == '0.00' ? '无门槛' : `满${scope.row.use_min_price}元` }} + {{ scope.row.use_min_price == '0.00' ? '无门槛' : `满${scope.row.use_min_price}` }} - + 不限量 - - 发布:{{ scope.row.total_count }} - 剩余:{{ scope.row.remain_count }} - + {{ scope.row.total_count }}/{{ scope.row.remain_count }} - + - - {{ $filters.formatDate(scope.row.start_time) }} ~ {{ $filters.formatDate(scope.row.end_time) }} - + + {{ formatDay(scope.row.start_time) }}~{{ formatDay(scope.row.end_time) }} + 不限时 - + - {{ scope.row.use_time }} + + + {{ formatDay(scope.row.start_use_time) }}~{{ formatDay(scope.row.end_use_time) }} + + {{ Number(scope.row.coupon_time || 0) }}天 @@ -83,7 +84,8 @@ @pagination="getList" /> -