调整了order和pay中的部分属性

This commit is contained in:
Xu Chang 2025-02-17 16:47:12 +08:00
parent e2be5c11fc
commit acb6746733
38 changed files with 457 additions and 88 deletions

View File

@ -21,7 +21,7 @@ declare const List: <T extends keyof EntityDict>(props: ReactComponentProps<Enti
rowSelection?: any;
hideHeader?: boolean | undefined;
disableSerialNumber?: boolean | undefined;
size?: "large" | "middle" | "small" | undefined;
size?: "small" | "middle" | "large" | undefined;
scroll?: any;
empty?: React.ReactNode;
opWidth?: number | undefined;
@ -43,7 +43,7 @@ declare const ListPro: <T extends keyof EntityDict>(props: {
tablePagination?: any;
rowSelection?: any;
disableSerialNumber?: boolean | undefined;
size?: "large" | "middle" | "small" | undefined;
size?: "small" | "middle" | "large" | undefined;
scroll?: any;
empty?: any;
opWidth?: number | undefined;

View File

@ -138,7 +138,7 @@ export default OakComponent({
}
const startPayable = iState === 'paying' && !['account', 'offlineAccount'].includes(data.entity) && (PayRoutineDict[data.entity] && PayRoutineDict[data.entity].judgeCanPay(data, this.features));
const { mode } = this.props;
const succeedable = data["#oakLegalActions"].includes('succeedPaying');
const succeedable = data["#oakLegalActions"]?.includes('succeedPaying');
const payChannels = this.features.pay.getPayChannels();
const offlines = this.features.cache.get('offlineAccount', {
data: {

View File

@ -134,9 +134,8 @@ function RenderPayMeta(props) {
case 'offlineAccount': {
if (offline && offlines) {
return (<>
{iState === 'paying' && (mode === 'frontend'
? <Alert type='info' message={t('code.help.frontend')}/>
: <Alert type='info' message={t('code.help.backend')}/>)}
{iState === 'paying' && mode === 'frontend' ? <Alert type='info' message={t('code.help.frontend')}/> : null}
{['unpaid', 'paying'].includes(iState) && mode === 'backend' ? <Alert type='info' message={t('code.help.backend')}/> : null}
<RenderOffline t={t} pay={pay} mode={mode} offline={offline} offlines={offlines} updateOfflineId={updateOfflineId} updateExternalId={updateExternalId}/>
</>);
}

View File

@ -136,9 +136,8 @@ function RenderPayMeta(props) {
case 'offlineAccount': {
if (offline && offlines) {
return (<>
{iState === 'paying' && (mode === 'frontend'
? <Alert type='info' message={t('code.help.frontend')}/>
: <Alert type='info' message={t('code.help.backend')}/>)}
{iState === 'paying' && mode === 'frontend' ? <Alert type='info' message={t('code.help.frontend')}/> : null}
{['unpaid', 'paying'].includes(iState) && mode === 'backend' ? <Alert type='info' message={t('code.help.backend')}/> : null}
<RenderOffline t={t} pay={pay} mode={mode} offline={offline} offlines={offlines} updateOfflineId={updateOfflineId} updateExternalId={updateExternalId}/>
</>);
}
@ -159,7 +158,19 @@ export default function Render(props) {
if (pay) {
const { iState, price, entity } = pay;
const BtnPart2 = [];
if (startPayable) {
if (succeedable) {
BtnPart2.push(<Button type="primary" onClick={() => {
if (autoSuccessAt) {
succeed(Date.now());
}
else {
setShowSa(true);
}
}}>
{t('pay:action.succeedPaying')}
</Button>);
}
else if (startPayable) {
BtnPart2.push(<Button style={{ backgroundColor: '#04BE02' }} className={Styles.btnWechatPay} onClick={() => startPay()}>
{t('pay')}
</Button>);
@ -171,43 +182,32 @@ export default function Render(props) {
{t('common::reset')}
</Button>);
}
else {
if (closable) {
BtnPart2.push(<Button danger onClick={() => {
Modal.confirm({
title: t('cc.title'),
content: t('cc.content'),
onOk: async () => {
await execute('close');
onClose();
},
okText: t('common::confirm'),
cancelText: t('common::action.cancel'),
});
}}>
{t('pay:action.close')}
</Button>);
}
if (goBackable) {
BtnPart2.push(<Button type="link" onClick={goBack}>
{t('common::back')}
</Button>);
}
if (closable) {
BtnPart2.push(<Button danger onClick={() => {
Modal.confirm({
title: t('cc.title'),
content: t('cc.content'),
onOk: async () => {
await execute('close');
onClose();
},
okText: t('common::confirm'),
cancelText: t('common::action.cancel'),
});
}}>
{t('pay:action.close')}
</Button>);
}
if (goBackable) {
BtnPart2.push(<Button type="link" onClick={goBack}>
{t('common::back')}
</Button>);
}
return (<>
<Card className={Styles.card} title={t('title')} extra={<Space>
{succeedable ? <Button type="primary" onClick={() => {
if (autoSuccessAt) {
succeed(Date.now());
}
else {
setShowSa(true);
}
}}>
{t('pay:action.succeedPaying')}
</Button> : <Tag color={iStateColor}>
{t(`pay:v.iState.${iState}`)}
</Tag>}
<Tag color={iStateColor}>
{t(`pay:v.iState.${iState}`)}
</Tag>
</Space>}>
<div className={Styles.container}>
<div className={Styles.detail}>

View File

@ -2,10 +2,12 @@ import { String, Text, Price, Boolean, Datetime } from 'oak-domain/lib/types/Dat
import { EntityShape } from 'oak-domain/lib/types/Entity';
import { EntityDesc, ActionDef } from 'oak-domain/lib/types';
import { Schema as User } from 'oak-general-business/lib/entities/User';
import { Schema as Address } from 'oak-general-business/lib/entities/Address';
import { Schema as AccountOper } from './AccountOper';
import { Schema as System } from './System';
export interface Schema extends EntityShape {
price: Price;
receivingMethod: 'express' | 'pickup';
paid: Price;
refunded: Price;
title: String<32>;
@ -17,12 +19,20 @@ export interface Schema extends EntityShape {
settled: Boolean;
allowPartialPay?: Boolean;
system: System;
address?: Address;
payAt?: Datetime;
shipAt?: Datetime;
opers: AccountOper[];
}
export type IAction = 'startPaying' | 'payAll' | 'payPartially' | 'payNone' | 'timeout' | 'cancel' | 'startRefunding' | 'refundAll' | 'refundPartially' | 'refundNone';
export type IState = 'unpaid' | 'timeout' | 'cancelled' | 'paying' | 'partiallyPaid' | 'paid' | 'refunding' | 'partiallyRefunded' | 'refunded';
export declare const IActionDef: ActionDef<IAction, IState>;
export type Action = IAction | 'settle';
export type GState = 'staging' | 'shipped' | 'unshipped' | 'received' | 'taken';
export type GAction = 'send' | 'receive' | 'store' | 'take' | 'turnBack' | 'unship';
export declare const GActionDef: ActionDef<GAction, GState>;
export type Action = IAction | GAction | 'settle';
export declare const entityDesc: EntityDesc<Schema, Action, '', {
iState: IState;
gState: GState;
receivingMethod: Schema['receivingMethod'];
}>;

View File

@ -14,6 +14,17 @@ export const IActionDef = {
},
is: 'unpaid',
};
export const GActionDef = {
stm: {
send: ['unshipped', 'shipped'],
receive: ['shipped', 'received'],
store: [['unshipped', 'shipped'], 'staging'],
unship: [['shipped', 'staging'], 'unshipped'],
turnBack: ['shipped', 'unshipped'],
take: [['staging'], 'taken'],
},
is: 'unshipped',
};
export const entityDesc = {
indexes: [
//索引
@ -52,16 +63,21 @@ export const entityDesc = {
paid: '已支付金额',
refunded: '已退款金额',
iState: '订单状态',
gState: '物流状态',
title: '订单标题',
desc: "订单描述",
timeoutAt: '过期时间',
allowPartialPay: '允许部分支付',
receivingMethod: '配送方式',
creator: '创建者',
entity: '关联对象',
entityId: '关联对象Id',
settled: '是否结算',
opers: '相关帐户操作',
system: '所属系统'
system: '所属系统',
address: '收货地址',
payAt: '付款时间',
shipAt: '发货时间',
},
action: {
startPaying: '开始支付',
@ -74,7 +90,13 @@ export const entityDesc = {
refundAll: '完全退款',
refundNone: '退款失败',
refundPartially: '部分退款',
send: '发货',
store: '暂存',
take: '取货',
receive: '收货',
settle: '结算',
turnBack: '退还',
unship: '入库'
},
v: {
iState: {
@ -88,6 +110,17 @@ export const entityDesc = {
partiallyRefunded: '已部分退款',
refunding: '退款中',
},
gState: {
unshipped: '未发货',
shipped: '已发货',
received: '已收货',
staging: '寄存中',
taken: '已取货',
},
receivingMethod: {
express: '配送',
pickup: '自提',
}
}
},
},
@ -116,6 +149,17 @@ export const entityDesc = {
partiallyRefunded: '#EDBB99',
refunding: '#FBEEE6'
},
gState: {
unshipped: '#AF601A',
shipped: '#2874A6',
received: '#1E8449',
staging: '#283747',
taken: '#117A65',
},
receivingMethod: {
express: '#5DADE2',
pickup: '#2ECC71',
}
}
}
};

View File

@ -34,8 +34,8 @@ export interface Schema extends EntityShape {
opers: AccountOper[];
autoStart?: Boolean;
}
type IAction = 'startPaying' | 'succeedPaying' | 'close' | 'startRefunding' | 'refundAll' | 'refundPartially' | 'stopRefunding';
type IState = 'unpaid' | 'paying' | 'paid' | 'closed' | 'refunding' | 'partiallyRefunded' | 'refunded';
export type IAction = 'startPaying' | 'succeedPaying' | 'close' | 'startRefunding' | 'refundAll' | 'refundPartially' | 'stopRefunding';
export type IState = 'unpaid' | 'paying' | 'paid' | 'closed' | 'refunding' | 'partiallyRefunded' | 'refunded';
export declare const IActionDef: ActionDef<IAction, IState>;
type Action = IAction | 'closeRefund' | 'continuePaying';
export declare const entityDesc: EntityDesc<Schema, Action, '', {

View File

@ -53,6 +53,7 @@ export declare const actionDefDict: {
offlineAccount: {};
order: {
iState: import("oak-domain/lib/types").ActionDef<string, string>;
gState: import("oak-domain/lib/types").ActionDef<string, string>;
};
pay: {
iState: import("oak-domain/lib/types").ActionDef<string, string>;

View File

@ -85,7 +85,7 @@ export type OpSchema = EntityShape & {
style?: Style | null;
dangerousVersions: Versions;
warningVersions: Versions;
soaVersion: String<12>;
soaVersion: String<32>;
domainId?: ForeignKey<"domain"> | null;
} & {
[A in ExpressionKey]?: any;

View File

@ -1128,14 +1128,22 @@ export type Address = {
Schema: BaseAddress.OpSchema & {
area: Area["Schema"];
user?: User["Schema"];
order$address?: Array<Omit<Order["Schema"], "address">>;
ship$to?: Array<Omit<Ship["Schema"], "to">>;
ship$from?: Array<Omit<Ship["Schema"], "from">>;
order$address$$aggr?: AggregationResult<Omit<Order["Schema"], "address">>;
ship$to$$aggr?: AggregationResult<Omit<Ship["Schema"], "to">>;
ship$from$$aggr?: AggregationResult<Omit<Ship["Schema"], "from">>;
};
Projection: BaseAddress.OpProjection & {
area?: Area["Projection"];
user?: User["Projection"];
order$address?: OakSelection<"select", Omit<Order["Projection"], "address">, Omit<Order["Filter"], "address">, Order["Sorter"]> & {
$entity: "order";
};
order$address$$aggr?: DeduceAggregation<Omit<Order["Projection"], "address">, Omit<Order["Filter"], "address">, Order["Sorter"]> & {
$entity: "order";
};
ship$to?: OakSelection<"select", Omit<Ship["Projection"], "address">, Omit<Ship["Filter"], "address">, Ship["Sorter"]> & {
$entity: "ship";
};
@ -1152,6 +1160,7 @@ export type Address = {
FilterUnit: BaseAddress.OpFilter & {
area: MakeFilter<Area["FilterUnit"]>;
user: MakeFilter<User["FilterUnit"]>;
order$address: MakeFilter<Omit<Order["FilterUnit"], "address">> & SubQueryPredicateMetadata;
ship$to: MakeFilter<Omit<Ship["FilterUnit"], "to">> & SubQueryPredicateMetadata;
ship$from: MakeFilter<Omit<Ship["FilterUnit"], "from">> & SubQueryPredicateMetadata;
};
@ -1169,6 +1178,7 @@ export type Address = {
Aggregation: DeduceAggregation<Address["Projection"], Address["Filter"], Address["Sorter"]>;
CreateOperationData: FormCreateData<BaseAddress.OpSchema & {
user?: OakOperation<"create", User["CreateOperationData"]> | OakOperation<BaseUser.OpUpdateAction, User["UpdateOperationData"], User["Filter"]>;
order$address?: (OakOperation<"create", Omit<Order["CreateOperationData"], "address"> | Omit<Order["CreateOperationData"], "address">[]> | OakOperation<BaseOrder.OpUpdateAction, Omit<Order["UpdateOperationData"], "address">, Order["Filter"]>)[];
ship$to?: (OakOperation<"create", Omit<Ship["CreateOperationData"], "to"> | Omit<Ship["CreateOperationData"], "to">[]> | OakOperation<BaseShip.OpUpdateAction, Omit<Ship["UpdateOperationData"], "to">, Ship["Filter"]>)[];
ship$from?: (OakOperation<"create", Omit<Ship["CreateOperationData"], "from"> | Omit<Ship["CreateOperationData"], "from">[]> | OakOperation<BaseShip.OpUpdateAction, Omit<Ship["UpdateOperationData"], "from">, Ship["Filter"]>)[];
}>;
@ -1177,6 +1187,7 @@ export type Address = {
Create: Address["CreateSingle"] | Address["CreateMulti"];
UpdateOperationData: FormUpdateData<BaseAddress.OpSchema & {
user?: OakOperation<"create", User["CreateOperationData"]> | OakOperation<BaseUser.OpUpdateAction, User["UpdateOperationData"], User["Filter"]> | OakOperation<"remove", User["RemoveOperationData"], User["Filter"]>;
order$address?: (OakOperation<"create", Omit<Order["CreateOperationData"], "address"> | Omit<Order["CreateOperationData"], "address">[]> | OakOperation<BaseOrder.OpUpdateAction, Omit<Order["UpdateOperationData"], "address">, Order["Filter"]> | OakOperation<"remove", Order["RemoveOperationData"], Order["Filter"]>)[];
ship$to?: (OakOperation<"create", Omit<Ship["CreateOperationData"], "to"> | Omit<Ship["CreateOperationData"], "to">[]> | OakOperation<BaseShip.OpUpdateAction, Omit<Ship["UpdateOperationData"], "to">, Ship["Filter"]> | OakOperation<"remove", Ship["RemoveOperationData"], Ship["Filter"]>)[];
ship$from?: (OakOperation<"create", Omit<Ship["CreateOperationData"], "from"> | Omit<Ship["CreateOperationData"], "from">[]> | OakOperation<BaseShip.OpUpdateAction, Omit<Ship["UpdateOperationData"], "from">, Ship["Filter"]> | OakOperation<"remove", Ship["RemoveOperationData"], Ship["Filter"]>)[];
}>;
@ -4022,6 +4033,7 @@ export type Order = {
Schema: BaseOrder.OpSchema & {
creator: User["Schema"];
system: System["Schema"];
address?: Address["Schema"];
pay$order?: Array<Omit<Pay["Schema"], "order">>;
settlement$order?: Array<Omit<Settlement["Schema"], "order">>;
shipOrder$order?: Array<Omit<ShipOrder["Schema"], "order">>;
@ -4034,6 +4046,7 @@ export type Order = {
Projection: BaseOrder.OpProjection & {
creator?: User["Projection"];
system?: System["Projection"];
address?: Address["Projection"];
pay$order?: OakSelection<"select", Omit<Pay["Projection"], "order">, Omit<Pay["Filter"], "order">, Pay["Sorter"]> & {
$entity: "pay";
};
@ -4062,6 +4075,7 @@ export type Order = {
FilterUnit: BaseOrder.OpFilter & {
creator: MakeFilter<User["FilterUnit"]>;
system: MakeFilter<System["FilterUnit"]>;
address: MakeFilter<Address["FilterUnit"]>;
pay$order: MakeFilter<Omit<Pay["FilterUnit"], "order">> & SubQueryPredicateMetadata;
settlement$order: MakeFilter<Omit<Settlement["FilterUnit"], "order">> & SubQueryPredicateMetadata;
shipOrder$order: MakeFilter<Omit<ShipOrder["FilterUnit"], "order">> & SubQueryPredicateMetadata;
@ -4071,6 +4085,7 @@ export type Order = {
SortAttr: Partial<BaseOrder.OpSortAttr | {
creator: User["SortAttr"];
system: System["SortAttr"];
address: Address["SortAttr"];
}>;
SortNode: {
$attr: Order["SortAttr"];
@ -4082,6 +4097,7 @@ export type Order = {
CreateOperationData: FormCreateData<BaseOrder.OpSchema & {
creator?: OakOperation<"create", User["CreateOperationData"]> | OakOperation<BaseUser.OpUpdateAction, User["UpdateOperationData"], User["Filter"]>;
system?: OakOperation<"create", System["CreateOperationData"]> | OakOperation<BaseSystem.OpUpdateAction, System["UpdateOperationData"], System["Filter"]>;
address?: OakOperation<"create", Address["CreateOperationData"]> | OakOperation<BaseAddress.OpUpdateAction, Address["UpdateOperationData"], Address["Filter"]>;
pay$order?: (OakOperation<"create", Omit<Pay["CreateOperationData"], "order"> | Omit<Pay["CreateOperationData"], "order">[]> | OakOperation<BasePay.OpUpdateAction, Omit<Pay["UpdateOperationData"], "order">, Pay["Filter"]>)[];
settlement$order?: (OakOperation<"create", Omit<Settlement["CreateOperationData"], "order"> | Omit<Settlement["CreateOperationData"], "order">[]> | OakOperation<BaseSettlement.OpUpdateAction, Omit<Settlement["UpdateOperationData"], "order">, Settlement["Filter"]>)[];
shipOrder$order?: (OakOperation<"create", Omit<ShipOrder["CreateOperationData"], "order"> | Omit<ShipOrder["CreateOperationData"], "order">[]> | OakOperation<BaseShipOrder.OpUpdateAction, Omit<ShipOrder["UpdateOperationData"], "order">, ShipOrder["Filter"]>)[];
@ -4093,6 +4109,7 @@ export type Order = {
UpdateOperationData: FormUpdateData<BaseOrder.OpSchema & {
creator?: OakOperation<"create", User["CreateOperationData"]> | OakOperation<BaseUser.OpUpdateAction, User["UpdateOperationData"], User["Filter"]> | OakOperation<"remove", User["RemoveOperationData"], User["Filter"]>;
system?: OakOperation<"create", System["CreateOperationData"]> | OakOperation<BaseSystem.OpUpdateAction, System["UpdateOperationData"], System["Filter"]> | OakOperation<"remove", System["RemoveOperationData"], System["Filter"]>;
address?: OakOperation<"create", Address["CreateOperationData"]> | OakOperation<BaseAddress.OpUpdateAction, Address["UpdateOperationData"], Address["Filter"]> | OakOperation<"remove", Address["RemoveOperationData"], Address["Filter"]>;
pay$order?: (OakOperation<"create", Omit<Pay["CreateOperationData"], "order"> | Omit<Pay["CreateOperationData"], "order">[]> | OakOperation<BasePay.OpUpdateAction, Omit<Pay["UpdateOperationData"], "order">, Pay["Filter"]> | OakOperation<"remove", Pay["RemoveOperationData"], Pay["Filter"]>)[];
settlement$order?: (OakOperation<"create", Omit<Settlement["CreateOperationData"], "order"> | Omit<Settlement["CreateOperationData"], "order">[]> | OakOperation<BaseSettlement.OpUpdateAction, Omit<Settlement["UpdateOperationData"], "order">, Settlement["Filter"]> | OakOperation<"remove", Settlement["RemoveOperationData"], Settlement["Filter"]>)[];
shipOrder$order?: (OakOperation<"create", Omit<ShipOrder["CreateOperationData"], "order"> | Omit<ShipOrder["CreateOperationData"], "order">[]> | OakOperation<BaseShipOrder.OpUpdateAction, Omit<ShipOrder["UpdateOperationData"], "order">, ShipOrder["Filter"]> | OakOperation<"remove", ShipOrder["RemoveOperationData"], ShipOrder["Filter"]>)[];

View File

@ -3,9 +3,13 @@ import { GenericAction } from "oak-domain/lib/actions/action";
export type IAction = 'startPaying' | 'payAll' | 'payPartially' | 'payNone' | 'timeout' | 'cancel' | 'startRefunding' | 'refundAll' | 'refundPartially' | 'refundNone' | string;
export type IState = 'unpaid' | 'timeout' | 'cancelled' | 'paying' | 'partiallyPaid' | 'paid' | 'refunding' | 'partiallyRefunded' | 'refunded' | string;
export declare const IActionDef: ActionDef<IAction, IState>;
export type ParticularAction = IAction | 'settle';
export type GState = 'staging' | 'shipped' | 'unshipped' | 'received' | 'taken' | string;
export type GAction = 'send' | 'receive' | 'store' | 'take' | 'turnBack' | 'unship' | string;
export declare const GActionDef: ActionDef<GAction, GState>;
export type ParticularAction = IAction | GAction | 'settle';
export declare const actions: string[];
export type Action = GenericAction | ParticularAction | string;
export declare const actionDefDict: {
iState: ActionDef<string, string>;
gState: ActionDef<string, string>;
};

View File

@ -13,7 +13,19 @@ export const IActionDef = {
},
is: 'unpaid',
};
export const actions = ["count", "stat", "download", "select", "aggregate", "create", "remove", "update", "startPaying", "payAll", "payPartially", "payNone", "timeout", "cancel", "startRefunding", "refundAll", "refundPartially", "refundNone", "settle"];
export const actionDefDict = {
iState: IActionDef
export const GActionDef = {
stm: {
send: ['unshipped', 'shipped'],
receive: ['shipped', 'received'],
store: [['unshipped', 'shipped'], 'staging'],
unship: [['shipped', 'staging'], 'unshipped'],
turnBack: ['shipped', 'unshipped'],
take: [['staging'], 'taken'],
},
is: 'unshipped',
};
export const actions = ["count", "stat", "download", "select", "aggregate", "create", "remove", "update", "startPaying", "payAll", "payPartially", "payNone", "timeout", "cancel", "startRefunding", "refundAll", "refundPartially", "refundNone", "send", "receive", "store", "take", "turnBack", "unship", "settle"];
export const actionDefDict = {
iState: IActionDef,
gState: GActionDef
};

View File

@ -5,6 +5,11 @@ export const desc = {
notNull: true,
type: "money"
},
receivingMethod: {
notNull: true,
type: "enum",
enumeration: ["express", "pickup"]
},
paid: {
notNull: true,
type: "money"
@ -58,9 +63,23 @@ export const desc = {
type: "ref",
ref: "system"
},
addressId: {
type: "ref",
ref: "address"
},
payAt: {
type: "datetime"
},
shipAt: {
type: "datetime"
},
iState: {
type: "enum",
enumeration: ["unpaid", "timeout", "cancelled", "paying", "partiallyPaid", "paid", "refunding", "partiallyRefunded", "refunded"]
},
gState: {
type: "enum",
enumeration: ["staging", "shipped", "unshipped", "received", "taken"]
}
},
actionType: "crud",

View File

@ -23,5 +23,16 @@ export const style = {
partiallyRefunded: '#EDBB99',
refunding: '#FBEEE6'
},
gState: {
unshipped: '#AF601A',
shipped: '#2874A6',
received: '#1E8449',
staging: '#283747',
taken: '#117A65',
},
receivingMethod: {
express: '#5DADE2',
pickup: '#2ECC71',
}
}
};

View File

@ -1,10 +1,11 @@
import { ForeignKey } from "oak-domain/lib/types/DataType";
import { Q_DateValue, Q_BooleanValue, Q_NumberValue, Q_StringValue, Q_EnumValue, NodeId, ExprOp, ExpressionKey } from "oak-domain/lib/types/Demand";
import { MakeAction as OakMakeAction, EntityShape } from "oak-domain/lib/types/Entity";
import { Action, ParticularAction, IState } from "./Action";
import { Action, ParticularAction, IState, GState } from "./Action";
import { Price, String, Text, Datetime, Boolean } from "oak-domain/lib/types/DataType";
export type OpSchema = EntityShape & {
price: Price;
receivingMethod: "express" | "pickup";
paid: Price;
refunded: Price;
title: String<32>;
@ -16,7 +17,11 @@ export type OpSchema = EntityShape & {
settled: Boolean;
allowPartialPay?: Boolean | null;
systemId: ForeignKey<"system">;
addressId?: ForeignKey<"address"> | null;
payAt?: Datetime | null;
shipAt?: Datetime | null;
iState?: IState | null;
gState?: GState | null;
} & {
[A in ExpressionKey]?: any;
};
@ -27,6 +32,7 @@ export type OpFilter = {
$$seq$$: Q_NumberValue;
$$updateAt$$: Q_DateValue;
price: Q_NumberValue;
receivingMethod: Q_EnumValue<"express" | "pickup">;
paid: Q_NumberValue;
refunded: Q_NumberValue;
title: Q_StringValue;
@ -38,7 +44,11 @@ export type OpFilter = {
settled: Q_BooleanValue;
allowPartialPay: Q_BooleanValue;
systemId: Q_StringValue;
addressId: Q_StringValue;
payAt: Q_DateValue;
shipAt: Q_DateValue;
iState: Q_EnumValue<IState>;
gState: Q_EnumValue<GState>;
} & ExprOp<OpAttr | string>;
export type OpProjection = {
"#id"?: NodeId;
@ -48,6 +58,7 @@ export type OpProjection = {
$$updateAt$$?: number;
$$seq$$?: number;
price?: number;
receivingMethod?: number;
paid?: number;
refunded?: number;
title?: number;
@ -59,7 +70,11 @@ export type OpProjection = {
settled?: number;
allowPartialPay?: number;
systemId?: number;
addressId?: number;
payAt?: number;
shipAt?: number;
iState?: number;
gState?: number;
} & Partial<ExprOp<OpAttr | string>>;
export type OpSortAttr = Partial<{
id: number;
@ -67,6 +82,7 @@ export type OpSortAttr = Partial<{
$$seq$$: number;
$$updateAt$$: number;
price: number;
receivingMethod: number;
paid: number;
refunded: number;
title: number;
@ -76,7 +92,10 @@ export type OpSortAttr = Partial<{
entityId: number;
settled: number;
allowPartialPay: number;
payAt: number;
shipAt: number;
iState: number;
gState: number;
[k: string]: any;
} | ExprOp<OpAttr | string>>;
export type OpAction = OakMakeAction<Action | string>;

View File

@ -5,16 +5,21 @@
"paid": "已支付金额",
"refunded": "已退款金额",
"iState": "订单状态",
"gState": "物流状态",
"title": "订单标题",
"desc": "订单描述",
"timeoutAt": "过期时间",
"allowPartialPay": "允许部分支付",
"receivingMethod": "配送方式",
"creator": "创建者",
"entity": "关联对象",
"entityId": "关联对象Id",
"settled": "是否结算",
"opers": "相关帐户操作",
"system": "所属系统"
"system": "所属系统",
"address": "收货地址",
"payAt": "付款时间",
"shipAt": "发货时间"
},
"action": {
"startPaying": "开始支付",
@ -27,7 +32,13 @@
"refundAll": "完全退款",
"refundNone": "退款失败",
"refundPartially": "部分退款",
"settle": "结算"
"send": "发货",
"store": "暂存",
"take": "取货",
"receive": "收货",
"settle": "结算",
"turnBack": "退还",
"unship": "入库"
},
"v": {
"iState": {
@ -40,6 +51,17 @@
"refunded": "已退款",
"partiallyRefunded": "已部分退款",
"refunding": "退款中"
},
"gState": {
"unshipped": "未发货",
"shipped": "已发货",
"received": "已收货",
"staging": "寄存中",
"taken": "已取货"
},
"receivingMethod": {
"express": "配送",
"pickup": "自提"
}
}
}

View File

@ -121,6 +121,7 @@ async function changeOrderStateByPay(filter, context, option) {
action,
data: {
paid: payPaid,
payAt: action === 'payAll' ? Date.now() : null,
},
filter: {
id: orderId,

View File

@ -6,6 +6,6 @@ import { BRC } from '../types/RuntimeCxt';
* @param context
* @param refunds
*/
export declare function updateWithdrawState(context: BRC, id: string): Promise<0 | 1>;
export declare function updateWithdrawState(context: BRC, id: string): Promise<1 | 0>;
declare const triggers: Trigger<EntityDict, 'withdraw', BRC>[];
export default triggers;

View File

@ -2,10 +2,12 @@ import { String, Text, Price, Boolean, Datetime } from 'oak-domain/lib/types/Dat
import { EntityShape } from 'oak-domain/lib/types/Entity';
import { EntityDesc, ActionDef } from 'oak-domain/lib/types';
import { Schema as User } from 'oak-general-business/lib/entities/User';
import { Schema as Address } from 'oak-general-business/lib/entities/Address';
import { Schema as AccountOper } from './AccountOper';
import { Schema as System } from './System';
export interface Schema extends EntityShape {
price: Price;
receivingMethod: 'express' | 'pickup';
paid: Price;
refunded: Price;
title: String<32>;
@ -17,12 +19,20 @@ export interface Schema extends EntityShape {
settled: Boolean;
allowPartialPay?: Boolean;
system: System;
address?: Address;
payAt?: Datetime;
shipAt?: Datetime;
opers: AccountOper[];
}
export type IAction = 'startPaying' | 'payAll' | 'payPartially' | 'payNone' | 'timeout' | 'cancel' | 'startRefunding' | 'refundAll' | 'refundPartially' | 'refundNone';
export type IState = 'unpaid' | 'timeout' | 'cancelled' | 'paying' | 'partiallyPaid' | 'paid' | 'refunding' | 'partiallyRefunded' | 'refunded';
export declare const IActionDef: ActionDef<IAction, IState>;
export type Action = IAction | 'settle';
export type GState = 'staging' | 'shipped' | 'unshipped' | 'received' | 'taken';
export type GAction = 'send' | 'receive' | 'store' | 'take' | 'turnBack' | 'unship';
export declare const GActionDef: ActionDef<GAction, GState>;
export type Action = IAction | GAction | 'settle';
export declare const entityDesc: EntityDesc<Schema, Action, '', {
iState: IState;
gState: GState;
receivingMethod: Schema['receivingMethod'];
}>;

View File

@ -1,6 +1,6 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.entityDesc = exports.IActionDef = void 0;
exports.entityDesc = exports.GActionDef = exports.IActionDef = void 0;
;
exports.IActionDef = {
stm: {
@ -17,6 +17,17 @@ exports.IActionDef = {
},
is: 'unpaid',
};
exports.GActionDef = {
stm: {
send: ['unshipped', 'shipped'],
receive: ['shipped', 'received'],
store: [['unshipped', 'shipped'], 'staging'],
unship: [['shipped', 'staging'], 'unshipped'],
turnBack: ['shipped', 'unshipped'],
take: [['staging'], 'taken'],
},
is: 'unshipped',
};
exports.entityDesc = {
indexes: [
//索引
@ -55,16 +66,21 @@ exports.entityDesc = {
paid: '已支付金额',
refunded: '已退款金额',
iState: '订单状态',
gState: '物流状态',
title: '订单标题',
desc: "订单描述",
timeoutAt: '过期时间',
allowPartialPay: '允许部分支付',
receivingMethod: '配送方式',
creator: '创建者',
entity: '关联对象',
entityId: '关联对象Id',
settled: '是否结算',
opers: '相关帐户操作',
system: '所属系统'
system: '所属系统',
address: '收货地址',
payAt: '付款时间',
shipAt: '发货时间',
},
action: {
startPaying: '开始支付',
@ -77,7 +93,13 @@ exports.entityDesc = {
refundAll: '完全退款',
refundNone: '退款失败',
refundPartially: '部分退款',
send: '发货',
store: '暂存',
take: '取货',
receive: '收货',
settle: '结算',
turnBack: '退还',
unship: '入库'
},
v: {
iState: {
@ -91,6 +113,17 @@ exports.entityDesc = {
partiallyRefunded: '已部分退款',
refunding: '退款中',
},
gState: {
unshipped: '未发货',
shipped: '已发货',
received: '已收货',
staging: '寄存中',
taken: '已取货',
},
receivingMethod: {
express: '配送',
pickup: '自提',
}
}
},
},
@ -119,6 +152,17 @@ exports.entityDesc = {
partiallyRefunded: '#EDBB99',
refunding: '#FBEEE6'
},
gState: {
unshipped: '#AF601A',
shipped: '#2874A6',
received: '#1E8449',
staging: '#283747',
taken: '#117A65',
},
receivingMethod: {
express: '#5DADE2',
pickup: '#2ECC71',
}
}
}
};

View File

@ -34,8 +34,8 @@ export interface Schema extends EntityShape {
opers: AccountOper[];
autoStart?: Boolean;
}
type IAction = 'startPaying' | 'succeedPaying' | 'close' | 'startRefunding' | 'refundAll' | 'refundPartially' | 'stopRefunding';
type IState = 'unpaid' | 'paying' | 'paid' | 'closed' | 'refunding' | 'partiallyRefunded' | 'refunded';
export type IAction = 'startPaying' | 'succeedPaying' | 'close' | 'startRefunding' | 'refundAll' | 'refundPartially' | 'stopRefunding';
export type IState = 'unpaid' | 'paying' | 'paid' | 'closed' | 'refunding' | 'partiallyRefunded' | 'refunded';
export declare const IActionDef: ActionDef<IAction, IState>;
type Action = IAction | 'closeRefund' | 'continuePaying';
export declare const entityDesc: EntityDesc<Schema, Action, '', {

View File

@ -53,6 +53,7 @@ export declare const actionDefDict: {
offlineAccount: {};
order: {
iState: import("oak-domain/lib/types").ActionDef<string, string>;
gState: import("oak-domain/lib/types").ActionDef<string, string>;
};
pay: {
iState: import("oak-domain/lib/types").ActionDef<string, string>;

View File

@ -85,7 +85,7 @@ export type OpSchema = EntityShape & {
style?: Style | null;
dangerousVersions: Versions;
warningVersions: Versions;
soaVersion: String<12>;
soaVersion: String<32>;
domainId?: ForeignKey<"domain"> | null;
} & {
[A in ExpressionKey]?: any;

View File

@ -1128,14 +1128,22 @@ export type Address = {
Schema: BaseAddress.OpSchema & {
area: Area["Schema"];
user?: User["Schema"];
order$address?: Array<Omit<Order["Schema"], "address">>;
ship$to?: Array<Omit<Ship["Schema"], "to">>;
ship$from?: Array<Omit<Ship["Schema"], "from">>;
order$address$$aggr?: AggregationResult<Omit<Order["Schema"], "address">>;
ship$to$$aggr?: AggregationResult<Omit<Ship["Schema"], "to">>;
ship$from$$aggr?: AggregationResult<Omit<Ship["Schema"], "from">>;
};
Projection: BaseAddress.OpProjection & {
area?: Area["Projection"];
user?: User["Projection"];
order$address?: OakSelection<"select", Omit<Order["Projection"], "address">, Omit<Order["Filter"], "address">, Order["Sorter"]> & {
$entity: "order";
};
order$address$$aggr?: DeduceAggregation<Omit<Order["Projection"], "address">, Omit<Order["Filter"], "address">, Order["Sorter"]> & {
$entity: "order";
};
ship$to?: OakSelection<"select", Omit<Ship["Projection"], "address">, Omit<Ship["Filter"], "address">, Ship["Sorter"]> & {
$entity: "ship";
};
@ -1152,6 +1160,7 @@ export type Address = {
FilterUnit: BaseAddress.OpFilter & {
area: MakeFilter<Area["FilterUnit"]>;
user: MakeFilter<User["FilterUnit"]>;
order$address: MakeFilter<Omit<Order["FilterUnit"], "address">> & SubQueryPredicateMetadata;
ship$to: MakeFilter<Omit<Ship["FilterUnit"], "to">> & SubQueryPredicateMetadata;
ship$from: MakeFilter<Omit<Ship["FilterUnit"], "from">> & SubQueryPredicateMetadata;
};
@ -1169,6 +1178,7 @@ export type Address = {
Aggregation: DeduceAggregation<Address["Projection"], Address["Filter"], Address["Sorter"]>;
CreateOperationData: FormCreateData<BaseAddress.OpSchema & {
user?: OakOperation<"create", User["CreateOperationData"]> | OakOperation<BaseUser.OpUpdateAction, User["UpdateOperationData"], User["Filter"]>;
order$address?: (OakOperation<"create", Omit<Order["CreateOperationData"], "address"> | Omit<Order["CreateOperationData"], "address">[]> | OakOperation<BaseOrder.OpUpdateAction, Omit<Order["UpdateOperationData"], "address">, Order["Filter"]>)[];
ship$to?: (OakOperation<"create", Omit<Ship["CreateOperationData"], "to"> | Omit<Ship["CreateOperationData"], "to">[]> | OakOperation<BaseShip.OpUpdateAction, Omit<Ship["UpdateOperationData"], "to">, Ship["Filter"]>)[];
ship$from?: (OakOperation<"create", Omit<Ship["CreateOperationData"], "from"> | Omit<Ship["CreateOperationData"], "from">[]> | OakOperation<BaseShip.OpUpdateAction, Omit<Ship["UpdateOperationData"], "from">, Ship["Filter"]>)[];
}>;
@ -1177,6 +1187,7 @@ export type Address = {
Create: Address["CreateSingle"] | Address["CreateMulti"];
UpdateOperationData: FormUpdateData<BaseAddress.OpSchema & {
user?: OakOperation<"create", User["CreateOperationData"]> | OakOperation<BaseUser.OpUpdateAction, User["UpdateOperationData"], User["Filter"]> | OakOperation<"remove", User["RemoveOperationData"], User["Filter"]>;
order$address?: (OakOperation<"create", Omit<Order["CreateOperationData"], "address"> | Omit<Order["CreateOperationData"], "address">[]> | OakOperation<BaseOrder.OpUpdateAction, Omit<Order["UpdateOperationData"], "address">, Order["Filter"]> | OakOperation<"remove", Order["RemoveOperationData"], Order["Filter"]>)[];
ship$to?: (OakOperation<"create", Omit<Ship["CreateOperationData"], "to"> | Omit<Ship["CreateOperationData"], "to">[]> | OakOperation<BaseShip.OpUpdateAction, Omit<Ship["UpdateOperationData"], "to">, Ship["Filter"]> | OakOperation<"remove", Ship["RemoveOperationData"], Ship["Filter"]>)[];
ship$from?: (OakOperation<"create", Omit<Ship["CreateOperationData"], "from"> | Omit<Ship["CreateOperationData"], "from">[]> | OakOperation<BaseShip.OpUpdateAction, Omit<Ship["UpdateOperationData"], "from">, Ship["Filter"]> | OakOperation<"remove", Ship["RemoveOperationData"], Ship["Filter"]>)[];
}>;
@ -4022,6 +4033,7 @@ export type Order = {
Schema: BaseOrder.OpSchema & {
creator: User["Schema"];
system: System["Schema"];
address?: Address["Schema"];
pay$order?: Array<Omit<Pay["Schema"], "order">>;
settlement$order?: Array<Omit<Settlement["Schema"], "order">>;
shipOrder$order?: Array<Omit<ShipOrder["Schema"], "order">>;
@ -4034,6 +4046,7 @@ export type Order = {
Projection: BaseOrder.OpProjection & {
creator?: User["Projection"];
system?: System["Projection"];
address?: Address["Projection"];
pay$order?: OakSelection<"select", Omit<Pay["Projection"], "order">, Omit<Pay["Filter"], "order">, Pay["Sorter"]> & {
$entity: "pay";
};
@ -4062,6 +4075,7 @@ export type Order = {
FilterUnit: BaseOrder.OpFilter & {
creator: MakeFilter<User["FilterUnit"]>;
system: MakeFilter<System["FilterUnit"]>;
address: MakeFilter<Address["FilterUnit"]>;
pay$order: MakeFilter<Omit<Pay["FilterUnit"], "order">> & SubQueryPredicateMetadata;
settlement$order: MakeFilter<Omit<Settlement["FilterUnit"], "order">> & SubQueryPredicateMetadata;
shipOrder$order: MakeFilter<Omit<ShipOrder["FilterUnit"], "order">> & SubQueryPredicateMetadata;
@ -4071,6 +4085,7 @@ export type Order = {
SortAttr: Partial<BaseOrder.OpSortAttr | {
creator: User["SortAttr"];
system: System["SortAttr"];
address: Address["SortAttr"];
}>;
SortNode: {
$attr: Order["SortAttr"];
@ -4082,6 +4097,7 @@ export type Order = {
CreateOperationData: FormCreateData<BaseOrder.OpSchema & {
creator?: OakOperation<"create", User["CreateOperationData"]> | OakOperation<BaseUser.OpUpdateAction, User["UpdateOperationData"], User["Filter"]>;
system?: OakOperation<"create", System["CreateOperationData"]> | OakOperation<BaseSystem.OpUpdateAction, System["UpdateOperationData"], System["Filter"]>;
address?: OakOperation<"create", Address["CreateOperationData"]> | OakOperation<BaseAddress.OpUpdateAction, Address["UpdateOperationData"], Address["Filter"]>;
pay$order?: (OakOperation<"create", Omit<Pay["CreateOperationData"], "order"> | Omit<Pay["CreateOperationData"], "order">[]> | OakOperation<BasePay.OpUpdateAction, Omit<Pay["UpdateOperationData"], "order">, Pay["Filter"]>)[];
settlement$order?: (OakOperation<"create", Omit<Settlement["CreateOperationData"], "order"> | Omit<Settlement["CreateOperationData"], "order">[]> | OakOperation<BaseSettlement.OpUpdateAction, Omit<Settlement["UpdateOperationData"], "order">, Settlement["Filter"]>)[];
shipOrder$order?: (OakOperation<"create", Omit<ShipOrder["CreateOperationData"], "order"> | Omit<ShipOrder["CreateOperationData"], "order">[]> | OakOperation<BaseShipOrder.OpUpdateAction, Omit<ShipOrder["UpdateOperationData"], "order">, ShipOrder["Filter"]>)[];
@ -4093,6 +4109,7 @@ export type Order = {
UpdateOperationData: FormUpdateData<BaseOrder.OpSchema & {
creator?: OakOperation<"create", User["CreateOperationData"]> | OakOperation<BaseUser.OpUpdateAction, User["UpdateOperationData"], User["Filter"]> | OakOperation<"remove", User["RemoveOperationData"], User["Filter"]>;
system?: OakOperation<"create", System["CreateOperationData"]> | OakOperation<BaseSystem.OpUpdateAction, System["UpdateOperationData"], System["Filter"]> | OakOperation<"remove", System["RemoveOperationData"], System["Filter"]>;
address?: OakOperation<"create", Address["CreateOperationData"]> | OakOperation<BaseAddress.OpUpdateAction, Address["UpdateOperationData"], Address["Filter"]> | OakOperation<"remove", Address["RemoveOperationData"], Address["Filter"]>;
pay$order?: (OakOperation<"create", Omit<Pay["CreateOperationData"], "order"> | Omit<Pay["CreateOperationData"], "order">[]> | OakOperation<BasePay.OpUpdateAction, Omit<Pay["UpdateOperationData"], "order">, Pay["Filter"]> | OakOperation<"remove", Pay["RemoveOperationData"], Pay["Filter"]>)[];
settlement$order?: (OakOperation<"create", Omit<Settlement["CreateOperationData"], "order"> | Omit<Settlement["CreateOperationData"], "order">[]> | OakOperation<BaseSettlement.OpUpdateAction, Omit<Settlement["UpdateOperationData"], "order">, Settlement["Filter"]> | OakOperation<"remove", Settlement["RemoveOperationData"], Settlement["Filter"]>)[];
shipOrder$order?: (OakOperation<"create", Omit<ShipOrder["CreateOperationData"], "order"> | Omit<ShipOrder["CreateOperationData"], "order">[]> | OakOperation<BaseShipOrder.OpUpdateAction, Omit<ShipOrder["UpdateOperationData"], "order">, ShipOrder["Filter"]> | OakOperation<"remove", ShipOrder["RemoveOperationData"], ShipOrder["Filter"]>)[];

View File

@ -3,9 +3,13 @@ import { GenericAction } from "oak-domain/lib/actions/action";
export type IAction = 'startPaying' | 'payAll' | 'payPartially' | 'payNone' | 'timeout' | 'cancel' | 'startRefunding' | 'refundAll' | 'refundPartially' | 'refundNone' | string;
export type IState = 'unpaid' | 'timeout' | 'cancelled' | 'paying' | 'partiallyPaid' | 'paid' | 'refunding' | 'partiallyRefunded' | 'refunded' | string;
export declare const IActionDef: ActionDef<IAction, IState>;
export type ParticularAction = IAction | 'settle';
export type GState = 'staging' | 'shipped' | 'unshipped' | 'received' | 'taken' | string;
export type GAction = 'send' | 'receive' | 'store' | 'take' | 'turnBack' | 'unship' | string;
export declare const GActionDef: ActionDef<GAction, GState>;
export type ParticularAction = IAction | GAction | 'settle';
export declare const actions: string[];
export type Action = GenericAction | ParticularAction | string;
export declare const actionDefDict: {
iState: ActionDef<string, string>;
gState: ActionDef<string, string>;
};

View File

@ -1,6 +1,6 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.actionDefDict = exports.actions = exports.IActionDef = void 0;
exports.actionDefDict = exports.actions = exports.GActionDef = exports.IActionDef = void 0;
exports.IActionDef = {
stm: {
startPaying: [['unpaid', 'partiallyPaid'], 'paying'],
@ -16,7 +16,19 @@ exports.IActionDef = {
},
is: 'unpaid',
};
exports.actions = ["count", "stat", "download", "select", "aggregate", "create", "remove", "update", "startPaying", "payAll", "payPartially", "payNone", "timeout", "cancel", "startRefunding", "refundAll", "refundPartially", "refundNone", "settle"];
exports.actionDefDict = {
iState: exports.IActionDef
exports.GActionDef = {
stm: {
send: ['unshipped', 'shipped'],
receive: ['shipped', 'received'],
store: [['unshipped', 'shipped'], 'staging'],
unship: [['shipped', 'staging'], 'unshipped'],
turnBack: ['shipped', 'unshipped'],
take: [['staging'], 'taken'],
},
is: 'unshipped',
};
exports.actions = ["count", "stat", "download", "select", "aggregate", "create", "remove", "update", "startPaying", "payAll", "payPartially", "payNone", "timeout", "cancel", "startRefunding", "refundAll", "refundPartially", "refundNone", "send", "receive", "store", "take", "turnBack", "unship", "settle"];
exports.actionDefDict = {
iState: exports.IActionDef,
gState: exports.GActionDef
};

View File

@ -8,6 +8,11 @@ exports.desc = {
notNull: true,
type: "money"
},
receivingMethod: {
notNull: true,
type: "enum",
enumeration: ["express", "pickup"]
},
paid: {
notNull: true,
type: "money"
@ -61,9 +66,23 @@ exports.desc = {
type: "ref",
ref: "system"
},
addressId: {
type: "ref",
ref: "address"
},
payAt: {
type: "datetime"
},
shipAt: {
type: "datetime"
},
iState: {
type: "enum",
enumeration: ["unpaid", "timeout", "cancelled", "paying", "partiallyPaid", "paid", "refunding", "partiallyRefunded", "refunded"]
},
gState: {
type: "enum",
enumeration: ["staging", "shipped", "unshipped", "received", "taken"]
}
},
actionType: "crud",

View File

@ -26,5 +26,16 @@ exports.style = {
partiallyRefunded: '#EDBB99',
refunding: '#FBEEE6'
},
gState: {
unshipped: '#AF601A',
shipped: '#2874A6',
received: '#1E8449',
staging: '#283747',
taken: '#117A65',
},
receivingMethod: {
express: '#5DADE2',
pickup: '#2ECC71',
}
}
};

View File

@ -1,10 +1,11 @@
import { ForeignKey } from "oak-domain/lib/types/DataType";
import { Q_DateValue, Q_BooleanValue, Q_NumberValue, Q_StringValue, Q_EnumValue, NodeId, ExprOp, ExpressionKey } from "oak-domain/lib/types/Demand";
import { MakeAction as OakMakeAction, EntityShape } from "oak-domain/lib/types/Entity";
import { Action, ParticularAction, IState } from "./Action";
import { Action, ParticularAction, IState, GState } from "./Action";
import { Price, String, Text, Datetime, Boolean } from "oak-domain/lib/types/DataType";
export type OpSchema = EntityShape & {
price: Price;
receivingMethod: "express" | "pickup";
paid: Price;
refunded: Price;
title: String<32>;
@ -16,7 +17,11 @@ export type OpSchema = EntityShape & {
settled: Boolean;
allowPartialPay?: Boolean | null;
systemId: ForeignKey<"system">;
addressId?: ForeignKey<"address"> | null;
payAt?: Datetime | null;
shipAt?: Datetime | null;
iState?: IState | null;
gState?: GState | null;
} & {
[A in ExpressionKey]?: any;
};
@ -27,6 +32,7 @@ export type OpFilter = {
$$seq$$: Q_NumberValue;
$$updateAt$$: Q_DateValue;
price: Q_NumberValue;
receivingMethod: Q_EnumValue<"express" | "pickup">;
paid: Q_NumberValue;
refunded: Q_NumberValue;
title: Q_StringValue;
@ -38,7 +44,11 @@ export type OpFilter = {
settled: Q_BooleanValue;
allowPartialPay: Q_BooleanValue;
systemId: Q_StringValue;
addressId: Q_StringValue;
payAt: Q_DateValue;
shipAt: Q_DateValue;
iState: Q_EnumValue<IState>;
gState: Q_EnumValue<GState>;
} & ExprOp<OpAttr | string>;
export type OpProjection = {
"#id"?: NodeId;
@ -48,6 +58,7 @@ export type OpProjection = {
$$updateAt$$?: number;
$$seq$$?: number;
price?: number;
receivingMethod?: number;
paid?: number;
refunded?: number;
title?: number;
@ -59,7 +70,11 @@ export type OpProjection = {
settled?: number;
allowPartialPay?: number;
systemId?: number;
addressId?: number;
payAt?: number;
shipAt?: number;
iState?: number;
gState?: number;
} & Partial<ExprOp<OpAttr | string>>;
export type OpSortAttr = Partial<{
id: number;
@ -67,6 +82,7 @@ export type OpSortAttr = Partial<{
$$seq$$: number;
$$updateAt$$: number;
price: number;
receivingMethod: number;
paid: number;
refunded: number;
title: number;
@ -76,7 +92,10 @@ export type OpSortAttr = Partial<{
entityId: number;
settled: number;
allowPartialPay: number;
payAt: number;
shipAt: number;
iState: number;
gState: number;
[k: string]: any;
} | ExprOp<OpAttr | string>>;
export type OpAction = OakMakeAction<Action | string>;

View File

@ -5,16 +5,21 @@
"paid": "已支付金额",
"refunded": "已退款金额",
"iState": "订单状态",
"gState": "物流状态",
"title": "订单标题",
"desc": "订单描述",
"timeoutAt": "过期时间",
"allowPartialPay": "允许部分支付",
"receivingMethod": "配送方式",
"creator": "创建者",
"entity": "关联对象",
"entityId": "关联对象Id",
"settled": "是否结算",
"opers": "相关帐户操作",
"system": "所属系统"
"system": "所属系统",
"address": "收货地址",
"payAt": "付款时间",
"shipAt": "发货时间"
},
"action": {
"startPaying": "开始支付",
@ -27,7 +32,13 @@
"refundAll": "完全退款",
"refundNone": "退款失败",
"refundPartially": "部分退款",
"settle": "结算"
"send": "发货",
"store": "暂存",
"take": "取货",
"receive": "收货",
"settle": "结算",
"turnBack": "退还",
"unship": "入库"
},
"v": {
"iState": {
@ -40,6 +51,17 @@
"refunded": "已退款",
"partiallyRefunded": "已部分退款",
"refunding": "退款中"
},
"gState": {
"unshipped": "未发货",
"shipped": "已发货",
"received": "已收货",
"staging": "寄存中",
"taken": "已取货"
},
"receivingMethod": {
"express": "配送",
"pickup": "自提"
}
}
}

View File

@ -124,6 +124,7 @@ async function changeOrderStateByPay(filter, context, option) {
action,
data: {
paid: payPaid,
payAt: action === 'payAll' ? Date.now() : null,
},
filter: {
id: orderId,

View File

@ -3,6 +3,8 @@
* by Xc 20230807
*/
// @ts-nocheck
import React from 'react';
import { EntityDict } from '../oak-app-domain';

View File

@ -260,11 +260,8 @@ function RenderPayMeta(props: {
if (offline && offlines) {
return (
<>
{iState === 'paying' && (
mode === 'frontend'
? <Alert type='info' message={t('code.help.frontend')} />
: <Alert type='info' message={t('code.help.backend')} />
)}
{iState === 'paying' && mode === 'frontend' ? <Alert type='info' message={t('code.help.frontend')} /> : null}
{['unpaid', 'paying'].includes(iState!) && mode === 'backend' ? <Alert type='info' message={t('code.help.backend')} /> : null}
<RenderOffline
t={t}
pay={pay}

View File

@ -254,11 +254,8 @@ function RenderPayMeta(props: {
if (offline && offlines) {
return (
<>
{iState === 'paying' && (
mode === 'frontend'
? <Alert type='info' message={t('code.help.frontend')} />
: <Alert type='info' message={t('code.help.backend')} />
)}
{iState === 'paying' && mode === 'frontend' ? <Alert type='info' message={t('code.help.frontend')} /> : null}
{['unpaid', 'paying'].includes(iState!) && mode === 'backend' ? <Alert type='info' message={t('code.help.backend')} /> : null}
<RenderOffline
t={t}
pay={pay}

View File

@ -53,5 +53,3 @@ export const entityDesc: EntityDesc<Schema, Action> = {
}
}
};

View File

@ -8,11 +8,13 @@ import {
import { EntityShape } from 'oak-domain/lib/types/Entity';
import { EntityDesc, ActionDef } from 'oak-domain/lib/types';
import { Schema as User } from 'oak-general-business/lib/entities/User';
import { Schema as Address } from 'oak-general-business/lib/entities/Address';
import { Schema as AccountOper } from './AccountOper';
import { Schema as System } from './System';
export interface Schema extends EntityShape {
price: Price;
receivingMethod: 'express' | 'pickup';
paid: Price;
refunded: Price;
title: String<32>;
@ -24,6 +26,9 @@ export interface Schema extends EntityShape {
settled: Boolean;
allowPartialPay?: Boolean;
system: System;
address?: Address;
payAt?: Datetime;
shipAt?: Datetime;
opers: AccountOper[];
};
@ -45,10 +50,28 @@ export const IActionDef: ActionDef<IAction, IState> = {
},
is: 'unpaid',
};
export type Action = IAction | 'settle';
export type GState = 'staging' | 'shipped' | 'unshipped' | 'received' | 'taken';
export type GAction = 'send' | 'receive' | 'store' | 'take' | 'turnBack' | 'unship';
export const GActionDef: ActionDef<GAction, GState> = {
stm: {
send: ['unshipped', 'shipped'],
receive: ['shipped', 'received'],
store: [['unshipped', 'shipped'], 'staging'],
unship: [['shipped', 'staging'], 'unshipped'],
turnBack: ['shipped', 'unshipped'],
take: [['staging'], 'taken'],
},
is: 'unshipped',
};
export type Action = IAction | GAction | 'settle';
export const entityDesc: EntityDesc<Schema, Action, '', {
iState: IState,
gState: GState,
receivingMethod: Schema['receivingMethod'];
}> = {
indexes: [
//索引
@ -87,16 +110,21 @@ export const entityDesc: EntityDesc<Schema, Action, '', {
paid: '已支付金额',
refunded: '已退款金额',
iState: '订单状态',
gState: '物流状态',
title: '订单标题',
desc: "订单描述",
timeoutAt: '过期时间',
allowPartialPay: '允许部分支付',
receivingMethod: '配送方式',
creator: '创建者',
entity: '关联对象',
entityId: '关联对象Id',
settled: '是否结算',
opers: '相关帐户操作',
system: '所属系统'
system: '所属系统',
address: '收货地址',
payAt: '付款时间',
shipAt: '发货时间',
},
action: {
startPaying: '开始支付',
@ -109,7 +137,13 @@ export const entityDesc: EntityDesc<Schema, Action, '', {
refundAll: '完全退款',
refundNone: '退款失败',
refundPartially: '部分退款',
send: '发货',
store: '暂存',
take: '取货',
receive: '收货',
settle: '结算',
turnBack: '退还',
unship: '入库'
},
v: {
iState: {
@ -123,6 +157,17 @@ export const entityDesc: EntityDesc<Schema, Action, '', {
partiallyRefunded: '已部分退款',
refunding: '退款中',
},
gState: {
unshipped: '未发货',
shipped: '已发货',
received: '已收货',
staging: '寄存中',
taken: '已取货',
},
receivingMethod: {
express: '配送',
pickup: '自提',
}
}
},
},
@ -151,6 +196,17 @@ export const entityDesc: EntityDesc<Schema, Action, '', {
partiallyRefunded: '#EDBB99',
refunding: '#FBEEE6'
},
gState: {
unshipped: '#AF601A',
shipped: '#2874A6',
received: '#1E8449',
staging: '#283747',
taken: '#117A65',
},
receivingMethod: {
express: '#5DADE2',
pickup: '#2ECC71',
}
}
}
};

View File

@ -44,9 +44,8 @@ export interface Schema extends EntityShape {
autoStart?: Boolean;
};
type IAction = 'startPaying' | 'succeedPaying' | 'close' | 'startRefunding' | 'refundAll' | 'refundPartially' | 'stopRefunding';
type IState = 'unpaid' | 'paying' | 'paid' | 'closed' | 'refunding' | 'partiallyRefunded' | 'refunded';
export type IAction = 'startPaying' | 'succeedPaying' | 'close' | 'startRefunding' | 'refundAll' | 'refundPartially' | 'stopRefunding';
export type IState = 'unpaid' | 'paying' | 'paid' | 'closed' | 'refunding' | 'partiallyRefunded' | 'refunded';
export const IActionDef: ActionDef<IAction, IState> = {
stm: {

View File

@ -134,6 +134,7 @@ async function changeOrderStateByPay(
action,
data: {
paid: payPaid,
payAt: action === 'payAll' ? Date.now() : null,
},
filter: {
id: orderId!,