From bda792c89dc1db3e75974e384ad2dcd73f5feca1 Mon Sep 17 00:00:00 2001 From: Sam <315859133@qq.com> Date: Tue, 10 Feb 2026 00:41:35 +0800 Subject: [PATCH] feat(member): change MemberId to Guid strongly typed id - Convert MemberId from long to Guid strongly typed ID - Update all Member commands to use record pattern with MemberId - Update all Member endpoints to use record pattern with MemberId - Update entity configurations to use GuidVersion7ValueGenerator - Add implicit conversion operators for MemberId Migration: ChangeMemberIdToGuid --- apps/web-ele/src/api/fengling/index.ts | 1 + apps/web-ele/src/api/fengling/points-rule.ts | 53 ++ apps/web-ele/src/api/fengling/typings.ts | 86 +++ .../src/router/routes/modules/fengling.ts | 9 + .../src/views/fengling/points-rules/index.vue | 581 ++++++++++++++++++ 5 files changed, 730 insertions(+) create mode 100644 apps/web-ele/src/api/fengling/points-rule.ts create mode 100644 apps/web-ele/src/views/fengling/points-rules/index.vue diff --git a/apps/web-ele/src/api/fengling/index.ts b/apps/web-ele/src/api/fengling/index.ts index 890049a..2e4bfd9 100644 --- a/apps/web-ele/src/api/fengling/index.ts +++ b/apps/web-ele/src/api/fengling/index.ts @@ -1,5 +1,6 @@ export * from './log'; export * from './oauth'; +export * from './points-rule'; export * from './role'; export * from './tenant'; export * from './user'; diff --git a/apps/web-ele/src/api/fengling/points-rule.ts b/apps/web-ele/src/api/fengling/points-rule.ts new file mode 100644 index 0000000..b90cef6 --- /dev/null +++ b/apps/web-ele/src/api/fengling/points-rule.ts @@ -0,0 +1,53 @@ +import type { FenglingApi } from './typings'; + +import { requestClient } from '#/api/request'; + +export namespace PointsRuleApi { + const apiPrefix = '/api/v1/points-rules'; + + export async function getRulesList() { + return requestClient.get(apiPrefix); + } + + export async function getRuleById(id: string) { + return requestClient.get(`${apiPrefix}/${id}`); + } + + export async function createRule(data: FenglingApi.PointsRule.CreatePointsRuleRequest) { + return requestClient.post(apiPrefix, data); + } + + export async function updateRule(id: string, data: Partial) { + return requestClient.put>(`${apiPrefix}/${id}`, data); + } + + export async function deleteRule(id: string) { + return requestClient.delete(`${apiPrefix}/${id}`); + } + + export async function toggleRuleStatus(id: string, isActive: boolean) { + return requestClient.patch(`${apiPrefix}/${id}/status`, { isActive }); + } + + export async function calculatePoints(data: FenglingApi.PointsRule.CalculatePointsRequest) { + return requestClient.post(`${apiPrefix}/calculate`, data); + } + + export async function batchEnable(ids: string[]) { + return requestClient.post<{ success: number; failed: number }, { ids: string[] }>(`${apiPrefix}/batch/enable`, { ids }); + } + + export async function batchDisable(ids: string[]) { + return requestClient.post<{ success: number; failed: number }, { ids: string[] }>(`${apiPrefix}/batch/disable`, { ids }); + } + + export async function batchDelete(ids: string[]) { + return requestClient.post<{ success: number; failed: number }, { ids: string[] }>(`${apiPrefix}/batch/delete`, { ids }); + } + + export async function batchExport(ids: string[]) { + return requestClient.post(`${apiPrefix}/batch/export`, { ids }, { + responseType: 'blob', + }); + } +} diff --git a/apps/web-ele/src/api/fengling/typings.ts b/apps/web-ele/src/api/fengling/typings.ts index d70b961..9fcb26d 100644 --- a/apps/web-ele/src/api/fengling/typings.ts +++ b/apps/web-ele/src/api/fengling/typings.ts @@ -186,6 +186,92 @@ export namespace FenglingApi { } } + export namespace PointsRule { + export enum RuleType { + FixedValue = 1, + PriceWeighted = 2, + } + + export enum CalculationMode { + Synchronous = 1, + Asynchronous = 2, + } + + export enum DimensionType { + Product = 1, + Dealer = 2, + Distributor = 3, + Store = 4, + } + + export interface PointsRuleConditionDto { + id: string + ruleId: string + dimensionType: DimensionType + dimensionValue: string + operator?: string + } + + export interface PointsRuleDto { + id: string + name: string + code: string + ruleType: RuleType + basePoints: number + weightFactor?: number + validityDays: number + priority: number + calculationMode: CalculationMode + isActive: boolean + effectiveFrom: string + effectiveTo?: string + conditions: PointsRuleConditionDto[] + } + + export interface CreateConditionRequest { + dimensionType: DimensionType + dimensionValue: string + operator?: string + } + + export interface CreatePointsRuleRequest { + name: string + code: string + ruleType: RuleType + basePoints: number + weightFactor?: number + validityDays: number + priority: number + calculationMode: CalculationMode + conditions: CreateConditionRequest[] + } + + export interface CreatePointsRuleResponse { + id: string + name: string + code: string + } + + export interface PointsCalculationResultDto { + success: boolean + points: number + expireAt: string + appliedRuleId?: string + message?: string + matchedDimensions: string[] + } + + export interface CalculatePointsRequest { + productId: string + productName: string + productPrice?: string + dealerId: string + distributorId: string + storeId: string + codeId: string + } + } + export interface PaginatedResponse { items: T[] totalCount: number diff --git a/apps/web-ele/src/router/routes/modules/fengling.ts b/apps/web-ele/src/router/routes/modules/fengling.ts index c5fdfcc..7caecab 100644 --- a/apps/web-ele/src/router/routes/modules/fengling.ts +++ b/apps/web-ele/src/router/routes/modules/fengling.ts @@ -65,6 +65,15 @@ const routes: RouteRecordRaw[] = [ title: 'Logs', }, }, + { + name: 'PointsRules', + path: '/fengling/points-rules', + component: () => import('#/views/fengling/points-rules/index.vue'), + meta: { + icon: 'lucide:coins', + title: 'Points Rules', + }, + }, ], }, ]; diff --git a/apps/web-ele/src/views/fengling/points-rules/index.vue b/apps/web-ele/src/views/fengling/points-rules/index.vue new file mode 100644 index 0000000..bc7ffa3 --- /dev/null +++ b/apps/web-ele/src/views/fengling/points-rules/index.vue @@ -0,0 +1,581 @@ + + +