feat: 新增商城模块,新增会员中心的会员详情的订单管理,售后管理,收藏记录,优惠券,推广用户的展示

This commit is contained in:
吃货
2025-07-06 08:49:22 +08:00
parent 280e79c55f
commit 4cc5d8bf92
115 changed files with 14819 additions and 206 deletions

View File

@@ -0,0 +1,65 @@
import type { MallCouponTemplateApi } from '#/api/mall/promotion/coupon/couponTemplate';
import { floatToFixed2, formatDate } from '@vben/utils';
import {
CouponTemplateValidityTypeEnum,
PromotionDiscountTypeEnum,
} from '#/utils';
// 格式化【优惠金额/折扣】
export function discountFormat(row: MallCouponTemplateApi.CouponTemplate) {
if (row.discountType === PromotionDiscountTypeEnum.PRICE.type) {
return `¥${floatToFixed2(row.discountPrice)}`;
}
if (row.discountType === PromotionDiscountTypeEnum.PERCENT.type) {
return `${row.discountPercent}%`;
}
return `未知【${row.discountType}`;
}
// 格式化【领取上限】
export function takeLimitCountFormat(
row: MallCouponTemplateApi.CouponTemplate,
) {
if (row.takeLimitCount) {
if (row.takeLimitCount === -1) {
return '无领取限制';
}
return `${row.takeLimitCount} 张/人`;
} else {
return ' ';
}
}
// 格式化【有效期限】
export function validityTypeFormat(row: MallCouponTemplateApi.CouponTemplate) {
if (row.validityType === CouponTemplateValidityTypeEnum.DATE.type) {
return `${formatDate(row.validStartTime)}${formatDate(row.validEndTime)}`;
}
if (row.validityType === CouponTemplateValidityTypeEnum.TERM.type) {
return `领取后第 ${row.fixedStartTerm} - ${row.fixedEndTerm} 天内可用`;
}
return `未知【${row.validityType}`;
}
// 格式化【totalCount】
export function totalCountFormat(row: MallCouponTemplateApi.CouponTemplate) {
if (row.totalCount === -1) {
return '不限制';
}
return row.totalCount;
}
// 格式化【剩余数量】
export function remainedCountFormat(row: MallCouponTemplateApi.CouponTemplate) {
if (row.totalCount === -1) {
return '不限制';
}
return row.totalCount - row.takeCount;
}
// 格式化【最低消费】
export function usePriceFormat(row: MallCouponTemplateApi.CouponTemplate) {
return `¥${floatToFixed2(row.usePrice)}`;
}