feat: diy editor property

This commit is contained in:
xingyu4j
2025-11-05 15:24:20 +08:00
parent 15835352cc
commit 326e88762c
3 changed files with 33 additions and 26 deletions

View File

@@ -23,7 +23,7 @@ export const CouponDiscountDesc = defineComponent({
const discountDesc = const discountDesc =
coupon.discountType === PromotionDiscountTypeEnum.PRICE.type coupon.discountType === PromotionDiscountTypeEnum.PRICE.type
? `${floatToFixed2(coupon.discountPrice)}` ? `${floatToFixed2(coupon.discountPrice)}`
: `${coupon.discountPercent ?? 0 / 10}`; : `${(coupon.discountPercent ?? 0) / 10}`;
return () => ( return () => (
<div> <div>
<span>{useCondition}</span> <span>{useCondition}</span>

View File

@@ -17,7 +17,7 @@ export const CouponDiscount = defineComponent({
setup(props) { setup(props) {
const coupon = props.coupon as MallCouponTemplateApi.CouponTemplate; const coupon = props.coupon as MallCouponTemplateApi.CouponTemplate;
// 折扣 // 折扣
let value = `${coupon.discountPercent ?? 0 / 10}`; let value = `${(coupon.discountPercent ?? 0) / 10}`;
let suffix = ' 折'; let suffix = ' 折';
// 满减 // 满减
if (coupon.discountType === PromotionDiscountTypeEnum.PRICE.type) { if (coupon.discountType === PromotionDiscountTypeEnum.PRICE.type) {

View File

@@ -40,8 +40,6 @@ const props = defineProps<{ modelValue: CouponCardProperty }>();
const emit = defineEmits(['update:modelValue']); const emit = defineEmits(['update:modelValue']);
const { Text: ATypographyText } = Typography;
const formData = useVModel(props, 'modelValue', emit); const formData = useVModel(props, 'modelValue', emit);
const couponList = ref<MallCouponTemplateApi.CouponTemplate[]>([]); // 已选择的优惠券列表 const couponList = ref<MallCouponTemplateApi.CouponTemplate[]>([]); // 已选择的优惠券列表
@@ -90,22 +88,24 @@ watch(
:key="index" :key="index"
class="flex items-center justify-between" class="flex items-center justify-between"
> >
<ATypographyText ellipsis class="text-base"> <Typography>
{{ coupon.name }} <Typography.Title :level="5">
</ATypographyText> {{ coupon.name }}
<ATypographyText type="secondary" ellipsis> </Typography.Title>
<span v-if="coupon.usePrice > 0"> <Typography.Text type="secondary">
{{ floatToFixed2(coupon.usePrice) }} <span v-if="coupon.usePrice > 0">
</span> {{ floatToFixed2(coupon.usePrice) }}
<span </span>
v-if=" <span
coupon.discountType === PromotionDiscountTypeEnum.PRICE.type v-if="
" coupon.discountType === PromotionDiscountTypeEnum.PRICE.type
> "
减{{ floatToFixed2(coupon.discountPrice) }}元 >
</span> 减{{ floatToFixed2(coupon.discountPrice) }}元
<span v-else> 打{{ coupon.discountPercent }}折 </span> </span>
</ATypographyText> <span v-else> 打{{ (coupon.discountPercent ?? 0) / 10 }}折 </span>
</Typography.Text>
</Typography>
</div> </div>
<FormItem> <FormItem>
<Button <Button
@@ -114,9 +114,7 @@ watch(
ghost ghost
class="mt-2 w-full" class="mt-2 w-full"
> >
<template #icon> <IconifyIcon icon="lucide:plus" />
<IconifyIcon icon="ep:plus" />
</template>
添加 添加
</Button> </Button>
</FormItem> </FormItem>
@@ -126,17 +124,26 @@ watch(
<RadioGroup v-model:value="formData.columns"> <RadioGroup v-model:value="formData.columns">
<Tooltip title="一列" placement="bottom"> <Tooltip title="一列" placement="bottom">
<RadioButton :value="1"> <RadioButton :value="1">
<IconifyIcon icon="fluent:text-column-one-24-filled" /> <IconifyIcon
icon="fluent:text-column-one-24-filled"
class="size-6"
/>
</RadioButton> </RadioButton>
</Tooltip> </Tooltip>
<Tooltip title="二列" placement="bottom"> <Tooltip title="二列" placement="bottom">
<RadioButton :value="2"> <RadioButton :value="2">
<IconifyIcon icon="fluent:text-column-two-24-filled" /> <IconifyIcon
icon="fluent:text-column-two-24-filled"
class="size-6"
/>
</RadioButton> </RadioButton>
</Tooltip> </Tooltip>
<Tooltip title="三列" placement="bottom"> <Tooltip title="三列" placement="bottom">
<RadioButton :value="3"> <RadioButton :value="3">
<IconifyIcon icon="fluent:text-column-three-24-filled" /> <IconifyIcon
icon="fluent:text-column-three-24-filled"
class="size-6"
/>
</RadioButton> </RadioButton>
</Tooltip> </Tooltip>
</RadioGroup> </RadioGroup>