去掉了order的gState及相关代码

This commit is contained in:
Xu Chang 2025-03-15 18:51:57 +08:00
parent a14e4cda76
commit 6afc25de0a
90 changed files with 527 additions and 1157 deletions

View File

@ -151,89 +151,5 @@ const checkers = [
});
}
},
{
// 订单根据receivingMethod决定货品发送动作
entity: 'order',
type: 'row',
action: ['package', 'send', 'turnBack', 'receive'],
filter: {
receivingMethod: 'express',
},
},
{
// 订单根据receivingMethod决定货品发送动作
entity: 'order',
type: 'row',
action: ['store', 'take', 'startTaking', 'cancelTaking', 'completeTaking'],
filter: {
receivingMethod: 'pickup',
},
},
{
// 走直接take的order一定不能有物流限制的小程序支付
entity: 'order',
type: 'row',
action: 'take',
filter: {
pay$order: {
'#sqp': 'not in',
wpProduct: {
type: 'mp',
},
},
}
},
{
// 走异步take的order一定要有小程序支付
entity: 'order',
type: 'row',
action: 'startTaking',
filter: {
pay$order: {
wpProduct: {
type: 'mp',
}
}
}
},
{
entity: 'order',
type: 'logicalData',
action: 'take',
checker: (operation) => {
const { data } = operation;
const now = Date.now();
if (!data.sendAt) {
data.sendAt = now;
}
if (!data.receiveAt) {
data.receiveAt = now;
}
}
},
{
entity: 'order',
type: 'logicalData',
action: 'send',
checker: (operation) => {
const { data } = operation;
if (!data.sendAt) {
const now = Date.now();
data.sendAt = now;
}
}
},
{
entity: 'order',
type: 'logicalData',
action: 'receive',
checker: (operation) => {
const { data } = operation;
if (!data.receiveAt) {
const now = Date.now();
data.receiveAt = now;
}
}
}
];
export default checkers;

View File

