实体新增settlementPlan,调整order、settlement

This commit is contained in:
lxy 2025-07-15 15:12:17 +08:00
parent c4823623ce
commit 5fbbc377c4
3 changed files with 81 additions and 17 deletions

View File

@ -16,13 +16,14 @@ export interface Schema extends EntityShape {
price: Price;
paid: Price;
refunded: Price;
settled: Price;
settlePlanned: Price;
title: String<32>;
desc: Text;
timeoutAt?: Datetime;
creator: User;
entity: String<32>;
entityId: String<64>;
settled: Boolean;
allowPartialPay?: Boolean;
system: System;
address?: Address;
@ -50,7 +51,7 @@ export const IActionDef: ActionDef<IAction, IState> = {
};
export type Action = IAction | 'settle';
export type Action = IAction;
export const entityDesc: EntityDesc<Schema, Action, '', {
iState: IState,
@ -91,6 +92,8 @@ export const entityDesc: EntityDesc<Schema, Action, '', {
price: '订单金额',
paid: '已支付金额',
refunded: '已退款金额',
settled: '已结算金额',
settlePlanned: '已计划结算金额',
iState: '订单状态',
title: '订单标题',
desc: "订单描述",
@ -99,7 +102,6 @@ export const entityDesc: EntityDesc<Schema, Action, '', {
creator: '创建者',
entity: '关联对象',
entityId: '关联对象Id',
settled: '是否结算',
opers: '相关帐户操作',
system: '所属系统',
address: '收货地址',
@ -116,7 +118,6 @@ export const entityDesc: EntityDesc<Schema, Action, '', {
refundAll: '完全退款',
refundNone: '退款失败',
refundPartially: '部分退款',
settle: '结算',
},
v: {
iState: {
@ -145,7 +146,6 @@ export const entityDesc: EntityDesc<Schema, Action, '', {
refundAll: '',
refundNone: '',
refundPartially: '',
settle: '',
},
color: {

View File

@ -0,0 +1,66 @@
import {
Price,
Datetime,
} from 'oak-domain/lib/types/DataType';
import { EntityShape } from 'oak-domain/lib/types/Entity';
import { EntityDesc, ActionDef } from 'oak-domain/lib/types';
import { Schema as Order } from './Order';
export interface Schema extends EntityShape {
when?: Datetime;
order: Order;
price: Price;
};
type IState = 'unsettled' | 'settled' | 'closed';
type IAction = 'settle' | 'close';
export const IActionDef: ActionDef<IAction, IState> = {
stm: {
settle: ['unsettled', 'settled'],
close: ['unsettled', 'closed'],
},
is: 'unsettled',
};
type Action = IAction
export const entityDesc: EntityDesc<Schema, Action, '', {
iState: IState,
}> = {
locales: {
zh_CN: {
name: '结算计划',
attr: {
when: '结算时间',
order: '订单',
price: '结算金额',
iState: '结算计划状态',
},
action: {
settle: '结算',
close: '关闭',
},
v: {
iState: {
unsettled: '未结算',
settled: '已结算',
closed: '已关闭',
},
},
},
},
style: {
icon: {
settle: '',
close: '',
},
color: {
iState: {
unsettled: '#52BE80',
settled: '#2E86C1',
closed: '#8C949C'
},
}
},
}

View File

@ -1,34 +1,31 @@
import {
String,
Text,
Price,
Boolean,
Datetime,
} from 'oak-domain/lib/types/DataType';
import { EntityShape } from 'oak-domain/lib/types/Entity';
import { EntityDesc, ActionDef } from 'oak-domain/lib/types';
import { Schema as Account } from './Account';
import { Schema as Order } from './Order';
import { Schema as SettlePlan } from './SettlePlan';
import { Schema as AccountOper } from './AccountOper';
export interface Schema extends EntityShape {
account: Account;
plan: SettlePlan;
price: Price;
order: Order;
opers?: AccountOper[];
};
type IState = 'unsettled' | 'settled';
type IAction = 'settle';
type IState = 'unsettled' | 'settled' | 'closed';
type IAction = 'settle' | 'close';
export const IActionDef: ActionDef<IAction, IState> = {
stm: {
settle: ['unsettled', 'settled'],
close: ['unsettled', 'closed'],
},
is: 'unsettled',
};
type Action = IAction | 'preSettle' | 'refund' | 'refundFailure';
type Action = IAction | 'refund' | 'refundFailure';
export const entityDesc: EntityDesc<Schema, Action, '', {
iState: IState,
@ -38,14 +35,14 @@ export const entityDesc: EntityDesc<Schema, Action, '', {
name: '结算明细',
attr: {
account: '帐号',
plan: '结算计划',
price: '变化金额',
order: '订单',
iState: '结算状态',
opers: '相关帐户操作',
},
action: {
preSettle: '预结算',
settle: '结算',
close: '关闭',
refund: '退款',
refundFailure: '退款失败',
},
@ -53,9 +50,9 @@ export const entityDesc: EntityDesc<Schema, Action, '', {
iState: {
unsettled: '未结算',
settled: '已结算',
closed: '已关闭',
},
},
},
},
style: {
@ -68,6 +65,7 @@ export const entityDesc: EntityDesc<Schema, Action, '', {
iState: {
unsettled: '#52BE80',
settled: '#2E86C1',
closed: '#8C949C'
},
}
},