diff --git a/es/checkers/order.js b/es/checkers/order.js
index 4fc52876..1cf3b97a 100644
--- a/es/checkers/order.js
+++ b/es/checkers/order.js
@@ -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;
diff --git a/es/components/offlineAccount/upsert/web.pc.js b/es/components/offlineAccount/upsert/web.pc.js
index ccceb5be..2ec772b5 100644
--- a/es/components/offlineAccount/upsert/web.pc.js
+++ b/es/components/offlineAccount/upsert/web.pc.js
@@ -41,19 +41,19 @@ export default function render(props) {
});
}} placeholder={t(`placeholder.qrCode.${offlineAccount.type}`)}/>}
}
-
+
{
const taxLossRatio = value;
update({ taxLossRatio });
}}/>
-
+
{
const refundGapDays = value;
update({ refundGapDays });
}}/>
-
+
{
const refundCompensateRatio = value;
update({ refundCompensateRatio });
diff --git a/es/components/wpAccount/config/web.pc.js b/es/components/wpAccount/config/web.pc.js
index 1137966d..f42193b2 100644
--- a/es/components/wpAccount/config/web.pc.js
+++ b/es/components/wpAccount/config/web.pc.js
@@ -17,10 +17,9 @@ export function WpAccount(props) {
{taxLossRatio}%
{refundCompensateRatio}%
{refundGapDays}
- {allowWithdrawTransfer}
+ {t(`common::${!!allowWithdrawTransfer}`)}
{withdrawTransferLossRatio}%
{t(`common::${enabled}`)}
- {t(`common::${needReceiving}`)}
);
if (onUpdate) {
return ( {
diff --git a/es/components/wpAccount/upsert/web.pc.js b/es/components/wpAccount/upsert/web.pc.js
index ff7624bd..1b756537 100644
--- a/es/components/wpAccount/upsert/web.pc.js
+++ b/es/components/wpAccount/upsert/web.pc.js
@@ -60,11 +60,6 @@ export default function render(props) {
{
update({ enabled });
- }}/>
-
-
- {
- update({ needReceiving });
}}/>
);
diff --git a/es/components/wpProduct/config/web.pc.js b/es/components/wpProduct/config/web.pc.js
index e6bfed72..c787d8cc 100644
--- a/es/components/wpProduct/config/web.pc.js
+++ b/es/components/wpProduct/config/web.pc.js
@@ -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 = ( {
+ const U = ( {
clean();
setUpsertId('');
}} closeIcon={null} onOk={async () => {
diff --git a/es/components/wpProduct/upsert/index.js b/es/components/wpProduct/upsert/index.js
index 32b57b64..2fa9508b 100644
--- a/es/components/wpProduct/upsert/index.js
+++ b/es/components/wpProduct/upsert/index.js
@@ -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,
diff --git a/es/components/wpProduct/upsert/locales/zh-CN.json b/es/components/wpProduct/upsert/locales/zh-CN.json
index 1f7faece..fd8c7859 100644
--- a/es/components/wpProduct/upsert/locales/zh-CN.json
+++ b/es/components/wpProduct/upsert/locales/zh-CN.json
@@ -1,5 +1,17 @@
{
"placeholder": {
- "taxLossRatio": "如果配置了产品的手续费,则覆盖微信支付账号上配置的手续费"
+ "taxLossRatio": {
+ "notNull": "产品的手续费会覆盖微信支付帐号上配置的手续费百分比",
+ "null": "将使用关联的微信支付帐号上配置的手续费的手续费百分比"
+ },
+ "refundCompensateRatio": {
+ "notNull": "产品的退款补偿会覆盖微信支付帐号上配置的退款补偿百分比",
+ "null": "将使用关联的微信支付帐号上配置的退款补偿百分比"
+ },
+ "refundGapDays": {
+ "notNull": "产品的退款时限会覆盖微信支付帐号上配置的最大退款天数",
+ "null": "将使用关联的微信支付帐号上配置的最大退款天数"
+ },
+ "needReceiving": "小程序默认需要用户确认收货才到账,此配置非常关键,会影响充值以及物流的逻辑,请谨慎修改!"
}
}
diff --git a/es/components/wpProduct/upsert/web.pc.js b/es/components/wpProduct/upsert/web.pc.js
index 70c61587..64452347 100644
--- a/es/components/wpProduct/upsert/web.pc.js
+++ b/es/components/wpProduct/upsert/web.pc.js
@@ -14,7 +14,7 @@ export default function render(props) {
update({ type, needReceiving: true });
}
else {
- update({ type });
+ update({ type, needReceiving: false });
}
}}/>
@@ -29,13 +29,25 @@ export default function render(props) {
update({ enabled });
}}/>
-
+
{
const taxLossRatio = value;
update({ taxLossRatio });
}}/>
- {wpProduct.type === 'mp' &&
+
+ {
+ const refundCompensateRatio = value;
+ update({ refundCompensateRatio });
+ }}/>
+
+
+ {
+ const refundGapDays = value;
+ update({ refundGapDays });
+ }}/>
+
+ {wpProduct.type === 'mp' &&
{
update({ needReceiving });
}}/>
diff --git a/es/data/i18n.js b/es/data/i18n.js
index c15bc7c2..f524867d 100644
--- a/es/data/i18n.js
+++ b/es/data/i18n.js
@@ -669,7 +669,19 @@ const i18ns = [
position: "src/components/wpProduct/upsert",
data: {
"placeholder": {
- "taxLossRatio": "如果配置了产品的手续费,则覆盖微信支付账号上配置的手续费"
+ "taxLossRatio": {
+ "notNull": "产品的手续费会覆盖微信支付帐号上配置的手续费百分比",
+ "null": "将使用关联的微信支付帐号上配置的手续费的手续费百分比"
+ },
+ "refundCompensateRatio": {
+ "notNull": "产品的退款补偿会覆盖微信支付帐号上配置的退款补偿百分比",
+ "null": "将使用关联的微信支付帐号上配置的退款补偿百分比"
+ },
+ "refundGapDays": {
+ "notNull": "产品的退款时限会覆盖微信支付帐号上配置的最大退款天数",
+ "null": "将使用关联的微信支付帐号上配置的最大退款天数"
+ },
+ "needReceiving": "小程序默认需要用户确认收货才到账,此配置非常关键,会影响充值以及物流的逻辑,请谨慎修改!"
}
}
},
diff --git a/es/entities/AbstactPayProduct.d.ts b/es/entities/AbstactPayProduct.d.ts
new file mode 100644
index 00000000..7c971466
--- /dev/null
+++ b/es/entities/AbstactPayProduct.d.ts
@@ -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;
diff --git a/es/entities/AbstactPayProduct.js b/es/entities/AbstactPayProduct.js
new file mode 100644
index 00000000..7a39961c
--- /dev/null
+++ b/es/entities/AbstactPayProduct.js
@@ -0,0 +1,16 @@
+;
+export const entityDesc = {
+ locales: {
+ zh_CN: {
+ name: '抽象支付产品',
+ attr: {
+ taxLossRatio: '渠道手续费百分比',
+ refundGapDays: '允许最大退款天数',
+ refundCompensateRatio: '退款渠道补偿百分比',
+ needReceiving: '用户确认收货后到账',
+ application: '关联应用',
+ enabled: '是否启用'
+ },
+ },
+ },
+};
diff --git a/es/entities/AbstractPayAccount.js b/es/entities/AbstractPayAccount.js
index 75669d7f..d9b99cf9 100644
--- a/es/entities/AbstractPayAccount.js
+++ b/es/entities/AbstractPayAccount.js
@@ -5,7 +5,7 @@ export const entityDesc = {
name: '抽象支付帐号',
attr: {
taxLossRatio: '渠道手续费百分比',
- refundGapDays: '最大允许退款的天数',
+ refundGapDays: '允许最大退款天数',
refundCompensateRatio: '退款渠道补偿百分比',
allowWithdrawTransfer: '允许提现转账',
withdrawTransferLossRatio: '提现转账费率(百分数)',
diff --git a/es/entities/OfflineAccount.js b/es/entities/OfflineAccount.js
index 89def2e4..4af7b1a6 100644
--- a/es/entities/OfflineAccount.js
+++ b/es/entities/OfflineAccount.js
@@ -8,9 +8,9 @@ export const entityDesc = {
channel: '通道',
name: '用户/帐号',
qrCode: '收款二维码',
- taxLossRatio: '商户号手续费(百分比)',
- refundCompensateRatio: '退款补偿百分比',
- refundGapDays: '(支付后)允许退款的天数',
+ taxLossRatio: '渠道手续费百分比',
+ refundGapDays: '允许最大退款天数',
+ refundCompensateRatio: '退款渠道补偿百分比',
allowWithdrawTransfer: '允许提现转账',
withdrawTransferLossRatio: '提现转账费率(百分数)',
allowDeposit: '允许主动充值',
diff --git a/es/entities/Order.d.ts b/es/entities/Order.d.ts
index 82bd3901..b3c394bf 100644
--- a/es/entities/Order.d.ts
+++ b/es/entities/Order.d.ts
@@ -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;
-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;
-export type Action = IAction | GAction | 'settle';
+export type Action = IAction | 'settle';
export declare const entityDesc: EntityDesc;
diff --git a/es/entities/Order.js b/es/entities/Order.js
index 887fc4df..377ff0c2 100644
--- a/es/entities/Order.js
+++ b/es/entities/Order.js
@@ -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',
- }
}
}
};
diff --git a/es/entities/Pay.d.ts b/es/entities/Pay.d.ts
index e3b0e350..f94a881e 100644
--- a/es/entities/Pay.d.ts
+++ b/es/entities/Pay.d.ts
@@ -31,6 +31,7 @@ export interface Schema extends EntityShape {
phantom2?: String<32>;
phantom3?: Int<4>;
phantom4?: Int<8>;
+ phantom5?: Object;
opers: AccountOper[];
autoStart?: Boolean;
}
diff --git a/es/entities/Pay.js b/es/entities/Pay.js
index 69aece07..10264441 100644
--- a/es/entities/Pay.js
+++ b/es/entities/Pay.js
@@ -86,6 +86,7 @@ export const entityDesc = {
phantom2: '索引项二',
phantom3: '索引项三',
phantom4: '索引项四',
+ phantom5: '备用项五',
autoStart: '自动开始支付',
},
action: {
diff --git a/es/entities/WpAccount.js b/es/entities/WpAccount.js
index 34d4b2fb..a0312168 100644
--- a/es/entities/WpAccount.js
+++ b/es/entities/WpAccount.js
@@ -6,7 +6,7 @@ export const entityDesc = {
attr: {
wechatPay: '微信支付',
taxLossRatio: '渠道手续费百分比',
- refundGapDays: '最大允许退款的天数',
+ refundGapDays: '允许最大退款天数',
refundCompensateRatio: '退款渠道补偿百分比',
allowWithdrawTransfer: '允许提现转账',
withdrawTransferLossRatio: '提现转账费率(百分数)',
diff --git a/es/entities/WpProduct.js b/es/entities/WpProduct.js
index 08dba66e..b3640776 100644
--- a/es/entities/WpProduct.js
+++ b/es/entities/WpProduct.js
@@ -5,7 +5,7 @@ export const entityDesc = {
name: '微信支付产品',
attr: {
taxLossRatio: '渠道手续费百分比',
- refundGapDays: '最大允许退款的天数',
+ refundGapDays: '允许最大退款天数',
refundCompensateRatio: '退款渠道补偿百分比',
needReceiving: '用户确认收货后到账',
application: '关联应用',
diff --git a/es/oak-app-domain/AbstactPayProduct/Schema.d.ts b/es/oak-app-domain/AbstactPayProduct/Schema.d.ts
new file mode 100644
index 00000000..9d2293e5
--- /dev/null
+++ b/es/oak-app-domain/AbstactPayProduct/Schema.d.ts
@@ -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"];
diff --git a/es/oak-app-domain/AbstactPayProduct/Schema.js b/es/oak-app-domain/AbstactPayProduct/Schema.js
new file mode 100644
index 00000000..6a83e4ba
--- /dev/null
+++ b/es/oak-app-domain/AbstactPayProduct/Schema.js
@@ -0,0 +1 @@
+export * from "./_baseSchema";
diff --git a/es/oak-app-domain/AbstactPayProduct/Storage.d.ts b/es/oak-app-domain/AbstactPayProduct/Storage.d.ts
new file mode 100644
index 00000000..a3f0fbbb
--- /dev/null
+++ b/es/oak-app-domain/AbstactPayProduct/Storage.d.ts
@@ -0,0 +1,3 @@
+import { StorageDesc } from "oak-domain/lib/types/Storage";
+import { OpSchema } from "./Schema";
+export declare const desc: StorageDesc;
diff --git a/es/oak-app-domain/AbstactPayProduct/Storage.js b/es/oak-app-domain/AbstactPayProduct/Storage.js
new file mode 100644
index 00000000..d804a181
--- /dev/null
+++ b/es/oak-app-domain/AbstactPayProduct/Storage.js
@@ -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
+};
diff --git a/es/oak-app-domain/AbstactPayProduct/_baseSchema.d.ts b/es/oak-app-domain/AbstactPayProduct/_baseSchema.d.ts
new file mode 100644
index 00000000..70d43385
--- /dev/null
+++ b/es/oak-app-domain/AbstactPayProduct/_baseSchema.d.ts
@@ -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;
+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>;
+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>;
+export type OpAction = OakMakeAction;
+export type OpUpdateAction = "update" | string;
diff --git a/es/oak-app-domain/AbstactPayProduct/_baseSchema.js b/es/oak-app-domain/AbstactPayProduct/_baseSchema.js
new file mode 100644
index 00000000..cb0ff5c3
--- /dev/null
+++ b/es/oak-app-domain/AbstactPayProduct/_baseSchema.js
@@ -0,0 +1 @@
+export {};
diff --git a/es/oak-app-domain/AbstactPayProduct/locales/zh_CN.json b/es/oak-app-domain/AbstactPayProduct/locales/zh_CN.json
new file mode 100644
index 00000000..c99b7a46
--- /dev/null
+++ b/es/oak-app-domain/AbstactPayProduct/locales/zh_CN.json
@@ -0,0 +1,11 @@
+{
+ "name": "抽象支付产品",
+ "attr": {
+ "taxLossRatio": "渠道手续费百分比",
+ "refundGapDays": "允许最大退款天数",
+ "refundCompensateRatio": "退款渠道补偿百分比",
+ "needReceiving": "用户确认收货后到账",
+ "application": "关联应用",
+ "enabled": "是否启用"
+ }
+}
diff --git a/es/oak-app-domain/AbstractPayAccount/locales/zh_CN.json b/es/oak-app-domain/AbstractPayAccount/locales/zh_CN.json
index f99173dc..e0d7da43 100644
--- a/es/oak-app-domain/AbstractPayAccount/locales/zh_CN.json
+++ b/es/oak-app-domain/AbstractPayAccount/locales/zh_CN.json
@@ -2,7 +2,7 @@
"name": "抽象支付帐号",
"attr": {
"taxLossRatio": "渠道手续费百分比",
- "refundGapDays": "最大允许退款的天数",
+ "refundGapDays": "允许最大退款天数",
"refundCompensateRatio": "退款渠道补偿百分比",
"allowWithdrawTransfer": "允许提现转账",
"withdrawTransferLossRatio": "提现转账费率(百分数)",
diff --git a/es/oak-app-domain/ActionDefDict.d.ts b/es/oak-app-domain/ActionDefDict.d.ts
index a433f8d1..24105df4 100644
--- a/es/oak-app-domain/ActionDefDict.d.ts
+++ b/es/oak-app-domain/ActionDefDict.d.ts
@@ -53,7 +53,6 @@ export declare const actionDefDict: {
offlineAccount: {};
order: {
iState: import("oak-domain/lib/types").ActionDef;
- gState: import("oak-domain/lib/types").ActionDef;
};
pay: {
iState: import("oak-domain/lib/types").ActionDef;
diff --git a/es/oak-app-domain/OfflineAccount/locales/zh_CN.json b/es/oak-app-domain/OfflineAccount/locales/zh_CN.json
index 9635e15b..55e7776c 100644
--- a/es/oak-app-domain/OfflineAccount/locales/zh_CN.json
+++ b/es/oak-app-domain/OfflineAccount/locales/zh_CN.json
@@ -5,9 +5,9 @@
"channel": "通道",
"name": "用户/帐号",
"qrCode": "收款二维码",
- "taxLossRatio": "商户号手续费(百分比)",
- "refundCompensateRatio": "退款补偿百分比",
- "refundGapDays": "(支付后)允许退款的天数",
+ "taxLossRatio": "渠道手续费百分比",
+ "refundGapDays": "允许最大退款天数",
+ "refundCompensateRatio": "退款渠道补偿百分比",
"allowWithdrawTransfer": "允许提现转账",
"withdrawTransferLossRatio": "提现转账费率(百分数)",
"allowDeposit": "允许主动充值",
diff --git a/es/oak-app-domain/Order/Action.d.ts b/es/oak-app-domain/Order/Action.d.ts
index 7503e5a3..db93ec9b 100644
--- a/es/oak-app-domain/Order/Action.d.ts
+++ b/es/oak-app-domain/Order/Action.d.ts
@@ -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;
-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;
-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;
- gState: ActionDef;
};
diff --git a/es/oak-app-domain/Order/Action.js b/es/oak-app-domain/Order/Action.js
index a3b82797..685cf1da 100644
--- a/es/oak-app-domain/Order/Action.js
+++ b/es/oak-app-domain/Order/Action.js
@@ -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
};
diff --git a/es/oak-app-domain/Order/Storage.js b/es/oak-app-domain/Order/Storage.js
index 50267600..62197b8b 100644
--- a/es/oak-app-domain/Order/Storage.js
+++ b/es/oak-app-domain/Order/Storage.js
@@ -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",
diff --git a/es/oak-app-domain/Order/Style.js b/es/oak-app-domain/Order/Style.js
index 7f1a56c3..602ea155 100644
--- a/es/oak-app-domain/Order/Style.js
+++ b/es/oak-app-domain/Order/Style.js
@@ -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',
- }
}
};
diff --git a/es/oak-app-domain/Order/_baseSchema.d.ts b/es/oak-app-domain/Order/_baseSchema.d.ts
index c28ef68f..445c9edf 100644
--- a/es/oak-app-domain/Order/_baseSchema.d.ts
+++ b/es/oak-app-domain/Order/_baseSchema.d.ts
@@ -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;
- gState: Q_EnumValue;
} & ExprOp;
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>;
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>;
export type OpAction = OakMakeAction;
diff --git a/es/oak-app-domain/Order/locales/zh_CN.json b/es/oak-app-domain/Order/locales/zh_CN.json
index 70b87692..2373bf06 100644
--- a/es/oak-app-domain/Order/locales/zh_CN.json
+++ b/es/oak-app-domain/Order/locales/zh_CN.json
@@ -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": "自提"
}
}
}
diff --git a/es/oak-app-domain/Pay/Storage.js b/es/oak-app-domain/Pay/Storage.js
index a194400c..4b05344a 100644
--- a/es/oak-app-domain/Pay/Storage.js
+++ b/es/oak-app-domain/Pay/Storage.js
@@ -95,6 +95,9 @@ export const desc = {
signed: true
}
},
+ phantom5: {
+ type: "object"
+ },
autoStart: {
type: "boolean"
},
diff --git a/es/oak-app-domain/Pay/_baseSchema.d.ts b/es/oak-app-domain/Pay/_baseSchema.d.ts
index 950369fc..117dbbc0 100644
--- a/es/oak-app-domain/Pay/_baseSchema.d.ts
+++ b/es/oak-app-domain/Pay/_baseSchema.d.ts
@@ -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;
} & ExprOp;
@@ -82,6 +84,7 @@ export type OpProjection = {
phantom2?: number;
phantom3?: number;
phantom4?: number;
+ phantom5?: number | Object;
autoStart?: number;
iState?: number;
} & Partial>;
diff --git a/es/oak-app-domain/Pay/locales/zh_CN.json b/es/oak-app-domain/Pay/locales/zh_CN.json
index bbd786ad..4c759ed0 100644
--- a/es/oak-app-domain/Pay/locales/zh_CN.json
+++ b/es/oak-app-domain/Pay/locales/zh_CN.json
@@ -22,6 +22,7 @@
"phantom2": "索引项二",
"phantom3": "索引项三",
"phantom4": "索引项四",
+ "phantom5": "备用项五",
"autoStart": "自动开始支付"
},
"action": {
diff --git a/es/oak-app-domain/WpAccount/locales/zh_CN.json b/es/oak-app-domain/WpAccount/locales/zh_CN.json
index df764024..542bb485 100644
--- a/es/oak-app-domain/WpAccount/locales/zh_CN.json
+++ b/es/oak-app-domain/WpAccount/locales/zh_CN.json
@@ -3,7 +3,7 @@
"attr": {
"wechatPay": "微信支付",
"taxLossRatio": "渠道手续费百分比",
- "refundGapDays": "最大允许退款的天数",
+ "refundGapDays": "允许最大退款天数",
"refundCompensateRatio": "退款渠道补偿百分比",
"allowWithdrawTransfer": "允许提现转账",
"withdrawTransferLossRatio": "提现转账费率(百分数)",
diff --git a/es/oak-app-domain/WpProduct/locales/zh_CN.json b/es/oak-app-domain/WpProduct/locales/zh_CN.json
index dff39eda..62beee61 100644
--- a/es/oak-app-domain/WpProduct/locales/zh_CN.json
+++ b/es/oak-app-domain/WpProduct/locales/zh_CN.json
@@ -2,7 +2,7 @@
"name": "微信支付产品",
"attr": {
"taxLossRatio": "渠道手续费百分比",
- "refundGapDays": "最大允许退款的天数",
+ "refundGapDays": "允许最大退款天数",
"refundCompensateRatio": "退款渠道补偿百分比",
"needReceiving": "用户确认收货后到账",
"application": "关联应用",
diff --git a/es/registry.d.ts b/es/registry.d.ts
index f8c39cf0..bc9d2c32 100644
--- a/es/registry.d.ts
+++ b/es/registry.d.ts
@@ -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';
diff --git a/es/registry.js b/es/registry.js
index f8c39cf0..bc9d2c32 100644
--- a/es/registry.js
+++ b/es/registry.js
@@ -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';
diff --git a/es/triggers/order.js b/es/triggers/order.js
index eba51207..5966c157 100644
--- a/es/triggers/order.js
+++ b/es/triggers/order.js
@@ -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;
diff --git a/es/triggers/ship.js b/es/triggers/ship.js
index 8c81221b..110215e3 100644
--- a/es/triggers/ship.js
+++ b/es/triggers/ship.js
@@ -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',
diff --git a/es/utils/payClazz/WechatPay/index.d.ts b/es/utils/payClazz/WechatPay/index.d.ts
index ce1d041a..eeba2b4b 100644
--- a/es/utils/payClazz/WechatPay/index.d.ts
+++ b/es/utils/payClazz/WechatPay/index.d.ts
@@ -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;
diff --git a/lib/checkers/order.js b/lib/checkers/order.js
index 7dfea919..4ef0dcd0 100644
--- a/lib/checkers/order.js
+++ b/lib/checkers/order.js
@@ -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;
diff --git a/lib/data/i18n.js b/lib/data/i18n.js
index ff00bf50..3abc31fa 100644
--- a/lib/data/i18n.js
+++ b/lib/data/i18n.js
@@ -671,7 +671,19 @@ const i18ns = [
position: "src/components/wpProduct/upsert",
data: {
"placeholder": {
- "taxLossRatio": "如果配置了产品的手续费,则覆盖微信支付账号上配置的手续费"
+ "taxLossRatio": {
+ "notNull": "产品的手续费会覆盖微信支付帐号上配置的手续费百分比",
+ "null": "将使用关联的微信支付帐号上配置的手续费的手续费百分比"
+ },
+ "refundCompensateRatio": {
+ "notNull": "产品的退款补偿会覆盖微信支付帐号上配置的退款补偿百分比",
+ "null": "将使用关联的微信支付帐号上配置的退款补偿百分比"
+ },
+ "refundGapDays": {
+ "notNull": "产品的退款时限会覆盖微信支付帐号上配置的最大退款天数",
+ "null": "将使用关联的微信支付帐号上配置的最大退款天数"
+ },
+ "needReceiving": "小程序默认需要用户确认收货才到账,此配置非常关键,会影响充值以及物流的逻辑,请谨慎修改!"
}
}
},
diff --git a/lib/entities/AbstactPayProduct.d.ts b/lib/entities/AbstactPayProduct.d.ts
new file mode 100644
index 00000000..7c971466
--- /dev/null
+++ b/lib/entities/AbstactPayProduct.d.ts
@@ -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;
diff --git a/lib/entities/AbstactPayProduct.js b/lib/entities/AbstactPayProduct.js
new file mode 100644
index 00000000..88583937
--- /dev/null
+++ b/lib/entities/AbstactPayProduct.js
@@ -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: '是否启用'
+ },
+ },
+ },
+};
diff --git a/lib/entities/AbstractPayAccount.js b/lib/entities/AbstractPayAccount.js
index b47ff3a5..619ed33c 100644
--- a/lib/entities/AbstractPayAccount.js
+++ b/lib/entities/AbstractPayAccount.js
@@ -8,7 +8,7 @@ exports.entityDesc = {
name: '抽象支付帐号',
attr: {
taxLossRatio: '渠道手续费百分比',
- refundGapDays: '最大允许退款的天数',
+ refundGapDays: '允许最大退款天数',
refundCompensateRatio: '退款渠道补偿百分比',
allowWithdrawTransfer: '允许提现转账',
withdrawTransferLossRatio: '提现转账费率(百分数)',
diff --git a/lib/entities/OfflineAccount.js b/lib/entities/OfflineAccount.js
index b719917a..f34c472f 100644
--- a/lib/entities/OfflineAccount.js
+++ b/lib/entities/OfflineAccount.js
@@ -11,9 +11,9 @@ exports.entityDesc = {
channel: '通道',
name: '用户/帐号',
qrCode: '收款二维码',
- taxLossRatio: '商户号手续费(百分比)',
- refundCompensateRatio: '退款补偿百分比',
- refundGapDays: '(支付后)允许退款的天数',
+ taxLossRatio: '渠道手续费百分比',
+ refundGapDays: '允许最大退款天数',
+ refundCompensateRatio: '退款渠道补偿百分比',
allowWithdrawTransfer: '允许提现转账',
withdrawTransferLossRatio: '提现转账费率(百分数)',
allowDeposit: '允许主动充值',
diff --git a/lib/entities/Order.d.ts b/lib/entities/Order.d.ts
index 82bd3901..b3c394bf 100644
--- a/lib/entities/Order.d.ts
+++ b/lib/entities/Order.d.ts
@@ -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;
-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;
-export type Action = IAction | GAction | 'settle';
+export type Action = IAction | 'settle';
export declare const entityDesc: EntityDesc;
diff --git a/lib/entities/Order.js b/lib/entities/Order.js
index d9becb0e..e8080160 100644
--- a/lib/entities/Order.js
+++ b/lib/entities/Order.js
@@ -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',
- }
}
}
};
diff --git a/lib/entities/Pay.d.ts b/lib/entities/Pay.d.ts
index e3b0e350..f94a881e 100644
--- a/lib/entities/Pay.d.ts
+++ b/lib/entities/Pay.d.ts
@@ -31,6 +31,7 @@ export interface Schema extends EntityShape {
phantom2?: String<32>;
phantom3?: Int<4>;
phantom4?: Int<8>;
+ phantom5?: Object;
opers: AccountOper[];
autoStart?: Boolean;
}
diff --git a/lib/entities/Pay.js b/lib/entities/Pay.js
index 3842008f..f8a0de91 100644
--- a/lib/entities/Pay.js
+++ b/lib/entities/Pay.js
@@ -89,6 +89,7 @@ exports.entityDesc = {
phantom2: '索引项二',
phantom3: '索引项三',
phantom4: '索引项四',
+ phantom5: '备用项五',
autoStart: '自动开始支付',
},
action: {
diff --git a/lib/entities/WpAccount.js b/lib/entities/WpAccount.js
index 14535380..424bf40a 100644
--- a/lib/entities/WpAccount.js
+++ b/lib/entities/WpAccount.js
@@ -9,7 +9,7 @@ exports.entityDesc = {
attr: {
wechatPay: '微信支付',
taxLossRatio: '渠道手续费百分比',
- refundGapDays: '最大允许退款的天数',
+ refundGapDays: '允许最大退款天数',
refundCompensateRatio: '退款渠道补偿百分比',
allowWithdrawTransfer: '允许提现转账',
withdrawTransferLossRatio: '提现转账费率(百分数)',
diff --git a/lib/entities/WpProduct.js b/lib/entities/WpProduct.js
index aeda3148..3fda4885 100644
--- a/lib/entities/WpProduct.js
+++ b/lib/entities/WpProduct.js
@@ -8,7 +8,7 @@ exports.entityDesc = {
name: '微信支付产品',
attr: {
taxLossRatio: '渠道手续费百分比',
- refundGapDays: '最大允许退款的天数',
+ refundGapDays: '允许最大退款天数',
refundCompensateRatio: '退款渠道补偿百分比',
needReceiving: '用户确认收货后到账',
application: '关联应用',
diff --git a/lib/oak-app-domain/AbstactPayProduct/Schema.d.ts b/lib/oak-app-domain/AbstactPayProduct/Schema.d.ts
new file mode 100644
index 00000000..9d2293e5
--- /dev/null
+++ b/lib/oak-app-domain/AbstactPayProduct/Schema.d.ts
@@ -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"];
diff --git a/lib/oak-app-domain/AbstactPayProduct/Schema.js b/lib/oak-app-domain/AbstactPayProduct/Schema.js
new file mode 100644
index 00000000..63a4184a
--- /dev/null
+++ b/lib/oak-app-domain/AbstactPayProduct/Schema.js
@@ -0,0 +1,4 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+const tslib_1 = require("tslib");
+tslib_1.__exportStar(require("./_baseSchema"), exports);
diff --git a/lib/oak-app-domain/AbstactPayProduct/Storage.d.ts b/lib/oak-app-domain/AbstactPayProduct/Storage.d.ts
new file mode 100644
index 00000000..a3f0fbbb
--- /dev/null
+++ b/lib/oak-app-domain/AbstactPayProduct/Storage.d.ts
@@ -0,0 +1,3 @@
+import { StorageDesc } from "oak-domain/lib/types/Storage";
+import { OpSchema } from "./Schema";
+export declare const desc: StorageDesc;
diff --git a/lib/oak-app-domain/AbstactPayProduct/Storage.js b/lib/oak-app-domain/AbstactPayProduct/Storage.js
new file mode 100644
index 00000000..374dabe4
--- /dev/null
+++ b/lib/oak-app-domain/AbstactPayProduct/Storage.js
@@ -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
+};
diff --git a/lib/oak-app-domain/AbstactPayProduct/_baseSchema.d.ts b/lib/oak-app-domain/AbstactPayProduct/_baseSchema.d.ts
new file mode 100644
index 00000000..70d43385
--- /dev/null
+++ b/lib/oak-app-domain/AbstactPayProduct/_baseSchema.d.ts
@@ -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;
+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>;
+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>;
+export type OpAction = OakMakeAction;
+export type OpUpdateAction = "update" | string;
diff --git a/lib/oak-app-domain/AbstactPayProduct/_baseSchema.js b/lib/oak-app-domain/AbstactPayProduct/_baseSchema.js
new file mode 100644
index 00000000..c8ad2e54
--- /dev/null
+++ b/lib/oak-app-domain/AbstactPayProduct/_baseSchema.js
@@ -0,0 +1,2 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
diff --git a/lib/oak-app-domain/AbstactPayProduct/locales/zh_CN.json b/lib/oak-app-domain/AbstactPayProduct/locales/zh_CN.json
new file mode 100644
index 00000000..c99b7a46
--- /dev/null
+++ b/lib/oak-app-domain/AbstactPayProduct/locales/zh_CN.json
@@ -0,0 +1,11 @@
+{
+ "name": "抽象支付产品",
+ "attr": {
+ "taxLossRatio": "渠道手续费百分比",
+ "refundGapDays": "允许最大退款天数",
+ "refundCompensateRatio": "退款渠道补偿百分比",
+ "needReceiving": "用户确认收货后到账",
+ "application": "关联应用",
+ "enabled": "是否启用"
+ }
+}
diff --git a/lib/oak-app-domain/AbstractPayAccount/locales/zh_CN.json b/lib/oak-app-domain/AbstractPayAccount/locales/zh_CN.json
index f99173dc..e0d7da43 100644
--- a/lib/oak-app-domain/AbstractPayAccount/locales/zh_CN.json
+++ b/lib/oak-app-domain/AbstractPayAccount/locales/zh_CN.json
@@ -2,7 +2,7 @@
"name": "抽象支付帐号",
"attr": {
"taxLossRatio": "渠道手续费百分比",
- "refundGapDays": "最大允许退款的天数",
+ "refundGapDays": "允许最大退款天数",
"refundCompensateRatio": "退款渠道补偿百分比",
"allowWithdrawTransfer": "允许提现转账",
"withdrawTransferLossRatio": "提现转账费率(百分数)",
diff --git a/lib/oak-app-domain/ActionDefDict.d.ts b/lib/oak-app-domain/ActionDefDict.d.ts
index a433f8d1..24105df4 100644
--- a/lib/oak-app-domain/ActionDefDict.d.ts
+++ b/lib/oak-app-domain/ActionDefDict.d.ts
@@ -53,7 +53,6 @@ export declare const actionDefDict: {
offlineAccount: {};
order: {
iState: import("oak-domain/lib/types").ActionDef;
- gState: import("oak-domain/lib/types").ActionDef;
};
pay: {
iState: import("oak-domain/lib/types").ActionDef;
diff --git a/lib/oak-app-domain/OfflineAccount/locales/zh_CN.json b/lib/oak-app-domain/OfflineAccount/locales/zh_CN.json
index 9635e15b..55e7776c 100644
--- a/lib/oak-app-domain/OfflineAccount/locales/zh_CN.json
+++ b/lib/oak-app-domain/OfflineAccount/locales/zh_CN.json
@@ -5,9 +5,9 @@
"channel": "通道",
"name": "用户/帐号",
"qrCode": "收款二维码",
- "taxLossRatio": "商户号手续费(百分比)",
- "refundCompensateRatio": "退款补偿百分比",
- "refundGapDays": "(支付后)允许退款的天数",
+ "taxLossRatio": "渠道手续费百分比",
+ "refundGapDays": "允许最大退款天数",
+ "refundCompensateRatio": "退款渠道补偿百分比",
"allowWithdrawTransfer": "允许提现转账",
"withdrawTransferLossRatio": "提现转账费率(百分数)",
"allowDeposit": "允许主动充值",
diff --git a/lib/oak-app-domain/Order/Action.d.ts b/lib/oak-app-domain/Order/Action.d.ts
index 7503e5a3..db93ec9b 100644
--- a/lib/oak-app-domain/Order/Action.d.ts
+++ b/lib/oak-app-domain/Order/Action.d.ts
@@ -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;
-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;
-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;
- gState: ActionDef;
};
diff --git a/lib/oak-app-domain/Order/Action.js b/lib/oak-app-domain/Order/Action.js
index e699f402..edfb6ab3 100644
--- a/lib/oak-app-domain/Order/Action.js
+++ b/lib/oak-app-domain/Order/Action.js
@@ -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
};
diff --git a/lib/oak-app-domain/Order/Storage.js b/lib/oak-app-domain/Order/Storage.js
index aa7dc52b..3d1ef18a 100644
--- a/lib/oak-app-domain/Order/Storage.js
+++ b/lib/oak-app-domain/Order/Storage.js
@@ -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",
diff --git a/lib/oak-app-domain/Order/Style.js b/lib/oak-app-domain/Order/Style.js
index 55c7e4e5..a452eedb 100644
--- a/lib/oak-app-domain/Order/Style.js
+++ b/lib/oak-app-domain/Order/Style.js
@@ -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',
- }
}
};
diff --git a/lib/oak-app-domain/Order/_baseSchema.d.ts b/lib/oak-app-domain/Order/_baseSchema.d.ts
index c28ef68f..445c9edf 100644
--- a/lib/oak-app-domain/Order/_baseSchema.d.ts
+++ b/lib/oak-app-domain/Order/_baseSchema.d.ts
@@ -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;
- gState: Q_EnumValue;
} & ExprOp;
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>;
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>;
export type OpAction = OakMakeAction;
diff --git a/lib/oak-app-domain/Order/locales/zh_CN.json b/lib/oak-app-domain/Order/locales/zh_CN.json
index 70b87692..2373bf06 100644
--- a/lib/oak-app-domain/Order/locales/zh_CN.json
+++ b/lib/oak-app-domain/Order/locales/zh_CN.json
@@ -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": "自提"
}
}
}
diff --git a/lib/oak-app-domain/Pay/Storage.js b/lib/oak-app-domain/Pay/Storage.js
index 5905b412..660d2b4f 100644
--- a/lib/oak-app-domain/Pay/Storage.js
+++ b/lib/oak-app-domain/Pay/Storage.js
@@ -98,6 +98,9 @@ exports.desc = {
signed: true
}
},
+ phantom5: {
+ type: "object"
+ },
autoStart: {
type: "boolean"
},
diff --git a/lib/oak-app-domain/Pay/_baseSchema.d.ts b/lib/oak-app-domain/Pay/_baseSchema.d.ts
index 950369fc..117dbbc0 100644
--- a/lib/oak-app-domain/Pay/_baseSchema.d.ts
+++ b/lib/oak-app-domain/Pay/_baseSchema.d.ts
@@ -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;
} & ExprOp;
@@ -82,6 +84,7 @@ export type OpProjection = {
phantom2?: number;
phantom3?: number;
phantom4?: number;
+ phantom5?: number | Object;
autoStart?: number;
iState?: number;
} & Partial>;
diff --git a/lib/oak-app-domain/Pay/locales/zh_CN.json b/lib/oak-app-domain/Pay/locales/zh_CN.json
index bbd786ad..4c759ed0 100644
--- a/lib/oak-app-domain/Pay/locales/zh_CN.json
+++ b/lib/oak-app-domain/Pay/locales/zh_CN.json
@@ -22,6 +22,7 @@
"phantom2": "索引项二",
"phantom3": "索引项三",
"phantom4": "索引项四",
+ "phantom5": "备用项五",
"autoStart": "自动开始支付"
},
"action": {
diff --git a/lib/oak-app-domain/WpAccount/locales/zh_CN.json b/lib/oak-app-domain/WpAccount/locales/zh_CN.json
index df764024..542bb485 100644
--- a/lib/oak-app-domain/WpAccount/locales/zh_CN.json
+++ b/lib/oak-app-domain/WpAccount/locales/zh_CN.json
@@ -3,7 +3,7 @@
"attr": {
"wechatPay": "微信支付",
"taxLossRatio": "渠道手续费百分比",
- "refundGapDays": "最大允许退款的天数",
+ "refundGapDays": "允许最大退款天数",
"refundCompensateRatio": "退款渠道补偿百分比",
"allowWithdrawTransfer": "允许提现转账",
"withdrawTransferLossRatio": "提现转账费率(百分数)",
diff --git a/lib/oak-app-domain/WpProduct/locales/zh_CN.json b/lib/oak-app-domain/WpProduct/locales/zh_CN.json
index dff39eda..62beee61 100644
--- a/lib/oak-app-domain/WpProduct/locales/zh_CN.json
+++ b/lib/oak-app-domain/WpProduct/locales/zh_CN.json
@@ -2,7 +2,7 @@
"name": "微信支付产品",
"attr": {
"taxLossRatio": "渠道手续费百分比",
- "refundGapDays": "最大允许退款的天数",
+ "refundGapDays": "允许最大退款天数",
"refundCompensateRatio": "退款渠道补偿百分比",
"needReceiving": "用户确认收货后到账",
"application": "关联应用",
diff --git a/lib/registry.d.ts b/lib/registry.d.ts
index f8c39cf0..bc9d2c32 100644
--- a/lib/registry.d.ts
+++ b/lib/registry.d.ts
@@ -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';
diff --git a/lib/registry.js b/lib/registry.js
index a2a298e9..244fe56c 100644
--- a/lib/registry.js
+++ b/lib/registry.js
@@ -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");
diff --git a/lib/triggers/order.js b/lib/triggers/order.js
index dcbda5ef..0da14527 100644
--- a/lib/triggers/order.js
+++ b/lib/triggers/order.js
@@ -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;
diff --git a/lib/triggers/ship.js b/lib/triggers/ship.js
index 8455f465..5fb8de44 100644
--- a/lib/triggers/ship.js
+++ b/lib/triggers/ship.js
@@ -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',
diff --git a/src/checkers/order.ts b/src/checkers/order.ts
index 088d7b38..379b4de0 100644
--- a/src/checkers/order.ts
+++ b/src/checkers/order.ts
@@ -169,91 +169,6 @@ const checkers: Checker[] = [
);
}
},
- {
- // 订单根据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;
diff --git a/src/components/offlineAccount/upsert/web.pc.tsx b/src/components/offlineAccount/upsert/web.pc.tsx
index effa8711..9988d119 100644
--- a/src/components/offlineAccount/upsert/web.pc.tsx
+++ b/src/components/offlineAccount/upsert/web.pc.tsx
@@ -91,6 +91,7 @@ export default function render(props: WebComponentProps
;
@@ -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 = {
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 = {
- 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 = {
indexes: [
//索引
@@ -115,12 +92,10 @@ export const entityDesc: EntityDesc;
phantom3?: Int<4>;
phantom4?: Int<8>;
+ phantom5?: Object;
opers: AccountOper[];
autoStart?: Boolean;
};
@@ -138,6 +139,7 @@ export const entityDesc: EntityDesc[] = [
return 0;
}
} as UpdateTriggerInTxn,
- {
+ /* {
name: '订单开始提货流程后,创建类型为pickup的ship',
entity: 'order',
action: 'startTaking',
@@ -212,7 +212,7 @@ const triggers: Trigger[] = [
return orders?.length;
},
- }
+ } */
];
export default triggers;
\ No newline at end of file
diff --git a/src/triggers/ship.ts b/src/triggers/ship.ts
index 67c34dc2..08873b4b 100644
--- a/src/triggers/ship.ts
+++ b/src/triggers/ship.ts
@@ -136,45 +136,7 @@ const triggers: Trigger[] = [
}
return 1;
}
- } as UpdateTriggerInTxn,
- {
- 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,
+ } as UpdateTriggerInTxn,
{
name: '当物流创建时,赋上对应的物流系统对象',
entity: 'ship',
@@ -188,114 +150,30 @@ const triggers: Trigger[] = [
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;
}
- } as CreateTrigger,
- {
- 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,
- {
- 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,
+ } as CreateTrigger,
{
name: '当物流类的ship取消后,调用外部接口取消下单',
entity: 'ship',