@ -41,19 +41,19 @@ export default function render(props) {
});
}} placeholder={t(`placeholder.qrCode.${offlineAccount.type}`)}/>}
</Form.Item>}
<Form.Item label={t('offlineAccount:attr.taxLossRatio')} help={t('placeholder.taxLossRatio')}>
<Form.Item label={t('offlineAccount:attr.taxLossRatio')} help={t('placeholder.taxLossRatio')} required>
<InputNumber value={offlineAccount.taxLossRatio} max={5} min={0} addonAfter={"%"} step={0} precision={2} onChange={(value) => {
const taxLossRatio = value;
update({ taxLossRatio });
}}/>
</Form.Item>
<Form.Item label={t('offlineAccount:attr.refundGapDays')} help={t('placeholder.refundGapDays')}>
<Form.Item label={t('offlineAccount:attr.refundGapDays')} help={t('placeholder.refundGapDays')} required>
<InputNumber value={offlineAccount.refundGapDays} max={365} min={0} addonAfter={"天"} step={1} onChange={(value) => {
const refundGapDays = value;
update({ refundGapDays });
}}/>
</Form.Item>
<Form.Item label={t('offlineAccount:attr.refundCompensateRatio')} help={t('placeholder.refundCompensateRatio')}>
<Form.Item label={t('offlineAccount:attr.refundCompensateRatio')} help={t('placeholder.refundCompensateRatio')} required>
<InputNumber value={offlineAccount.refundCompensateRatio} max={100} min={0} addonAfter={"%"} step={1} onChange={(value) => {
const refundCompensateRatio = value;
update({ refundCompensateRatio });

View File

@ -17,10 +17,9 @@ export function WpAccount(props) {
<Descriptions.Item label={t('wpAccount:attr.taxLossRatio')}>{taxLossRatio}%</Descriptions.Item>
<Descriptions.Item label={t('wpAccount:attr.refundCompensateRatio')}>{refundCompensateRatio}%</Descriptions.Item>
<Descriptions.Item label={t('wpAccount:attr.refundGapDays')}>{refundGapDays}</Descriptions.Item>
<Descriptions.Item label={t('wpAccount:attr.allowWithdrawTransfer')}>{allowWithdrawTransfer}</Descriptions.Item>
<Descriptions.Item label={t('wpAccount:attr.allowWithdrawTransfer')}>{t(`common::${!!allowWithdrawTransfer}`)}</Descriptions.Item>
<Descriptions.Item label={t('wpAccount:attr.withdrawTransferLossRatio')}>{withdrawTransferLossRatio}%</Descriptions.Item>
<Descriptions.Item label={t('wpAccount:attr.enabled')}>{t(`common::${enabled}`)}</Descriptions.Item>
<Descriptions.Item label={t('wpAccount:attr.needReceiving')}>{t(`common::${needReceiving}`)}</Descriptions.Item>
</Descriptions>);
if (onUpdate) {
return (<Tabs activeKey={activeKey} onTabClick={(activeKey) => {

View File

@ -60,11 +60,6 @@ export default function render(props) {
<Form.Item label={t('wpAccount:attr.enabled')} required>
<Switch value={wpAccount.enabled} onChange={(enabled) => {
update({ enabled });
}}/>
</Form.Item>
<Form.Item label={t('wpAccount:attr.needReceiving')} required>
<Switch value={!!wpAccount.needReceiving} onChange={(needReceiving) => {
update({ needReceiving });
}}/>
</Form.Item>
</Form>);

View File

@ -13,7 +13,7 @@ export default function render(props) {
};
const errMsg = oakExecutable instanceof OakException && (oakExecutable instanceof OakAttrNotNullException ? getNotNullMessage(oakExecutable.getEntity(), oakExecutable.getAttributes()[0]) : t(oakExecutable.message));
const [upsertId, setUpsertId] = useState('');
const U = (<Modal width={620} destroyOnClose title={`${t('wpProduct:name')}${t('common::action.update')}`} open={!!upsertId} onCancel={() => {
const U = (<Modal width={920} destroyOnClose title={`${t('wpProduct:name')}${t('common::action.update')}`} open={!!upsertId} onCancel={() => {
clean();
setUpsertId('');
}} closeIcon={null} onOk={async () => {

View File

@ -7,6 +7,10 @@ export default OakComponent({
type: 1,
wpAccountId: 1,
applicationId: 1,
taxLossRatio: 1,
refundCompensateRatio: 1,
refundGapDays: 1,
needReceiving: 1,
enabled: 1,
application: {
id: 1,

View File

@ -1,5 +1,17 @@
{
"placeholder": {
"taxLossRatio": "如果配置了产品的手续费,则覆盖微信支付账号上配置的手续费"
"taxLossRatio": {
"notNull": "产品的手续费会覆盖微信支付帐号上配置的手续费百分比",
"null": "将使用关联的微信支付帐号上配置的手续费的手续费百分比"
},
"refundCompensateRatio": {
"notNull": "产品的退款补偿会覆盖微信支付帐号上配置的退款补偿百分比",
"null": "将使用关联的微信支付帐号上配置的退款补偿百分比"
},
"refundGapDays": {
"notNull": "产品的退款时限会覆盖微信支付帐号上配置的最大退款天数",
"null": "将使用关联的微信支付帐号上配置的最大退款天数"
},
"needReceiving": "小程序默认需要用户确认收货才到账,此配置非常关键,会影响充值以及物流的逻辑,请谨慎修改!"
}
}

View File

@ -14,7 +14,7 @@ export default function render(props) {
update({ type, needReceiving: true });
}
else {
update({ type });
update({ type, needReceiving: false });
}
}}/>
</Form.Item>
@ -29,13 +29,25 @@ export default function render(props) {
update({ enabled });
}}/>
</Form.Item>
<Form.Item label={t('wpAccount:attr.taxLossRatio')} help={t('placeholder.taxLossRatio')}>
<Form.Item label={t('wpAccount:attr.taxLossRatio')} help={t(`placeholder.taxLossRatio.${wpProduct.taxLossRatio ? 'notNull' : 'null'}`)}>
<InputNumber value={wpProduct.taxLossRatio} max={5} min={0.01} addonAfter={"%"} step={0.01} precision={2} onChange={(value) => {
const taxLossRatio = value;
update({ taxLossRatio });
}}/>
</Form.Item>
{wpProduct.type === 'mp' && <Form.Item label={t('wpAccount:attr.direct')} required>
<Form.Item label={t('wpAccount:attr.refundCompensateRatio')} help={t(`placeholder.refundCompensateRatio.${wpProduct.refundCompensateRatio ? 'notNull' : 'null'}`)}>
<InputNumber value={wpProduct.refundCompensateRatio} max={5} min={0.01} addonAfter={"%"} step={0.01} precision={2} onChange={(value) => {
const refundCompensateRatio = value;
update({ refundCompensateRatio });
}}/>
</Form.Item>
<Form.Item label={t('wpAccount:attr.refundGapDays')} help={t(`placeholder.refundGapDays.${wpProduct.refundGapDays ? 'notNull' : 'null'}`)}>
<InputNumber value={wpProduct.refundGapDays} max={300} min={0} step={1} onChange={(value) => {
const refundGapDays = value;
update({ refundGapDays });
}}/>
</Form.Item>
{wpProduct.type === 'mp' && <Form.Item label={t('wpAccount:attr.needReceiving')} help={t('placeholder.needReceiving')} required>
<Switch value={!!wpProduct.needReceiving} onChange={(needReceiving) => {
update({ needReceiving });
}}/>

View File

@ -669,7 +669,19 @@ const i18ns = [
position: "src/components/wpProduct/upsert",
data: {
"placeholder": {
"taxLossRatio": "如果配置了产品的手续费,则覆盖微信支付账号上配置的手续费"
"taxLossRatio": {
"notNull": "产品的手续费会覆盖微信支付帐号上配置的手续费百分比",
"null": "将使用关联的微信支付帐号上配置的手续费的手续费百分比"
},
"refundCompensateRatio": {
"notNull": "产品的退款补偿会覆盖微信支付帐号上配置的退款补偿百分比",
"null": "将使用关联的微信支付帐号上配置的退款补偿百分比"
},
"refundGapDays": {
"notNull": "产品的退款时限会覆盖微信支付帐号上配置的最大退款天数",
"null": "将使用关联的微信支付帐号上配置的最大退款天数"
},
"needReceiving": "小程序默认需要用户确认收货才到账,此配置非常关键,会影响充值以及物流的逻辑,请谨慎修改!"
}
}
},

13
es/entities/AbstactPayProduct.d.ts vendored Normal file
View File

@ -0,0 +1,13 @@
import { Boolean, Int, Decimal } from 'oak-domain/lib/types/DataType';
import { EntityShape } from 'oak-domain/lib/types/Entity';
import { Schema as Application } from 'oak-general-business/lib/entities/Application';
import { EntityDesc } from 'oak-domain/lib/types';
export interface Schema extends EntityShape {
taxLossRatio?: Decimal<4, 2>;
refundGapDays?: Int<4>;
refundCompensateRatio?: Int<4>;
needReceiving?: Boolean;
application: Application;
enabled: Boolean;
}
export declare const entityDesc: EntityDesc<Schema>;

View File

@ -0,0 +1,16 @@
;
export const entityDesc = {
locales: {
zh_CN: {
name: '抽象支付产品',
attr: {
taxLossRatio: '渠道手续费百分比',
refundGapDays: '允许最大退款天数',
refundCompensateRatio: '退款渠道补偿百分比',
needReceiving: '用户确认收货后到账',
application: '关联应用',
enabled: '是否启用'
},
},
},
};

View File

@ -5,7 +5,7 @@ export const entityDesc = {
name: '抽象支付帐号',
attr: {
taxLossRatio: '渠道手续费百分比',
refundGapDays: '最大允许退款天数',
refundGapDays: '允许最大退款天数',
refundCompensateRatio: '退款渠道补偿百分比',
allowWithdrawTransfer: '允许提现转账',
withdrawTransferLossRatio: '提现转账费率(百分数)',

View File

@ -8,9 +8,9 @@ export const entityDesc = {
channel: '通道',
name: '用户/帐号',
qrCode: '收款二维码',
taxLossRatio: '商户号手续费(百分比)',
refundCompensateRatio: '退款补偿百分比',
refundGapDays: '(支付后)允许退款的天数',
taxLossRatio: '渠道手续费百分比',
refundGapDays: '允许最大退款天数',
refundCompensateRatio: '退款渠道补偿百分比',
allowWithdrawTransfer: '允许提现转账',
withdrawTransferLossRatio: '提现转账费率(百分数)',
allowDeposit: '允许主动充值',

View File

@ -7,7 +7,6 @@ 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>;
@ -21,19 +20,12 @@ export interface Schema extends EntityShape {
system: System;
address?: Address;
payAt?: Datetime;
sendAt?: Datetime;
receiveAt?: 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 GState = 'staging' | 'shipping' | 'packaged' | 'unshipped' | 'received' | 'taken' | 'taking';
export type GAction = 'package' | 'send' | 'receive' | 'store' | 'take' | 'startTaking' | 'cancelTaking' | 'completeTaking' | 'turnBack' | 'unship';
export declare const GActionDef: ActionDef<GAction, GState>;
export type Action = IAction | GAction | 'settle';
export type Action = IAction | 'settle';
export declare const entityDesc: EntityDesc<Schema, Action, '', {
iState: IState;
gState: GState;
receivingMethod: Schema['receivingMethod'];
}>;

View File

@ -14,21 +14,6 @@ export const IActionDef = {
},
is: 'unpaid',
};
export const GActionDef = {
stm: {
package: ['unshipped', 'packaged'],
send: ['packaged', 'shipping'],
receive: ['shipping', 'received'],
store: ['unshipped', 'staging'],
unship: [['packaged', 'staging'], 'unshipped'],
turnBack: ['shipping', 'unshipped'],
take: [['staging'], 'taken'],
startTaking: ['staging', 'taking'],
cancelTaking: ['taking', 'staging'],
completeTaking: ['taking', 'taken'],
},
is: 'unshipped',
};
export const entityDesc = {
indexes: [
//索引
@ -67,12 +52,10 @@ export const entityDesc = {
paid: '已支付金额',
refunded: '已退款金额',
iState: '订单状态',
gState: '物流状态',
title: '订单标题',
desc: "订单描述",
timeoutAt: '过期时间',
allowPartialPay: '允许部分支付',
receivingMethod: '配送方式',
creator: '创建者',
entity: '关联对象',
entityId: '关联对象Id',
@ -81,8 +64,6 @@ export const entityDesc = {
system: '所属系统',
address: '收货地址',
payAt: '付款时间',
sendAt: '发货时间',
receiveAt: '收货时间',
},
action: {
startPaying: '开始支付',
@ -95,17 +76,7 @@ export const entityDesc = {
refundAll: '完全退款',
refundNone: '退款失败',
refundPartially: '部分退款',
package: '打包',
send: '发货',
store: '暂存',
take: '提货',
receive: '收货',
settle: '结算',
turnBack: '退还',
unship: '入库',
startTaking: '开始提货流程',
completeTaking: '完成提货流程',
cancelTaking: '取消提货流程',
},
v: {
iState: {
@ -119,19 +90,6 @@ export const entityDesc = {
partiallyRefunded: '已部分退款',
refunding: '退款中',
},
gState: {
unshipped: '未发货',
packaged: '已打包',
shipping: '已发货',
received: '已收货',
staging: '寄存中',
taken: '已提货',
taking: '提货流程中',
},
receivingMethod: {
express: '配送',
pickup: '自提',
}
}
},
},
@ -147,16 +105,7 @@ export const entityDesc = {
refundAll: '',
refundNone: '',
refundPartially: '',
send: '',
store: '',
take: '',
receive: '',
settle: '',
turnBack: '',
unship: '',
startTaking: '',
completeTaking: '',
cancelTaking: '',
},
color: {
iState: {
@ -170,19 +119,6 @@ export const entityDesc = {
partiallyRefunded: '#EDBB99',
refunding: '#FBEEE6'
},
gState: {
unshipped: '#AF601A',
packaged: '#676855',
shipping: '#2874A6',
received: '#1E8449',
staging: '#283747',
taken: '#117A65',
taking: '#FFC107',
},
receivingMethod: {
express: '#5DADE2',
pickup: '#2ECC71',
}
}
}
};

View File

@ -31,6 +31,7 @@ export interface Schema extends EntityShape {
phantom2?: String<32>;
phantom3?: Int<4>;
phantom4?: Int<8>;
phantom5?: Object;
opers: AccountOper[];
autoStart?: Boolean;
}

View File

@ -86,6 +86,7 @@ export const entityDesc = {
phantom2: '索引项二',
phantom3: '索引项三',
phantom4: '索引项四',
phantom5: '备用项五',
autoStart: '自动开始支付',
},
action: {

View File

@ -6,7 +6,7 @@ export const entityDesc = {
attr: {
wechatPay: '微信支付',
taxLossRatio: '渠道手续费百分比',
refundGapDays: '最大允许退款天数',
refundGapDays: '允许最大退款天数',
refundCompensateRatio: '退款渠道补偿百分比',
allowWithdrawTransfer: '允许提现转账',
withdrawTransferLossRatio: '提现转账费率(百分数)',

View File

@ -5,7 +5,7 @@ export const entityDesc = {
name: '微信支付产品',
attr: {
taxLossRatio: '渠道手续费百分比',
refundGapDays: '最大允许退款天数',
refundGapDays: '允许最大退款天数',
refundCompensateRatio: '退款渠道补偿百分比',
needReceiving: '用户确认收货后到账',
application: '关联应用',

View File

@ -0,0 +1,19 @@
export * from "./_baseSchema";
import { AbstactPayProduct } from "../EntityDict";
export type Schema = AbstactPayProduct["Schema"];
export type Action = AbstactPayProduct["Action"];
export type Projection = AbstactPayProduct["Projection"];
export type Filter = AbstactPayProduct["Filter"];
export type SortNode = AbstactPayProduct["SortNode"];
export type Sorter = AbstactPayProduct["Sorter"];
export type Selection = AbstactPayProduct["Selection"];
export type Aggregation = AbstactPayProduct["Aggregation"];
export type CreateOperationData = AbstactPayProduct["CreateOperationData"];
export type CreateSingle = AbstactPayProduct["CreateSingle"];
export type CreateMulti = AbstactPayProduct["CreateMulti"];
export type Create = AbstactPayProduct["Create"];
export type UpdateOperationData = AbstactPayProduct["UpdateOperationData"];
export type Update = AbstactPayProduct["Update"];
export type RemoveOperationData = AbstactPayProduct["RemoveOperationData"];
export type Remove = AbstactPayProduct["Remove"];
export type Operation = AbstactPayProduct["Operation"];

View File

@ -0,0 +1 @@
export * from "./_baseSchema";

View File

@ -0,0 +1,3 @@
import { StorageDesc } from "oak-domain/lib/types/Storage";
import { OpSchema } from "./Schema";
export declare const desc: StorageDesc<OpSchema>;

View File

@ -0,0 +1,40 @@
import { genericActions as actions } from "oak-domain/lib/actions/action";
export const desc = {
attributes: {
taxLossRatio: {
type: "decimal",
params: {
precision: 4,
scale: 2
}
},
refundGapDays: {
type: "int",
params: {
width: 4,
signed: true
}
},
refundCompensateRatio: {
type: "int",
params: {
width: 4,
signed: true
}
},
needReceiving: {
type: "boolean"
},
applicationId: {
notNull: true,
type: "ref",
ref: "application"
},
enabled: {
notNull: true,
type: "boolean"
}
},
actionType: "crud",
actions
};

View File

@ -0,0 +1,56 @@
import { ForeignKey } from "oak-domain/lib/types/DataType";
import { Q_DateValue, Q_BooleanValue, Q_NumberValue, Q_StringValue, NodeId, ExprOp, ExpressionKey } from "oak-domain/lib/types/Demand";
import { MakeAction as OakMakeAction, EntityShape } from "oak-domain/lib/types/Entity";
import { GenericAction } from "oak-domain/lib/actions/action";
import { Decimal, Int, Boolean } from "oak-domain/lib/types/DataType";
export type OpSchema = EntityShape & {
taxLossRatio?: Decimal<4, 2> | null;
refundGapDays?: Int<4> | null;
refundCompensateRatio?: Int<4> | null;
needReceiving?: Boolean | null;
applicationId: ForeignKey<"application">;
enabled: Boolean;
} & {
[A in ExpressionKey]?: any;
};
export type OpAttr = keyof OpSchema;
export type OpFilter = {
id: Q_StringValue;
$$createAt$$: Q_DateValue;
$$seq$$: Q_NumberValue;
$$updateAt$$: Q_DateValue;
taxLossRatio: Q_NumberValue;
refundGapDays: Q_NumberValue;
refundCompensateRatio: Q_NumberValue;
needReceiving: Q_BooleanValue;
applicationId: Q_StringValue;
enabled: Q_BooleanValue;
} & ExprOp<OpAttr | string>;
export type OpProjection = {
"#id"?: NodeId;
[k: string]: any;
id?: number;
$$createAt$$?: number;
$$updateAt$$?: number;
$$seq$$?: number;
taxLossRatio?: number;
refundGapDays?: number;
refundCompensateRatio?: number;
needReceiving?: number;
applicationId?: number;
enabled?: number;
} & Partial<ExprOp<OpAttr | string>>;
export type OpSortAttr = Partial<{
id: number;
$$createAt$$: number;
$$seq$$: number;
$$updateAt$$: number;
taxLossRatio: number;
refundGapDays: number;
refundCompensateRatio: number;
needReceiving: number;
enabled: number;
[k: string]: any;
} | ExprOp<OpAttr | string>>;
export type OpAction = OakMakeAction<GenericAction | string>;
export type OpUpdateAction = "update" | string;

View File

@ -0,0 +1 @@
export {};

View File

@ -0,0 +1,11 @@
{
"name": "抽象支付产品",
"attr": {
"taxLossRatio": "渠道手续费百分比",
"refundGapDays": "允许最大退款天数",
"refundCompensateRatio": "退款渠道补偿百分比",
"needReceiving": "用户确认收货后到账",
"application": "关联应用",
"enabled": "是否启用"
}
}

View File

@ -2,7 +2,7 @@
"name": "抽象支付帐号",
"attr": {
"taxLossRatio": "渠道手续费百分比",
"refundGapDays": "最大允许退款天数",
"refundGapDays": "允许最大退款天数",
"refundCompensateRatio": "退款渠道补偿百分比",
"allowWithdrawTransfer": "允许提现转账",
"withdrawTransferLossRatio": "提现转账费率(百分数)",

View File

@ -53,7 +53,6 @@ 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

@ -5,9 +5,9 @@
"channel": "通道",
"name": "用户/帐号",
"qrCode": "收款二维码",
"taxLossRatio": "商户号手续费(百分比)",
"refundCompensateRatio": "退款补偿百分比",
"refundGapDays": "(支付后)允许退款的天数",
"taxLossRatio": "渠道手续费百分比",
"refundGapDays": "允许最大退款天数",
"refundCompensateRatio": "退款渠道补偿百分比",
"allowWithdrawTransfer": "允许提现转账",
"withdrawTransferLossRatio": "提现转账费率(百分数)",
"allowDeposit": "允许主动充值",

View File

@ -3,13 +3,9 @@ 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 GState = 'staging' | 'shipping' | 'packaged' | 'unshipped' | 'received' | 'taken' | 'taking' | string;
export type GAction = 'package' | 'send' | 'receive' | 'store' | 'take' | 'startTaking' | 'cancelTaking' | 'completeTaking' | 'turnBack' | 'unship' | string;
export declare const GActionDef: ActionDef<GAction, GState>;
export type ParticularAction = IAction | GAction | 'settle';
export type ParticularAction = IAction | '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,23 +13,7 @@ export const IActionDef = {
},
is: 'unpaid',
};
export const GActionDef = {
stm: {
package: ['unshipped', 'packaged'],
send: ['packaged', 'shipping'],
receive: ['shipping', 'received'],
store: ['unshipped', 'staging'],
unship: [['packaged', 'staging'], 'unshipped'],
turnBack: ['shipping', 'unshipped'],
take: [['staging'], 'taken'],
startTaking: ['staging', 'taking'],
cancelTaking: ['taking', 'staging'],
completeTaking: ['taking', 'taken'],
},
is: 'unshipped',
};
export const actions = ["count", "stat", "download", "select", "aggregate", "create", "remove", "update", "startPaying", "payAll", "payPartially", "payNone", "timeout", "cancel", "startRefunding", "refundAll", "refundPartially", "refundNone", "package", "send", "receive", "store", "take", "startTaking", "cancelTaking", "completeTaking", "turnBack", "unship", "settle"];
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,
gState: GActionDef
iState: IActionDef
};

View File

@ -5,11 +5,6 @@ export const desc = {
notNull: true,
type: "money"
},
receivingMethod: {
notNull: true,
type: "enum",
enumeration: ["express", "pickup"]
},
paid: {
notNull: true,
type: "money"
@ -70,19 +65,9 @@ export const desc = {
payAt: {
type: "datetime"
},
sendAt: {
type: "datetime"
},
receiveAt: {
type: "datetime"
},
iState: {
type: "enum",
enumeration: ["unpaid", "timeout", "cancelled", "paying", "partiallyPaid", "paid", "refunding", "partiallyRefunded", "refunded"]
},
gState: {
type: "enum",
enumeration: ["staging", "shipping", "packaged", "unshipped", "received", "taken", "taking"]
}
},
actionType: "crud",

View File

@ -10,16 +10,7 @@ export const style = {
refundAll: '',
refundNone: '',
refundPartially: '',
send: '',
store: '',
take: '',
receive: '',
settle: '',
turnBack: '',
unship: '',
startTaking: '',
completeTaking: '',
cancelTaking: '',
},
color: {
iState: {
@ -33,18 +24,5 @@ export const style = {
partiallyRefunded: '#EDBB99',
refunding: '#FBEEE6'
},
gState: {
unshipped: '#AF601A',
packaged: '#676855',
shipping: '#2874A6',
received: '#1E8449',
staging: '#283747',
taken: '#117A65',
taking: '#FFC107',
},
receivingMethod: {
express: '#5DADE2',
pickup: '#2ECC71',
}
}
};

View File

@ -1,11 +1,10 @@
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, GState } from "./Action";
import { Action, ParticularAction, IState } 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>;
@ -19,10 +18,7 @@ export type OpSchema = EntityShape & {
systemId: ForeignKey<"system">;
addressId?: ForeignKey<"address"> | null;
payAt?: Datetime | null;
sendAt?: Datetime | null;
receiveAt?: Datetime | null;
iState?: IState | null;
gState?: GState | null;
} & {
[A in ExpressionKey]?: any;
};
@ -33,7 +29,6 @@ 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;
@ -47,10 +42,7 @@ export type OpFilter = {
systemId: Q_StringValue;
addressId: Q_StringValue;
payAt: Q_DateValue;
sendAt: Q_DateValue;
receiveAt: Q_DateValue;
iState: Q_EnumValue<IState>;
gState: Q_EnumValue<GState>;
} & ExprOp<OpAttr | string>;
export type OpProjection = {
"#id"?: NodeId;
@ -60,7 +52,6 @@ export type OpProjection = {
$$updateAt$$?: number;
$$seq$$?: number;
price?: number;
receivingMethod?: number;
paid?: number;
refunded?: number;
title?: number;
@ -74,10 +65,7 @@ export type OpProjection = {
systemId?: number;
addressId?: number;
payAt?: number;
sendAt?: number;
receiveAt?: number;
iState?: number;
gState?: number;
} & Partial<ExprOp<OpAttr | string>>;
export type OpSortAttr = Partial<{
id: number;
@ -85,7 +73,6 @@ export type OpSortAttr = Partial<{
$$seq$$: number;
$$updateAt$$: number;
price: number;
receivingMethod: number;
paid: number;
refunded: number;
title: number;
@ -96,10 +83,7 @@ export type OpSortAttr = Partial<{
settled: number;
allowPartialPay: number;
payAt: number;
sendAt: number;
receiveAt: number;
iState: number;
gState: number;
[k: string]: any;
} | ExprOp<OpAttr | string>>;
export type OpAction = OakMakeAction<Action | string>;

View File

@ -5,12 +5,10 @@
"paid": "已支付金额",
"refunded": "已退款金额",
"iState": "订单状态",
"gState": "物流状态",
"title": "订单标题",
"desc": "订单描述",
"timeoutAt": "过期时间",
"allowPartialPay": "允许部分支付",
"receivingMethod": "配送方式",
"creator": "创建者",
"entity": "关联对象",
"entityId": "关联对象Id",
@ -18,9 +16,7 @@
"opers": "相关帐户操作",
"system": "所属系统",
"address": "收货地址",
"payAt": "付款时间",
"sendAt": "发货时间",
"receiveAt": "收货时间"
"payAt": "付款时间"
},
"action": {
"startPaying": "开始支付",
@ -33,17 +29,7 @@
"refundAll": "完全退款",
"refundNone": "退款失败",
"refundPartially": "部分退款",
"package": "打包",
"send": "发货",
"store": "暂存",
"take": "提货",
"receive": "收货",
"settle": "结算",
"turnBack": "退还",
"unship": "入库",
"startTaking": "开始提货流程",
"completeTaking": "完成提货流程",
"cancelTaking": "取消提货流程"
"settle": "结算"
},
"v": {
"iState": {
@ -56,19 +42,6 @@
"refunded": "已退款",
"partiallyRefunded": "已部分退款",
"refunding": "退款中"
},
"gState": {
"unshipped": "未发货",
"packaged": "已打包",
"shipping": "已发货",
"received": "已收货",
"staging": "寄存中",
"taken": "已提货",
"taking": "提货流程中"
},
"receivingMethod": {
"express": "配送",
"pickup": "自提"
}
}
}

View File

@ -95,6 +95,9 @@ export const desc = {
signed: true
}
},
phantom5: {
type: "object"
},
autoStart: {
type: "boolean"
},

View File

@ -23,6 +23,7 @@ export type OpSchema = EntityShape & {
phantom2?: String<32> | null;
phantom3?: Int<4> | null;
phantom4?: Int<8> | null;
phantom5?: Object | null;
autoStart?: Boolean | null;
iState?: IState | null;
} & {
@ -53,6 +54,7 @@ export type OpFilter = {
phantom2: Q_StringValue;
phantom3: Q_NumberValue;
phantom4: Q_NumberValue;
phantom5: Object;
autoStart: Q_BooleanValue;
iState: Q_EnumValue<IState>;
} & ExprOp<OpAttr | string>;
@ -82,6 +84,7 @@ export type OpProjection = {
phantom2?: number;
phantom3?: number;
phantom4?: number;
phantom5?: number | Object;
autoStart?: number;
iState?: number;
} & Partial<ExprOp<OpAttr | string>>;

View File

@ -22,6 +22,7 @@
"phantom2": "索引项二",
"phantom3": "索引项三",
"phantom4": "索引项四",
"phantom5": "备用项五",
"autoStart": "自动开始支付"
},
"action": {

View File

@ -3,7 +3,7 @@
"attr": {
"wechatPay": "微信支付",
"taxLossRatio": "渠道手续费百分比",
"refundGapDays": "最大允许退款天数",
"refundGapDays": "允许最大退款天数",
"refundCompensateRatio": "退款渠道补偿百分比",
"allowWithdrawTransfer": "允许提现转账",
"withdrawTransferLossRatio": "提现转账费率(百分数)",

View File

@ -2,7 +2,7 @@
"name": "微信支付产品",
"attr": {
"taxLossRatio": "渠道手续费百分比",
"refundGapDays": "最大允许退款天数",
"refundGapDays": "允许最大退款天数",
"refundCompensateRatio": "退款渠道补偿百分比",
"needReceiving": "用户确认收货后到账",
"application": "关联应用",

2
es/registry.d.ts vendored
View File

@ -1,4 +1,4 @@
export { registerPayClazz as registerPayClazzEntity } from './utils/payClazz';
export { registerPayClazz } from './utils/payClazz';
export { registerPayChannelComponent } from './components/payConfig/system/web.pc';
export { registerFrontendPayRoutine } from './components/pay/detail/index';
export { registerShipSettingComponent } from './components/ship/system/web.pc';

View File

@ -1,4 +1,4 @@
export { registerPayClazz as registerPayClazzEntity } from './utils/payClazz';
export { registerPayClazz } from './utils/payClazz';
export { registerPayChannelComponent } from './components/payConfig/system/web.pc';
export { registerFrontendPayRoutine } from './components/pay/detail/index';
export { registerShipSettingComponent } from './components/ship/system/web.pc';

View File

@ -153,7 +153,7 @@ const triggers = [
return 0;
}
},
{
/* {
name: '订单开始提货流程后创建类型为pickup的ship',
entity: 'order',
action: 'startTaking',
@ -190,8 +190,9 @@ const triggers = [
},
}, {});
}
return orders?.length;
},
}
} */
];
export default triggers;

View File

@ -128,42 +128,6 @@ const triggers = [
return 1;
}
},
{
name: '当物流创建时将对应的receivingMethod为express的order变为packaged状态',
entity: 'ship',
action: 'create',
when: 'after',
fn: async ({ operation }, context, option) => {
const { data } = operation;
const orders = await context.select('order', {
data: {
id: 1,
gState: 1,
},
filter: {
receivingMethod: 'express',
shipOrder$order: {
shipId: data.id,
}
}
}, { dontCollect: true });
if (orders && orders.length > 0) {
orders.forEach(ele => assert(ele.gState === 'unshipped'));
await context.operate('order', {
id: await generateNewIdAsync(),
action: 'package',
data: {},
filter: {
id: {
$in: orders.map(ele => ele.id),
},
},
}, option);
return orders.length;
}
return 0;
}
},
{
name: '当物流创建时,赋上对应的物流系统对象',
entity: 'ship',
@ -177,113 +141,30 @@ const triggers = [
if (data instanceof Array) {
for (const d of data) {
const { shipServiceId, shipOrder$ship } = d;
assert(shipServiceId);
const result = await getShipEntity(shipServiceId, shipOrder$ship.map(ele => ele.data.orderId), context);
if (result) {
d.entity = result[0];
d.entityId = result[1];
count++;
if (shipServiceId) {
const result = await getShipEntity(shipServiceId, shipOrder$ship.map(ele => ele.data.orderId), context);
if (result) {
d.entity = result[0];
d.entityId = result[1];
count++;
}
}
}
}
else {
const { shipServiceId, shipOrder$ship } = data;
assert(shipServiceId);
const result = await getShipEntity(shipServiceId, shipOrder$ship.map(ele => ele.data.orderId), context);
if (result) {
data.entity = result[0];
data.entityId = result[1];
count++;
if (shipServiceId) {
const result = await getShipEntity(shipServiceId, shipOrder$ship.map(ele => ele.data.orderId), context);
if (result) {
data.entity = result[0];
data.entityId = result[1];
count++;
}
}
}
return count;
}
},
{
name: '当物流发货时将对应的order状态变为已发货/提货中',
entity: 'ship',
action: 'ship',
when: 'after',
fn: async ({ operation }, context, option) => {
const { filter } = operation;
assert(typeof filter.id === 'string');
const orders = await context.select('order', {
data: {
id: 1,
gState: 1,
},
filter: {
shipOrder$order: {
shipId: filter.id,
}
}
}, { dontCollect: true });
const packaged = orders.filter(ele => ele.gState === 'packaged');
if (packaged.length > 0) {
await context.operate('order', {
id: await generateNewIdAsync(),
action: 'send',
data: {},
filter: {
id: {
$in: packaged.map(ele => ele.id),
},
},
}, option);
}
// const staged = orders.filter(ele => ele.gState === 'staging');
// if (staged.length > 0) {
// await context.operate('order', {
// id: await generateNewIdAsync(),
// action: 'startTaking',
// data: {},
// filter: {
// id: {
// $in: staged.map(ele => ele.id!),
// },
// },
// }, option);
// }
// assert(staged.length + packaged.length === orders.length);
return packaged.length;
}
},
{
name: '当物流取消时将对应的order状态改回packaged/staging',
entity: 'ship',
action: 'cancel',
when: 'after',
fn: async ({ operation }, context, option) => {
const { filter } = operation;
assert(typeof filter.id === 'string');
const orders = await context.select('order', {
data: {
id: 1,
gState: 1,
receivingMethod: 1,
},
filter: {
shipOrder$order: {
shipId: filter.id,
}
}
}, { dontCollect: true });
if (orders && orders.length > 0) {
await context.operate('order', {
id: await generateNewIdAsync(),
action: 'unship',
data: {},
filter: {
id: {
$in: orders.map(ele => ele.id),
},
},
}, option);
return orders.length;
}
return 0;
}
},
{
name: '当物流类的ship取消后调用外部接口取消下单',
entity: 'ship',

View File

@ -1,4 +1,4 @@
import WechatPay from './WechatPay';
import WechatPayDebug from './WechatPay.debug';
declare const _default: typeof WechatPay | typeof WechatPayDebug;
declare const _default: typeof WechatPayDebug | typeof WechatPay;
export default _default;

View File

@ -154,89 +154,5 @@ const checkers = [
});
}
},
{
// 订单根据receivingMethod决定货品发送动作
entity: 'order',
type: 'row',
action: ['package', 'send', 'turnBack', 'receive'],
filter: {
receivingMethod: 'express',
},
},
{
// 订单根据receivingMethod决定货品发送动作
entity: 'order',
type: 'row',
action: ['store', 'take', 'startTaking', 'cancelTaking', 'completeTaking'],
filter: {
receivingMethod: 'pickup',
},
},
{
// 走直接take的order一定不能有物流限制的小程序支付
entity: 'order',
type: 'row',
action: 'take',
filter: {
pay$order: {
'#sqp': 'not in',
wpProduct: {
type: 'mp',
},
},
}
},
{
// 走异步take的order一定要有小程序支付
entity: 'order',
type: 'row',
action: 'startTaking',
filter: {
pay$order: {
wpProduct: {
type: 'mp',
}
}
}
},
{
entity: 'order',
type: 'logicalData',
action: 'take',
checker: (operation) => {
const { data } = operation;
const now = Date.now();
if (!data.sendAt) {
data.sendAt = now;
}
if (!data.receiveAt) {
data.receiveAt = now;
}
}
},
{
entity: 'order',
type: 'logicalData',
action: 'send',
checker: (operation) => {
const { data } = operation;
if (!data.sendAt) {
const now = Date.now();
data.sendAt = now;
}
}
},
{
entity: 'order',
type: 'logicalData',
action: 'receive',
checker: (operation) => {
const { data } = operation;
if (!data.receiveAt) {
const now = Date.now();
data.receiveAt = now;
}
}
}
];
exports.default = checkers;

View File

@ -671,7 +671,19 @@ const i18ns = [
position: "src/components/wpProduct/upsert",
data: {
"placeholder": {
"taxLossRatio": "如果配置了产品的手续费,则覆盖微信支付账号上配置的手续费"
"taxLossRatio": {
"notNull": "产品的手续费会覆盖微信支付帐号上配置的手续费百分比",
"null": "将使用关联的微信支付帐号上配置的手续费的手续费百分比"
},
"refundCompensateRatio": {
"notNull": "产品的退款补偿会覆盖微信支付帐号上配置的退款补偿百分比",
"null": "将使用关联的微信支付帐号上配置的退款补偿百分比"
},
"refundGapDays": {
"notNull": "产品的退款时限会覆盖微信支付帐号上配置的最大退款天数",
"null": "将使用关联的微信支付帐号上配置的最大退款天数"
},
"needReceiving": "小程序默认需要用户确认收货才到账,此配置非常关键,会影响充值以及物流的逻辑,请谨慎修改!"
}
}
},

13
lib/entities/AbstactPayProduct.d.ts vendored Normal file
View File

@ -0,0 +1,13 @@
import { Boolean, Int, Decimal } from 'oak-domain/lib/types/DataType';
import { EntityShape } from 'oak-domain/lib/types/Entity';
import { Schema as Application } from 'oak-general-business/lib/entities/Application';
import { EntityDesc } from 'oak-domain/lib/types';
export interface Schema extends EntityShape {
taxLossRatio?: Decimal<4, 2>;
refundGapDays?: Int<4>;
refundCompensateRatio?: Int<4>;
needReceiving?: Boolean;
application: Application;
enabled: Boolean;
}
export declare const entityDesc: EntityDesc<Schema>;

View File

@ -0,0 +1,19 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.entityDesc = void 0;
;
exports.entityDesc = {
locales: {
zh_CN: {
name: '抽象支付产品',
attr: {
taxLossRatio: '渠道手续费百分比',
refundGapDays: '允许最大退款天数',
refundCompensateRatio: '退款渠道补偿百分比',
needReceiving: '用户确认收货后到账',
application: '关联应用',
enabled: '是否启用'
},
},
},
};

View File

@ -8,7 +8,7 @@ exports.entityDesc = {
name: '抽象支付帐号',
attr: {
taxLossRatio: '渠道手续费百分比',
refundGapDays: '最大允许退款天数',
refundGapDays: '允许最大退款天数',
refundCompensateRatio: '退款渠道补偿百分比',
allowWithdrawTransfer: '允许提现转账',
withdrawTransferLossRatio: '提现转账费率(百分数)',

View File

@ -11,9 +11,9 @@ exports.entityDesc = {
channel: '通道',
name: '用户/帐号',
qrCode: '收款二维码',
taxLossRatio: '商户号手续费(百分比)',
refundCompensateRatio: '退款补偿百分比',
refundGapDays: '(支付后)允许退款的天数',
taxLossRatio: '渠道手续费百分比',
refundGapDays: '允许最大退款天数',
refundCompensateRatio: '退款渠道补偿百分比',
allowWithdrawTransfer: '允许提现转账',
withdrawTransferLossRatio: '提现转账费率(百分数)',
allowDeposit: '允许主动充值',

View File

@ -7,7 +7,6 @@ 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>;
@ -21,19 +20,12 @@ export interface Schema extends EntityShape {
system: System;
address?: Address;
payAt?: Datetime;
sendAt?: Datetime;
receiveAt?: 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 GState = 'staging' | 'shipping' | 'packaged' | 'unshipped' | 'received' | 'taken' | 'taking';
export type GAction = 'package' | 'send' | 'receive' | 'store' | 'take' | 'startTaking' | 'cancelTaking' | 'completeTaking' | 'turnBack' | 'unship';
export declare const GActionDef: ActionDef<GAction, GState>;
export type Action = IAction | GAction | 'settle';
export type Action = IAction | '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.GActionDef = exports.IActionDef = void 0;
exports.entityDesc = exports.IActionDef = void 0;
;
exports.IActionDef = {
stm: {
@ -17,21 +17,6 @@ exports.IActionDef = {
},
is: 'unpaid',
};
exports.GActionDef = {
stm: {
package: ['unshipped', 'packaged'],
send: ['packaged', 'shipping'],
receive: ['shipping', 'received'],
store: ['unshipped', 'staging'],
unship: [['packaged', 'staging'], 'unshipped'],
turnBack: ['shipping', 'unshipped'],
take: [['staging'], 'taken'],
startTaking: ['staging', 'taking'],
cancelTaking: ['taking', 'staging'],
completeTaking: ['taking', 'taken'],
},
is: 'unshipped',
};
exports.entityDesc = {
indexes: [
//索引
@ -70,12 +55,10 @@ exports.entityDesc = {
paid: '已支付金额',
refunded: '已退款金额',
iState: '订单状态',
gState: '物流状态',
title: '订单标题',
desc: "订单描述",
timeoutAt: '过期时间',
allowPartialPay: '允许部分支付',
receivingMethod: '配送方式',
creator: '创建者',
entity: '关联对象',
entityId: '关联对象Id',
@ -84,8 +67,6 @@ exports.entityDesc = {
system: '所属系统',
address: '收货地址',
payAt: '付款时间',
sendAt: '发货时间',
receiveAt: '收货时间',
},
action: {
startPaying: '开始支付',
@ -98,17 +79,7 @@ exports.entityDesc = {
refundAll: '完全退款',
refundNone: '退款失败',
refundPartially: '部分退款',
package: '打包',
send: '发货',
store: '暂存',
take: '提货',
receive: '收货',
settle: '结算',
turnBack: '退还',
unship: '入库',
startTaking: '开始提货流程',
completeTaking: '完成提货流程',
cancelTaking: '取消提货流程',
},
v: {
iState: {
@ -122,19 +93,6 @@ exports.entityDesc = {
partiallyRefunded: '已部分退款',
refunding: '退款中',
},
gState: {
unshipped: '未发货',
packaged: '已打包',
shipping: '已发货',
received: '已收货',
staging: '寄存中',
taken: '已提货',
taking: '提货流程中',
},
receivingMethod: {
express: '配送',
pickup: '自提',
}
}
},
},
@ -150,16 +108,7 @@ exports.entityDesc = {
refundAll: '',
refundNone: '',
refundPartially: '',
send: '',
store: '',
take: '',
receive: '',
settle: '',
turnBack: '',
unship: '',
startTaking: '',
completeTaking: '',
cancelTaking: '',
},
color: {
iState: {
@ -173,19 +122,6 @@ exports.entityDesc = {
partiallyRefunded: '#EDBB99',
refunding: '#FBEEE6'
},
gState: {
unshipped: '#AF601A',
packaged: '#676855',
shipping: '#2874A6',
received: '#1E8449',
staging: '#283747',
taken: '#117A65',
taking: '#FFC107',
},
receivingMethod: {
express: '#5DADE2',
pickup: '#2ECC71',
}
}
}
};

View File

@ -31,6 +31,7 @@ export interface Schema extends EntityShape {
phantom2?: String<32>;
phantom3?: Int<4>;
phantom4?: Int<8>;
phantom5?: Object;
opers: AccountOper[];
autoStart?: Boolean;
}

View File

@ -89,6 +89,7 @@ exports.entityDesc = {
phantom2: '索引项二',
phantom3: '索引项三',
phantom4: '索引项四',
phantom5: '备用项五',
autoStart: '自动开始支付',
},
action: {

View File

@ -9,7 +9,7 @@ exports.entityDesc = {
attr: {
wechatPay: '微信支付',
taxLossRatio: '渠道手续费百分比',
refundGapDays: '最大允许退款天数',
refundGapDays: '允许最大退款天数',
refundCompensateRatio: '退款渠道补偿百分比',
allowWithdrawTransfer: '允许提现转账',
withdrawTransferLossRatio: '提现转账费率(百分数)',

View File

@ -8,7 +8,7 @@ exports.entityDesc = {
name: '微信支付产品',
attr: {
taxLossRatio: '渠道手续费百分比',
refundGapDays: '最大允许退款天数',
refundGapDays: '允许最大退款天数',
refundCompensateRatio: '退款渠道补偿百分比',
needReceiving: '用户确认收货后到账',
application: '关联应用',

View File

@ -0,0 +1,19 @@
export * from "./_baseSchema";
import { AbstactPayProduct } from "../EntityDict";
export type Schema = AbstactPayProduct["Schema"];
export type Action = AbstactPayProduct["Action"];
export type Projection = AbstactPayProduct["Projection"];
export type Filter = AbstactPayProduct["Filter"];
export type SortNode = AbstactPayProduct["SortNode"];
export type Sorter = AbstactPayProduct["Sorter"];
export type Selection = AbstactPayProduct["Selection"];
export type Aggregation = AbstactPayProduct["Aggregation"];
export type CreateOperationData = AbstactPayProduct["CreateOperationData"];
export type CreateSingle = AbstactPayProduct["CreateSingle"];
export type CreateMulti = AbstactPayProduct["CreateMulti"];
export type Create = AbstactPayProduct["Create"];
export type UpdateOperationData = AbstactPayProduct["UpdateOperationData"];
export type Update = AbstactPayProduct["Update"];
export type RemoveOperationData = AbstactPayProduct["RemoveOperationData"];
export type Remove = AbstactPayProduct["Remove"];
export type Operation = AbstactPayProduct["Operation"];

View File

@ -0,0 +1,4 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const tslib_1 = require("tslib");
tslib_1.__exportStar(require("./_baseSchema"), exports);

View File

@ -0,0 +1,3 @@
import { StorageDesc } from "oak-domain/lib/types/Storage";
import { OpSchema } from "./Schema";
export declare const desc: StorageDesc<OpSchema>;

View File

@ -0,0 +1,43 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.desc = void 0;
const action_1 = require("oak-domain/lib/actions/action");
exports.desc = {
attributes: {
taxLossRatio: {
type: "decimal",
params: {
precision: 4,
scale: 2
}
},
refundGapDays: {
type: "int",
params: {
width: 4,
signed: true
}
},
refundCompensateRatio: {
type: "int",
params: {
width: 4,
signed: true
}
},
needReceiving: {
type: "boolean"
},
applicationId: {
notNull: true,
type: "ref",
ref: "application"
},
enabled: {
notNull: true,
type: "boolean"
}
},
actionType: "crud",
actions: action_1.genericActions
};

View File

@ -0,0 +1,56 @@
import { ForeignKey } from "oak-domain/lib/types/DataType";
import { Q_DateValue, Q_BooleanValue, Q_NumberValue, Q_StringValue, NodeId, ExprOp, ExpressionKey } from "oak-domain/lib/types/Demand";
import { MakeAction as OakMakeAction, EntityShape } from "oak-domain/lib/types/Entity";
import { GenericAction } from "oak-domain/lib/actions/action";
import { Decimal, Int, Boolean } from "oak-domain/lib/types/DataType";
export type OpSchema = EntityShape & {
taxLossRatio?: Decimal<4, 2> | null;
refundGapDays?: Int<4> | null;
refundCompensateRatio?: Int<4> | null;
needReceiving?: Boolean | null;
applicationId: ForeignKey<"application">;
enabled: Boolean;
} & {
[A in ExpressionKey]?: any;
};
export type OpAttr = keyof OpSchema;
export type OpFilter = {
id: Q_StringValue;
$$createAt$$: Q_DateValue;
$$seq$$: Q_NumberValue;
$$updateAt$$: Q_DateValue;
taxLossRatio: Q_NumberValue;
refundGapDays: Q_NumberValue;
refundCompensateRatio: Q_NumberValue;
needReceiving: Q_BooleanValue;
applicationId: Q_StringValue;
enabled: Q_BooleanValue;
} & ExprOp<OpAttr | string>;
export type OpProjection = {
"#id"?: NodeId;
[k: string]: any;
id?: number;
$$createAt$$?: number;
$$updateAt$$?: number;
$$seq$$?: number;
taxLossRatio?: number;
refundGapDays?: number;
refundCompensateRatio?: number;
needReceiving?: number;
applicationId?: number;
enabled?: number;
} & Partial<ExprOp<OpAttr | string>>;
export type OpSortAttr = Partial<{
id: number;
$$createAt$$: number;
$$seq$$: number;
$$updateAt$$: number;
taxLossRatio: number;
refundGapDays: number;
refundCompensateRatio: number;
needReceiving: number;
enabled: number;
[k: string]: any;
} | ExprOp<OpAttr | string>>;
export type OpAction = OakMakeAction<GenericAction | string>;
export type OpUpdateAction = "update" | string;

View File

@ -0,0 +1,2 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });

View File

@ -0,0 +1,11 @@
{
"name": "抽象支付产品",
"attr": {
"taxLossRatio": "渠道手续费百分比",
"refundGapDays": "允许最大退款天数",
"refundCompensateRatio": "退款渠道补偿百分比",
"needReceiving": "用户确认收货后到账",
"application": "关联应用",
"enabled": "是否启用"
}
}

View File

@ -2,7 +2,7 @@
"name": "抽象支付帐号",
"attr": {
"taxLossRatio": "渠道手续费百分比",
"refundGapDays": "最大允许退款天数",
"refundGapDays": "允许最大退款天数",
"refundCompensateRatio": "退款渠道补偿百分比",
"allowWithdrawTransfer": "允许提现转账",
"withdrawTransferLossRatio": "提现转账费率(百分数)",

View File

@ -53,7 +53,6 @@ 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

@ -5,9 +5,9 @@
"channel": "通道",
"name": "用户/帐号",
"qrCode": "收款二维码",
"taxLossRatio": "商户号手续费(百分比)",
"refundCompensateRatio": "退款补偿百分比",
"refundGapDays": "(支付后)允许退款的天数",
"taxLossRatio": "渠道手续费百分比",
"refundGapDays": "允许最大退款天数",
"refundCompensateRatio": "退款渠道补偿百分比",
"allowWithdrawTransfer": "允许提现转账",
"withdrawTransferLossRatio": "提现转账费率(百分数)",
"allowDeposit": "允许主动充值",

View File

@ -3,13 +3,9 @@ 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 GState = 'staging' | 'shipping' | 'packaged' | 'unshipped' | 'received' | 'taken' | 'taking' | string;
export type GAction = 'package' | 'send' | 'receive' | 'store' | 'take' | 'startTaking' | 'cancelTaking' | 'completeTaking' | 'turnBack' | 'unship' | string;
export declare const GActionDef: ActionDef<GAction, GState>;
export type ParticularAction = IAction | GAction | 'settle';
export type ParticularAction = IAction | '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.GActionDef = exports.IActionDef = void 0;
exports.actionDefDict = exports.actions = exports.IActionDef = void 0;
exports.IActionDef = {
stm: {
startPaying: [['unpaid', 'partiallyPaid'], 'paying'],
@ -16,23 +16,7 @@ exports.IActionDef = {
},
is: 'unpaid',
};
exports.GActionDef = {
stm: {
package: ['unshipped', 'packaged'],
send: ['packaged', 'shipping'],
receive: ['shipping', 'received'],
store: ['unshipped', 'staging'],
unship: [['packaged', 'staging'], 'unshipped'],
turnBack: ['shipping', 'unshipped'],
take: [['staging'], 'taken'],
startTaking: ['staging', 'taking'],
cancelTaking: ['taking', 'staging'],
completeTaking: ['taking', 'taken'],
},
is: 'unshipped',
};
exports.actions = ["count", "stat", "download", "select", "aggregate", "create", "remove", "update", "startPaying", "payAll", "payPartially", "payNone", "timeout", "cancel", "startRefunding", "refundAll", "refundPartially", "refundNone", "package", "send", "receive", "store", "take", "startTaking", "cancelTaking", "completeTaking", "turnBack", "unship", "settle"];
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,
gState: exports.GActionDef
iState: exports.IActionDef
};

View File

@ -8,11 +8,6 @@ exports.desc = {
notNull: true,
type: "money"
},
receivingMethod: {
notNull: true,
type: "enum",
enumeration: ["express", "pickup"]
},
paid: {
notNull: true,
type: "money"
@ -73,19 +68,9 @@ exports.desc = {
payAt: {
type: "datetime"
},
sendAt: {
type: "datetime"
},
receiveAt: {
type: "datetime"
},
iState: {
type: "enum",
enumeration: ["unpaid", "timeout", "cancelled", "paying", "partiallyPaid", "paid", "refunding", "partiallyRefunded", "refunded"]
},
gState: {
type: "enum",
enumeration: ["staging", "shipping", "packaged", "unshipped", "received", "taken", "taking"]
}
},
actionType: "crud",

View File

@ -13,16 +13,7 @@ exports.style = {
refundAll: '',
refundNone: '',
refundPartially: '',
send: '',
store: '',
take: '',
receive: '',
settle: '',
turnBack: '',
unship: '',
startTaking: '',
completeTaking: '',
cancelTaking: '',
},
color: {
iState: {
@ -36,18 +27,5 @@ exports.style = {
partiallyRefunded: '#EDBB99',
refunding: '#FBEEE6'
},
gState: {
unshipped: '#AF601A',
packaged: '#676855',
shipping: '#2874A6',
received: '#1E8449',
staging: '#283747',
taken: '#117A65',
taking: '#FFC107',
},
receivingMethod: {
express: '#5DADE2',
pickup: '#2ECC71',
}
}
};

View File

@ -1,11 +1,10 @@
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, GState } from "./Action";
import { Action, ParticularAction, IState } 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>;
@ -19,10 +18,7 @@ export type OpSchema = EntityShape & {
systemId: ForeignKey<"system">;
addressId?: ForeignKey<"address"> | null;
payAt?: Datetime | null;
sendAt?: Datetime | null;
receiveAt?: Datetime | null;
iState?: IState | null;
gState?: GState | null;
} & {
[A in ExpressionKey]?: any;
};
@ -33,7 +29,6 @@ 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;
@ -47,10 +42,7 @@ export type OpFilter = {
systemId: Q_StringValue;
addressId: Q_StringValue;
payAt: Q_DateValue;
sendAt: Q_DateValue;
receiveAt: Q_DateValue;
iState: Q_EnumValue<IState>;
gState: Q_EnumValue<GState>;
} & ExprOp<OpAttr | string>;
export type OpProjection = {
"#id"?: NodeId;
@ -60,7 +52,6 @@ export type OpProjection = {
$$updateAt$$?: number;
$$seq$$?: number;
price?: number;
receivingMethod?: number;
paid?: number;
refunded?: number;
title?: number;
@ -74,10 +65,7 @@ export type OpProjection = {
systemId?: number;
addressId?: number;
payAt?: number;
sendAt?: number;
receiveAt?: number;
iState?: number;
gState?: number;
} & Partial<ExprOp<OpAttr | string>>;
export type OpSortAttr = Partial<{
id: number;
@ -85,7 +73,6 @@ export type OpSortAttr = Partial<{
$$seq$$: number;
$$updateAt$$: number;
price: number;
receivingMethod: number;
paid: number;
refunded: number;
title: number;
@ -96,10 +83,7 @@ export type OpSortAttr = Partial<{
settled: number;
allowPartialPay: number;
payAt: number;
sendAt: number;
receiveAt: number;
iState: number;
gState: number;
[k: string]: any;
} | ExprOp<OpAttr | string>>;
export type OpAction = OakMakeAction<Action | string>;

View File

@ -5,12 +5,10 @@
"paid": "已支付金额",
"refunded": "已退款金额",
"iState": "订单状态",
"gState": "物流状态",
"title": "订单标题",
"desc": "订单描述",
"timeoutAt": "过期时间",
"allowPartialPay": "允许部分支付",
"receivingMethod": "配送方式",
"creator": "创建者",
"entity": "关联对象",
"entityId": "关联对象Id",
@ -18,9 +16,7 @@
"opers": "相关帐户操作",
"system": "所属系统",
"address": "收货地址",
"payAt": "付款时间",
"sendAt": "发货时间",
"receiveAt": "收货时间"
"payAt": "付款时间"
},
"action": {
"startPaying": "开始支付",
@ -33,17 +29,7 @@
"refundAll": "完全退款",
"refundNone": "退款失败",
"refundPartially": "部分退款",
"package": "打包",
"send": "发货",
"store": "暂存",
"take": "提货",
"receive": "收货",
"settle": "结算",
"turnBack": "退还",
"unship": "入库",
"startTaking": "开始提货流程",
"completeTaking": "完成提货流程",
"cancelTaking": "取消提货流程"
"settle": "结算"
},
"v": {
"iState": {
@ -56,19 +42,6 @@
"refunded": "已退款",
"partiallyRefunded": "已部分退款",
"refunding": "退款中"
},
"gState": {
"unshipped": "未发货",
"packaged": "已打包",
"shipping": "已发货",
"received": "已收货",
"staging": "寄存中",
"taken": "已提货",
"taking": "提货流程中"
},
"receivingMethod": {
"express": "配送",
"pickup": "自提"
}
}
}

View File

@ -98,6 +98,9 @@ exports.desc = {
signed: true
}
},
phantom5: {
type: "object"
},
autoStart: {
type: "boolean"
},

View File

@ -23,6 +23,7 @@ export type OpSchema = EntityShape & {
phantom2?: String<32> | null;
phantom3?: Int<4> | null;
phantom4?: Int<8> | null;
phantom5?: Object | null;
autoStart?: Boolean | null;
iState?: IState | null;
} & {
@ -53,6 +54,7 @@ export type OpFilter = {
phantom2: Q_StringValue;
phantom3: Q_NumberValue;
phantom4: Q_NumberValue;
phantom5: Object;
autoStart: Q_BooleanValue;
iState: Q_EnumValue<IState>;
} & ExprOp<OpAttr | string>;
@ -82,6 +84,7 @@ export type OpProjection = {
phantom2?: number;
phantom3?: number;
phantom4?: number;
phantom5?: number | Object;
autoStart?: number;
iState?: number;
} & Partial<ExprOp<OpAttr | string>>;

View File

@ -22,6 +22,7 @@
"phantom2": "索引项二",
"phantom3": "索引项三",
"phantom4": "索引项四",
"phantom5": "备用项五",
"autoStart": "自动开始支付"
},
"action": {

View File

@ -3,7 +3,7 @@
"attr": {
"wechatPay": "微信支付",
"taxLossRatio": "渠道手续费百分比",
"refundGapDays": "最大允许退款天数",
"refundGapDays": "允许最大退款天数",
"refundCompensateRatio": "退款渠道补偿百分比",
"allowWithdrawTransfer": "允许提现转账",
"withdrawTransferLossRatio": "提现转账费率(百分数)",

View File

@ -2,7 +2,7 @@
"name": "微信支付产品",
"attr": {
"taxLossRatio": "渠道手续费百分比",
"refundGapDays": "最大允许退款天数",
"refundGapDays": "允许最大退款天数",
"refundCompensateRatio": "退款渠道补偿百分比",
"needReceiving": "用户确认收货后到账",
"application": "关联应用",

2
lib/registry.d.ts vendored
View File

@ -1,4 +1,4 @@
export { registerPayClazz as registerPayClazzEntity } from './utils/payClazz';
export { registerPayClazz } from './utils/payClazz';
export { registerPayChannelComponent } from './components/payConfig/system/web.pc';
export { registerFrontendPayRoutine } from './components/pay/detail/index';
export { registerShipSettingComponent } from './components/ship/system/web.pc';

View File

@ -1,8 +1,8 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.registerShipSettingComponent = exports.registerFrontendPayRoutine = exports.registerPayChannelComponent = exports.registerPayClazzEntity = void 0;
exports.registerShipSettingComponent = exports.registerFrontendPayRoutine = exports.registerPayChannelComponent = exports.registerPayClazz = void 0;
var payClazz_1 = require("./utils/payClazz");
Object.defineProperty(exports, "registerPayClazzEntity", { enumerable: true, get: function () { return payClazz_1.registerPayClazz; } });
Object.defineProperty(exports, "registerPayClazz", { enumerable: true, get: function () { return payClazz_1.registerPayClazz; } });
var web_pc_1 = require("./components/payConfig/system/web.pc");
Object.defineProperty(exports, "registerPayChannelComponent", { enumerable: true, get: function () { return web_pc_1.registerPayChannelComponent; } });
var index_1 = require("./components/pay/detail/index");

View File

@ -156,7 +156,7 @@ const triggers = [
return 0;
}
},
{
/* {
name: '订单开始提货流程后创建类型为pickup的ship',
entity: 'order',
action: 'startTaking',
@ -175,26 +175,27 @@ const triggers = [
dontCollect: true,
});
for (const order of orders) {
(0, assert_1.default)(order.receivingMethod === 'pickup');
assert(order.receivingMethod === 'pickup');
await context.operate('shipOrder', {
id: await (0, uuid_1.generateNewIdAsync)(),
id: await generateNewIdAsync(),
action: 'create',
data: {
id: await (0, uuid_1.generateNewIdAsync)(),
id: await generateNewIdAsync(),
orderId: order.id,
ship: {
id: await (0, uuid_1.generateNewIdAsync)(),
id: await generateNewIdAsync(),
action: 'create',
data: {
id: await (0, uuid_1.generateNewIdAsync)(),
id: await generateNewIdAsync(),
type: 'pickup'
}
}
},
}, {});
}
return orders?.length;
},
}
} */
];
exports.default = triggers;

View File

@ -131,42 +131,6 @@ const triggers = [
return 1;
}
},
{
name: '当物流创建时将对应的receivingMethod为express的order变为packaged状态',
entity: 'ship',
action: 'create',
when: 'after',
fn: async ({ operation }, context, option) => {
const { data } = operation;
const orders = await context.select('order', {
data: {
id: 1,
gState: 1,
},
filter: {
receivingMethod: 'express',
shipOrder$order: {
shipId: data.id,
}
}
}, { dontCollect: true });
if (orders && orders.length > 0) {
orders.forEach(ele => (0, assert_1.default)(ele.gState === 'unshipped'));
await context.operate('order', {
id: await (0, uuid_1.generateNewIdAsync)(),
action: 'package',
data: {},
filter: {
id: {
$in: orders.map(ele => ele.id),
},
},
}, option);
return orders.length;
}
return 0;
}
},
{
name: '当物流创建时,赋上对应的物流系统对象',
entity: 'ship',
@ -180,113 +144,30 @@ const triggers = [
if (data instanceof Array) {
for (const d of data) {
const { shipServiceId, shipOrder$ship } = d;
(0, assert_1.default)(shipServiceId);
const result = await (0, shipClazz_1.getShipEntity)(shipServiceId, shipOrder$ship.map(ele => ele.data.orderId), context);
if (result) {
d.entity = result[0];
d.entityId = result[1];
count++;
if (shipServiceId) {
const result = await (0, shipClazz_1.getShipEntity)(shipServiceId, shipOrder$ship.map(ele => ele.data.orderId), context);
if (result) {
d.entity = result[0];
d.entityId = result[1];
count++;
}
}
}
}
else {
const { shipServiceId, shipOrder$ship } = data;
(0, assert_1.default)(shipServiceId);
const result = await (0, shipClazz_1.getShipEntity)(shipServiceId, shipOrder$ship.map(ele => ele.data.orderId), context);
if (result) {
data.entity = result[0];
data.entityId = result[1];
count++;
if (shipServiceId) {
const result = await (0, shipClazz_1.getShipEntity)(shipServiceId, shipOrder$ship.map(ele => ele.data.orderId), context);
if (result) {
data.entity = result[0];
data.entityId = result[1];
count++;
}
}
}
return count;
}
},
{
name: '当物流发货时将对应的order状态变为已发货/提货中',
entity: 'ship',
action: 'ship',
when: 'after',
fn: async ({ operation }, context, option) => {
const { filter } = operation;
(0, assert_1.default)(typeof filter.id === 'string');
const orders = await context.select('order', {
data: {
id: 1,
gState: 1,
},
filter: {
shipOrder$order: {
shipId: filter.id,
}
}
}, { dontCollect: true });
const packaged = orders.filter(ele => ele.gState === 'packaged');
if (packaged.length > 0) {
await context.operate('order', {
id: await (0, uuid_1.generateNewIdAsync)(),
action: 'send',
data: {},
filter: {
id: {
$in: packaged.map(ele => ele.id),
},
},
}, option);
}
// const staged = orders.filter(ele => ele.gState === 'staging');
// if (staged.length > 0) {
// await context.operate('order', {
// id: await generateNewIdAsync(),
// action: 'startTaking',
// data: {},
// filter: {
// id: {
// $in: staged.map(ele => ele.id!),
// },
// },
// }, option);
// }
// assert(staged.length + packaged.length === orders.length);
return packaged.length;
}
},
{
name: '当物流取消时将对应的order状态改回packaged/staging',
entity: 'ship',
action: 'cancel',
when: 'after',
fn: async ({ operation }, context, option) => {
const { filter } = operation;
(0, assert_1.default)(typeof filter.id === 'string');
const orders = await context.select('order', {
data: {
id: 1,
gState: 1,
receivingMethod: 1,
},
filter: {
shipOrder$order: {
shipId: filter.id,
}
}
}, { dontCollect: true });
if (orders && orders.length > 0) {
await context.operate('order', {
id: await (0, uuid_1.generateNewIdAsync)(),
action: 'unship',
data: {},
filter: {
id: {
$in: orders.map(ele => ele.id),
},
},
}, option);
return orders.length;
}
return 0;
}
},
{
name: '当物流类的ship取消后调用外部接口取消下单',
entity: 'ship',

View File

@ -169,91 +169,6 @@ const checkers: Checker<EntityDict, 'order', RuntimeCxt>[] = [
);
}
},
{
// 订单根据receivingMethod决定货品发送动作
entity: 'order',
type: 'row',
action: ['package', 'send', 'turnBack', 'receive'],
filter: {
receivingMethod: 'express',
},
},
{
// 订单根据receivingMethod决定货品发送动作
entity: 'order',
type: 'row',
action: ['store', 'take', 'startTaking', 'cancelTaking', 'completeTaking'],
filter: {
receivingMethod: 'pickup',
},
},
{
// 走直接take的order一定不能有物流限制的小程序支付
entity: 'order',
type: 'row',
action: 'take',
filter: {
pay$order: {
'#sqp': 'not in',
wpProduct: {
type: 'mp',
},
},
}
},
{
// 走异步take的order一定要有小程序支付
entity: 'order',
type: 'row',
action: 'startTaking',
filter: {
pay$order: {
wpProduct: {
type: 'mp',
}
}
}
},
{
entity: 'order',
type: 'logicalData',
action: 'take',
checker: (operation) => {
const { data } = operation as EntityDict['order']['Update'];
const now = Date.now();
if (!data.sendAt) {
data.sendAt = now;
}
if (!data.receiveAt) {
data.receiveAt = now;
}
}
},
{
entity: 'order',
type: 'logicalData',
action: 'send',
checker: (operation) => {
const { data } = operation as EntityDict['order']['Update'];
if (!data.sendAt) {
const now = Date.now();
data.sendAt = now;
}
}
},
{
entity: 'order',
type: 'logicalData',
action: 'receive',
checker: (operation) => {
const { data } = operation as EntityDict['order']['Update'];
if (!data.receiveAt) {
const now = Date.now();
data.receiveAt = now;
}
}
}
];
export default checkers;

View File

@ -91,6 +91,7 @@ export default function render(props: WebComponentProps<EntityDict, 'offlineAcco
<Form.Item
label={t('offlineAccount:attr.taxLossRatio')}
help={t('placeholder.taxLossRatio')}
required
>
<InputNumber
value={offlineAccount.taxLossRatio}
@ -108,6 +109,7 @@ export default function render(props: WebComponentProps<EntityDict, 'offlineAcco
<Form.Item
label={t('offlineAccount:attr.refundGapDays')}
help={t('placeholder.refundGapDays')}
required
>
<InputNumber
value={offlineAccount.refundGapDays}
@ -124,6 +126,7 @@ export default function render(props: WebComponentProps<EntityDict, 'offlineAcco
<Form.Item
label={t('offlineAccount:attr.refundCompensateRatio')}
help={t('placeholder.refundCompensateRatio')}
required
>
<InputNumber
value={offlineAccount.refundCompensateRatio}

View File

@ -672,16 +672,16 @@ const i18ns: I18n[] = [
data: {
"placeholder": {
"taxLossRatio": {
"notNull": "产品的手续费会覆盖微信支付帐号上配置的手续费",
"null": "将使用关联的微信支付帐号上配置的手续费"
"notNull": "产品的手续费会覆盖微信支付帐号上配置的手续费百分比",
"null": "将使用关联的微信支付帐号上配置的手续费的手续费百分比"
},
"refundCompensateRatio": {
"notNull": "产品的退款补偿会覆盖微信支付帐号上配置的退款补偿",
"null": "将使用关联的微信支付帐号上配置的退款补偿"
"notNull": "产品的退款补偿会覆盖微信支付帐号上配置的退款补偿百分比",
"null": "将使用关联的微信支付帐号上配置的退款补偿百分比"
},
"refundGapDays": {
"notNull": "产品的退款时限会覆盖微信支付帐号上配置的退款时限",
"null": "将使用关联的微信支付帐号上配置的退款时限"
"notNull": "产品的退款时限会覆盖微信支付帐号上配置的最大退款天数",
"null": "将使用关联的微信支付帐号上配置的最大退款天数"
},
"needReceiving": "小程序默认需要用户确认收货才到账,此配置非常关键,会影响充值以及物流的逻辑,请谨慎修改!"
}

View File

@ -14,7 +14,6 @@ import { Schema as System } from './System';
export interface Schema extends EntityShape {
price: Price;
receivingMethod: 'express' | 'pickup';
paid: Price;
refunded: Price;
title: String<32>;
@ -28,8 +27,6 @@ export interface Schema extends EntityShape {
system: System;
address?: Address;
payAt?: Datetime;
sendAt?: Datetime;
receiveAt?: Datetime;
opers: AccountOper[];
};
@ -52,31 +49,11 @@ export const IActionDef: ActionDef<IAction, IState> = {
is: 'unpaid',
};
export type GState = 'staging' | 'shipping' | 'packaged' | 'unshipped' | 'received' | 'taken' | 'taking';
export type GAction = 'package' | 'send' | 'receive' | 'store' | 'take' | 'startTaking' | 'cancelTaking' | 'completeTaking' | 'turnBack' | 'unship';
export const GActionDef: ActionDef<GAction, GState> = {
stm: {
package: ['unshipped', 'packaged'],
send: ['packaged', 'shipping'],
receive: ['shipping', 'received'],
store: ['unshipped', 'staging'],
unship: [['packaged', 'staging'], 'unshipped'],
turnBack: ['shipping', 'unshipped'],
take: [['staging'], 'taken'],
startTaking: ['staging', 'taking'],
cancelTaking: ['taking', 'staging'],
completeTaking: ['taking', 'taken'],
},
is: 'unshipped',
};
export type Action = IAction | GAction | 'settle';
export type Action = IAction | 'settle';
export const entityDesc: EntityDesc<Schema, Action, '', {
iState: IState,
gState: GState,
receivingMethod: Schema['receivingMethod'];
}> = {
indexes: [
//索引
@ -115,12 +92,10 @@ export const entityDesc: EntityDesc<Schema, Action, '', {
paid: '已支付金额',
refunded: '已退款金额',
iState: '订单状态',
gState: '物流状态',
title: '订单标题',
desc: "订单描述",
timeoutAt: '过期时间',
allowPartialPay: '允许部分支付',
receivingMethod: '配送方式',
creator: '创建者',
entity: '关联对象',
entityId: '关联对象Id',
@ -129,8 +104,6 @@ export const entityDesc: EntityDesc<Schema, Action, '', {
system: '所属系统',
address: '收货地址',
payAt: '付款时间',
sendAt: '发货时间',
receiveAt: '收货时间',
},
action: {
startPaying: '开始支付',
@ -143,17 +116,7 @@ export const entityDesc: EntityDesc<Schema, Action, '', {
refundAll: '完全退款',
refundNone: '退款失败',
refundPartially: '部分退款',
package: '打包',
send: '发货',
store: '暂存',
take: '提货',
receive: '收货',
settle: '结算',
turnBack: '退还',
unship: '入库',
startTaking: '开始提货流程',
completeTaking: '完成提货流程',
cancelTaking: '取消提货流程',
},
v: {
iState: {
@ -167,19 +130,6 @@ export const entityDesc: EntityDesc<Schema, Action, '', {
partiallyRefunded: '已部分退款',
refunding: '退款中',
},
gState: {
unshipped: '未发货',
packaged: '已打包',
shipping: '已发货',
received: '已收货',
staging: '寄存中',
taken: '已提货',
taking: '提货流程中',
},
receivingMethod: {
express: '配送',
pickup: '自提',
}
}
},
},
@ -195,16 +145,7 @@ export const entityDesc: EntityDesc<Schema, Action, '', {
refundAll: '',
refundNone: '',
refundPartially: '',
send: '',
store: '',
take: '',
receive: '',
settle: '',
turnBack: '',
unship: '',
startTaking: '',
completeTaking: '',
cancelTaking: '',
},
color: {
@ -219,19 +160,6 @@ export const entityDesc: EntityDesc<Schema, Action, '', {
partiallyRefunded: '#EDBB99',
refunding: '#FBEEE6'
},
gState: {
unshipped: '#AF601A',
packaged: '#676855',
shipping: '#2874A6',
received: '#1E8449',
staging: '#283747',
taken: '#117A65',
taking: '#FFC107',
},
receivingMethod: {
express: '#5DADE2',
pickup: '#2ECC71',
}
}
}
};

View File

@ -40,6 +40,7 @@ export interface Schema extends EntityShape {
phantom2?: String<32>;
phantom3?: Int<4>;
phantom4?: Int<8>;
phantom5?: Object;
opers: AccountOper[];
autoStart?: Boolean;
};
@ -138,6 +139,7 @@ export const entityDesc: EntityDesc<Schema, Action, '', {
phantom2: '索引项二',
phantom3: '索引项三',
phantom4: '索引项四',
phantom5: '备用项五',
autoStart: '自动开始支付',
},
action: {

View File

@ -1,4 +1,4 @@
export { registerPayClazz as registerPayClazzEntity } from './utils/payClazz';
export { registerPayClazz } from './utils/payClazz';
export { registerPayChannelComponent } from './components/payConfig/system/web.pc';
export { registerFrontendPayRoutine } from './components/pay/detail/index';
export { registerShipSettingComponent } from './components/ship/system/web.pc';

View File

@ -172,7 +172,7 @@ const triggers: Trigger<EntityDict, 'order', BRC>[] = [
return 0;
}
} as UpdateTriggerInTxn<EntityDict, 'order', BRC>,
{
/* {
name: '订单开始提货流程后创建类型为pickup的ship',
entity: 'order',
action: 'startTaking',
@ -212,7 +212,7 @@ const triggers: Trigger<EntityDict, 'order', BRC>[] = [
return orders?.length;
},
}
} */
];
export default triggers;

View File

@ -136,45 +136,7 @@ const triggers: Trigger<EntityDict, 'ship', BRC>[] = [
}
return 1;
}
} as UpdateTriggerInTxn<EntityDict, 'ship', BRC>,
{
name: '当物流创建时将对应的receivingMethod为express的order变为packaged状态',
entity: 'ship',
action: 'create',
when: 'after',
fn: async ({ operation }, context, option) => {
const { data } = operation as EntityDict['ship']['CreateSingle'];
const orders = await context.select('order', {
data: {
id: 1,
gState: 1,
},
filter: {
receivingMethod: 'express',
shipOrder$order: {
shipId: data.id,
}
}
}, { dontCollect: true });
if (orders && orders.length > 0) {
orders.forEach(
ele => assert(ele.gState === 'unshipped')
);
await context.operate('order', {
id: await generateNewIdAsync(),
action: 'package',
data: {},
filter: {
id: {
$in: orders.map(ele => ele.id!),
},
},
}, option);
return orders.length;
}
return 0;
}
} as CreateTrigger<EntityDict, 'ship', BRC>,
} as UpdateTriggerInTxn<EntityDict, 'ship', BRC>,
{
name: '当物流创建时,赋上对应的物流系统对象',
entity: 'ship',
@ -188,114 +150,30 @@ const triggers: Trigger<EntityDict, 'ship', BRC>[] = [
if (data instanceof Array) {
for (const d of data) {
const { shipServiceId, shipOrder$ship } = d;
assert(shipServiceId);
const result = await getShipEntity(shipServiceId, shipOrder$ship!.map(ele => (<EntityDict['shipOrder']['CreateOperationData']>ele.data).orderId!), context);
if (result) {
d.entity = result[0];
d.entityId = result[1];
count++;
if (shipServiceId) {
const result = await getShipEntity(shipServiceId, shipOrder$ship!.map(ele => (<EntityDict['shipOrder']['CreateOperationData']>ele.data).orderId!), context);
if (result) {
d.entity = result[0];
d.entityId = result[1];
count++;
}
}
}
}
else {
const { shipServiceId, shipOrder$ship } = data;
assert(shipServiceId);
const result = await getShipEntity(shipServiceId, shipOrder$ship!.map(ele => (<EntityDict['shipOrder']['CreateOperationData']>ele.data).orderId!), context);
if (result) {
data.entity = result[0];
data.entityId = result[1];
count++;
if (shipServiceId) {
const result = await getShipEntity(shipServiceId, shipOrder$ship!.map(ele => (<EntityDict['shipOrder']['CreateOperationData']>ele.data).orderId!), context);
if (result) {
data.entity = result[0];
data.entityId = result[1];
count++;
}
}
}
return count;
}
} as CreateTrigger<EntityDict, 'ship', BRC>,
{
name: '当物流发货时将对应的order状态变为已发货/提货中',
entity: 'ship',
action: 'ship',
when: 'after',
fn: async ({ operation }, context, option) => {
const { filter } = operation as EntityDict['ship']['Update'];
assert(typeof filter!.id === 'string');
const orders = await context.select('order', {
data: {
id: 1,
gState: 1,
},
filter: {
shipOrder$order: {
shipId: filter!.id,
}
}
}, { dontCollect: true });
const packaged = orders.filter(ele => ele.gState === 'packaged');
if (packaged.length > 0) {
await context.operate('order', {
id: await generateNewIdAsync(),
action: 'send',
data: {},
filter: {
id: {
$in: packaged.map(ele => ele.id!),
},
},
}, option);
}
// const staged = orders.filter(ele => ele.gState === 'staging');
// if (staged.length > 0) {
// await context.operate('order', {
// id: await generateNewIdAsync(),
// action: 'startTaking',
// data: {},
// filter: {
// id: {
// $in: staged.map(ele => ele.id!),
// },
// },
// }, option);
// }
// assert(staged.length + packaged.length === orders.length);
return packaged.length;
}
} as UpdateTriggerInTxn<EntityDict, 'ship', BRC>,
{
name: '当物流取消时将对应的order状态改回packaged/staging',
entity: 'ship',
action: 'cancel',
when: 'after',
fn: async ({ operation }, context, option) => {
const { filter } = operation as EntityDict['ship']['Update'];
assert(typeof filter!.id === 'string');
const orders = await context.select('order', {
data: {
id: 1,
gState: 1,
receivingMethod: 1,
},
filter: {
shipOrder$order: {
shipId: filter!.id,
}
}
}, { dontCollect: true });
if (orders && orders.length > 0) {
await context.operate('order', {
id: await generateNewIdAsync(),
action: 'unship',
data: {},
filter: {
id: {
$in: orders.map(ele => ele.id!),
},
},
}, option);
return orders.length;
}
return 0;
}
} as UpdateTriggerInTxn<EntityDict, 'ship', BRC>,
} as CreateTrigger<EntityDict, 'ship', BRC>,
{
name: '当物流类的ship取消后调用外部接口取消下单',
entity: 'ship',