From 9195d6353d6ace02baae762a4eb43130a699f774 Mon Sep 17 00:00:00 2001 From: Xc Date: Fri, 21 Feb 2025 21:41:48 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4=E4=BA=86shipAccount=E7=9B=B8?= =?UTF-8?q?=E5=85=B3=E7=9A=84=E6=95=B0=E6=8D=AE=E7=BB=93=E6=9E=84=EF=BC=8C?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E4=BA=86wechatMpShip=E5=AF=B9=E8=B1=A1?= =?UTF-8?q?=E7=9A=84=E9=85=8D=E7=BD=AE=E7=BB=84=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- es/checkers/order.js | 32 +++- es/components/account/deposit/index.d.ts | 10 -- es/components/account/deposit/index.js | 117 ------------- es/components/account/deposit/index.json | 10 -- es/components/account/deposit/index.less | 10 -- es/components/account/deposit/index.xml | 27 --- .../account/deposit/locales/zh-CN.json | 11 -- es/components/account/deposit/web.d.ts | 19 -- es/components/account/deposit/web.js | 37 ---- es/components/account/deposit/web.pc.d.ts | 18 -- es/components/account/deposit/web.pc.js | 32 ---- .../account/deposit/web.pc.module.less | 3 - es/components/order/pay/web.d.ts | 2 - es/components/order/pay/web.pc.d.ts | 2 - .../payConfig/upsert/account/index.d.ts | 7 - .../payConfig/upsert/account/index.js | 24 --- .../upsert/account/locales/zh-CN.json | 11 -- es/components/payConfig/upsert/index.d.ts | 17 -- es/components/payConfig/upsert/index.js | 86 --------- .../payConfig/upsert/locales/zh-CN.json | 4 - .../payConfig/upsert/offline/index.d.ts | 7 - .../payConfig/upsert/offline/index.js | 76 -------- .../upsert/offline/locales/zh-CN.json | 8 - .../upsert/offline/web.pc.module.less | 5 - .../payConfig/upsert/wechatPay/index.d.ts | 10 -- .../payConfig/upsert/wechatPay/index.js | 72 -------- .../upsert/wechatPay/locales/zh-CN.json | 24 --- es/components/ship/system/index.d.ts | 3 + es/components/ship/system/index.js | 15 ++ es/components/ship/system/index.json | 1 + es/components/ship/system/locales/zh-CN.json | 5 + es/components/ship/system/web.pc.d.ts | 10 ++ es/components/ship/system/web.pc.js | 38 ++++ es/components/ship/system/web.pc.module.less | 9 + es/components/ship/wechatMpShip/index.d.ts | 3 + es/components/ship/wechatMpShip/index.js | 21 +++ es/components/ship/wechatMpShip/index.json | 1 + .../ship/wechatMpShip/locales/zh-CN.json | 9 + es/components/ship/wechatMpShip/web.pc.d.ts | 7 + es/components/ship/wechatMpShip/web.pc.js | 19 ++ es/components/wpProduct/upsert/index.js | 1 - es/components/wpProduct/upsert/web.pc.js | 7 - es/data/i18n.js | 121 +++---------- es/entities/AbstractPayAccount.d.ts | 13 ++ es/entities/AbstractPayAccount.js | 32 ++++ es/entities/AbstractShipAccount.d.ts | 10 ++ es/entities/AbstractShipAccount.js | 14 ++ es/entities/OfflineAccount.d.ts | 4 +- es/entities/Order.d.ts | 4 +- es/entities/Order.js | 22 ++- es/entities/Ship.d.ts | 2 + es/entities/Ship.js | 2 + es/entities/WechatMpShip.d.ts | 13 ++ es/entities/WechatMpShip.js | 18 ++ es/entities/WpAccount.d.ts | 4 +- es/entities/WpProduct.d.ts | 1 - es/entities/WpProduct.js | 1 - es/features/Pay.d.ts | 2 - es/features/Pay.js | 3 - .../AbstractPayAccount/Action.d.ts | 5 + .../AbstractPayAccount/Action.js | 2 + .../AbstractPayAccount/Schema.d.ts | 19 ++ .../AbstractPayAccount/Schema.js | 1 + .../AbstractPayAccount/Storage.d.ts | 3 + .../AbstractPayAccount/Storage.js | 44 +++++ .../AbstractPayAccount/Style.d.ts | 3 + es/oak-app-domain/AbstractPayAccount/Style.js | 9 + .../AbstractPayAccount/_baseSchema.d.ts | 56 ++++++ .../AbstractPayAccount/_baseSchema.js | 1 + .../AbstractPayAccount/locales/zh_CN.json | 18 ++ .../AbstractShipAccount/Schema.d.ts | 19 ++ .../AbstractShipAccount/Schema.js | 1 + .../AbstractShipAccount/Storage.d.ts | 3 + .../AbstractShipAccount/Storage.js | 34 ++++ .../AbstractShipAccount/_baseSchema.d.ts | 48 +++++ .../AbstractShipAccount/_baseSchema.js | 1 + .../AbstractShipAccount/locales/zh_CN.json | 9 + es/oak-app-domain/ActionDefDict.d.ts | 2 +- es/oak-app-domain/ActionDefDict.js | 4 +- es/oak-app-domain/EntityDict.d.ts | 155 ++++++++++++++--- es/oak-app-domain/Order/Action.d.ts | 4 +- es/oak-app-domain/Order/Action.js | 5 +- es/oak-app-domain/Order/Storage.js | 2 +- es/oak-app-domain/Order/Style.js | 11 ++ es/oak-app-domain/Order/locales/zh_CN.json | 8 +- es/oak-app-domain/Ship/Storage.js | 13 ++ es/oak-app-domain/Ship/_baseSchema.d.ts | 8 + es/oak-app-domain/Ship/locales/zh_CN.json | 2 + es/oak-app-domain/Storage.js | 8 +- es/oak-app-domain/StyleDict.js | 4 +- es/oak-app-domain/WechatMpShip/Schema.d.ts | 19 ++ es/oak-app-domain/WechatMpShip/Schema.js | 1 + es/oak-app-domain/WechatMpShip/Storage.d.ts | 3 + es/oak-app-domain/WechatMpShip/Storage.js | 48 +++++ .../WechatMpShip/_baseSchema.d.ts | 59 +++++++ es/oak-app-domain/WechatMpShip/_baseSchema.js | 1 + .../WechatMpShip/locales/zh_CN.json | 13 ++ es/oak-app-domain/WpProduct/Storage.js | 4 - es/oak-app-domain/WpProduct/_baseSchema.d.ts | 4 - .../WpProduct/locales/zh_CN.json | 1 - es/registry.d.ts | 10 +- es/registry.frontend.d.ts | 3 + es/registry.frontend.js | 3 + es/registry.js | 9 +- es/triggers/deposit.js | 154 ++++++++-------- es/triggers/pay.js | 52 +++--- es/utils/payClazz/WechatPay/WechatPay.js | 2 +- lib/checkers/order.js | 31 ++-- lib/data/i18n.js | 28 +++ lib/entities/AbstractShipAccount.d.ts | 4 +- lib/entities/AbstractShipAccount.js | 2 + lib/entities/WechatMpShip.d.ts | 4 + lib/entities/WechatMpShip.js | 4 + lib/entities/WpProduct.d.ts | 1 - lib/entities/WpProduct.js | 1 - .../AbstractShipAccount/Storage.js | 14 ++ .../AbstractShipAccount/_baseSchema.d.ts | 10 +- .../AbstractShipAccount/locales/zh_CN.json | 4 +- lib/oak-app-domain/EntityDict.d.ts | 17 ++ lib/oak-app-domain/WechatMpShip/Storage.js | 23 +++ .../WechatMpShip/_baseSchema.d.ts | 19 +- .../WechatMpShip/locales/zh_CN.json | 6 +- lib/oak-app-domain/WpProduct/Storage.js | 4 - lib/oak-app-domain/WpProduct/_baseSchema.d.ts | 4 - .../WpProduct/locales/zh_CN.json | 1 - lib/registry.d.ts | 10 +- lib/registry.frontend.d.ts | 3 + lib/registry.frontend.js | 9 + lib/registry.js | 13 +- lib/triggers/deposit.js | 154 ++++++++-------- lib/triggers/pay.js | 52 +++--- lib/triggers/withdraw.d.ts | 2 +- lib/utils/payClazz/WechatPay/WechatPay.js | 2 +- package.json | 1 + src/checkers/order.ts | 31 ++-- src/components/ship/system/index.json | 1 + src/components/ship/system/index.ts | 15 ++ src/components/ship/system/locales/zh-CN.json | 6 + src/components/ship/system/web.pc.module.less | 16 ++ src/components/ship/system/web.pc.tsx | 97 +++++++++++ src/components/ship/wechatMpShip/index.json | 1 + src/components/ship/wechatMpShip/index.ts | 59 +++++++ .../ship/wechatMpShip/locales/zh-CN.json | 10 ++ .../ship/wechatMpShip/upsert/index.json | 1 + .../ship/wechatMpShip/upsert/index.ts | 70 ++++++++ .../wechatMpShip/upsert/locales/zh-CN.json | 7 + .../ship/wechatMpShip/upsert/web.pc.tsx | 78 +++++++++ .../ship/wechatMpShip}/web.pc.module.less | 7 +- src/components/ship/wechatMpShip/web.pc.tsx | 144 +++++++++++++++ src/components/wpProduct/config/index.ts | 1 - src/components/wpProduct/upsert/index.ts | 2 - src/components/wpProduct/upsert/web.pc.tsx | 15 -- src/data/i18n.ts | 28 +++ src/entities/AbstractShipAccount.ts | 4 + src/entities/Ship.ts | 9 + src/entities/WechatMpShip.ts | 6 + src/entities/WpProduct.ts | 2 - src/registry.frontend.ts | 3 + src/registry.ts | 19 +- src/triggers/deposit.ts | 164 +++++++++--------- src/triggers/pay.ts | 52 +++--- src/types/ShipClazz.ts | 22 +++ src/utils/payClazz/WechatPay/WechatPay.ts | 3 +- 163 files changed, 2035 insertions(+), 1245 deletions(-) delete mode 100644 es/components/account/deposit/index.d.ts delete mode 100644 es/components/account/deposit/index.js delete mode 100644 es/components/account/deposit/index.json delete mode 100644 es/components/account/deposit/index.less delete mode 100644 es/components/account/deposit/index.xml delete mode 100644 es/components/account/deposit/locales/zh-CN.json delete mode 100644 es/components/account/deposit/web.d.ts delete mode 100644 es/components/account/deposit/web.js delete mode 100644 es/components/account/deposit/web.pc.d.ts delete mode 100644 es/components/account/deposit/web.pc.js delete mode 100644 es/components/account/deposit/web.pc.module.less delete mode 100644 es/components/payConfig/upsert/account/index.d.ts delete mode 100644 es/components/payConfig/upsert/account/index.js delete mode 100644 es/components/payConfig/upsert/account/locales/zh-CN.json delete mode 100644 es/components/payConfig/upsert/index.d.ts delete mode 100644 es/components/payConfig/upsert/index.js delete mode 100644 es/components/payConfig/upsert/locales/zh-CN.json delete mode 100644 es/components/payConfig/upsert/offline/index.d.ts delete mode 100644 es/components/payConfig/upsert/offline/index.js delete mode 100644 es/components/payConfig/upsert/offline/locales/zh-CN.json delete mode 100644 es/components/payConfig/upsert/offline/web.pc.module.less delete mode 100644 es/components/payConfig/upsert/wechatPay/index.d.ts delete mode 100644 es/components/payConfig/upsert/wechatPay/index.js delete mode 100644 es/components/payConfig/upsert/wechatPay/locales/zh-CN.json create mode 100644 es/components/ship/system/index.d.ts create mode 100644 es/components/ship/system/index.js create mode 100644 es/components/ship/system/index.json create mode 100644 es/components/ship/system/locales/zh-CN.json create mode 100644 es/components/ship/system/web.pc.d.ts create mode 100644 es/components/ship/system/web.pc.js create mode 100644 es/components/ship/system/web.pc.module.less create mode 100644 es/components/ship/wechatMpShip/index.d.ts create mode 100644 es/components/ship/wechatMpShip/index.js create mode 100644 es/components/ship/wechatMpShip/index.json create mode 100644 es/components/ship/wechatMpShip/locales/zh-CN.json create mode 100644 es/components/ship/wechatMpShip/web.pc.d.ts create mode 100644 es/components/ship/wechatMpShip/web.pc.js create mode 100644 es/entities/AbstractPayAccount.d.ts create mode 100644 es/entities/AbstractPayAccount.js create mode 100644 es/entities/AbstractShipAccount.d.ts create mode 100644 es/entities/AbstractShipAccount.js create mode 100644 es/entities/WechatMpShip.d.ts create mode 100644 es/entities/WechatMpShip.js create mode 100644 es/oak-app-domain/AbstractPayAccount/Action.d.ts create mode 100644 es/oak-app-domain/AbstractPayAccount/Action.js create mode 100644 es/oak-app-domain/AbstractPayAccount/Schema.d.ts create mode 100644 es/oak-app-domain/AbstractPayAccount/Schema.js create mode 100644 es/oak-app-domain/AbstractPayAccount/Storage.d.ts create mode 100644 es/oak-app-domain/AbstractPayAccount/Storage.js create mode 100644 es/oak-app-domain/AbstractPayAccount/Style.d.ts create mode 100644 es/oak-app-domain/AbstractPayAccount/Style.js create mode 100644 es/oak-app-domain/AbstractPayAccount/_baseSchema.d.ts create mode 100644 es/oak-app-domain/AbstractPayAccount/_baseSchema.js create mode 100644 es/oak-app-domain/AbstractPayAccount/locales/zh_CN.json create mode 100644 es/oak-app-domain/AbstractShipAccount/Schema.d.ts create mode 100644 es/oak-app-domain/AbstractShipAccount/Schema.js create mode 100644 es/oak-app-domain/AbstractShipAccount/Storage.d.ts create mode 100644 es/oak-app-domain/AbstractShipAccount/Storage.js create mode 100644 es/oak-app-domain/AbstractShipAccount/_baseSchema.d.ts create mode 100644 es/oak-app-domain/AbstractShipAccount/_baseSchema.js create mode 100644 es/oak-app-domain/AbstractShipAccount/locales/zh_CN.json create mode 100644 es/oak-app-domain/WechatMpShip/Schema.d.ts create mode 100644 es/oak-app-domain/WechatMpShip/Schema.js create mode 100644 es/oak-app-domain/WechatMpShip/Storage.d.ts create mode 100644 es/oak-app-domain/WechatMpShip/Storage.js create mode 100644 es/oak-app-domain/WechatMpShip/_baseSchema.d.ts create mode 100644 es/oak-app-domain/WechatMpShip/_baseSchema.js create mode 100644 es/oak-app-domain/WechatMpShip/locales/zh_CN.json create mode 100644 es/registry.frontend.d.ts create mode 100644 es/registry.frontend.js create mode 100644 lib/registry.frontend.d.ts create mode 100644 lib/registry.frontend.js create mode 100644 src/components/ship/system/index.json create mode 100644 src/components/ship/system/index.ts create mode 100644 src/components/ship/system/locales/zh-CN.json create mode 100644 src/components/ship/system/web.pc.module.less create mode 100644 src/components/ship/system/web.pc.tsx create mode 100644 src/components/ship/wechatMpShip/index.json create mode 100644 src/components/ship/wechatMpShip/index.ts create mode 100644 src/components/ship/wechatMpShip/locales/zh-CN.json create mode 100644 src/components/ship/wechatMpShip/upsert/index.json create mode 100644 src/components/ship/wechatMpShip/upsert/index.ts create mode 100644 src/components/ship/wechatMpShip/upsert/locales/zh-CN.json create mode 100644 src/components/ship/wechatMpShip/upsert/web.pc.tsx rename {es/components/payConfig/upsert => src/components/ship/wechatMpShip}/web.pc.module.less (61%) create mode 100644 src/components/ship/wechatMpShip/web.pc.tsx create mode 100644 src/registry.frontend.ts create mode 100644 src/types/ShipClazz.ts diff --git a/es/checkers/order.js b/es/checkers/order.js index e0a94ef5..d15b555f 100644 --- a/es/checkers/order.js +++ b/es/checkers/order.js @@ -164,11 +164,41 @@ const checkers = [ // 订单根据receivingMethod决定货品发送动作 entity: 'order', type: 'row', - action: ['store', 'take'], + action: ['store', 'take', 'startTaking', 'cancelTaking', 'completeTaking'], filter: { receivingMethod: 'pickup', }, }, + { + // 走直接take的order,一定不能有(物流限制的)小程序支付 + entity: 'order', + type: 'row', + action: 'take', + filter: { + shipOrder$order: { + ship: { + entity: { + $exists: false, + }, + }, + }, + } + }, + { + // 走异步take的order,一定要有(物流限制的)小程序支付 + entity: 'order', + type: 'row', + action: 'take', + filter: { + shipOrder$order: { + ship: { + entity: { + $exists: true, + }, + }, + }, + } + }, { entity: 'order', type: 'logicalData', diff --git a/es/components/account/deposit/index.d.ts b/es/components/account/deposit/index.d.ts deleted file mode 100644 index ef42a4b3..00000000 --- a/es/components/account/deposit/index.d.ts +++ /dev/null @@ -1,10 +0,0 @@ -declare const _default: (props: import("oak-frontend-base").ReactComponentProps void; - onSetChannel: (channel: string) => void; - onSetMeta: (meta: any) => void; - channel: string; - meta: any; -}>) => React.ReactElement; -export default _default; diff --git a/es/components/account/deposit/index.js b/es/components/account/deposit/index.js deleted file mode 100644 index a763a02d..00000000 --- a/es/components/account/deposit/index.js +++ /dev/null @@ -1,117 +0,0 @@ -import { ToCent, ToYuan } from 'oak-domain/lib/utils/money'; -import { PAY_CHANNEL_ACCOUNT_NAME, PAY_CHANNEL_OFFLINE_NAME, PAY_ORG_CHANNELS } from '../../../types/PayConfig'; -import assert from 'assert'; -export default OakComponent({ - properties: { - depositMinCent: 0, - depositMaxCent: 1000000, - onSetPrice: (price) => undefined, - onSetChannel: (channel) => undefined, - onSetMeta: (meta) => undefined, - channel: '', - meta: {}, - }, - formData({ data }) { - const payConfig2 = this.features.pay.getPayConfigs(); - let accountConfig; - const payConfig = []; - for (const config of payConfig2) { - if (config.channel === PAY_CHANNEL_ACCOUNT_NAME) { - accountConfig = config; - } - else if (config.channel !== PAY_CHANNEL_OFFLINE_NAME || config.allowUser) { - payConfig.push(config); - } - } - const { depositMaxCent, depositMinCent } = this.props; - const depositLoss = accountConfig?.depositLoss; - const depositLossRatio = accountConfig?.depositLossRatio; - const tips = depositLoss ? depositLossRatio ? this.t('tips.depositLossRatio', { ratio: depositLossRatio }) : this.t('tips.depositLoss') : ''; - return { - depositMax: ToYuan(depositMaxCent), - depositMin: ToYuan(depositMinCent), - account: data, - payConfig, - tips, - }; - }, - features: ['application'], - listeners: { - price() { - this.reRender(); - }, - channel(prev, next) { - // 如果是自动充值,传了depositMinCent,这里切换渠道的时候自动计算一下损耗 - const { price, priceChanged, ratioDelta } = this.state; - if (!priceChanged) { - if (PAY_ORG_CHANNELS.includes(prev.channel) && !PAY_ORG_CHANNELS.includes(next.channel)) { - // 计算损耗 - if (ratioDelta > 0) { - this.onPriceChange(ToYuan(price - ratioDelta), true); - } - } - else if (PAY_ORG_CHANNELS.includes(next.channel) && (!prev.channel || !PAY_ORG_CHANNELS.includes(prev.channel))) { - // 计算损耗 - const ratio = this.features.pay.getDepositRatio(next.channel); - if (ratio > 0) { - const ratioDelta = Math.floor(price * ratio / 100); - this.onPriceChange(ToYuan(price + ratioDelta), true, ratioDelta); - } - } - } - } - }, - methods: { - onPriceChange(price2, strict, ratioDelta) { - if (price2 === null) { - assert(!ratioDelta); - this.props.onSetPrice(price2); - this.setState({ - price: price2, - priceStr: '', - }); - } - else { - let price = ToCent(price2); - this.props.onSetPrice(price); - if (this.props.depositMaxCent && price > this.props.depositMaxCent && !strict) { - price = this.props.depositMaxCent; - } - this.setState({ - price, - priceStr: ToYuan(price), - priceChanged: !strict, - ratioDelta, - }); - } - }, - onDepPriceChangeMp(event) { - const { value } = event.detail; - if (value === null) { - this.onPriceChange(value); - } - else { - const price2 = parseInt(value); - if (!isNaN(price2)) { - this.onPriceChange(price2); - } - } - }, - }, - data: { - onChannelPickMp(channel) { this.props.onSetChannel(channel); }, - onMetaSetMp(meta) { this.props.onSetMeta(meta); }, - price: 0, - priceStr: '', - priceChanged: false, - ratioDelta: 0, - }, - lifetimes: { - ready() { - const { depositMinCent } = this.props; - if (depositMinCent) { - this.onPriceChange(ToYuan(depositMinCent), true); - } - } - } -}); diff --git a/es/components/account/deposit/index.json b/es/components/account/deposit/index.json deleted file mode 100644 index 233bafb5..00000000 --- a/es/components/account/deposit/index.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "usingComponents": { - "l-form": "@oak-frontend-base/miniprogram_npm/lin-ui/form/index", - "l-form-item": "@oak-frontend-base/miniprogram_npm/lin-ui/form-item/index", - "l-input": "@oak-frontend-base/miniprogram_npm/lin-ui/input/index", - "l-button": "@oak-frontend-base/miniprogram_npm/lin-ui/button/index", - "l-notice-bar": "@oak-frontend-base/miniprogram_npm/lin-ui/notice-bar/index", - "pay-channel-picker": "../../pay/channelPicker2/index" - } -} diff --git a/es/components/account/deposit/index.less b/es/components/account/deposit/index.less deleted file mode 100644 index 11da4643..00000000 --- a/es/components/account/deposit/index.less +++ /dev/null @@ -1,10 +0,0 @@ -@import '../../../config/styles/mp/mixins.less'; -@import '../../../config/styles/mp/index.less'; - -.container { - background-color: @oak-bg-color-container; - - .form-label { - align-self: flex-start; - } -} \ No newline at end of file diff --git a/es/components/account/deposit/index.xml b/es/components/account/deposit/index.xml deleted file mode 100644 index be4637f9..00000000 --- a/es/components/account/deposit/index.xml +++ /dev/null @@ -1,27 +0,0 @@ - - - - {{tips}} - - - - - - - - - - - \ No newline at end of file diff --git a/es/components/account/deposit/locales/zh-CN.json b/es/components/account/deposit/locales/zh-CN.json deleted file mode 100644 index 6be2f71d..00000000 --- a/es/components/account/deposit/locales/zh-CN.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "placeholder": "一次最大充值%{max}元", - "label": { - "depPrice": "充值金额", - "channel": "充值渠道" - }, - "tips": { - "depositLoss": "线上充值将按照充值渠道的扣款比例扣除相应费用(一般是0.6%),敬请知晓", - "depositLossRatio": "线上充值将按照%{ratio}%的比例扣除相应费用,敬请知晓" - } -} diff --git a/es/components/account/deposit/web.d.ts b/es/components/account/deposit/web.d.ts deleted file mode 100644 index bddd1e44..00000000 --- a/es/components/account/deposit/web.d.ts +++ /dev/null @@ -1,19 +0,0 @@ -import React from 'react'; -import { WebComponentProps } from 'oak-frontend-base'; -import { EntityDict } from '../../../oak-app-domain'; -import { AccountPayConfig, PayConfig } from '../../../types/PayConfig'; -export default function Render(props: WebComponentProps void; - onSetMeta: (meta: any) => void; - price: number; - priceStr: string | undefined; - channel: string; - meta: any; - depositMin: number; - tips: string; -}, { - onPriceChange: (price: null | number) => void; -}>): React.JSX.Element | null; diff --git a/es/components/account/deposit/web.js b/es/components/account/deposit/web.js deleted file mode 100644 index 2eec1992..00000000 --- a/es/components/account/deposit/web.js +++ /dev/null @@ -1,37 +0,0 @@ -import React from 'react'; -import { Form, Input, NoticeBar } from 'antd-mobile'; -export default function Render(props) { - const { depositMax, payConfig, tips, price, channel, meta, priceStr, onSetChannel, onSetMeta } = props.data; - const { t, onPriceChange } = props.methods; - if (payConfig) { - return (
- {tips && } - {t("label.depPrice")}:} extra={t('common::pay.symbol')}> - { - if (value === '' || value === null) { - onPriceChange(null); - return; - } - const v = parseInt(value); - if (!isNaN(v)) { - onPriceChange(v); - } - }}/> - - {price > 0 && - {t('label.channel')}: - }> - {/* { - onSetChannel(channel); - }} - channel={channel} - meta={meta} - onSetMeta={(meta) => onSetMeta(meta)} - /> */} - } - ); - } - return null; -} diff --git a/es/components/account/deposit/web.pc.d.ts b/es/components/account/deposit/web.pc.d.ts deleted file mode 100644 index 4816374a..00000000 --- a/es/components/account/deposit/web.pc.d.ts +++ /dev/null @@ -1,18 +0,0 @@ -import React from 'react'; -import { WebComponentProps } from 'oak-frontend-base'; -import { EntityDict } from '../../../oak-app-domain'; -import { AccountPayConfig, PayConfig } from '../../../types/PayConfig'; -export default function Render(props: WebComponentProps void; - onSetMeta: (meta: any) => void; - price: number; - channel: string; - meta: any; - depositMin: number; - tips: string; -}, { - onPriceChange: (price: null | number) => void; -}>): React.JSX.Element | null; diff --git a/es/components/account/deposit/web.pc.js b/es/components/account/deposit/web.pc.js deleted file mode 100644 index fe348dcf..00000000 --- a/es/components/account/deposit/web.pc.js +++ /dev/null @@ -1,32 +0,0 @@ -import React from 'react'; -import { Form, InputNumber, Alert } from 'antd'; -import { ToYuan } from 'oak-domain/lib/utils/money'; -import Styles from './web.pc.module.less'; -export default function Render(props) { - const { depositMax, payConfig, price, channel, meta, tips, onSetChannel, onSetMeta } = props.data; - const { t, onPriceChange } = props.methods; - if (payConfig) { - return (
- {tips && } - {t("label.depPrice")}:}> - { - onPriceChange(value); - }}/> - - {price > 0 ? - {t('label.channel')}: - }> - {/* { - onSetChannel(channel); - }} - channel={channel} - meta={meta} - onSetMeta={(meta) => onSetMeta(meta)} - /> */} - :
} - ); - } - return null; -} diff --git a/es/components/account/deposit/web.pc.module.less b/es/components/account/deposit/web.pc.module.less deleted file mode 100644 index 5a5abdb2..00000000 --- a/es/components/account/deposit/web.pc.module.less +++ /dev/null @@ -1,3 +0,0 @@ -.tips { - margin-bottom: 4px; -} \ No newline at end of file diff --git a/es/components/order/pay/web.d.ts b/es/components/order/pay/web.d.ts index 54ef29ef..3c5d9e6f 100644 --- a/es/components/order/pay/web.d.ts +++ b/es/components/order/pay/web.d.ts @@ -1,14 +1,12 @@ import React from 'react'; import { WebComponentProps } from 'oak-frontend-base'; import { EntityDict } from '../../../oak-app-domain'; -import { AccountPayConfig } from '../../../types/PayConfig'; import { PayChannel, PayChannels } from '../../../types/Pay'; export default function Render(props: WebComponentProps void; - t: (k: string) => string; -}): React.JSX.Element; diff --git a/es/components/payConfig/upsert/account/index.js b/es/components/payConfig/upsert/account/index.js deleted file mode 100644 index 90f4629a..00000000 --- a/es/components/payConfig/upsert/account/index.js +++ /dev/null @@ -1,24 +0,0 @@ -import React from 'react'; -import { Alert, Form, Switch, InputNumber } from 'antd'; -export default function Account(props) { - const { t, config, update } = props; - return (
- - - { - config.depositLoss = value; - if (value === false) { - config.depositLossRatio = undefined; - } - update(config); - }}/> - - {config.depositLoss && - - { - config.depositLossRatio = value; - update(config); - }}/> - } - ); -} diff --git a/es/components/payConfig/upsert/account/locales/zh-CN.json b/es/components/payConfig/upsert/account/locales/zh-CN.json deleted file mode 100644 index 78c9c4e6..00000000 --- a/es/components/payConfig/upsert/account/locales/zh-CN.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "tips": "开启后支持向系统帐户内充值,并使用帐户余额进行抵扣、支付、提现等操作,请了解功能后再使用", - "label": { - "depositLossRatio": "充值损耗比例", - "depositLoss": "充值损耗" - }, - "placeholder": { - "depositLossRatio": "若为空,则默认按收费途径的损耗扣除", - "depositLoss": "开启后用户充值有损耗" - } -} diff --git a/es/components/payConfig/upsert/index.d.ts b/es/components/payConfig/upsert/index.d.ts deleted file mode 100644 index cb26e2ed..00000000 --- a/es/components/payConfig/upsert/index.d.ts +++ /dev/null @@ -1,17 +0,0 @@ -import React from 'react'; -import { PayConfig, ConfigBase } from '../../../types/PayConfig'; -type FC = React.FC<{ - config: T; - update: (config: Omit) => void; - t: (k: string) => string; - extra: any; -}>; -export declare function registerPayConfigComponent(channel: string, C: FC): void; -export default function Upsert(props: { - config?: PayConfig | null; - channels: [string, string][]; - serverUrl?: string; - update: (config: PayConfig) => void; - t: (k: string) => string; -}): React.JSX.Element; -export {}; diff --git a/es/components/payConfig/upsert/index.js b/es/components/payConfig/upsert/index.js deleted file mode 100644 index 4d7eb1bd..00000000 --- a/es/components/payConfig/upsert/index.js +++ /dev/null @@ -1,86 +0,0 @@ -import React, { useState } from 'react'; -import { Button, Alert, Modal, Space, Select, Card } from 'antd'; -import { CloseOutlined } from '@ant-design/icons'; -import classnames from 'classnames'; -import WechatPayConfigUpsert from './wechatPay'; -import AccountConfigUpsert from './account'; -import OfflineConfigUpsert from './offline'; -import assert from 'assert'; -import Styles from './web.pc.module.less'; -const PayConfigComponentsDict = { - WECHAT_APP: WechatPayConfigUpsert, - WECHAT_H5: WechatPayConfigUpsert, - WECHAT_JS: WechatPayConfigUpsert, - WECHAT_MP: WechatPayConfigUpsert, - WECHAT_NATIVE: WechatPayConfigUpsert, - ACCOUNT: AccountConfigUpsert, - OFFLINE: OfflineConfigUpsert, -}; -export function registerPayConfigComponent(channel, C) { - PayConfigComponentsDict[channel] = C; -} -export default function Upsert(props) { - const { serverUrl, config, channels, update, t } = props; - const [open, setOpen] = useState(false); - const AddButton = (); - let C = (<> - -
- {AddButton} -
- ); - const availableChannels = channels.filter((ele) => !config?.find(ele2 => ele2.channel === ele[1])); - if (config && config.length > 0) { - C = (
- - {config.map((cf, idx) => { - const { channel } = cf; - const C = PayConfigComponentsDict[channel]; - assert(C); - return ( ele[1] === channel)[0]} style={{ - minWidth: 380, - }} key={idx} extra={
); - } - // 还没有配置config - return (<> - {C} - setOpen(false)} title={t('pickChannel')} onOk={() => { }} footer={null} destroyOnClose={true}> - setOption(currentTarget.value)} onBlur={handleOptionCreated} onPressEnter={handleOptionCreated}/>) : (} onClick={() => setInputVisible(true)}> - {t('newOption')} - )} - - - - { - update({ - ...config, - allowUser: v, - }); - }}/> - - -
); -} diff --git a/es/components/payConfig/upsert/offline/locales/zh-CN.json b/es/components/payConfig/upsert/offline/locales/zh-CN.json deleted file mode 100644 index 62f3e20e..00000000 --- a/es/components/payConfig/upsert/offline/locales/zh-CN.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "tips": "配置后系统允许手动同步来自系统以外的支付", - "newOption": "添加途径", - "tips2": "线下支付说明", - "tipsHolder": "描述用户如何进行线下支付(例如往哪个银行帐号汇款)", - "options": "收银途径", - "allowUser": "用户主动发起" -} diff --git a/es/components/payConfig/upsert/offline/web.pc.module.less b/es/components/payConfig/upsert/offline/web.pc.module.less deleted file mode 100644 index 27fc9a93..00000000 --- a/es/components/payConfig/upsert/offline/web.pc.module.less +++ /dev/null @@ -1,5 +0,0 @@ -.container { - display: flex; - flex-direction: column; - width: 100%; -} \ No newline at end of file diff --git a/es/components/payConfig/upsert/wechatPay/index.d.ts b/es/components/payConfig/upsert/wechatPay/index.d.ts deleted file mode 100644 index 6098d60e..00000000 --- a/es/components/payConfig/upsert/wechatPay/index.d.ts +++ /dev/null @@ -1,10 +0,0 @@ -import { WechatPayConfig } from '../../../../types/PayConfig'; -import React from 'react'; -export default function WechatPay(props: { - config: WechatPayConfig; - update: (config: Omit) => void; - t: (k: string) => string; - extra: { - serverUrl: string; - }; -}): React.JSX.Element; diff --git a/es/components/payConfig/upsert/wechatPay/index.js b/es/components/payConfig/upsert/wechatPay/index.js deleted file mode 100644 index dba753e4..00000000 --- a/es/components/payConfig/upsert/wechatPay/index.js +++ /dev/null @@ -1,72 +0,0 @@ -import React from 'react'; -import { Form, Input, InputNumber, Radio } from 'antd'; -export default function WechatPay(props) { - const { config, update, t, extra: { serverUrl } } = props; - return (
- - { - config.mchId = currentTarget.value; - update(config); - }}/> - - - { - config.privateKeyFilePath = currentTarget.value; - update(config); - }}/> - - - { - config.publicKeyFilePath = currentTarget.value; - update(config); - }}/> - - - { - config.payNotifyUrl = currentTarget.value; - update(config); - }}/> - - - { - config.refundNotifyUrl = currentTarget.value; - update(config); - }}/> - - - { - config.apiV3Key = currentTarget.value; - update(config); - }}/> - - - { - config.lossRatio = value; - update(config); - }}/> - - - { - config.refundGapDays = value; - update(config); - }}/> - - - { - config.refundLossRatio = value; - update(config); - }}/> - - - { - const { value } = target; - config.refundLossFloor = value; - update(config); - }} value={config.refundLossFloor}> - - - - - -
); -} diff --git a/es/components/payConfig/upsert/wechatPay/locales/zh-CN.json b/es/components/payConfig/upsert/wechatPay/locales/zh-CN.json deleted file mode 100644 index 356e8493..00000000 --- a/es/components/payConfig/upsert/wechatPay/locales/zh-CN.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "label": { - "privateKeyFilePath": "私钥文件路径", - "publicKeyFilePath": "公钥文件路径", - "payNotifyUrl": "支付回调URL", - "refundNotifyUrl": "退款回调URL", - "lossRatio": "手续费比例", - "apiV3Key": "apiV3Key", - "refundGapDays": "退款限制天数", - "refundLossRatio": "退款损耗百分比", - "refundLossFloor": "退款取整位数" - }, - "placeholder": { - "privateKeyFilePath": "服务器上存放apiclient_key.pem的路径,注意访问权限", - "publicKeyFilePath": "服务器上存放apiclient_cert.pem的路径,注意访问权限", - "lossRatio": "填百分比(0.6就代表千分之六)", - "payNotifyUrl": "endpoint", - "refundNotifyUrl": "endpoint", - "apiV3Key": "需要登录商户后台获取", - "refundGapDays": "超过这个天数后无法退款", - "refundLossRatio": "退款时将按这个百分比扣除损耗(0.6就代表千分之六)", - "refundLossFloor": "退款时按位向下取整(如按元取整,则忽略角位和分位)" - } -} diff --git a/es/components/ship/system/index.d.ts b/es/components/ship/system/index.d.ts new file mode 100644 index 00000000..8bf853bb --- /dev/null +++ b/es/components/ship/system/index.d.ts @@ -0,0 +1,3 @@ +/// +declare const _default: (props: import("oak-frontend-base").ReactComponentProps) => React.ReactElement; +export default _default; diff --git a/es/components/ship/system/index.js b/es/components/ship/system/index.js new file mode 100644 index 00000000..d00e90e6 --- /dev/null +++ b/es/components/ship/system/index.js @@ -0,0 +1,15 @@ +export default OakComponent({ + entity: 'system', + isList: false, + projection: { + id: 1, + name: 1, + }, + formData({ data }) { + const executable = this.tryExecute(); + return { + system: data, + executable, + }; + } +}); diff --git a/es/components/ship/system/index.json b/es/components/ship/system/index.json new file mode 100644 index 00000000..0967ef42 --- /dev/null +++ b/es/components/ship/system/index.json @@ -0,0 +1 @@ +{} diff --git a/es/components/ship/system/locales/zh-CN.json b/es/components/ship/system/locales/zh-CN.json new file mode 100644 index 00000000..ff92ab23 --- /dev/null +++ b/es/components/ship/system/locales/zh-CN.json @@ -0,0 +1,5 @@ +{ + "tips": { + "header": "Ship模块需要在代码端进行注入" + } +} diff --git a/es/components/ship/system/web.pc.d.ts b/es/components/ship/system/web.pc.d.ts new file mode 100644 index 00000000..0c73941c --- /dev/null +++ b/es/components/ship/system/web.pc.d.ts @@ -0,0 +1,10 @@ +/// +import { EntityDict } from "../../../oak-app-domain"; +import { WebComponentProps } from "oak-frontend-base"; +export declare function registerShipSettingComponent(entity: string, component: (props: { + oakPath: string; + systemId: string; +}) => React.ReactElement): void; +export default function render(props: WebComponentProps): import("react").JSX.Element; diff --git a/es/components/ship/system/web.pc.js b/es/components/ship/system/web.pc.js new file mode 100644 index 00000000..40cf5c6a --- /dev/null +++ b/es/components/ship/system/web.pc.js @@ -0,0 +1,38 @@ +import assert from "assert"; +import { Tabs, Flex, Button, Alert } from 'antd'; +import Styles from './web.pc.module.less'; +const ShipSettingComponentDict = {}; +export function registerShipSettingComponent(entity, component) { + assert(!ShipSettingComponentDict[entity]); + ShipSettingComponentDict[entity] = component; +} +export default function render(props) { + const { oakId, oakFullpath, oakDirty, executable } = props.data; + const { t, execute, clean } = props.methods; + const entities = Object.keys(ShipSettingComponentDict); + if (oakId && oakFullpath && entities.length) { + return ( { + const Comp = ShipSettingComponentDict[entity]; + return { + label: (
+ {t(`${entity}:name`)} +
), + key: entity, + children: ( + + + + + + ) + }; + })}/>); + } + return ( + + ); +} diff --git a/es/components/ship/system/web.pc.module.less b/es/components/ship/system/web.pc.module.less new file mode 100644 index 00000000..08963d9d --- /dev/null +++ b/es/components/ship/system/web.pc.module.less @@ -0,0 +1,9 @@ +.container { + width: 100%; + height: 100%; +} + +.tips { + width: 100%; + height: 100%; +} \ No newline at end of file diff --git a/es/components/ship/wechatMpShip/index.d.ts b/es/components/ship/wechatMpShip/index.d.ts new file mode 100644 index 00000000..05d03f96 --- /dev/null +++ b/es/components/ship/wechatMpShip/index.d.ts @@ -0,0 +1,3 @@ +/// +declare const _default: (props: import("oak-frontend-base").ReactComponentProps) => React.ReactElement; +export default _default; diff --git a/es/components/ship/wechatMpShip/index.js b/es/components/ship/wechatMpShip/index.js new file mode 100644 index 00000000..045955d8 --- /dev/null +++ b/es/components/ship/wechatMpShip/index.js @@ -0,0 +1,21 @@ +export default OakComponent({ + entity: 'wechatMpShip', + projection: { + id: 1, + wpProduct: { + application: { + name: 1, + }, + }, + disabled: 1, + }, + isList: false, + formData({ data }) { + const appName = data.wpProduct?.application.name; + const disabled = data.disabled; + return { + appName, + disabled, + }; + } +}); diff --git a/es/components/ship/wechatMpShip/index.json b/es/components/ship/wechatMpShip/index.json new file mode 100644 index 00000000..0967ef42 --- /dev/null +++ b/es/components/ship/wechatMpShip/index.json @@ -0,0 +1 @@ +{} diff --git a/es/components/ship/wechatMpShip/locales/zh-CN.json b/es/components/ship/wechatMpShip/locales/zh-CN.json new file mode 100644 index 00000000..5d8c2065 --- /dev/null +++ b/es/components/ship/wechatMpShip/locales/zh-CN.json @@ -0,0 +1,9 @@ +{ + "appName": "关联小程序", + "help": { + "disabled": "小程序支付的物流能力默认必须开启,如果您申请的小程序是特殊行业,已向微信申请取消物流能力,在此可以关闭" + }, + "warning": { + "disabled": "注意,小程序要求大部分支付必须与物流进行绑定,若是关闭,可能会造成资金无法正常结转" + } +} diff --git a/es/components/ship/wechatMpShip/web.pc.d.ts b/es/components/ship/wechatMpShip/web.pc.d.ts new file mode 100644 index 00000000..18ff22e2 --- /dev/null +++ b/es/components/ship/wechatMpShip/web.pc.d.ts @@ -0,0 +1,7 @@ +/// +import { EntityDict } from "../../../oak-app-domain"; +import { WebComponentProps } from "oak-frontend-base"; +export default function render(props: WebComponentProps): import("react").JSX.Element | undefined; diff --git a/es/components/ship/wechatMpShip/web.pc.js b/es/components/ship/wechatMpShip/web.pc.js new file mode 100644 index 00000000..debbf289 --- /dev/null +++ b/es/components/ship/wechatMpShip/web.pc.js @@ -0,0 +1,19 @@ +import { Form, Switch, Input } from 'antd'; +export default function render(props) { + const { appName, disabled } = props.data; + const { t, update } = props.methods; + if (appName) { + return (
+ {t("appName")}:}> + + + {t('wechatMpShip:attr.disabled')}} help={t('help.disabled')}> + { + update({ + disabled: value, + }); + }}/> + +
); + } +} diff --git a/es/components/wpProduct/upsert/index.js b/es/components/wpProduct/upsert/index.js index ddbf2a01..8fe078ec 100644 --- a/es/components/wpProduct/upsert/index.js +++ b/es/components/wpProduct/upsert/index.js @@ -51,7 +51,6 @@ export default OakComponent({ this.update({ wpAccountId, enabled: true, - shipping: false, //默认不受发货限制 }); } } diff --git a/es/components/wpProduct/upsert/web.pc.js b/es/components/wpProduct/upsert/web.pc.js index ae36cdd0..f2a77f12 100644 --- a/es/components/wpProduct/upsert/web.pc.js +++ b/es/components/wpProduct/upsert/web.pc.js @@ -22,13 +22,6 @@ export default function render(props) { update({ enabled }); }}/> - {wpProduct.type && wpProduct.type === 'mp' && ( - //仅小程序会受发货限制 - - { - update({ shipping: checked }); - }}/> - )} { const taxLossRatio = value; diff --git a/es/data/i18n.js b/es/data/i18n.js index c87cdda6..b7f14982 100644 --- a/es/data/i18n.js +++ b/es/data/i18n.js @@ -1,23 +1,5 @@ // 本文件为自动编译产生,请勿直接修改 const i18ns = [ - { - id: "a7dab1e9edd21024ad094a553064102d", - namespace: "oak-pay-business-c-account-deposit", - language: "zh-CN", - module: "oak-pay-business", - position: "src/components/account/deposit", - data: { - "placeholder": "一次最大充值%{max}元", - "label": { - "depPrice": "充值金额", - "channel": "充值渠道" - }, - "tips": { - "depositLoss": "线上充值将按照充值渠道的扣款比例扣除相应费用(一般是0.6%),敬请知晓", - "depositLossRatio": "线上充值将按照%{ratio}%的比例扣除相应费用,敬请知晓" - } - } - }, { id: "f86292a7fab630dee76783fe38c35381", namespace: "oak-pay-business-c-account-detail", @@ -294,81 +276,6 @@ const i18ns = [ } } }, - { - id: "b498c969e467aad958efb0c900eb6d27", - namespace: "oak-pay-business-c-payConfig-upsert-account", - language: "zh-CN", - module: "oak-pay-business", - position: "src/components/payConfig/upsert/account", - data: { - "tips": "开启后支持向系统帐户内充值,并使用帐户余额进行抵扣、支付、提现等操作,请了解功能后再使用", - "label": { - "depositLossRatio": "充值损耗比例", - "depositLoss": "充值损耗" - }, - "placeholder": { - "depositLossRatio": "若为空,则默认按收费途径的损耗扣除", - "depositLoss": "开启后用户充值有损耗" - } - } - }, - { - id: "13dd1040fa574f095005854ea31fa913", - namespace: "oak-pay-business-c-payConfig-upsert", - language: "zh-CN", - module: "oak-pay-business", - position: "src/components/payConfig/upsert", - data: { - "tips": "在此创建的支付设置将对所有app有效", - "pickChannel": "选择支付通道" - } - }, - { - id: "4ceac38d67e35b7e9c76f0d2c1ad1e9a", - namespace: "oak-pay-business-c-payConfig-upsert-offline", - language: "zh-CN", - module: "oak-pay-business", - position: "src/components/payConfig/upsert/offline", - data: { - "tips": "配置后系统允许手动同步来自系统以外的支付", - "newOption": "添加途径", - "tips2": "线下支付说明", - "tipsHolder": "描述用户如何进行线下支付(例如往哪个银行帐号汇款)", - "options": "收银途径", - "allowUser": "用户主动发起" - } - }, - { - id: "6fcb5b3689d3f682af148af94b385ae3", - namespace: "oak-pay-business-c-payConfig-upsert-wechatPay", - language: "zh-CN", - module: "oak-pay-business", - position: "src/components/payConfig/upsert/wechatPay", - data: { - "label": { - "privateKeyFilePath": "私钥文件路径", - "publicKeyFilePath": "公钥文件路径", - "payNotifyUrl": "支付回调URL", - "refundNotifyUrl": "退款回调URL", - "lossRatio": "手续费比例", - "apiV3Key": "apiV3Key", - "refundGapDays": "退款限制天数", - "refundLossRatio": "退款损耗百分比", - "refundLossFloor": "退款取整位数" - }, - "placeholder": { - "privateKeyFilePath": "服务器上存放apiclient_key.pem的路径,注意访问权限", - "publicKeyFilePath": "服务器上存放apiclient_cert.pem的路径,注意访问权限", - "lossRatio": "填百分比(0.6就代表千分之六)", - "payNotifyUrl": "endpoint", - "refundNotifyUrl": "endpoint", - "apiV3Key": "需要登录商户后台获取", - "refundGapDays": "超过这个天数后无法退款", - "refundLossRatio": "退款时将按这个百分比扣除损耗(0.6就代表千分之六)", - "refundLossFloor": "退款时按位向下取整(如按元取整,则忽略角位和分位)" - } - } - }, { id: "22243a7fe04843821e798c1a670cb8c9", namespace: "oak-pay-business-c-refund-list", @@ -387,6 +294,34 @@ const i18ns = [ "chargePlz": "请向对应的系统账号中充值,系统会自动调用渠道的退款接口" } }, + { + id: "6259d9c9fa4e09edc7899903219b59e4", + namespace: "oak-pay-business-c-ship-system", + language: "zh-CN", + module: "oak-pay-business", + position: "src/components/ship/system", + data: { + "tips": { + "header": "Ship模块需要在代码端进行注入" + } + } + }, + { + id: "bca82eb1392f291564a68c8ab138feec", + namespace: "oak-pay-business-c-ship-wechatMpShip", + language: "zh-CN", + module: "oak-pay-business", + position: "src/components/ship/wechatMpShip", + data: { + "appName": "关联小程序", + "help": { + "disabled": "小程序支付的物流能力默认必须开启,如果您申请的小程序是特殊行业,已向微信申请取消物流能力,在此可以关闭" + }, + "warning": { + "disabled": "注意,小程序要求大部分支付必须与物流进行绑定,若是关闭,可能会造成资金无法正常结转" + } + } + }, { id: "297eb88cf8a759b3bd882e8bd2eeae5a", namespace: "oak-pay-business-c-shipCompanySystem-list", diff --git a/es/entities/AbstractPayAccount.d.ts b/es/entities/AbstractPayAccount.d.ts new file mode 100644 index 00000000..bb2f173d --- /dev/null +++ b/es/entities/AbstractPayAccount.d.ts @@ -0,0 +1,13 @@ +import { Price, Boolean, Int, Decimal } from 'oak-domain/lib/types/DataType'; +import { EntityShape } from 'oak-domain/lib/types/Entity'; +import { EntityDesc } from 'oak-domain/lib/types'; +export interface Schema extends EntityShape { + taxLossRatio: Decimal<4, 2>; + refundGapDays?: Int<4>; + refundCompensateRatio?: Int<4>; + allowWithdrawTransfer: Boolean; + withdrawTransferLossRatio?: Decimal<4, 2>; + price: Price; +} +export type Action = 'pay' | 'refund' | 'deposit' | 'withdraw' | 'tax'; +export declare const entityDesc: EntityDesc; diff --git a/es/entities/AbstractPayAccount.js b/es/entities/AbstractPayAccount.js new file mode 100644 index 00000000..b87cf9e8 --- /dev/null +++ b/es/entities/AbstractPayAccount.js @@ -0,0 +1,32 @@ +; +export const entityDesc = { + locales: { + zh_CN: { + name: '抽象支付帐号', + attr: { + taxLossRatio: '渠道手续费(百分比)', + refundGapDays: '(支付后)允许退款的天数', + refundCompensateRatio: '退款补偿百分比', + allowWithdrawTransfer: '允许提现转账', + withdrawTransferLossRatio: '提现转账费率(百分数)', + price: '余额', + }, + action: { + pay: '支付', + refund: '退款', + deposit: '充值', + withdraw: '提现', + tax: '渠道费', + } + }, + }, + style: { + icon: { + pay: '', + refund: '', + deposit: '', + withdraw: '', + tax: '', + } + } +}; diff --git a/es/entities/AbstractShipAccount.d.ts b/es/entities/AbstractShipAccount.d.ts new file mode 100644 index 00000000..2d2d2d4b --- /dev/null +++ b/es/entities/AbstractShipAccount.d.ts @@ -0,0 +1,10 @@ +import { String, Int, Decimal } from 'oak-domain/lib/types/DataType'; +import { EntityShape } from 'oak-domain/lib/types/Entity'; +import { EntityDesc } from 'oak-domain/lib/types'; +export interface Schema extends EntityShape { + bizId?: String<128>; + sort: Decimal<4, 10>; + phatom1?: Int<8>; + phatom2?: String<64>; +} +export declare const entityDesc: EntityDesc; diff --git a/es/entities/AbstractShipAccount.js b/es/entities/AbstractShipAccount.js new file mode 100644 index 00000000..746b8e22 --- /dev/null +++ b/es/entities/AbstractShipAccount.js @@ -0,0 +1,14 @@ +; +export const entityDesc = { + locales: { + zh_CN: { + name: '抽象快递帐号', + attr: { + phatom1: '备用属性一', + phatom2: '备用属性二', + bizId: '面单Id', + sort: '排序', + }, + }, + }, +}; diff --git a/es/entities/OfflineAccount.d.ts b/es/entities/OfflineAccount.d.ts index fd1a39d2..2cde380e 100644 --- a/es/entities/OfflineAccount.d.ts +++ b/es/entities/OfflineAccount.d.ts @@ -3,9 +3,9 @@ import { EntityDesc } from 'oak-domain/lib/types'; import { Schema as System } from './System'; import { Schema as Pay } from './Pay'; import { Schema as SysAccountOper } from './SysAccountOper'; -import { Schema as AbstractAccount } from './AbstractAccount'; +import { Schema as AbstractPayAccount } from './AbstractPayAccount'; import { Schema as WithdrawChannel } from './WithdrawChannel'; -export interface Schema extends AbstractAccount { +export interface Schema extends AbstractPayAccount { type: 'bank' | 'alipay' | 'wechat' | 'shouqianba' | 'others'; channel?: String<32>; name?: String<64>; diff --git a/es/entities/Order.d.ts b/es/entities/Order.d.ts index 4a9c1d74..58b6aa38 100644 --- a/es/entities/Order.d.ts +++ b/es/entities/Order.d.ts @@ -28,8 +28,8 @@ export interface Schema extends EntityShape { 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' | 'shipped' | 'unshipped' | 'received' | 'taken'; -export type GAction = 'send' | 'receive' | 'store' | 'take' | 'turnBack' | 'unship'; +export type GState = 'staging' | 'shipped' | 'unshipped' | 'received' | 'taken' | 'taking'; +export type GAction = 'send' | 'receive' | 'store' | 'take' | 'startTaking' | 'cancelTaking' | 'completeTaking' | 'turnBack' | 'unship'; export declare const GActionDef: ActionDef; export type Action = IAction | GAction | 'settle'; export declare const entityDesc: EntityDesc; to?: Address; from?: Address; + entity?: String<32>; + entityId?: String<64>; phantom1?: String<32>; phantom2?: String<32>; phantom3?: Int<4>; diff --git a/es/entities/Ship.js b/es/entities/Ship.js index 7b2ee904..6286d377 100644 --- a/es/entities/Ship.js +++ b/es/entities/Ship.js @@ -48,6 +48,8 @@ export const entityDesc = { to: '收件地址', from: '寄件地址', iState: '状态', + entity: '关联对象', + entityId: '关联对象id', phantom1: '索引项一', phantom2: '索引项二', phantom3: '索引项三', diff --git a/es/entities/WechatMpShip.d.ts b/es/entities/WechatMpShip.d.ts new file mode 100644 index 00000000..78fb5e76 --- /dev/null +++ b/es/entities/WechatMpShip.d.ts @@ -0,0 +1,13 @@ +import { Boolean } from 'oak-domain/lib/types/DataType'; +import { EntityDesc } from 'oak-domain/lib/types'; +import { Schema as System } from './System'; +import { Schema as AbstractShipAccount } from './AbstractShipAccount'; +import { Schema as WpProduct } from './WpProduct'; +import { Schema as Ship } from './Ship'; +export interface Schema extends AbstractShipAccount { + wpProduct: WpProduct; + ships: Ship[]; + disabled: Boolean; + system: System; +} +export declare const entityDesc: EntityDesc; diff --git a/es/entities/WechatMpShip.js b/es/entities/WechatMpShip.js new file mode 100644 index 00000000..0126019a --- /dev/null +++ b/es/entities/WechatMpShip.js @@ -0,0 +1,18 @@ +; +export const entityDesc = { + locales: { + zh_CN: { + name: '微信小程序快递帐号', + attr: { + bizId: '面单Id', + sort: '排序', + phatom1: '备用属性一', + phatom2: '备用属性二', + wpProduct: '关联小程序支付', + disabled: '是否禁用', + ships: '关联快递', + system: '所属系统' + }, + }, + }, +}; diff --git a/es/entities/WpAccount.d.ts b/es/entities/WpAccount.d.ts index 108e65f5..68f2e69a 100644 --- a/es/entities/WpAccount.d.ts +++ b/es/entities/WpAccount.d.ts @@ -3,9 +3,9 @@ import { EntityDesc } from 'oak-domain/lib/types'; import { Schema as WechatPay } from './WechatPay'; import { Schema as System } from './System'; import { Schema as SysAccountOper } from './SysAccountOper'; -import { Schema as AbstractAccount } from './AbstractAccount'; +import { Schema as AbstractPayAccount } from './AbstractPayAccount'; import { Schema as WithdrawChannel } from './WithdrawChannel'; -export interface Schema extends AbstractAccount { +export interface Schema extends AbstractPayAccount { wechatPay: WechatPay; mchId: String<128>; publicKeyFilePath: Text; diff --git a/es/entities/WpProduct.d.ts b/es/entities/WpProduct.d.ts index a293ecc2..439f9c8b 100644 --- a/es/entities/WpProduct.d.ts +++ b/es/entities/WpProduct.d.ts @@ -10,7 +10,6 @@ export interface Schema extends EntityShape { taxLossRatio?: Decimal<4, 2>; application: Application; enabled: Boolean; - shipping: Boolean; pays: Pay[]; } export declare const entityDesc: EntityDesc['application'], locales: BasicFeatures['locales']); getPayChannels(type?: 'deposit' | 'pay', accountId?: string): PayChannels; - getPayConfigs(): PayConfig; calcDepositLoss(price: number, channel: PayChannel): [number, string, any]; getDepositRatio(channel: string): number; } diff --git a/es/features/Pay.js b/es/features/Pay.js index 2fcda584..0ff0a936 100644 --- a/es/features/Pay.js +++ b/es/features/Pay.js @@ -63,9 +63,6 @@ export default class Pay extends Feature { } return channels; } - getPayConfigs() { - throw new Error('method not support anymore'); - } calcDepositLoss(price, channel) { const { entity, entityId } = channel; return getDepositLoss(price, this.application.getApplication()); diff --git a/es/oak-app-domain/AbstractPayAccount/Action.d.ts b/es/oak-app-domain/AbstractPayAccount/Action.d.ts new file mode 100644 index 00000000..bbec0c80 --- /dev/null +++ b/es/oak-app-domain/AbstractPayAccount/Action.d.ts @@ -0,0 +1,5 @@ +import { GenericAction } from "oak-domain/lib/actions/action"; +export type ParticularAction = 'pay' | 'refund' | 'deposit' | 'withdraw' | 'tax'; +export declare const actions: string[]; +export type Action = GenericAction | ParticularAction | string; +export declare const actionDefDict: {}; diff --git a/es/oak-app-domain/AbstractPayAccount/Action.js b/es/oak-app-domain/AbstractPayAccount/Action.js new file mode 100644 index 00000000..31c501f2 --- /dev/null +++ b/es/oak-app-domain/AbstractPayAccount/Action.js @@ -0,0 +1,2 @@ +export const actions = ["count", "stat", "download", "select", "aggregate", "create", "remove", "update", "pay", "refund", "deposit", "withdraw", "tax"]; +export const actionDefDict = {}; diff --git a/es/oak-app-domain/AbstractPayAccount/Schema.d.ts b/es/oak-app-domain/AbstractPayAccount/Schema.d.ts new file mode 100644 index 00000000..957491a1 --- /dev/null +++ b/es/oak-app-domain/AbstractPayAccount/Schema.d.ts @@ -0,0 +1,19 @@ +export * from "./_baseSchema"; +import { AbstractPayAccount } from "../EntityDict"; +export type Schema = AbstractPayAccount["Schema"]; +export type Action = AbstractPayAccount["Action"]; +export type Projection = AbstractPayAccount["Projection"]; +export type Filter = AbstractPayAccount["Filter"]; +export type SortNode = AbstractPayAccount["SortNode"]; +export type Sorter = AbstractPayAccount["Sorter"]; +export type Selection = AbstractPayAccount["Selection"]; +export type Aggregation = AbstractPayAccount["Aggregation"]; +export type CreateOperationData = AbstractPayAccount["CreateOperationData"]; +export type CreateSingle = AbstractPayAccount["CreateSingle"]; +export type CreateMulti = AbstractPayAccount["CreateMulti"]; +export type Create = AbstractPayAccount["Create"]; +export type UpdateOperationData = AbstractPayAccount["UpdateOperationData"]; +export type Update = AbstractPayAccount["Update"]; +export type RemoveOperationData = AbstractPayAccount["RemoveOperationData"]; +export type Remove = AbstractPayAccount["Remove"]; +export type Operation = AbstractPayAccount["Operation"]; diff --git a/es/oak-app-domain/AbstractPayAccount/Schema.js b/es/oak-app-domain/AbstractPayAccount/Schema.js new file mode 100644 index 00000000..6a83e4ba --- /dev/null +++ b/es/oak-app-domain/AbstractPayAccount/Schema.js @@ -0,0 +1 @@ +export * from "./_baseSchema"; diff --git a/es/oak-app-domain/AbstractPayAccount/Storage.d.ts b/es/oak-app-domain/AbstractPayAccount/Storage.d.ts new file mode 100644 index 00000000..a3f0fbbb --- /dev/null +++ b/es/oak-app-domain/AbstractPayAccount/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/AbstractPayAccount/Storage.js b/es/oak-app-domain/AbstractPayAccount/Storage.js new file mode 100644 index 00000000..3995e0af --- /dev/null +++ b/es/oak-app-domain/AbstractPayAccount/Storage.js @@ -0,0 +1,44 @@ +import { actions } from "./Action"; +export const desc = { + attributes: { + taxLossRatio: { + notNull: true, + type: "decimal", + params: { + precision: 4, + scale: 2 + } + }, + refundGapDays: { + type: "int", + params: { + width: 4, + signed: true + } + }, + refundCompensateRatio: { + type: "int", + params: { + width: 4, + signed: true + } + }, + allowWithdrawTransfer: { + notNull: true, + type: "boolean" + }, + withdrawTransferLossRatio: { + type: "decimal", + params: { + precision: 4, + scale: 2 + } + }, + price: { + notNull: true, + type: "money" + } + }, + actionType: "crud", + actions +}; diff --git a/es/oak-app-domain/AbstractPayAccount/Style.d.ts b/es/oak-app-domain/AbstractPayAccount/Style.d.ts new file mode 100644 index 00000000..24c9a5ea --- /dev/null +++ b/es/oak-app-domain/AbstractPayAccount/Style.d.ts @@ -0,0 +1,3 @@ +import { Action, OpSchema } from "./Schema"; +import { StyleDef } from "oak-domain/lib/types/Style"; +export declare const style: StyleDef; diff --git a/es/oak-app-domain/AbstractPayAccount/Style.js b/es/oak-app-domain/AbstractPayAccount/Style.js new file mode 100644 index 00000000..e42b9d3b --- /dev/null +++ b/es/oak-app-domain/AbstractPayAccount/Style.js @@ -0,0 +1,9 @@ +export const style = { + icon: { + pay: '', + refund: '', + deposit: '', + withdraw: '', + tax: '', + } +}; diff --git a/es/oak-app-domain/AbstractPayAccount/_baseSchema.d.ts b/es/oak-app-domain/AbstractPayAccount/_baseSchema.d.ts new file mode 100644 index 00000000..78bbaea5 --- /dev/null +++ b/es/oak-app-domain/AbstractPayAccount/_baseSchema.d.ts @@ -0,0 +1,56 @@ +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 { Action, ParticularAction } from "./Action"; +import { Decimal, Int, Boolean, Price } from "oak-domain/lib/types/DataType"; +export type OpSchema = EntityShape & { + taxLossRatio: Decimal<4, 2>; + refundGapDays?: Int<4> | null; + refundCompensateRatio?: Int<4> | null; + allowWithdrawTransfer: Boolean; + withdrawTransferLossRatio?: Decimal<4, 2> | null; + price: Price; +} & { + [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; + allowWithdrawTransfer: Q_BooleanValue; + withdrawTransferLossRatio: Q_NumberValue; + price: Q_NumberValue; +} & ExprOp; +export type OpProjection = { + "#id"?: NodeId; + [k: string]: any; + id?: number; + $$createAt$$?: number; + $$updateAt$$?: number; + $$seq$$?: number; + taxLossRatio?: number; + refundGapDays?: number; + refundCompensateRatio?: number; + allowWithdrawTransfer?: number; + withdrawTransferLossRatio?: number; + price?: number; +} & Partial>; +export type OpSortAttr = Partial<{ + id: number; + $$createAt$$: number; + $$seq$$: number; + $$updateAt$$: number; + taxLossRatio: number; + refundGapDays: number; + refundCompensateRatio: number; + allowWithdrawTransfer: number; + withdrawTransferLossRatio: number; + price: number; + [k: string]: any; +} | ExprOp>; +export type OpAction = OakMakeAction; +export type OpUpdateAction = "update" | ParticularAction | string; diff --git a/es/oak-app-domain/AbstractPayAccount/_baseSchema.js b/es/oak-app-domain/AbstractPayAccount/_baseSchema.js new file mode 100644 index 00000000..cb0ff5c3 --- /dev/null +++ b/es/oak-app-domain/AbstractPayAccount/_baseSchema.js @@ -0,0 +1 @@ +export {}; diff --git a/es/oak-app-domain/AbstractPayAccount/locales/zh_CN.json b/es/oak-app-domain/AbstractPayAccount/locales/zh_CN.json new file mode 100644 index 00000000..b4d57db2 --- /dev/null +++ b/es/oak-app-domain/AbstractPayAccount/locales/zh_CN.json @@ -0,0 +1,18 @@ +{ + "name": "抽象支付帐号", + "attr": { + "taxLossRatio": "渠道手续费(百分比)", + "refundGapDays": "(支付后)允许退款的天数", + "refundCompensateRatio": "退款补偿百分比", + "allowWithdrawTransfer": "允许提现转账", + "withdrawTransferLossRatio": "提现转账费率(百分数)", + "price": "余额" + }, + "action": { + "pay": "支付", + "refund": "退款", + "deposit": "充值", + "withdraw": "提现", + "tax": "渠道费" + } +} diff --git a/es/oak-app-domain/AbstractShipAccount/Schema.d.ts b/es/oak-app-domain/AbstractShipAccount/Schema.d.ts new file mode 100644 index 00000000..71f09ea6 --- /dev/null +++ b/es/oak-app-domain/AbstractShipAccount/Schema.d.ts @@ -0,0 +1,19 @@ +export * from "./_baseSchema"; +import { AbstractShipAccount } from "../EntityDict"; +export type Schema = AbstractShipAccount["Schema"]; +export type Action = AbstractShipAccount["Action"]; +export type Projection = AbstractShipAccount["Projection"]; +export type Filter = AbstractShipAccount["Filter"]; +export type SortNode = AbstractShipAccount["SortNode"]; +export type Sorter = AbstractShipAccount["Sorter"]; +export type Selection = AbstractShipAccount["Selection"]; +export type Aggregation = AbstractShipAccount["Aggregation"]; +export type CreateOperationData = AbstractShipAccount["CreateOperationData"]; +export type CreateSingle = AbstractShipAccount["CreateSingle"]; +export type CreateMulti = AbstractShipAccount["CreateMulti"]; +export type Create = AbstractShipAccount["Create"]; +export type UpdateOperationData = AbstractShipAccount["UpdateOperationData"]; +export type Update = AbstractShipAccount["Update"]; +export type RemoveOperationData = AbstractShipAccount["RemoveOperationData"]; +export type Remove = AbstractShipAccount["Remove"]; +export type Operation = AbstractShipAccount["Operation"]; diff --git a/es/oak-app-domain/AbstractShipAccount/Schema.js b/es/oak-app-domain/AbstractShipAccount/Schema.js new file mode 100644 index 00000000..6a83e4ba --- /dev/null +++ b/es/oak-app-domain/AbstractShipAccount/Schema.js @@ -0,0 +1 @@ +export * from "./_baseSchema"; diff --git a/es/oak-app-domain/AbstractShipAccount/Storage.d.ts b/es/oak-app-domain/AbstractShipAccount/Storage.d.ts new file mode 100644 index 00000000..a3f0fbbb --- /dev/null +++ b/es/oak-app-domain/AbstractShipAccount/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/AbstractShipAccount/Storage.js b/es/oak-app-domain/AbstractShipAccount/Storage.js new file mode 100644 index 00000000..887b5754 --- /dev/null +++ b/es/oak-app-domain/AbstractShipAccount/Storage.js @@ -0,0 +1,34 @@ +import { genericActions as actions } from "oak-domain/lib/actions/action"; +export const desc = { + attributes: { + bizId: { + type: "varchar", + params: { + length: 128 + } + }, + sort: { + notNull: true, + type: "decimal", + params: { + precision: 4, + scale: 10 + } + }, + phatom1: { + type: "int", + params: { + width: 8, + signed: true + } + }, + phatom2: { + type: "varchar", + params: { + length: 64 + } + } + }, + actionType: "crud", + actions +}; diff --git a/es/oak-app-domain/AbstractShipAccount/_baseSchema.d.ts b/es/oak-app-domain/AbstractShipAccount/_baseSchema.d.ts new file mode 100644 index 00000000..98c409e9 --- /dev/null +++ b/es/oak-app-domain/AbstractShipAccount/_baseSchema.d.ts @@ -0,0 +1,48 @@ +import { Q_DateValue, 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 { String, Decimal, Int } from "oak-domain/lib/types/DataType"; +export type OpSchema = EntityShape & { + bizId?: String<128> | null; + sort: Decimal<4, 10>; + phatom1?: Int<8> | null; + phatom2?: String<64> | null; +} & { + [A in ExpressionKey]?: any; +}; +export type OpAttr = keyof OpSchema; +export type OpFilter = { + id: Q_StringValue; + $$createAt$$: Q_DateValue; + $$seq$$: Q_NumberValue; + $$updateAt$$: Q_DateValue; + bizId: Q_StringValue; + sort: Q_NumberValue; + phatom1: Q_NumberValue; + phatom2: Q_StringValue; +} & ExprOp; +export type OpProjection = { + "#id"?: NodeId; + [k: string]: any; + id?: number; + $$createAt$$?: number; + $$updateAt$$?: number; + $$seq$$?: number; + bizId?: number; + sort?: number; + phatom1?: number; + phatom2?: number; +} & Partial>; +export type OpSortAttr = Partial<{ + id: number; + $$createAt$$: number; + $$seq$$: number; + $$updateAt$$: number; + bizId: number; + sort: number; + phatom1: number; + phatom2: number; + [k: string]: any; +} | ExprOp>; +export type OpAction = OakMakeAction; +export type OpUpdateAction = "update" | string; diff --git a/es/oak-app-domain/AbstractShipAccount/_baseSchema.js b/es/oak-app-domain/AbstractShipAccount/_baseSchema.js new file mode 100644 index 00000000..cb0ff5c3 --- /dev/null +++ b/es/oak-app-domain/AbstractShipAccount/_baseSchema.js @@ -0,0 +1 @@ +export {}; diff --git a/es/oak-app-domain/AbstractShipAccount/locales/zh_CN.json b/es/oak-app-domain/AbstractShipAccount/locales/zh_CN.json new file mode 100644 index 00000000..07080265 --- /dev/null +++ b/es/oak-app-domain/AbstractShipAccount/locales/zh_CN.json @@ -0,0 +1,9 @@ +{ + "name": "抽象快递帐号", + "attr": { + "phatom1": "备用属性一", + "phatom2": "备用属性二", + "bizId": "面单Id", + "sort": "排序" + } +} diff --git a/es/oak-app-domain/ActionDefDict.d.ts b/es/oak-app-domain/ActionDefDict.d.ts index 034d6c64..a433f8d1 100644 --- a/es/oak-app-domain/ActionDefDict.d.ts +++ b/es/oak-app-domain/ActionDefDict.d.ts @@ -43,7 +43,7 @@ export declare const actionDefDict: { wechatPublicTag: { iState: import("oak-domain/lib/types").ActionDef; }; - abstractAccount: {}; + abstractPayAccount: {}; account: { ableState: import("oak-domain/lib/types").ActionDef; }; diff --git a/es/oak-app-domain/ActionDefDict.js b/es/oak-app-domain/ActionDefDict.js index b80fdb4b..5bd2c755 100644 --- a/es/oak-app-domain/ActionDefDict.js +++ b/es/oak-app-domain/ActionDefDict.js @@ -15,7 +15,7 @@ import { actionDefDict as userWechatPublicTag } from "./UserWechatPublicTag/Acti import { actionDefDict as wechatLogin } from "./WechatLogin/Action"; import { actionDefDict as wechatMenu } from "./WechatMenu/Action"; import { actionDefDict as wechatPublicTag } from "./WechatPublicTag/Action"; -import { actionDefDict as abstractAccount } from "./AbstractAccount/Action"; +import { actionDefDict as abstractPayAccount } from "./AbstractPayAccount/Action"; import { actionDefDict as account } from "./Account/Action"; import { actionDefDict as deposit } from "./Deposit/Action"; import { actionDefDict as offlineAccount } from "./OfflineAccount/Action"; @@ -48,7 +48,7 @@ export const actionDefDict = { wechatLogin, wechatMenu, wechatPublicTag, - abstractAccount, + abstractPayAccount, account, deposit, offlineAccount, diff --git a/es/oak-app-domain/EntityDict.d.ts b/es/oak-app-domain/EntityDict.d.ts index 5525fbc3..c77c7cda 100644 --- a/es/oak-app-domain/EntityDict.d.ts +++ b/es/oak-app-domain/EntityDict.d.ts @@ -58,7 +58,8 @@ import * as BaseWechatPublicTag from "./WechatPublicTag/_baseSchema"; import * as BaseWechatQrCode from "./WechatQrCode/_baseSchema"; import * as BaseWechatTemplate from "./WechatTemplate/_baseSchema"; import * as BaseWechatUser from "./WechatUser/_baseSchema"; -import * as BaseAbstractAccount from "./AbstractAccount/_baseSchema"; +import * as BaseAbstractPayAccount from "./AbstractPayAccount/_baseSchema"; +import * as BaseAbstractShipAccount from "./AbstractShipAccount/_baseSchema"; import * as BaseAccount from "./Account/_baseSchema"; import * as BaseAccountOper from "./AccountOper/_baseSchema"; import * as BaseDeposit from "./Deposit/_baseSchema"; @@ -73,6 +74,7 @@ import * as BaseShipCompanySystem from "./ShipCompanySystem/_baseSchema"; import * as BaseShipOrder from "./ShipOrder/_baseSchema"; import * as BaseSysAccountMove from "./SysAccountMove/_baseSchema"; import * as BaseSysAccountOper from "./SysAccountOper/_baseSchema"; +import * as BaseWechatMpShip from "./WechatMpShip/_baseSchema"; import * as BaseWechatPay from "./WechatPay/_baseSchema"; import * as BaseWithdraw from "./Withdraw/_baseSchema"; import * as BaseWithdrawAccount from "./WithdrawAccount/_baseSchema"; @@ -2823,6 +2825,7 @@ export type System = { order$system?: Array>; shipCompanySystem$system?: Array>; sysAccountMove$system?: Array>; + wechatMpShip$system?: Array>; wechatPay$system?: Array>; withdrawAccount$ofSystem?: Array>; withdrawAccount$entity?: Array>; @@ -2840,6 +2843,7 @@ export type System = { order$system$$aggr?: AggregationResult>; shipCompanySystem$system$$aggr?: AggregationResult>; sysAccountMove$system$$aggr?: AggregationResult>; + wechatMpShip$system$$aggr?: AggregationResult>; wechatPay$system$$aggr?: AggregationResult>; withdrawAccount$ofSystem$$aggr?: AggregationResult>; withdrawAccount$entity$$aggr?: AggregationResult>; @@ -2920,6 +2924,12 @@ export type System = { sysAccountMove$system$$aggr?: DeduceAggregation, Omit, SysAccountMove["Sorter"]> & { $entity: "sysAccountMove"; }; + wechatMpShip$system?: OakSelection<"select", Omit, Omit, WechatMpShip["Sorter"]> & { + $entity: "wechatMpShip"; + }; + wechatMpShip$system$$aggr?: DeduceAggregation, Omit, WechatMpShip["Sorter"]> & { + $entity: "wechatMpShip"; + }; wechatPay$system?: OakSelection<"select", Omit, Omit, WechatPay["Sorter"]> & { $entity: "wechatPay"; }; @@ -2965,6 +2975,7 @@ export type System = { order$system: MakeFilter> & SubQueryPredicateMetadata; shipCompanySystem$system: MakeFilter> & SubQueryPredicateMetadata; sysAccountMove$system: MakeFilter> & SubQueryPredicateMetadata; + wechatMpShip$system: MakeFilter> & SubQueryPredicateMetadata; wechatPay$system: MakeFilter> & SubQueryPredicateMetadata; withdrawAccount$ofSystem: MakeFilter> & SubQueryPredicateMetadata; withdrawAccount$entity: MakeFilter> & SubQueryPredicateMetadata; @@ -2996,6 +3007,7 @@ export type System = { order$system?: (OakOperation<"create", Omit | Omit[]> | OakOperation, Order["Filter"]>)[]; shipCompanySystem$system?: (OakOperation<"create", Omit | Omit[]> | OakOperation, ShipCompanySystem["Filter"]>)[]; sysAccountMove$system?: OakOperation<"create", Omit | Omit[]>[]; + wechatMpShip$system?: (OakOperation<"create", Omit | Omit[]> | OakOperation, WechatMpShip["Filter"]>)[]; wechatPay$system?: (OakOperation<"create", Omit | Omit[]> | OakOperation, WechatPay["Filter"]>)[]; withdrawAccount$ofSystem?: (OakOperation<"create", Omit | Omit[]> | OakOperation, WithdrawAccount["Filter"]>)[]; withdrawAccount$entity?: (OakOperation<"create", Omit | Omit[]> | OakOperation, WithdrawAccount["Filter"]>)[]; @@ -3019,6 +3031,7 @@ export type System = { order$system?: (OakOperation<"create", Omit | Omit[]> | OakOperation, Order["Filter"]> | OakOperation<"remove", Order["RemoveOperationData"], Order["Filter"]>)[]; shipCompanySystem$system?: (OakOperation<"create", Omit | Omit[]> | OakOperation, ShipCompanySystem["Filter"]> | OakOperation<"remove", ShipCompanySystem["RemoveOperationData"], ShipCompanySystem["Filter"]>)[]; sysAccountMove$system?: OakOperation<"create", Omit | Omit[]>[]; + wechatMpShip$system?: (OakOperation<"create", Omit | Omit[]> | OakOperation, WechatMpShip["Filter"]> | OakOperation<"remove", WechatMpShip["RemoveOperationData"], WechatMpShip["Filter"]>)[]; wechatPay$system?: (OakOperation<"create", Omit | Omit[]> | OakOperation, WechatPay["Filter"]> | OakOperation<"remove", WechatPay["RemoveOperationData"], WechatPay["Filter"]>)[]; withdrawAccount$ofSystem?: (OakOperation<"create", Omit | Omit[]> | OakOperation, WithdrawAccount["Filter"]> | OakOperation<"remove", WithdrawAccount["RemoveOperationData"], WithdrawAccount["Filter"]>)[]; withdrawAccount$entity?: (OakOperation<"create", Omit | Omit[]> | OakOperation, WithdrawAccount["Filter"]> | OakOperation<"remove", WithdrawAccount["RemoveOperationData"], WithdrawAccount["Filter"]>)[]; @@ -3684,30 +3697,55 @@ export type WechatUser = { Remove: OakOperation<"remove", WechatUser["RemoveOperationData"], WechatUser["Filter"], WechatUser["Sorter"]>; Operation: WechatUser["Create"] | WechatUser["Update"] | WechatUser["Remove"]; }; -export type AbstractAccount = { - OpSchema: BaseAbstractAccount.OpSchema; - Action: BaseAbstractAccount.OpAction; - Schema: BaseAbstractAccount.OpSchema & {}; - Projection: BaseAbstractAccount.OpProjection & {}; - FilterUnit: BaseAbstractAccount.OpFilter & {}; - Filter: MakeFilter; - SortAttr: Partial; +export type AbstractPayAccount = { + OpSchema: BaseAbstractPayAccount.OpSchema; + Action: BaseAbstractPayAccount.OpAction; + Schema: BaseAbstractPayAccount.OpSchema & {}; + Projection: BaseAbstractPayAccount.OpProjection & {}; + FilterUnit: BaseAbstractPayAccount.OpFilter & {}; + Filter: MakeFilter; + SortAttr: Partial; SortNode: { - $attr: AbstractAccount["SortAttr"]; + $attr: AbstractPayAccount["SortAttr"]; $direction?: "asc" | "desc"; }; - Sorter: AbstractAccount["SortNode"][]; - Selection: OakSelection<"select", AbstractAccount["Projection"], AbstractAccount["Filter"], AbstractAccount["Sorter"]>; - Aggregation: DeduceAggregation; - CreateOperationData: FormCreateData; - CreateSingle: OakOperation<"create", AbstractAccount["CreateOperationData"]>; - CreateMulti: OakOperation<"create", Array>; - Create: AbstractAccount["CreateSingle"] | AbstractAccount["CreateMulti"]; - UpdateOperationData: FormUpdateData; - Update: OakOperation; + Sorter: AbstractPayAccount["SortNode"][]; + Selection: OakSelection<"select", AbstractPayAccount["Projection"], AbstractPayAccount["Filter"], AbstractPayAccount["Sorter"]>; + Aggregation: DeduceAggregation; + CreateOperationData: FormCreateData; + CreateSingle: OakOperation<"create", AbstractPayAccount["CreateOperationData"]>; + CreateMulti: OakOperation<"create", Array>; + Create: AbstractPayAccount["CreateSingle"] | AbstractPayAccount["CreateMulti"]; + UpdateOperationData: FormUpdateData; + Update: OakOperation; RemoveOperationData: {}; - Remove: OakOperation<"remove", AbstractAccount["RemoveOperationData"], AbstractAccount["Filter"], AbstractAccount["Sorter"]>; - Operation: AbstractAccount["Create"] | AbstractAccount["Update"] | AbstractAccount["Remove"]; + Remove: OakOperation<"remove", AbstractPayAccount["RemoveOperationData"], AbstractPayAccount["Filter"], AbstractPayAccount["Sorter"]>; + Operation: AbstractPayAccount["Create"] | AbstractPayAccount["Update"] | AbstractPayAccount["Remove"]; +}; +export type AbstractShipAccount = { + OpSchema: BaseAbstractShipAccount.OpSchema; + Action: BaseAbstractShipAccount.OpAction; + Schema: BaseAbstractShipAccount.OpSchema & {}; + Projection: BaseAbstractShipAccount.OpProjection & {}; + FilterUnit: BaseAbstractShipAccount.OpFilter & {}; + Filter: MakeFilter; + SortAttr: Partial; + SortNode: { + $attr: AbstractShipAccount["SortAttr"]; + $direction?: "asc" | "desc"; + }; + Sorter: AbstractShipAccount["SortNode"][]; + Selection: OakSelection<"select", AbstractShipAccount["Projection"], AbstractShipAccount["Filter"], AbstractShipAccount["Sorter"]>; + Aggregation: DeduceAggregation; + CreateOperationData: FormCreateData; + CreateSingle: OakOperation<"create", AbstractShipAccount["CreateOperationData"]>; + CreateMulti: OakOperation<"create", Array>; + Create: AbstractShipAccount["CreateSingle"] | AbstractShipAccount["CreateMulti"]; + UpdateOperationData: FormUpdateData; + Update: OakOperation; + RemoveOperationData: {}; + Remove: OakOperation<"remove", AbstractShipAccount["RemoveOperationData"], AbstractShipAccount["Filter"], AbstractShipAccount["Sorter"]>; + Operation: AbstractShipAccount["Create"] | AbstractShipAccount["Update"] | AbstractShipAccount["Remove"]; }; export type Account = { OpSchema: BaseAccount.OpSchema; @@ -4347,6 +4385,7 @@ export type Ship = { shipCompany?: ShipCompany["Schema"]; to?: Address["Schema"]; from?: Address["Schema"]; + wechatMpShip?: WechatMpShip["Schema"]; deposit$ship?: Array>; shipOrder$ship?: Array>; deposit$ship$$aggr?: AggregationResult>; @@ -4356,6 +4395,7 @@ export type Ship = { shipCompany?: ShipCompany["Projection"]; to?: Address["Projection"]; from?: Address["Projection"]; + wechatMpShip?: WechatMpShip["Projection"]; deposit$ship?: OakSelection<"select", Omit, Omit, Deposit["Sorter"]> & { $entity: "deposit"; }; @@ -4373,6 +4413,7 @@ export type Ship = { shipCompany: MakeFilter; to: MakeFilter; from: MakeFilter; + wechatMpShip: MakeFilter; deposit$ship: MakeFilter> & SubQueryPredicateMetadata; shipOrder$ship: MakeFilter> & SubQueryPredicateMetadata; }; @@ -4381,6 +4422,7 @@ export type Ship = { shipCompany: ShipCompany["SortAttr"]; to: Address["SortAttr"]; from: Address["SortAttr"]; + wechatMpShip: WechatMpShip["SortAttr"]; }>; SortNode: { $attr: Ship["SortAttr"]; @@ -4393,6 +4435,7 @@ export type Ship = { shipCompany?: OakOperation<"create", ShipCompany["CreateOperationData"]> | OakOperation; to?: OakOperation<"create", Address["CreateOperationData"]> | OakOperation; from?: OakOperation<"create", Address["CreateOperationData"]> | OakOperation; + wechatMpShip?: OakOperation<"create", WechatMpShip["CreateOperationData"]> | OakOperation; deposit$ship?: (OakOperation<"create", Omit | Omit[]> | OakOperation, Deposit["Filter"]>)[]; shipOrder$ship?: (OakOperation<"create", Omit | Omit[]> | OakOperation, ShipOrder["Filter"]>)[]; }>; @@ -4403,6 +4446,7 @@ export type Ship = { shipCompany?: OakOperation<"create", ShipCompany["CreateOperationData"]> | OakOperation | OakOperation<"remove", ShipCompany["RemoveOperationData"], ShipCompany["Filter"]>; to?: OakOperation<"create", Address["CreateOperationData"]> | OakOperation | OakOperation<"remove", Address["RemoveOperationData"], Address["Filter"]>; from?: OakOperation<"create", Address["CreateOperationData"]> | OakOperation | OakOperation<"remove", Address["RemoveOperationData"], Address["Filter"]>; + wechatMpShip?: OakOperation<"create", WechatMpShip["CreateOperationData"]> | OakOperation | OakOperation<"remove", WechatMpShip["RemoveOperationData"], WechatMpShip["Filter"]>; deposit$ship?: (OakOperation<"create", Omit | Omit[]> | OakOperation, Deposit["Filter"]> | OakOperation<"remove", Deposit["RemoveOperationData"], Deposit["Filter"]>)[]; shipOrder$ship?: (OakOperation<"create", Omit | Omit[]> | OakOperation, ShipOrder["Filter"]> | OakOperation<"remove", ShipOrder["RemoveOperationData"], ShipOrder["Filter"]>)[]; }>; @@ -4670,6 +4714,60 @@ export type SysAccountOper = { Remove: OakOperation<"remove", SysAccountOper["RemoveOperationData"], SysAccountOper["Filter"], SysAccountOper["Sorter"]>; Operation: SysAccountOper["Create"] | SysAccountOper["Update"] | SysAccountOper["Remove"]; }; +export type WechatMpShip = { + OpSchema: BaseWechatMpShip.OpSchema; + Action: BaseWechatMpShip.OpAction; + Schema: BaseWechatMpShip.OpSchema & { + wpProduct: WpProduct["Schema"]; + system: System["Schema"]; + ship$entity?: Array>; + ship$entity$$aggr?: AggregationResult>; + }; + Projection: BaseWechatMpShip.OpProjection & { + wpProduct?: WpProduct["Projection"]; + system?: System["Projection"]; + ship$entity?: OakSelection<"select", Omit, Omit, Ship["Sorter"]> & { + $entity: "ship"; + }; + ship$entity$$aggr?: DeduceAggregation, Omit, Ship["Sorter"]> & { + $entity: "ship"; + }; + }; + FilterUnit: BaseWechatMpShip.OpFilter & { + wpProduct: MakeFilter; + system: MakeFilter; + ship$entity: MakeFilter> & SubQueryPredicateMetadata; + }; + Filter: MakeFilter; + SortAttr: Partial; + SortNode: { + $attr: WechatMpShip["SortAttr"]; + $direction?: "asc" | "desc"; + }; + Sorter: WechatMpShip["SortNode"][]; + Selection: OakSelection<"select", WechatMpShip["Projection"], WechatMpShip["Filter"], WechatMpShip["Sorter"]>; + Aggregation: DeduceAggregation; + CreateOperationData: FormCreateData | OakOperation; + system?: OakOperation<"create", System["CreateOperationData"]> | OakOperation; + ship$entity?: (OakOperation<"create", Omit | Omit[]> | OakOperation, Ship["Filter"]>)[]; + }>; + CreateSingle: OakOperation<"create", WechatMpShip["CreateOperationData"]>; + CreateMulti: OakOperation<"create", Array>; + Create: WechatMpShip["CreateSingle"] | WechatMpShip["CreateMulti"]; + UpdateOperationData: FormUpdateData | OakOperation | OakOperation<"remove", WpProduct["RemoveOperationData"], WpProduct["Filter"]>; + system?: OakOperation<"create", System["CreateOperationData"]> | OakOperation | OakOperation<"remove", System["RemoveOperationData"], System["Filter"]>; + ship$entity?: (OakOperation<"create", Omit | Omit[]> | OakOperation, Ship["Filter"]> | OakOperation<"remove", Ship["RemoveOperationData"], Ship["Filter"]>)[]; + }>; + Update: OakOperation; + RemoveOperationData: {}; + Remove: OakOperation<"remove", WechatMpShip["RemoveOperationData"], WechatMpShip["Filter"], WechatMpShip["Sorter"]>; + Operation: WechatMpShip["Create"] | WechatMpShip["Update"] | WechatMpShip["Remove"]; +}; export type WechatPay = { OpSchema: BaseWechatPay.OpSchema; Action: BaseWechatPay.OpAction; @@ -5079,12 +5177,20 @@ export type WpProduct = { Schema: BaseWpProduct.OpSchema & { wpAccount: WpAccount["Schema"]; application: Application["Schema"]; + wechatMpShip$wpProduct?: Array>; pay$entity?: Array>; + wechatMpShip$wpProduct$$aggr?: AggregationResult>; pay$entity$$aggr?: AggregationResult>; }; Projection: BaseWpProduct.OpProjection & { wpAccount?: WpAccount["Projection"]; application?: Application["Projection"]; + wechatMpShip$wpProduct?: OakSelection<"select", Omit, Omit, WechatMpShip["Sorter"]> & { + $entity: "wechatMpShip"; + }; + wechatMpShip$wpProduct$$aggr?: DeduceAggregation, Omit, WechatMpShip["Sorter"]> & { + $entity: "wechatMpShip"; + }; pay$entity?: OakSelection<"select", Omit, Omit, Pay["Sorter"]> & { $entity: "pay"; }; @@ -5095,6 +5201,7 @@ export type WpProduct = { FilterUnit: BaseWpProduct.OpFilter & { wpAccount: MakeFilter; application: MakeFilter; + wechatMpShip$wpProduct: MakeFilter> & SubQueryPredicateMetadata; pay$entity: MakeFilter> & SubQueryPredicateMetadata; }; Filter: MakeFilter; @@ -5112,6 +5219,7 @@ export type WpProduct = { CreateOperationData: FormCreateData | OakOperation; application?: OakOperation<"create", Application["CreateOperationData"]> | OakOperation; + wechatMpShip$wpProduct?: (OakOperation<"create", Omit | Omit[]> | OakOperation, WechatMpShip["Filter"]>)[]; pay$entity?: (OakOperation<"create", Omit | Omit[]> | OakOperation, Pay["Filter"]>)[]; }>; CreateSingle: OakOperation<"create", WpProduct["CreateOperationData"]>; @@ -5120,6 +5228,7 @@ export type WpProduct = { UpdateOperationData: FormUpdateData | OakOperation | OakOperation<"remove", WpAccount["RemoveOperationData"], WpAccount["Filter"]>; application?: OakOperation<"create", Application["CreateOperationData"]> | OakOperation | OakOperation<"remove", Application["RemoveOperationData"], Application["Filter"]>; + wechatMpShip$wpProduct?: (OakOperation<"create", Omit | Omit[]> | OakOperation, WechatMpShip["Filter"]> | OakOperation<"remove", WechatMpShip["RemoveOperationData"], WechatMpShip["Filter"]>)[]; pay$entity?: (OakOperation<"create", Omit | Omit[]> | OakOperation, Pay["Filter"]> | OakOperation<"remove", Pay["RemoveOperationData"], Pay["Filter"]>)[]; }>; Update: OakOperation; @@ -5186,7 +5295,8 @@ export type EntityDict = { wechatQrCode: WechatQrCode; wechatTemplate: WechatTemplate; wechatUser: WechatUser; - abstractAccount: AbstractAccount; + abstractPayAccount: AbstractPayAccount; + abstractShipAccount: AbstractShipAccount; account: Account; accountOper: AccountOper; deposit: Deposit; @@ -5201,6 +5311,7 @@ export type EntityDict = { shipOrder: ShipOrder; sysAccountMove: SysAccountMove; sysAccountOper: SysAccountOper; + wechatMpShip: WechatMpShip; wechatPay: WechatPay; withdraw: Withdraw; withdrawAccount: WithdrawAccount; diff --git a/es/oak-app-domain/Order/Action.d.ts b/es/oak-app-domain/Order/Action.d.ts index 8476a233..ffadb030 100644 --- a/es/oak-app-domain/Order/Action.d.ts +++ b/es/oak-app-domain/Order/Action.d.ts @@ -3,8 +3,8 @@ 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' | 'shipped' | 'unshipped' | 'received' | 'taken' | string; -export type GAction = 'send' | 'receive' | 'store' | 'take' | 'turnBack' | 'unship' | string; +export type GState = 'staging' | 'shipped' | 'unshipped' | 'received' | 'taken' | 'taking' | string; +export type GAction = 'send' | 'receive' | 'store' | 'take' | 'startTaking' | 'cancelTaking' | 'completeTaking' | 'turnBack' | 'unship' | string; export declare const GActionDef: ActionDef; export type ParticularAction = IAction | GAction | 'settle'; export declare const actions: string[]; diff --git a/es/oak-app-domain/Order/Action.js b/es/oak-app-domain/Order/Action.js index 098f7f56..715d9f44 100644 --- a/es/oak-app-domain/Order/Action.js +++ b/es/oak-app-domain/Order/Action.js @@ -21,10 +21,13 @@ export const GActionDef = { unship: [['shipped', 'staging'], 'unshipped'], turnBack: ['shipped', '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", "send", "receive", "store", "take", "turnBack", "unship", "settle"]; +export const actions = ["count", "stat", "download", "select", "aggregate", "create", "remove", "update", "startPaying", "payAll", "payPartially", "payNone", "timeout", "cancel", "startRefunding", "refundAll", "refundPartially", "refundNone", "send", "receive", "store", "take", "startTaking", "cancelTaking", "completeTaking", "turnBack", "unship", "settle"]; export const actionDefDict = { iState: IActionDef, gState: GActionDef diff --git a/es/oak-app-domain/Order/Storage.js b/es/oak-app-domain/Order/Storage.js index fec79175..36f364a3 100644 --- a/es/oak-app-domain/Order/Storage.js +++ b/es/oak-app-domain/Order/Storage.js @@ -82,7 +82,7 @@ export const desc = { }, gState: { type: "enum", - enumeration: ["staging", "shipped", "unshipped", "received", "taken"] + enumeration: ["staging", "shipped", "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 502727c2..48671ed6 100644 --- a/es/oak-app-domain/Order/Style.js +++ b/es/oak-app-domain/Order/Style.js @@ -10,6 +10,16 @@ export const style = { refundAll: '', refundNone: '', refundPartially: '', + send: '', + store: '', + take: '', + receive: '', + settle: '', + turnBack: '', + unship: '', + startTaking: '', + completeTaking: '', + cancelTaking: '', }, color: { iState: { @@ -29,6 +39,7 @@ export const style = { received: '#1E8449', staging: '#283747', taken: '#117A65', + taking: '#FFC107', }, receivingMethod: { express: '#5DADE2', diff --git a/es/oak-app-domain/Order/locales/zh_CN.json b/es/oak-app-domain/Order/locales/zh_CN.json index 9f7ab0a2..26a8b13e 100644 --- a/es/oak-app-domain/Order/locales/zh_CN.json +++ b/es/oak-app-domain/Order/locales/zh_CN.json @@ -39,7 +39,10 @@ "receive": "收货", "settle": "结算", "turnBack": "退还", - "unship": "入库" + "unship": "入库", + "startTaking": "开始提货流程", + "completeTaking": "完成提货流程", + "cancelTaking": "取消提货流程" }, "v": { "iState": { @@ -58,7 +61,8 @@ "shipped": "已发货", "received": "已收货", "staging": "寄存中", - "taken": "已取货" + "taken": "已提货", + "taking": "提货流程中" }, "receivingMethod": { "express": "配送", diff --git a/es/oak-app-domain/Ship/Storage.js b/es/oak-app-domain/Ship/Storage.js index b6be9051..6d07ac02 100644 --- a/es/oak-app-domain/Ship/Storage.js +++ b/es/oak-app-domain/Ship/Storage.js @@ -24,6 +24,19 @@ export const desc = { type: "ref", ref: "address" }, + entity: { + type: "varchar", + params: { + length: 32 + }, + ref: ["wechatMpShip"] + }, + entityId: { + type: "varchar", + params: { + length: 64 + } + }, phantom1: { type: "varchar", params: { diff --git a/es/oak-app-domain/Ship/_baseSchema.d.ts b/es/oak-app-domain/Ship/_baseSchema.d.ts index f8a7d0b2..5b6a8e04 100644 --- a/es/oak-app-domain/Ship/_baseSchema.d.ts +++ b/es/oak-app-domain/Ship/_baseSchema.d.ts @@ -9,6 +9,8 @@ export type OpSchema = EntityShape & { serial?: String<64> | null; toId?: ForeignKey<"address"> | null; fromId?: ForeignKey<"address"> | null; + entity?: ("wechatMpShip" | string) | null; + entityId?: String<64> | null; phantom1?: String<32> | null; phantom2?: String<32> | null; phantom3?: Int<4> | null; @@ -28,6 +30,8 @@ export type OpFilter = { serial: Q_StringValue; toId: Q_StringValue; fromId: Q_StringValue; + entity: Q_EnumValue<"wechatMpShip" | string>; + entityId: Q_StringValue; phantom1: Q_StringValue; phantom2: Q_StringValue; phantom3: Q_NumberValue; @@ -46,6 +50,8 @@ export type OpProjection = { serial?: number; toId?: number; fromId?: number; + entity?: number; + entityId?: number; phantom1?: number; phantom2?: number; phantom3?: number; @@ -59,6 +65,8 @@ export type OpSortAttr = Partial<{ $$updateAt$$: number; type: number; serial: number; + entity: number; + entityId: number; phantom1: number; phantom2: number; phantom3: number; diff --git a/es/oak-app-domain/Ship/locales/zh_CN.json b/es/oak-app-domain/Ship/locales/zh_CN.json index d1b36d29..defea4f5 100644 --- a/es/oak-app-domain/Ship/locales/zh_CN.json +++ b/es/oak-app-domain/Ship/locales/zh_CN.json @@ -7,6 +7,8 @@ "to": "收件地址", "from": "寄件地址", "iState": "状态", + "entity": "关联对象", + "entityId": "关联对象id", "phantom1": "索引项一", "phantom2": "索引项二", "phantom3": "索引项三", diff --git a/es/oak-app-domain/Storage.js b/es/oak-app-domain/Storage.js index 961b1b1e..9321a637 100644 --- a/es/oak-app-domain/Storage.js +++ b/es/oak-app-domain/Storage.js @@ -56,7 +56,8 @@ import { desc as wechatPublicTagDesc } from "./WechatPublicTag/Storage"; import { desc as wechatQrCodeDesc } from "./WechatQrCode/Storage"; import { desc as wechatTemplateDesc } from "./WechatTemplate/Storage"; import { desc as wechatUserDesc } from "./WechatUser/Storage"; -import { desc as abstractAccountDesc } from "./AbstractAccount/Storage"; +import { desc as abstractPayAccountDesc } from "./AbstractPayAccount/Storage"; +import { desc as abstractShipAccountDesc } from "./AbstractShipAccount/Storage"; import { desc as accountDesc } from "./Account/Storage"; import { desc as accountOperDesc } from "./AccountOper/Storage"; import { desc as depositDesc } from "./Deposit/Storage"; @@ -71,6 +72,7 @@ import { desc as shipCompanySystemDesc } from "./ShipCompanySystem/Storage"; import { desc as shipOrderDesc } from "./ShipOrder/Storage"; import { desc as sysAccountMoveDesc } from "./SysAccountMove/Storage"; import { desc as sysAccountOperDesc } from "./SysAccountOper/Storage"; +import { desc as wechatMpShipDesc } from "./WechatMpShip/Storage"; import { desc as wechatPayDesc } from "./WechatPay/Storage"; import { desc as withdrawDesc } from "./Withdraw/Storage"; import { desc as withdrawAccountDesc } from "./WithdrawAccount/Storage"; @@ -137,7 +139,8 @@ export const storageSchema = { wechatQrCode: wechatQrCodeDesc, wechatTemplate: wechatTemplateDesc, wechatUser: wechatUserDesc, - abstractAccount: abstractAccountDesc, + abstractPayAccount: abstractPayAccountDesc, + abstractShipAccount: abstractShipAccountDesc, account: accountDesc, accountOper: accountOperDesc, deposit: depositDesc, @@ -152,6 +155,7 @@ export const storageSchema = { shipOrder: shipOrderDesc, sysAccountMove: sysAccountMoveDesc, sysAccountOper: sysAccountOperDesc, + wechatMpShip: wechatMpShipDesc, wechatPay: wechatPayDesc, withdraw: withdrawDesc, withdrawAccount: withdrawAccountDesc, diff --git a/es/oak-app-domain/StyleDict.js b/es/oak-app-domain/StyleDict.js index 2ae0f4c7..5e34773b 100644 --- a/es/oak-app-domain/StyleDict.js +++ b/es/oak-app-domain/StyleDict.js @@ -25,7 +25,7 @@ import { style as wechatMenu } from "./WechatMenu/Style"; import { style as wechatPublicTag } from "./WechatPublicTag/Style"; import { style as wechatQrCode } from "./WechatQrCode/Style"; import { style as wechatUser } from "./WechatUser/Style"; -import { style as abstractAccount } from "./AbstractAccount/Style"; +import { style as abstractPayAccount } from "./AbstractPayAccount/Style"; import { style as account } from "./Account/Style"; import { style as accountOper } from "./AccountOper/Style"; import { style as deposit } from "./Deposit/Style"; @@ -71,7 +71,7 @@ export const styleDict = { wechatPublicTag, wechatQrCode, wechatUser, - abstractAccount, + abstractPayAccount, account, accountOper, deposit, diff --git a/es/oak-app-domain/WechatMpShip/Schema.d.ts b/es/oak-app-domain/WechatMpShip/Schema.d.ts new file mode 100644 index 00000000..79bd6925 --- /dev/null +++ b/es/oak-app-domain/WechatMpShip/Schema.d.ts @@ -0,0 +1,19 @@ +export * from "./_baseSchema"; +import { WechatMpShip } from "../EntityDict"; +export type Schema = WechatMpShip["Schema"]; +export type Action = WechatMpShip["Action"]; +export type Projection = WechatMpShip["Projection"]; +export type Filter = WechatMpShip["Filter"]; +export type SortNode = WechatMpShip["SortNode"]; +export type Sorter = WechatMpShip["Sorter"]; +export type Selection = WechatMpShip["Selection"]; +export type Aggregation = WechatMpShip["Aggregation"]; +export type CreateOperationData = WechatMpShip["CreateOperationData"]; +export type CreateSingle = WechatMpShip["CreateSingle"]; +export type CreateMulti = WechatMpShip["CreateMulti"]; +export type Create = WechatMpShip["Create"]; +export type UpdateOperationData = WechatMpShip["UpdateOperationData"]; +export type Update = WechatMpShip["Update"]; +export type RemoveOperationData = WechatMpShip["RemoveOperationData"]; +export type Remove = WechatMpShip["Remove"]; +export type Operation = WechatMpShip["Operation"]; diff --git a/es/oak-app-domain/WechatMpShip/Schema.js b/es/oak-app-domain/WechatMpShip/Schema.js new file mode 100644 index 00000000..6a83e4ba --- /dev/null +++ b/es/oak-app-domain/WechatMpShip/Schema.js @@ -0,0 +1 @@ +export * from "./_baseSchema"; diff --git a/es/oak-app-domain/WechatMpShip/Storage.d.ts b/es/oak-app-domain/WechatMpShip/Storage.d.ts new file mode 100644 index 00000000..a3f0fbbb --- /dev/null +++ b/es/oak-app-domain/WechatMpShip/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/WechatMpShip/Storage.js b/es/oak-app-domain/WechatMpShip/Storage.js new file mode 100644 index 00000000..0b17f503 --- /dev/null +++ b/es/oak-app-domain/WechatMpShip/Storage.js @@ -0,0 +1,48 @@ +import { genericActions as actions } from "oak-domain/lib/actions/action"; +export const desc = { + attributes: { + bizId: { + type: "varchar", + params: { + length: 128 + } + }, + sort: { + notNull: true, + type: "decimal", + params: { + precision: 4, + scale: 10 + } + }, + phatom1: { + type: "int", + params: { + width: 8, + signed: true + } + }, + phatom2: { + type: "varchar", + params: { + length: 64 + } + }, + wpProductId: { + notNull: true, + type: "ref", + ref: "wpProduct" + }, + disabled: { + notNull: true, + type: "boolean" + }, + systemId: { + notNull: true, + type: "ref", + ref: "system" + } + }, + actionType: "crud", + actions +}; diff --git a/es/oak-app-domain/WechatMpShip/_baseSchema.d.ts b/es/oak-app-domain/WechatMpShip/_baseSchema.d.ts new file mode 100644 index 00000000..d421cf10 --- /dev/null +++ b/es/oak-app-domain/WechatMpShip/_baseSchema.d.ts @@ -0,0 +1,59 @@ +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 { String, Decimal, Int, Boolean } from "oak-domain/lib/types/DataType"; +export type OpSchema = EntityShape & { + bizId?: String<128> | null; + sort: Decimal<4, 10>; + phatom1?: Int<8> | null; + phatom2?: String<64> | null; + wpProductId: ForeignKey<"wpProduct">; + disabled: Boolean; + systemId: ForeignKey<"system">; +} & { + [A in ExpressionKey]?: any; +}; +export type OpAttr = keyof OpSchema; +export type OpFilter = { + id: Q_StringValue; + $$createAt$$: Q_DateValue; + $$seq$$: Q_NumberValue; + $$updateAt$$: Q_DateValue; + bizId: Q_StringValue; + sort: Q_NumberValue; + phatom1: Q_NumberValue; + phatom2: Q_StringValue; + wpProductId: Q_StringValue; + disabled: Q_BooleanValue; + systemId: Q_StringValue; +} & ExprOp; +export type OpProjection = { + "#id"?: NodeId; + [k: string]: any; + id?: number; + $$createAt$$?: number; + $$updateAt$$?: number; + $$seq$$?: number; + bizId?: number; + sort?: number; + phatom1?: number; + phatom2?: number; + wpProductId?: number; + disabled?: number; + systemId?: number; +} & Partial>; +export type OpSortAttr = Partial<{ + id: number; + $$createAt$$: number; + $$seq$$: number; + $$updateAt$$: number; + bizId: number; + sort: number; + phatom1: number; + phatom2: number; + disabled: number; + [k: string]: any; +} | ExprOp>; +export type OpAction = OakMakeAction; +export type OpUpdateAction = "update" | string; diff --git a/es/oak-app-domain/WechatMpShip/_baseSchema.js b/es/oak-app-domain/WechatMpShip/_baseSchema.js new file mode 100644 index 00000000..cb0ff5c3 --- /dev/null +++ b/es/oak-app-domain/WechatMpShip/_baseSchema.js @@ -0,0 +1 @@ +export {}; diff --git a/es/oak-app-domain/WechatMpShip/locales/zh_CN.json b/es/oak-app-domain/WechatMpShip/locales/zh_CN.json new file mode 100644 index 00000000..16e662ab --- /dev/null +++ b/es/oak-app-domain/WechatMpShip/locales/zh_CN.json @@ -0,0 +1,13 @@ +{ + "name": "微信小程序快递帐号", + "attr": { + "bizId": "面单Id", + "sort": "排序", + "phatom1": "备用属性一", + "phatom2": "备用属性二", + "wpProduct": "关联小程序支付", + "disabled": "是否禁用", + "ships": "关联快递", + "system": "所属系统" + } +} diff --git a/es/oak-app-domain/WpProduct/Storage.js b/es/oak-app-domain/WpProduct/Storage.js index 1a3df346..a954fe44 100644 --- a/es/oak-app-domain/WpProduct/Storage.js +++ b/es/oak-app-domain/WpProduct/Storage.js @@ -26,10 +26,6 @@ export const desc = { enabled: { notNull: true, type: "boolean" - }, - shipping: { - notNull: true, - type: "boolean" } }, actionType: "crud", diff --git a/es/oak-app-domain/WpProduct/_baseSchema.d.ts b/es/oak-app-domain/WpProduct/_baseSchema.d.ts index f9c3fc11..0a95dfcd 100644 --- a/es/oak-app-domain/WpProduct/_baseSchema.d.ts +++ b/es/oak-app-domain/WpProduct/_baseSchema.d.ts @@ -9,7 +9,6 @@ export type OpSchema = EntityShape & { taxLossRatio?: Decimal<4, 2> | null; applicationId: ForeignKey<"application">; enabled: Boolean; - shipping: Boolean; } & { [A in ExpressionKey]?: any; }; @@ -24,7 +23,6 @@ export type OpFilter = { taxLossRatio: Q_NumberValue; applicationId: Q_StringValue; enabled: Q_BooleanValue; - shipping: Q_BooleanValue; } & ExprOp; export type OpProjection = { "#id"?: NodeId; @@ -38,7 +36,6 @@ export type OpProjection = { taxLossRatio?: number; applicationId?: number; enabled?: number; - shipping?: number; } & Partial>; export type OpSortAttr = Partial<{ id: number; @@ -48,7 +45,6 @@ export type OpSortAttr = Partial<{ type: number; taxLossRatio: number; enabled: number; - shipping: number; [k: string]: any; } | ExprOp>; export type OpAction = OakMakeAction; diff --git a/es/oak-app-domain/WpProduct/locales/zh_CN.json b/es/oak-app-domain/WpProduct/locales/zh_CN.json index 4fd77ec0..f6843edc 100644 --- a/es/oak-app-domain/WpProduct/locales/zh_CN.json +++ b/es/oak-app-domain/WpProduct/locales/zh_CN.json @@ -6,7 +6,6 @@ "application": "关联应用", "enabled": "有效中", "taxLossRatio": "产品手续费(百分比)", - "shipping": "受发货限制", "pays": "支付" }, "v": { diff --git a/es/registry.d.ts b/es/registry.d.ts index b20b504c..b1919bd8 100644 --- a/es/registry.d.ts +++ b/es/registry.d.ts @@ -1,12 +1,4 @@ export { registerPayClazzEntity } from './utils/payClazz'; export { registerPayChannelComponent } from './components/payConfig/system/web.pc'; export { registerFrontendPayRoutine } from './components/pay/detail/index'; -import { EntityDict } from './oak-app-domain'; -import { EntityDict as BaseEntityDict } from 'oak-domain/lib/types/Entity'; -export declare const ExtraOnlineChannels: Array<{ - entity: string; - name: string; -}>; -export declare function registerOnlinePayEntity(entity: keyof ED, options: { - name: string; -}): void; +export { registerShipSettingComponent } from './components/ship/system/web.pc'; diff --git a/es/registry.frontend.d.ts b/es/registry.frontend.d.ts new file mode 100644 index 00000000..e5c6603d --- /dev/null +++ b/es/registry.frontend.d.ts @@ -0,0 +1,3 @@ +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.frontend.js b/es/registry.frontend.js new file mode 100644 index 00000000..e5c6603d --- /dev/null +++ b/es/registry.frontend.js @@ -0,0 +1,3 @@ +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 9c384e07..b1919bd8 100644 --- a/es/registry.js +++ b/es/registry.js @@ -1,11 +1,4 @@ export { registerPayClazzEntity } from './utils/payClazz'; export { registerPayChannelComponent } from './components/payConfig/system/web.pc'; export { registerFrontendPayRoutine } from './components/pay/detail/index'; -export const ExtraOnlineChannels = []; -export function registerOnlinePayEntity(entity, options) { - const { name } = options; - ExtraOnlineChannels.push({ - entity: entity, - name, - }); -} +export { registerShipSettingComponent } from './components/ship/system/web.pc'; diff --git a/es/triggers/deposit.js b/es/triggers/deposit.js index eaf0a919..bdc8ad0f 100644 --- a/es/triggers/deposit.js +++ b/es/triggers/deposit.js @@ -27,6 +27,7 @@ const triggers = [ price: 1, loss: 1, accountId: 1, + shipId: 1, pay$deposit: { $entity: 'pay', data: { @@ -45,7 +46,7 @@ const triggers = [ id: 1, type: 1, shipping: 1, - } + }, } } }, @@ -53,91 +54,90 @@ const triggers = [ }, {}); assert(deposits.length === 1); const [deposit] = deposits; - const { pay$deposit: pays, price, loss } = deposit; + const { pay$deposit: pays, price, loss, shipId } = deposit; let cnt = 1; - if (pays && pays.length > 0) { + if (shipId) { + assert(pays); for (const pay of pays) { const { price: payPrice, paid, application, entity, entityId, wpProduct } = pay; - if (entity === 'wpProduct' && wpProduct?.shipping && pay.iState === 'paid') { - //受发货限制的微信支付充值 - const clazz = await getPayClazz(entity, entityId, context); - const [tax, sysAccountEntity, sysAccountEntityId] = clazz.calcPayTax(paid); - await context.operate('sysAccountOper', { + //受发货限制的微信支付充值 + const clazz = await getPayClazz(entity, entityId, context); + const [tax, sysAccountEntity, sysAccountEntityId] = clazz.calcPayTax(paid); + await context.operate('sysAccountOper', { + id: await generateNewIdAsync(), + action: 'create', + data: { + id: await generateNewIdAsync(), + delta: paid - tax, + entity: sysAccountEntity, + entityId: sysAccountEntityId, + payId: pay.id, + type: 'pay', + } + }, {}); + cnt++; + if (tax !== 0) { + // tax产生的损失由sys account来承担 + const [account] = await context.select('account', { + data: { + id: 1, + }, + filter: { + entity: 'system', + entityId: application.systemId, + } + }, { dontCollect: true }); + await context.operate('accountOper', { id: await generateNewIdAsync(), action: 'create', data: { id: await generateNewIdAsync(), - delta: paid - tax, - entity: sysAccountEntity, - entityId: sysAccountEntityId, - payId: pay.id, - type: 'pay', - } + accountId: account.id, + type: 'tax', + totalPlus: -tax, + availPlus: -tax, + entity: 'pay', + entityId: pay.id, + }, }, {}); + } + const accountOpers = [ + { + id: await generateNewIdAsync(), + data: { + id: await generateNewIdAsync(), + totalPlus: payPrice - loss, + availPlus: payPrice - loss, + refundablePlus: pay.refundable ? price : 0, + accountId: deposit.accountId, + type: 'deposit', + }, + action: 'create', + } + ]; + if (loss > 0) { + // 如果有loss就充入system的account账户 + const [account] = await context.select('account', { + data: { + id: 1, + }, + filter: { + entity: 'system', + entityId: application?.systemId, + }, + }, { dontCollect: true }); + accountOpers.push({ + id: await generateNewIdAsync(), + data: { + id: await generateNewIdAsync(), + totalPlus: loss, + availPlus: loss, + accountId: account.id, + type: 'earn', + }, + action: 'create', + }); cnt++; - if (tax !== 0) { - // tax产生的损失由sys account来承担 - const [account] = await context.select('account', { - data: { - id: 1, - }, - filter: { - entity: 'system', - entityId: application.systemId, - } - }, { dontCollect: true }); - await context.operate('accountOper', { - id: await generateNewIdAsync(), - action: 'create', - data: { - id: await generateNewIdAsync(), - accountId: account.id, - type: 'tax', - totalPlus: -tax, - availPlus: -tax, - entity: 'pay', - entityId: pay.id, - }, - }, {}); - } - const accountOpers = [ - { - id: await generateNewIdAsync(), - data: { - id: await generateNewIdAsync(), - totalPlus: payPrice - loss, - availPlus: payPrice - loss, - refundablePlus: pay.refundable ? price : 0, - accountId: deposit.accountId, - type: 'deposit', - }, - action: 'create', - } - ]; - if (loss > 0) { - // 如果有loss就充入system的account账户 - const [account] = await context.select('account', { - data: { - id: 1, - }, - filter: { - entity: 'system', - entityId: application?.systemId, - }, - }, { dontCollect: true }); - accountOpers.push({ - id: await generateNewIdAsync(), - data: { - id: await generateNewIdAsync(), - totalPlus: loss, - availPlus: loss, - accountId: account.id, - type: 'earn', - }, - action: 'create', - }); - cnt++; - } } } } diff --git a/es/triggers/pay.js b/es/triggers/pay.js index d9bb7c6f..2bc49a12 100644 --- a/es/triggers/pay.js +++ b/es/triggers/pay.js @@ -468,6 +468,15 @@ const triggers = [ id: 1, type: 1, shipping: 1, + wechatMpShip$wpProduct: { + $entity: 'wechatMpShip', + data: { + id: 1, + }, + filter: { + disabled: false, + } + } } }; const pays = await context.select('pay', { @@ -479,30 +488,33 @@ const triggers = [ const { price, paid, entity, entityId, iState, applicationId, application, depositId, deposit, wpProduct } = pay; assert(iState === 'paid' && paid === price); let cnt = 1; - if (entity === 'wpProduct' && wpProduct && wpProduct.type === 'mp' && wpProduct.shipping) { + if (entity === 'wpProduct' && wpProduct && wpProduct.type === 'mp') { //小程序支付受到发货限制,对deposit执行ship并级联创建虚拟发货的ship,系统账户的金额变化延后至确认收货后操作 - if (depositId) { - //充值deposit执行ship,并创建关联的虚拟ship - await context.operate('deposit', { - id: await generateNewIdAsync(), - action: 'ship', - data: { - ship: { - id: await generateNewIdAsync(), - action: 'create', - data: { + const { wechatMpShip$wpProduct: wmShips } = wpProduct; + if (wmShips?.length) { + if (depositId) { + //充值deposit执行ship,并创建关联的虚拟ship + await context.operate('deposit', { + id: await generateNewIdAsync(), + action: 'ship', + data: { + ship: { id: await generateNewIdAsync(), - type: 'virtual' + action: 'create', + data: { + id: await generateNewIdAsync(), + type: 'virtual' + } } - } - }, - filter: { - id: depositId, - }, - }, {}); - cnt++; + }, + filter: { + id: depositId, + }, + }, {}); + cnt++; + } + return cnt; } - return cnt; } if (entity !== 'account') { const clazz = await getPayClazz(entity, entityId, context); diff --git a/es/utils/payClazz/WechatPay/WechatPay.js b/es/utils/payClazz/WechatPay/WechatPay.js index e802572f..0142723d 100644 --- a/es/utils/payClazz/WechatPay/WechatPay.js +++ b/es/utils/payClazz/WechatPay/WechatPay.js @@ -381,6 +381,6 @@ export default class WechatPay extends WechatPayDebug { return this.caclRefundDeadline(successAt); } uploadShipInfo(pay) { - assert(pay.entity === 'wpProduct' && pay.wpProduct?.shipping); + // assert(pay.entity === 'wpProduct' && pay.wpProduct?.shipping); } } diff --git a/lib/checkers/order.js b/lib/checkers/order.js index 535d052d..c18fb105 100644 --- a/lib/checkers/order.js +++ b/lib/checkers/order.js @@ -178,17 +178,13 @@ const checkers = [ type: 'row', action: 'take', filter: { - pay$order: { - "#sqp": 'not in', - entity: 'wpProduct', - iState: { - $in: ['paid', 'refunding', 'partiallyRefunded', 'refunded'], + shipOrder$order: { + ship: { + entity: { + $exists: false, + }, }, - wpProduct: { - type: 'mp', - shipping: true, - } - } + }, } }, { @@ -197,16 +193,13 @@ const checkers = [ type: 'row', action: 'take', filter: { - pay$order: { - entity: 'wpProduct', - iState: { - $in: ['paid', 'refunding', 'partiallyRefunded', 'refunded'], + shipOrder$order: { + ship: { + entity: { + $exists: true, + }, }, - wpProduct: { - type: 'mp', - shipping: true, - } - } + }, } }, { diff --git a/lib/data/i18n.js b/lib/data/i18n.js index 761edcc9..7a438558 100644 --- a/lib/data/i18n.js +++ b/lib/data/i18n.js @@ -296,6 +296,34 @@ const i18ns = [ "chargePlz": "请向对应的系统账号中充值,系统会自动调用渠道的退款接口" } }, + { + id: "6259d9c9fa4e09edc7899903219b59e4", + namespace: "oak-pay-business-c-ship-system", + language: "zh-CN", + module: "oak-pay-business", + position: "src/components/ship/system", + data: { + "tips": { + "header": "Ship模块需要在代码端进行注入" + } + } + }, + { + id: "bca82eb1392f291564a68c8ab138feec", + namespace: "oak-pay-business-c-ship-wechatMpShip", + language: "zh-CN", + module: "oak-pay-business", + position: "src/components/ship/wechatMpShip", + data: { + "appName": "关联小程序", + "help": { + "disabled": "小程序支付的物流能力默认必须开启,如果您申请的小程序是特殊行业,已向微信申请取消物流能力,在此可以关闭" + }, + "warning": { + "disabled": "注意,小程序要求大部分支付必须与物流进行绑定,若是关闭,可能会造成资金无法正常结转" + } + } + }, { id: "297eb88cf8a759b3bd882e8bd2eeae5a", namespace: "oak-pay-business-c-shipCompanySystem-list", diff --git a/lib/entities/AbstractShipAccount.d.ts b/lib/entities/AbstractShipAccount.d.ts index b42feea7..2d2d2d4b 100644 --- a/lib/entities/AbstractShipAccount.d.ts +++ b/lib/entities/AbstractShipAccount.d.ts @@ -1,7 +1,9 @@ -import { String, Int } from 'oak-domain/lib/types/DataType'; +import { String, Int, Decimal } from 'oak-domain/lib/types/DataType'; import { EntityShape } from 'oak-domain/lib/types/Entity'; import { EntityDesc } from 'oak-domain/lib/types'; export interface Schema extends EntityShape { + bizId?: String<128>; + sort: Decimal<4, 10>; phatom1?: Int<8>; phatom2?: String<64>; } diff --git a/lib/entities/AbstractShipAccount.js b/lib/entities/AbstractShipAccount.js index aa7f4b9d..4c602706 100644 --- a/lib/entities/AbstractShipAccount.js +++ b/lib/entities/AbstractShipAccount.js @@ -9,6 +9,8 @@ exports.entityDesc = { attr: { phatom1: '备用属性一', phatom2: '备用属性二', + bizId: '面单Id', + sort: '排序', }, }, }, diff --git a/lib/entities/WechatMpShip.d.ts b/lib/entities/WechatMpShip.d.ts index b932d821..78fb5e76 100644 --- a/lib/entities/WechatMpShip.d.ts +++ b/lib/entities/WechatMpShip.d.ts @@ -1,9 +1,13 @@ +import { Boolean } from 'oak-domain/lib/types/DataType'; import { EntityDesc } from 'oak-domain/lib/types'; +import { Schema as System } from './System'; import { Schema as AbstractShipAccount } from './AbstractShipAccount'; import { Schema as WpProduct } from './WpProduct'; import { Schema as Ship } from './Ship'; export interface Schema extends AbstractShipAccount { wpProduct: WpProduct; ships: Ship[]; + disabled: Boolean; + system: System; } export declare const entityDesc: EntityDesc; diff --git a/lib/entities/WechatMpShip.js b/lib/entities/WechatMpShip.js index 52f7255e..02ae7d45 100644 --- a/lib/entities/WechatMpShip.js +++ b/lib/entities/WechatMpShip.js @@ -7,10 +7,14 @@ exports.entityDesc = { zh_CN: { name: '微信小程序快递帐号', attr: { + bizId: '面单Id', + sort: '排序', phatom1: '备用属性一', phatom2: '备用属性二', wpProduct: '关联小程序支付', + disabled: '是否禁用', ships: '关联快递', + system: '所属系统' }, }, }, diff --git a/lib/entities/WpProduct.d.ts b/lib/entities/WpProduct.d.ts index a293ecc2..439f9c8b 100644 --- a/lib/entities/WpProduct.d.ts +++ b/lib/entities/WpProduct.d.ts @@ -10,7 +10,6 @@ export interface Schema extends EntityShape { taxLossRatio?: Decimal<4, 2>; application: Application; enabled: Boolean; - shipping: Boolean; pays: Pay[]; } export declare const entityDesc: EntityDesc | null; + sort: Decimal<4, 10>; phatom1?: Int<8> | null; phatom2?: String<64> | null; } & { @@ -14,6 +16,8 @@ export type OpFilter = { $$createAt$$: Q_DateValue; $$seq$$: Q_NumberValue; $$updateAt$$: Q_DateValue; + bizId: Q_StringValue; + sort: Q_NumberValue; phatom1: Q_NumberValue; phatom2: Q_StringValue; } & ExprOp; @@ -24,6 +28,8 @@ export type OpProjection = { $$createAt$$?: number; $$updateAt$$?: number; $$seq$$?: number; + bizId?: number; + sort?: number; phatom1?: number; phatom2?: number; } & Partial>; @@ -32,6 +38,8 @@ export type OpSortAttr = Partial<{ $$createAt$$: number; $$seq$$: number; $$updateAt$$: number; + bizId: number; + sort: number; phatom1: number; phatom2: number; [k: string]: any; diff --git a/lib/oak-app-domain/AbstractShipAccount/locales/zh_CN.json b/lib/oak-app-domain/AbstractShipAccount/locales/zh_CN.json index fad90cc1..07080265 100644 --- a/lib/oak-app-domain/AbstractShipAccount/locales/zh_CN.json +++ b/lib/oak-app-domain/AbstractShipAccount/locales/zh_CN.json @@ -2,6 +2,8 @@ "name": "抽象快递帐号", "attr": { "phatom1": "备用属性一", - "phatom2": "备用属性二" + "phatom2": "备用属性二", + "bizId": "面单Id", + "sort": "排序" } } diff --git a/lib/oak-app-domain/EntityDict.d.ts b/lib/oak-app-domain/EntityDict.d.ts index ff757eef..c77c7cda 100644 --- a/lib/oak-app-domain/EntityDict.d.ts +++ b/lib/oak-app-domain/EntityDict.d.ts @@ -2825,6 +2825,7 @@ export type System = { order$system?: Array>; shipCompanySystem$system?: Array>; sysAccountMove$system?: Array>; + wechatMpShip$system?: Array>; wechatPay$system?: Array>; withdrawAccount$ofSystem?: Array>; withdrawAccount$entity?: Array>; @@ -2842,6 +2843,7 @@ export type System = { order$system$$aggr?: AggregationResult>; shipCompanySystem$system$$aggr?: AggregationResult>; sysAccountMove$system$$aggr?: AggregationResult>; + wechatMpShip$system$$aggr?: AggregationResult>; wechatPay$system$$aggr?: AggregationResult>; withdrawAccount$ofSystem$$aggr?: AggregationResult>; withdrawAccount$entity$$aggr?: AggregationResult>; @@ -2922,6 +2924,12 @@ export type System = { sysAccountMove$system$$aggr?: DeduceAggregation, Omit, SysAccountMove["Sorter"]> & { $entity: "sysAccountMove"; }; + wechatMpShip$system?: OakSelection<"select", Omit, Omit, WechatMpShip["Sorter"]> & { + $entity: "wechatMpShip"; + }; + wechatMpShip$system$$aggr?: DeduceAggregation, Omit, WechatMpShip["Sorter"]> & { + $entity: "wechatMpShip"; + }; wechatPay$system?: OakSelection<"select", Omit, Omit, WechatPay["Sorter"]> & { $entity: "wechatPay"; }; @@ -2967,6 +2975,7 @@ export type System = { order$system: MakeFilter> & SubQueryPredicateMetadata; shipCompanySystem$system: MakeFilter> & SubQueryPredicateMetadata; sysAccountMove$system: MakeFilter> & SubQueryPredicateMetadata; + wechatMpShip$system: MakeFilter> & SubQueryPredicateMetadata; wechatPay$system: MakeFilter> & SubQueryPredicateMetadata; withdrawAccount$ofSystem: MakeFilter> & SubQueryPredicateMetadata; withdrawAccount$entity: MakeFilter> & SubQueryPredicateMetadata; @@ -2998,6 +3007,7 @@ export type System = { order$system?: (OakOperation<"create", Omit | Omit[]> | OakOperation, Order["Filter"]>)[]; shipCompanySystem$system?: (OakOperation<"create", Omit | Omit[]> | OakOperation, ShipCompanySystem["Filter"]>)[]; sysAccountMove$system?: OakOperation<"create", Omit | Omit[]>[]; + wechatMpShip$system?: (OakOperation<"create", Omit | Omit[]> | OakOperation, WechatMpShip["Filter"]>)[]; wechatPay$system?: (OakOperation<"create", Omit | Omit[]> | OakOperation, WechatPay["Filter"]>)[]; withdrawAccount$ofSystem?: (OakOperation<"create", Omit | Omit[]> | OakOperation, WithdrawAccount["Filter"]>)[]; withdrawAccount$entity?: (OakOperation<"create", Omit | Omit[]> | OakOperation, WithdrawAccount["Filter"]>)[]; @@ -3021,6 +3031,7 @@ export type System = { order$system?: (OakOperation<"create", Omit | Omit[]> | OakOperation, Order["Filter"]> | OakOperation<"remove", Order["RemoveOperationData"], Order["Filter"]>)[]; shipCompanySystem$system?: (OakOperation<"create", Omit | Omit[]> | OakOperation, ShipCompanySystem["Filter"]> | OakOperation<"remove", ShipCompanySystem["RemoveOperationData"], ShipCompanySystem["Filter"]>)[]; sysAccountMove$system?: OakOperation<"create", Omit | Omit[]>[]; + wechatMpShip$system?: (OakOperation<"create", Omit | Omit[]> | OakOperation, WechatMpShip["Filter"]> | OakOperation<"remove", WechatMpShip["RemoveOperationData"], WechatMpShip["Filter"]>)[]; wechatPay$system?: (OakOperation<"create", Omit | Omit[]> | OakOperation, WechatPay["Filter"]> | OakOperation<"remove", WechatPay["RemoveOperationData"], WechatPay["Filter"]>)[]; withdrawAccount$ofSystem?: (OakOperation<"create", Omit | Omit[]> | OakOperation, WithdrawAccount["Filter"]> | OakOperation<"remove", WithdrawAccount["RemoveOperationData"], WithdrawAccount["Filter"]>)[]; withdrawAccount$entity?: (OakOperation<"create", Omit | Omit[]> | OakOperation, WithdrawAccount["Filter"]> | OakOperation<"remove", WithdrawAccount["RemoveOperationData"], WithdrawAccount["Filter"]>)[]; @@ -4708,11 +4719,13 @@ export type WechatMpShip = { Action: BaseWechatMpShip.OpAction; Schema: BaseWechatMpShip.OpSchema & { wpProduct: WpProduct["Schema"]; + system: System["Schema"]; ship$entity?: Array>; ship$entity$$aggr?: AggregationResult>; }; Projection: BaseWechatMpShip.OpProjection & { wpProduct?: WpProduct["Projection"]; + system?: System["Projection"]; ship$entity?: OakSelection<"select", Omit, Omit, Ship["Sorter"]> & { $entity: "ship"; }; @@ -4722,11 +4735,13 @@ export type WechatMpShip = { }; FilterUnit: BaseWechatMpShip.OpFilter & { wpProduct: MakeFilter; + system: MakeFilter; ship$entity: MakeFilter> & SubQueryPredicateMetadata; }; Filter: MakeFilter; SortAttr: Partial; SortNode: { $attr: WechatMpShip["SortAttr"]; @@ -4737,6 +4752,7 @@ export type WechatMpShip = { Aggregation: DeduceAggregation; CreateOperationData: FormCreateData | OakOperation; + system?: OakOperation<"create", System["CreateOperationData"]> | OakOperation; ship$entity?: (OakOperation<"create", Omit | Omit[]> | OakOperation, Ship["Filter"]>)[]; }>; CreateSingle: OakOperation<"create", WechatMpShip["CreateOperationData"]>; @@ -4744,6 +4760,7 @@ export type WechatMpShip = { Create: WechatMpShip["CreateSingle"] | WechatMpShip["CreateMulti"]; UpdateOperationData: FormUpdateData | OakOperation | OakOperation<"remove", WpProduct["RemoveOperationData"], WpProduct["Filter"]>; + system?: OakOperation<"create", System["CreateOperationData"]> | OakOperation | OakOperation<"remove", System["RemoveOperationData"], System["Filter"]>; ship$entity?: (OakOperation<"create", Omit | Omit[]> | OakOperation, Ship["Filter"]> | OakOperation<"remove", Ship["RemoveOperationData"], Ship["Filter"]>)[]; }>; Update: OakOperation; diff --git a/lib/oak-app-domain/WechatMpShip/Storage.js b/lib/oak-app-domain/WechatMpShip/Storage.js index cce30d5f..481ba07a 100644 --- a/lib/oak-app-domain/WechatMpShip/Storage.js +++ b/lib/oak-app-domain/WechatMpShip/Storage.js @@ -4,6 +4,20 @@ exports.desc = void 0; const action_1 = require("oak-domain/lib/actions/action"); exports.desc = { attributes: { + bizId: { + type: "varchar", + params: { + length: 128 + } + }, + sort: { + notNull: true, + type: "decimal", + params: { + precision: 4, + scale: 10 + } + }, phatom1: { type: "int", params: { @@ -21,6 +35,15 @@ exports.desc = { notNull: true, type: "ref", ref: "wpProduct" + }, + disabled: { + notNull: true, + type: "boolean" + }, + systemId: { + notNull: true, + type: "ref", + ref: "system" } }, actionType: "crud", diff --git a/lib/oak-app-domain/WechatMpShip/_baseSchema.d.ts b/lib/oak-app-domain/WechatMpShip/_baseSchema.d.ts index 930b9db0..d421cf10 100644 --- a/lib/oak-app-domain/WechatMpShip/_baseSchema.d.ts +++ b/lib/oak-app-domain/WechatMpShip/_baseSchema.d.ts @@ -1,12 +1,16 @@ import { ForeignKey } from "oak-domain/lib/types/DataType"; -import { Q_DateValue, Q_NumberValue, Q_StringValue, NodeId, ExprOp, ExpressionKey } from "oak-domain/lib/types/Demand"; +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 { Int, String } from "oak-domain/lib/types/DataType"; +import { String, Decimal, Int, Boolean } from "oak-domain/lib/types/DataType"; export type OpSchema = EntityShape & { + bizId?: String<128> | null; + sort: Decimal<4, 10>; phatom1?: Int<8> | null; phatom2?: String<64> | null; wpProductId: ForeignKey<"wpProduct">; + disabled: Boolean; + systemId: ForeignKey<"system">; } & { [A in ExpressionKey]?: any; }; @@ -16,9 +20,13 @@ export type OpFilter = { $$createAt$$: Q_DateValue; $$seq$$: Q_NumberValue; $$updateAt$$: Q_DateValue; + bizId: Q_StringValue; + sort: Q_NumberValue; phatom1: Q_NumberValue; phatom2: Q_StringValue; wpProductId: Q_StringValue; + disabled: Q_BooleanValue; + systemId: Q_StringValue; } & ExprOp; export type OpProjection = { "#id"?: NodeId; @@ -27,17 +35,24 @@ export type OpProjection = { $$createAt$$?: number; $$updateAt$$?: number; $$seq$$?: number; + bizId?: number; + sort?: number; phatom1?: number; phatom2?: number; wpProductId?: number; + disabled?: number; + systemId?: number; } & Partial>; export type OpSortAttr = Partial<{ id: number; $$createAt$$: number; $$seq$$: number; $$updateAt$$: number; + bizId: number; + sort: number; phatom1: number; phatom2: number; + disabled: number; [k: string]: any; } | ExprOp>; export type OpAction = OakMakeAction; diff --git a/lib/oak-app-domain/WechatMpShip/locales/zh_CN.json b/lib/oak-app-domain/WechatMpShip/locales/zh_CN.json index c3537cae..16e662ab 100644 --- a/lib/oak-app-domain/WechatMpShip/locales/zh_CN.json +++ b/lib/oak-app-domain/WechatMpShip/locales/zh_CN.json @@ -1,9 +1,13 @@ { "name": "微信小程序快递帐号", "attr": { + "bizId": "面单Id", + "sort": "排序", "phatom1": "备用属性一", "phatom2": "备用属性二", "wpProduct": "关联小程序支付", - "ships": "关联快递" + "disabled": "是否禁用", + "ships": "关联快递", + "system": "所属系统" } } diff --git a/lib/oak-app-domain/WpProduct/Storage.js b/lib/oak-app-domain/WpProduct/Storage.js index 6dedad9a..1a633677 100644 --- a/lib/oak-app-domain/WpProduct/Storage.js +++ b/lib/oak-app-domain/WpProduct/Storage.js @@ -29,10 +29,6 @@ exports.desc = { enabled: { notNull: true, type: "boolean" - }, - shipping: { - notNull: true, - type: "boolean" } }, actionType: "crud", diff --git a/lib/oak-app-domain/WpProduct/_baseSchema.d.ts b/lib/oak-app-domain/WpProduct/_baseSchema.d.ts index f9c3fc11..0a95dfcd 100644 --- a/lib/oak-app-domain/WpProduct/_baseSchema.d.ts +++ b/lib/oak-app-domain/WpProduct/_baseSchema.d.ts @@ -9,7 +9,6 @@ export type OpSchema = EntityShape & { taxLossRatio?: Decimal<4, 2> | null; applicationId: ForeignKey<"application">; enabled: Boolean; - shipping: Boolean; } & { [A in ExpressionKey]?: any; }; @@ -24,7 +23,6 @@ export type OpFilter = { taxLossRatio: Q_NumberValue; applicationId: Q_StringValue; enabled: Q_BooleanValue; - shipping: Q_BooleanValue; } & ExprOp; export type OpProjection = { "#id"?: NodeId; @@ -38,7 +36,6 @@ export type OpProjection = { taxLossRatio?: number; applicationId?: number; enabled?: number; - shipping?: number; } & Partial>; export type OpSortAttr = Partial<{ id: number; @@ -48,7 +45,6 @@ export type OpSortAttr = Partial<{ type: number; taxLossRatio: number; enabled: number; - shipping: number; [k: string]: any; } | ExprOp>; export type OpAction = OakMakeAction; diff --git a/lib/oak-app-domain/WpProduct/locales/zh_CN.json b/lib/oak-app-domain/WpProduct/locales/zh_CN.json index 4fd77ec0..f6843edc 100644 --- a/lib/oak-app-domain/WpProduct/locales/zh_CN.json +++ b/lib/oak-app-domain/WpProduct/locales/zh_CN.json @@ -6,7 +6,6 @@ "application": "关联应用", "enabled": "有效中", "taxLossRatio": "产品手续费(百分比)", - "shipping": "受发货限制", "pays": "支付" }, "v": { diff --git a/lib/registry.d.ts b/lib/registry.d.ts index b20b504c..b1919bd8 100644 --- a/lib/registry.d.ts +++ b/lib/registry.d.ts @@ -1,12 +1,4 @@ export { registerPayClazzEntity } from './utils/payClazz'; export { registerPayChannelComponent } from './components/payConfig/system/web.pc'; export { registerFrontendPayRoutine } from './components/pay/detail/index'; -import { EntityDict } from './oak-app-domain'; -import { EntityDict as BaseEntityDict } from 'oak-domain/lib/types/Entity'; -export declare const ExtraOnlineChannels: Array<{ - entity: string; - name: string; -}>; -export declare function registerOnlinePayEntity(entity: keyof ED, options: { - name: string; -}): void; +export { registerShipSettingComponent } from './components/ship/system/web.pc'; diff --git a/lib/registry.frontend.d.ts b/lib/registry.frontend.d.ts new file mode 100644 index 00000000..e5c6603d --- /dev/null +++ b/lib/registry.frontend.d.ts @@ -0,0 +1,3 @@ +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.frontend.js b/lib/registry.frontend.js new file mode 100644 index 00000000..2bc468e1 --- /dev/null +++ b/lib/registry.frontend.js @@ -0,0 +1,9 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.registerShipSettingComponent = exports.registerFrontendPayRoutine = exports.registerPayChannelComponent = void 0; +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"); +Object.defineProperty(exports, "registerFrontendPayRoutine", { enumerable: true, get: function () { return index_1.registerFrontendPayRoutine; } }); +var web_pc_2 = require("./components/ship/system/web.pc"); +Object.defineProperty(exports, "registerShipSettingComponent", { enumerable: true, get: function () { return web_pc_2.registerShipSettingComponent; } }); diff --git a/lib/registry.js b/lib/registry.js index 4f62fecd..0a9c9709 100644 --- a/lib/registry.js +++ b/lib/registry.js @@ -1,18 +1,11 @@ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -exports.registerOnlinePayEntity = exports.ExtraOnlineChannels = exports.registerFrontendPayRoutine = exports.registerPayChannelComponent = exports.registerPayClazzEntity = void 0; +exports.registerShipSettingComponent = exports.registerFrontendPayRoutine = exports.registerPayChannelComponent = exports.registerPayClazzEntity = void 0; var payClazz_1 = require("./utils/payClazz"); Object.defineProperty(exports, "registerPayClazzEntity", { enumerable: true, get: function () { return payClazz_1.registerPayClazzEntity; } }); 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"); Object.defineProperty(exports, "registerFrontendPayRoutine", { enumerable: true, get: function () { return index_1.registerFrontendPayRoutine; } }); -exports.ExtraOnlineChannels = []; -function registerOnlinePayEntity(entity, options) { - const { name } = options; - exports.ExtraOnlineChannels.push({ - entity: entity, - name, - }); -} -exports.registerOnlinePayEntity = registerOnlinePayEntity; +var web_pc_2 = require("./components/ship/system/web.pc"); +Object.defineProperty(exports, "registerShipSettingComponent", { enumerable: true, get: function () { return web_pc_2.registerShipSettingComponent; } }); diff --git a/lib/triggers/deposit.js b/lib/triggers/deposit.js index b7976094..1858afdd 100644 --- a/lib/triggers/deposit.js +++ b/lib/triggers/deposit.js @@ -30,6 +30,7 @@ const triggers = [ price: 1, loss: 1, accountId: 1, + shipId: 1, pay$deposit: { $entity: 'pay', data: { @@ -48,7 +49,7 @@ const triggers = [ id: 1, type: 1, shipping: 1, - } + }, } } }, @@ -56,91 +57,90 @@ const triggers = [ }, {}); (0, assert_1.default)(deposits.length === 1); const [deposit] = deposits; - const { pay$deposit: pays, price, loss } = deposit; + const { pay$deposit: pays, price, loss, shipId } = deposit; let cnt = 1; - if (pays && pays.length > 0) { + if (shipId) { + (0, assert_1.default)(pays); for (const pay of pays) { const { price: payPrice, paid, application, entity, entityId, wpProduct } = pay; - if (entity === 'wpProduct' && wpProduct?.shipping && pay.iState === 'paid') { - //受发货限制的微信支付充值 - const clazz = await (0, payClazz_1.getPayClazz)(entity, entityId, context); - const [tax, sysAccountEntity, sysAccountEntityId] = clazz.calcPayTax(paid); - await context.operate('sysAccountOper', { + //受发货限制的微信支付充值 + const clazz = await (0, payClazz_1.getPayClazz)(entity, entityId, context); + const [tax, sysAccountEntity, sysAccountEntityId] = clazz.calcPayTax(paid); + await context.operate('sysAccountOper', { + id: await (0, uuid_1.generateNewIdAsync)(), + action: 'create', + data: { + id: await (0, uuid_1.generateNewIdAsync)(), + delta: paid - tax, + entity: sysAccountEntity, + entityId: sysAccountEntityId, + payId: pay.id, + type: 'pay', + } + }, {}); + cnt++; + if (tax !== 0) { + // tax产生的损失由sys account来承担 + const [account] = await context.select('account', { + data: { + id: 1, + }, + filter: { + entity: 'system', + entityId: application.systemId, + } + }, { dontCollect: true }); + await context.operate('accountOper', { id: await (0, uuid_1.generateNewIdAsync)(), action: 'create', data: { id: await (0, uuid_1.generateNewIdAsync)(), - delta: paid - tax, - entity: sysAccountEntity, - entityId: sysAccountEntityId, - payId: pay.id, - type: 'pay', - } + accountId: account.id, + type: 'tax', + totalPlus: -tax, + availPlus: -tax, + entity: 'pay', + entityId: pay.id, + }, }, {}); + } + const accountOpers = [ + { + id: await (0, uuid_1.generateNewIdAsync)(), + data: { + id: await (0, uuid_1.generateNewIdAsync)(), + totalPlus: payPrice - loss, + availPlus: payPrice - loss, + refundablePlus: pay.refundable ? price : 0, + accountId: deposit.accountId, + type: 'deposit', + }, + action: 'create', + } + ]; + if (loss > 0) { + // 如果有loss就充入system的account账户 + const [account] = await context.select('account', { + data: { + id: 1, + }, + filter: { + entity: 'system', + entityId: application?.systemId, + }, + }, { dontCollect: true }); + accountOpers.push({ + id: await (0, uuid_1.generateNewIdAsync)(), + data: { + id: await (0, uuid_1.generateNewIdAsync)(), + totalPlus: loss, + availPlus: loss, + accountId: account.id, + type: 'earn', + }, + action: 'create', + }); cnt++; - if (tax !== 0) { - // tax产生的损失由sys account来承担 - const [account] = await context.select('account', { - data: { - id: 1, - }, - filter: { - entity: 'system', - entityId: application.systemId, - } - }, { dontCollect: true }); - await context.operate('accountOper', { - id: await (0, uuid_1.generateNewIdAsync)(), - action: 'create', - data: { - id: await (0, uuid_1.generateNewIdAsync)(), - accountId: account.id, - type: 'tax', - totalPlus: -tax, - availPlus: -tax, - entity: 'pay', - entityId: pay.id, - }, - }, {}); - } - const accountOpers = [ - { - id: await (0, uuid_1.generateNewIdAsync)(), - data: { - id: await (0, uuid_1.generateNewIdAsync)(), - totalPlus: payPrice - loss, - availPlus: payPrice - loss, - refundablePlus: pay.refundable ? price : 0, - accountId: deposit.accountId, - type: 'deposit', - }, - action: 'create', - } - ]; - if (loss > 0) { - // 如果有loss就充入system的account账户 - const [account] = await context.select('account', { - data: { - id: 1, - }, - filter: { - entity: 'system', - entityId: application?.systemId, - }, - }, { dontCollect: true }); - accountOpers.push({ - id: await (0, uuid_1.generateNewIdAsync)(), - data: { - id: await (0, uuid_1.generateNewIdAsync)(), - totalPlus: loss, - availPlus: loss, - accountId: account.id, - type: 'earn', - }, - action: 'create', - }); - cnt++; - } } } } diff --git a/lib/triggers/pay.js b/lib/triggers/pay.js index e4888f9c..aea104fe 100644 --- a/lib/triggers/pay.js +++ b/lib/triggers/pay.js @@ -471,6 +471,15 @@ const triggers = [ id: 1, type: 1, shipping: 1, + wechatMpShip$wpProduct: { + $entity: 'wechatMpShip', + data: { + id: 1, + }, + filter: { + disabled: false, + } + } } }; const pays = await context.select('pay', { @@ -482,30 +491,33 @@ const triggers = [ const { price, paid, entity, entityId, iState, applicationId, application, depositId, deposit, wpProduct } = pay; (0, assert_1.default)(iState === 'paid' && paid === price); let cnt = 1; - if (entity === 'wpProduct' && wpProduct && wpProduct.type === 'mp' && wpProduct.shipping) { + if (entity === 'wpProduct' && wpProduct && wpProduct.type === 'mp') { //小程序支付受到发货限制,对deposit执行ship并级联创建虚拟发货的ship,系统账户的金额变化延后至确认收货后操作 - if (depositId) { - //充值deposit执行ship,并创建关联的虚拟ship - await context.operate('deposit', { - id: await (0, uuid_1.generateNewIdAsync)(), - action: 'ship', - data: { - ship: { - id: await (0, uuid_1.generateNewIdAsync)(), - action: 'create', - data: { + const { wechatMpShip$wpProduct: wmShips } = wpProduct; + if (wmShips?.length) { + if (depositId) { + //充值deposit执行ship,并创建关联的虚拟ship + await context.operate('deposit', { + id: await (0, uuid_1.generateNewIdAsync)(), + action: 'ship', + data: { + ship: { id: await (0, uuid_1.generateNewIdAsync)(), - type: 'virtual' + action: 'create', + data: { + id: await (0, uuid_1.generateNewIdAsync)(), + type: 'virtual' + } } - } - }, - filter: { - id: depositId, - }, - }, {}); - cnt++; + }, + filter: { + id: depositId, + }, + }, {}); + cnt++; + } + return cnt; } - return cnt; } if (entity !== 'account') { const clazz = await (0, payClazz_1.getPayClazz)(entity, entityId, context); diff --git a/lib/triggers/withdraw.d.ts b/lib/triggers/withdraw.d.ts index e69f8d6e..979a44c8 100644 --- a/lib/triggers/withdraw.d.ts +++ b/lib/triggers/withdraw.d.ts @@ -6,6 +6,6 @@ import { BRC } from '../types/RuntimeCxt'; * @param context * @param refunds */ -export declare function updateWithdrawState(context: BRC, id: string): Promise<0 | 1>; +export declare function updateWithdrawState(context: BRC, id: string): Promise<1 | 0>; declare const triggers: Trigger[]; export default triggers; diff --git a/lib/utils/payClazz/WechatPay/WechatPay.js b/lib/utils/payClazz/WechatPay/WechatPay.js index 7c6456fd..b337e736 100644 --- a/lib/utils/payClazz/WechatPay/WechatPay.js +++ b/lib/utils/payClazz/WechatPay/WechatPay.js @@ -384,7 +384,7 @@ class WechatPay extends WechatPay_debug_1.default { return this.caclRefundDeadline(successAt); } uploadShipInfo(pay) { - (0, assert_1.default)(pay.entity === 'wpProduct' && pay.wpProduct?.shipping); + // assert(pay.entity === 'wpProduct' && pay.wpProduct?.shipping); } } exports.default = WechatPay; diff --git a/package.json b/package.json index 16bbdb5b..529f12f8 100644 --- a/package.json +++ b/package.json @@ -35,6 +35,7 @@ "oak-external-sdk": "file:../oak-external-sdk", "oak-frontend-base": "file:../oak-frontend-base", "oak-general-business": "file:../oak-general-business", + "react-markdown": "^9.0.3", "wechat-pay-nodejs": "^0.2.3" }, "peerDependencies": { diff --git a/src/checkers/order.ts b/src/checkers/order.ts index 32584d72..5750ce0c 100644 --- a/src/checkers/order.ts +++ b/src/checkers/order.ts @@ -193,17 +193,13 @@ const checkers: Checker[] = [ type: 'row', action: 'take', filter: { - pay$order: { - "#sqp": 'not in', - entity: 'wpProduct', - iState: { - $in: ['paid', 'refunding', 'partiallyRefunded', 'refunded'], + shipOrder$order: { + ship: { + entity: { + $exists: false, + }, }, - wpProduct: { - type: 'mp', - shipping: true, - } - } + }, } }, { @@ -212,16 +208,13 @@ const checkers: Checker[] = [ type: 'row', action: 'take', filter: { - pay$order: { - entity: 'wpProduct', - iState: { - $in: ['paid', 'refunding', 'partiallyRefunded', 'refunded'], + shipOrder$order: { + ship: { + entity: { + $exists: true, + }, }, - wpProduct: { - type: 'mp', - shipping: true, - } - } + }, } }, { diff --git a/src/components/ship/system/index.json b/src/components/ship/system/index.json new file mode 100644 index 00000000..9e26dfee --- /dev/null +++ b/src/components/ship/system/index.json @@ -0,0 +1 @@ +{} \ No newline at end of file diff --git a/src/components/ship/system/index.ts b/src/components/ship/system/index.ts new file mode 100644 index 00000000..4ab94bfe --- /dev/null +++ b/src/components/ship/system/index.ts @@ -0,0 +1,15 @@ +export default OakComponent({ + entity: 'system', + isList: false, + projection: { + id: 1, + name: 1, + }, + formData({ data }) { + const executable = this.tryExecute(); + return { + system: data, + executable, + }; + } +}) \ No newline at end of file diff --git a/src/components/ship/system/locales/zh-CN.json b/src/components/ship/system/locales/zh-CN.json new file mode 100644 index 00000000..d0dc58dc --- /dev/null +++ b/src/components/ship/system/locales/zh-CN.json @@ -0,0 +1,6 @@ +{ + "tips": { + "header": "启用某个Ship模块需要在程序中进行注入", + "desc": "如下所示的一个例子是将oak-pay-business中的微信小程序物流组件启用,但注意要同步在此页面对应的web.pc.tsx中注入相应的ShipClazz" + } +} \ No newline at end of file diff --git a/src/components/ship/system/web.pc.module.less b/src/components/ship/system/web.pc.module.less new file mode 100644 index 00000000..f284b5b8 --- /dev/null +++ b/src/components/ship/system/web.pc.module.less @@ -0,0 +1,16 @@ +.container { + width: 100%; + height: 100%; +} + +.tips { + width: 100%; + height: 100%; + + .code { + width: 80%; + margin-top: 40px; + background-color: aquamarine; + align-self: center; + } +} \ No newline at end of file diff --git a/src/components/ship/system/web.pc.tsx b/src/components/ship/system/web.pc.tsx new file mode 100644 index 00000000..5ced70f1 --- /dev/null +++ b/src/components/ship/system/web.pc.tsx @@ -0,0 +1,97 @@ +import React from 'react'; +import Markdown from 'react-markdown'; +import assert from "assert"; +import { EntityDict } from "../../../oak-app-domain"; +import { WebComponentProps } from "oak-frontend-base"; +import { Tabs, Flex, Button, Alert } from 'antd'; +import Styles from './web.pc.module.less'; + +const ShipSettingComponentDict: Record React.ReactElement> = {}; + +export function registerShipSettingComponent(entity: string, component: (props: { + oakPath: string; + systemId: string; +}) => React.ReactElement) { + assert(!ShipSettingComponentDict[entity]); + ShipSettingComponentDict[entity] = component; +} + +export default function render(props: WebComponentProps) { + const { oakId, oakFullpath, oakDirty, executable } = props.data; + const { t, execute, clean } = props.methods; + + const entities = Object.keys(ShipSettingComponentDict); + if (oakId && oakFullpath && entities.length) { + return ( + { + const Comp = ShipSettingComponentDict[entity]; + return { + label: (
+ {t(`${entity}:name`)} +
), + key: entity, + children: ( + + + {/* + + + */} + + ) + }; + } + )} + /> + ); + } + + return ( + + +
+ {` +\`\`\` + import { registerShipSettingComponent } from 'oak-pay-business/es/registry'; + import WechatMpShipSetting from 'oak-pay-business/es/components/ship/wechatMpShip'; + registerShipSettingComponent('wechatMpShip', WechatMpShipSetting); +\`\`\` + + `} + +
+
+ ) +} \ No newline at end of file diff --git a/src/components/ship/wechatMpShip/index.json b/src/components/ship/wechatMpShip/index.json new file mode 100644 index 00000000..9e26dfee --- /dev/null +++ b/src/components/ship/wechatMpShip/index.json @@ -0,0 +1 @@ +{} \ No newline at end of file diff --git a/src/components/ship/wechatMpShip/index.ts b/src/components/ship/wechatMpShip/index.ts new file mode 100644 index 00000000..12b69b30 --- /dev/null +++ b/src/components/ship/wechatMpShip/index.ts @@ -0,0 +1,59 @@ +export default OakComponent({ + entity: 'wechatMpShip', + projection: { + id: 1, + wpProduct: { + application: { + name: 1, + }, + }, + disabled: 1, + bizId: 1, + sort: 1, + }, + isList: true, + formData({ data, features }) { + const { systemId } = this.props; + const wpProducts = features.cache.get('wpProduct', { + data: { + id: 1, + application: { + name: 1, + } + }, + filter: { + application: { + systemId, + }, + type: 'mp', + }, + }); + return { + ships: data.filter(ele => ele.$$createAt$$ as number > 1), + wpProducts, + }; + }, + properties: { + systemId: '', + }, + lifetimes: { + ready() { + const { systemId } = this.props; + return this.features.cache.refresh('wpProduct', { + data: { + id: 1, + application: { + id: 1, + name: 1, + } + }, + filter: { + application: { + systemId, + }, + type: 'mp', + }, + }); + } + } +}) \ No newline at end of file diff --git a/src/components/ship/wechatMpShip/locales/zh-CN.json b/src/components/ship/wechatMpShip/locales/zh-CN.json new file mode 100644 index 00000000..93fa02e0 --- /dev/null +++ b/src/components/ship/wechatMpShip/locales/zh-CN.json @@ -0,0 +1,10 @@ +{ + "appName": "关联小程序", + "help": { + "intro": "小程序关联物流的优先级最高,只要通过该小程序下单就会默认启用" + }, + "warning": { + "disabled": "注意,小程序要求大部分支付必须与物流进行绑定,若是关闭,可能会造成资金无法正常结转", + "noWpProduct": "微信小程序的物流设置必须和微信小程序支付绑定,目前没有此类支付配置" + } +} \ No newline at end of file diff --git a/src/components/ship/wechatMpShip/upsert/index.json b/src/components/ship/wechatMpShip/upsert/index.json new file mode 100644 index 00000000..9e26dfee --- /dev/null +++ b/src/components/ship/wechatMpShip/upsert/index.json @@ -0,0 +1 @@ +{} \ No newline at end of file diff --git a/src/components/ship/wechatMpShip/upsert/index.ts b/src/components/ship/wechatMpShip/upsert/index.ts new file mode 100644 index 00000000..3d4bc280 --- /dev/null +++ b/src/components/ship/wechatMpShip/upsert/index.ts @@ -0,0 +1,70 @@ +import assert from 'assert'; +import { EntityDict } from "../../../../oak-app-domain"; + +export default OakComponent({ + entity: 'wechatMpShip', + projection: { + id: 1, + disabled: 1, + wpProduct: { + id: 1, + application: { + id: 1, + name: 1, + }, + }, + bizId: 1, + sort: 1, + }, + isList: false, + formData({ data, features }) { + return { + wechatMpShip: data, + }; + }, + data: { + wpProducts: [] as { label: string, value: string }[], + wpProductChangable: false, + }, + lifetimes: { + ready() { + const systemId = this.features.application.getApplication()!.systemId; + const wpProducts = this.features.cache.get('wpProduct', { + data: { + id: 1, + application: { + name: 1, + }, + }, + filter: { + application: { + systemId, + }, + type: 'mp', + wechatMpShip$wpProduct: { + '#sqp': 'not in', + }, + }, + }); + assert(wpProducts.length); + if (this.isCreation()) { + this.update({ + wpProductId: wpProducts[0]!.id, + sort: 9999, + systemId, + disabled: false, + }); + } + + this.setState({ + wpProducts: wpProducts.map( + ele => ({ + label: ele.application!.name!, + value: ele.id!, + }) + ), + wpProductChangable: this.isCreation() && wpProducts.length > 1, + }) + } + } +}); diff --git a/src/components/ship/wechatMpShip/upsert/locales/zh-CN.json b/src/components/ship/wechatMpShip/upsert/locales/zh-CN.json new file mode 100644 index 00000000..7331c754 --- /dev/null +++ b/src/components/ship/wechatMpShip/upsert/locales/zh-CN.json @@ -0,0 +1,7 @@ +{ + "help": { + "bizId": "如果设置了面单Id,在下快递单时就会默认使用这个Id,但仍然可以在下单时传入新的面单Id来覆盖。如果没有设置,在下单时也不传入,则按微信小程序物流的文档,对顺丰和德邦会使用散单Id,其余物流报错。见https://developers.weixin.qq.com/miniprogram/dev/platform-capabilities/industry/express/business/introduction.html", + "disabled": "小程序支付的物流能力默认必须开启,如果您申请的小程序是特殊行业,已向微信申请取消物流能力,在此可以关闭", + "sort": "小程序关联物流默认拥有最高的优先级,不需要调整" + } +} \ No newline at end of file diff --git a/src/components/ship/wechatMpShip/upsert/web.pc.tsx b/src/components/ship/wechatMpShip/upsert/web.pc.tsx new file mode 100644 index 00000000..9079616b --- /dev/null +++ b/src/components/ship/wechatMpShip/upsert/web.pc.tsx @@ -0,0 +1,78 @@ +import React from "react"; +import { Form, Select, Input, InputNumber, Switch } from 'antd'; +import { EntityDict } from "../../../../oak-app-domain"; +import { WebComponentProps } from "oak-frontend-base"; + +export default function render(props: WebComponentProps) { + const { wechatMpShip, wpProductChangable, wpProducts } = props.data; + const { t, update } = props.methods; + + if (wechatMpShip) { + return ( +
+ + { + wpProductChangable ? + } + + + { + update({ + bizId: currentTarget.value!, + }); + }} + /> + + + { + update({ + disabled: v, + }); + }} + /> + + + + +
+ ); + } +} \ No newline at end of file diff --git a/es/components/payConfig/upsert/web.pc.module.less b/src/components/ship/wechatMpShip/web.pc.module.less similarity index 61% rename from es/components/payConfig/upsert/web.pc.module.less rename to src/components/ship/wechatMpShip/web.pc.module.less index cf55585d..5bb16b1f 100644 --- a/es/components/payConfig/upsert/web.pc.module.less +++ b/src/components/ship/wechatMpShip/web.pc.module.less @@ -1,11 +1,8 @@ -.empty { - min-height: 600px; -} - .container { width: 100%; + height: 100%; display: flex; - flex-direction: column; align-items: center; justify-content: center; + min-height: 30vh; } \ No newline at end of file diff --git a/src/components/ship/wechatMpShip/web.pc.tsx b/src/components/ship/wechatMpShip/web.pc.tsx new file mode 100644 index 00000000..8a6c963a --- /dev/null +++ b/src/components/ship/wechatMpShip/web.pc.tsx @@ -0,0 +1,144 @@ +import { EntityDict } from "../../../oak-app-domain"; +import { WebComponentProps } from "oak-frontend-base"; +import { Form, Switch, Card, Modal, Button, Alert, Space } from 'antd'; +import { PlusOutlined, EditOutlined } from '@ant-design/icons'; +import Styles from './web.pc.module.less'; +import Upsert from './upsert'; +import React, { useState } from "react"; +import { generateNewIdAsync } from "oak-domain/lib/utils/uuid"; +import Detail from 'oak-frontend-base/es/components/detail'; + + +export default function render(props: WebComponentProps) { + const { ships, wpProducts, oakFullpath, oakDirty } = props.data; + const { t, update, clean, execute, addItem } = props.methods; + const [upsertId, setUpsertId] = useState(''); + + const U = ( + { + clean(); + setUpsertId(''); + }} + onOk={async () => { + await execute(); + setUpsertId(''); + }} + width={720} + okText={t('common::confirm')} + cancelText={t('common::action.cancel')} + > + + + ); + if (ships?.length) { + return ( +
+ + + { + ships.map( + (ele, idx) => ( + } + type="text" + onClick={() => { + setUpsertId(ele.id); + }} + /> + } + > + + + ) + ) + } + {wpProducts.length > ships.length && +
+ ); + } + + if (wpProducts?.length) { + return ( + <> +
+
+ {U} + + ); + } + + return ( +
+ +
+ ); +} \ No newline at end of file diff --git a/src/components/wpProduct/config/index.ts b/src/components/wpProduct/config/index.ts index 1c8c5c6a..94f080c2 100644 --- a/src/components/wpProduct/config/index.ts +++ b/src/components/wpProduct/config/index.ts @@ -7,7 +7,6 @@ export default OakComponent({ wpAccountId: 1, applicationId: 1, enabled: 1, - shipping: 1, application: { id: 1, type: 1, diff --git a/src/components/wpProduct/upsert/index.ts b/src/components/wpProduct/upsert/index.ts index 60515be1..993624f5 100644 --- a/src/components/wpProduct/upsert/index.ts +++ b/src/components/wpProduct/upsert/index.ts @@ -9,7 +9,6 @@ export default OakComponent({ wpAccountId: 1, applicationId: 1, enabled: 1, - shipping: 1, application: { id: 1, type: 1, @@ -52,7 +51,6 @@ export default OakComponent({ this.update({ wpAccountId, enabled: true, - shipping: false, //默认不受发货限制 }); } } diff --git a/src/components/wpProduct/upsert/web.pc.tsx b/src/components/wpProduct/upsert/web.pc.tsx index 0efc6c19..4cca598d 100644 --- a/src/components/wpProduct/upsert/web.pc.tsx +++ b/src/components/wpProduct/upsert/web.pc.tsx @@ -60,21 +60,6 @@ export default function render(props: WebComponentProps
- {wpProduct.type && wpProduct.type === 'mp' && ( - //仅小程序会受发货限制 - - { - update({ shipping: checked }); - }} - /> - - )} ; // 全局的面单id,可以不设置,在下单的时候传业务逻辑中的bizId来代替 + sort: Decimal<12, 8>; // 优先级高的会被优先使用来下快递 phatom1?: Int<8>; phatom2?: String<64>; }; @@ -23,6 +25,8 @@ export const entityDesc: EntityDesc = { attr: { phatom1: '备用属性一', phatom2: '备用属性二', + bizId: '面单Id', + sort: '排序', }, }, }, diff --git a/src/entities/Ship.ts b/src/entities/Ship.ts index 43e14b8f..7f1a53bb 100644 --- a/src/entities/Ship.ts +++ b/src/entities/Ship.ts @@ -11,6 +11,11 @@ import { ActionDef, EntityDesc } from 'oak-domain/lib/types'; import { Schema as ShipCompany } from './ShipCompany'; import { Schema as Address } from 'oak-general-business/lib/entities/Address'; +type Paths = Array<{ + time: number; + action: string; +}>; + export interface Schema extends EntityShape { type: 'virtual' | 'pickup' | 'express'; shipCompany?: ShipCompany; @@ -23,6 +28,8 @@ export interface Schema extends EntityShape { phantom2?: String<32>; phantom3?: Int<4>; phantom4?: Int<8>; + extraShipId?: String<128>; + extraPaths?: Paths; }; type IState = 'unshipped' | 'shipping' | 'givenUp' | 'received' | 'rejected'; @@ -87,6 +94,8 @@ export const entityDesc: EntityDesc = { @@ -23,10 +25,14 @@ export const entityDesc: EntityDesc = { zh_CN: { name: '微信小程序快递帐号', attr: { + bizId: '面单Id', + sort: '排序', phatom1: '备用属性一', phatom2: '备用属性二', wpProduct: '关联小程序支付', + disabled: '是否禁用', ships: '关联快递', + system: '所属系统' }, }, }, diff --git a/src/entities/WpProduct.ts b/src/entities/WpProduct.ts index 0167498f..941965da 100644 --- a/src/entities/WpProduct.ts +++ b/src/entities/WpProduct.ts @@ -19,7 +19,6 @@ export interface Schema extends EntityShape { taxLossRatio?: Decimal<4, 2>; // 支付损耗比例,百分数 application: Application; enabled: Boolean; - shipping: Boolean; pays: Pay[]; }; @@ -36,7 +35,6 @@ export const entityDesc: EntityDesc = []; - -export function registerOnlinePayEntity(entity: keyof ED, options: { - name: string; -}) { - const { name } = options; - ExtraOnlineChannels.push({ - entity: entity as string, - name, - }); -} \ No newline at end of file +export { registerShipSettingComponent } from './components/ship/system/web.pc'; \ No newline at end of file diff --git a/src/triggers/deposit.ts b/src/triggers/deposit.ts index f1e6040c..5589b9a8 100644 --- a/src/triggers/deposit.ts +++ b/src/triggers/deposit.ts @@ -32,6 +32,7 @@ const triggers: Trigger[] = [ price: 1, loss: 1, accountId: 1, + shipId: 1, pay$deposit: { $entity: 'pay', data: { @@ -50,7 +51,7 @@ const triggers: Trigger[] = [ id: 1, type: 1, shipping: 1, - } + }, } } }, @@ -58,96 +59,95 @@ const triggers: Trigger[] = [ }, {}); assert(deposits.length === 1); const [deposit] = deposits; - const { pay$deposit: pays, price, loss } = deposit; + const { pay$deposit: pays, price, loss, shipId } = deposit; let cnt = 1; - if (pays && pays.length > 0) { + if (shipId) { + assert(pays); for (const pay of pays) { const { price: payPrice, paid, application, entity, entityId, wpProduct } = pay; - if (entity === 'wpProduct' && wpProduct?.shipping && pay.iState === 'paid') { - //受发货限制的微信支付充值 - const clazz = await getPayClazz(entity!, entityId!, context); - const [tax, sysAccountEntity, sysAccountEntityId] = clazz.calcPayTax(paid!); - await context.operate('sysAccountOper', { + //受发货限制的微信支付充值 + const clazz = await getPayClazz(entity!, entityId!, context); + const [tax, sysAccountEntity, sysAccountEntityId] = clazz.calcPayTax(paid!); + await context.operate('sysAccountOper', { + id: await generateNewIdAsync(), + action: 'create', + data: { + id: await generateNewIdAsync(), + delta: paid! - tax, + entity: sysAccountEntity, + entityId: sysAccountEntityId, + payId: pay.id, + type: 'pay', + } + }, {}); + cnt++; + + if (tax !== 0) { + // tax产生的损失由sys account来承担 + const [account] = await context.select('account', { + data: { + id: 1, + }, + filter: { + entity: 'system', + entityId: application!.systemId!, + } + }, { dontCollect: true }); + + await context.operate('accountOper', { id: await generateNewIdAsync(), action: 'create', data: { id: await generateNewIdAsync(), - delta: paid! - tax, - entity: sysAccountEntity, - entityId: sysAccountEntityId, - payId: pay.id, - type: 'pay', - } + accountId: account!.id, + type: 'tax', + totalPlus: -tax, + availPlus: -tax, + entity: 'pay', + entityId: pay.id!, + }, }, {}); + + } + const accountOpers: EntityDict['deposit']['Update']['data']['accountOper$entity'] = [ + { + id: await generateNewIdAsync(), + data: { + id: await generateNewIdAsync(), + totalPlus: payPrice! - loss!, + availPlus: payPrice! - loss!, + refundablePlus: pay.refundable ? price : 0, + accountId: deposit!.accountId, + type: 'deposit', + }, + action: 'create', + } + ]; + + if (loss! > 0) { + // 如果有loss就充入system的account账户 + const [account] = await context.select('account', { + data: { + id: 1, + }, + filter: { + entity: 'system', + entityId: application?.systemId!, + }, + }, { dontCollect: true }); + accountOpers.push({ + id: await generateNewIdAsync(), + data: { + id: await generateNewIdAsync(), + totalPlus: loss, + availPlus: loss, + accountId: account!.id!, + type: 'earn', + }, + action: 'create', + }); + cnt++; - - if (tax !== 0) { - // tax产生的损失由sys account来承担 - const [account] = await context.select('account', { - data: { - id: 1, - }, - filter: { - entity: 'system', - entityId: application!.systemId!, - } - }, { dontCollect: true }); - - await context.operate('accountOper', { - id: await generateNewIdAsync(), - action: 'create', - data: { - id: await generateNewIdAsync(), - accountId: account!.id, - type: 'tax', - totalPlus: -tax, - availPlus: -tax, - entity: 'pay', - entityId: pay.id!, - }, - }, {}); - - } - const accountOpers: EntityDict['deposit']['Update']['data']['accountOper$entity'] = [ - { - id: await generateNewIdAsync(), - data: { - id: await generateNewIdAsync(), - totalPlus: payPrice! - loss!, - availPlus: payPrice! - loss!, - refundablePlus: pay.refundable ? price : 0, - accountId: deposit!.accountId, - type: 'deposit', - }, - action: 'create', - } - ]; - - if (loss! > 0) { - // 如果有loss就充入system的account账户 - const [account] = await context.select('account', { - data: { - id: 1, - }, - filter: { - entity: 'system', - entityId: application?.systemId!, - }, - }, { dontCollect: true }); - accountOpers.push({ - id: await generateNewIdAsync(), - data: { - id: await generateNewIdAsync(), - totalPlus: loss, - availPlus: loss, - accountId: account!.id!, - type: 'earn', - }, - action: 'create', - }); - - cnt++; - } } } } diff --git a/src/triggers/pay.ts b/src/triggers/pay.ts index d2e80cef..06fde30a 100644 --- a/src/triggers/pay.ts +++ b/src/triggers/pay.ts @@ -509,6 +509,15 @@ const triggers: Trigger[] = [ id: 1, type: 1, shipping: 1, + wechatMpShip$wpProduct: { + $entity: 'wechatMpShip', + data: { + id: 1, + }, + filter: { + disabled: false, + } + } } }; @@ -522,30 +531,33 @@ const triggers: Trigger[] = [ assert(iState === 'paid' && paid === price); let cnt = 1; - if (entity === 'wpProduct' && wpProduct && wpProduct.type === 'mp' && wpProduct.shipping) { + if (entity === 'wpProduct' && wpProduct && wpProduct.type === 'mp') { //小程序支付受到发货限制,对deposit执行ship并级联创建虚拟发货的ship,系统账户的金额变化延后至确认收货后操作 - if (depositId) { - //充值deposit执行ship,并创建关联的虚拟ship - await context.operate('deposit', { - id: await generateNewIdAsync(), - action: 'ship', - data: { - ship: { - id: await generateNewIdAsync(), - action: 'create', - data: { + const { wechatMpShip$wpProduct: wmShips } = wpProduct; + if (wmShips?.length) { + if (depositId) { + //充值deposit执行ship,并创建关联的虚拟ship + await context.operate('deposit', { + id: await generateNewIdAsync(), + action: 'ship', + data: { + ship: { id: await generateNewIdAsync(), - type: 'virtual' + action: 'create', + data: { + id: await generateNewIdAsync(), + type: 'virtual' + } } - } - }, - filter: { - id: depositId, - }, - }, {}); - cnt++; + }, + filter: { + id: depositId, + }, + }, {}); + cnt++; + } + return cnt; } - return cnt; } if (entity !== 'account') { diff --git a/src/types/ShipClazz.ts b/src/types/ShipClazz.ts new file mode 100644 index 00000000..9decf540 --- /dev/null +++ b/src/types/ShipClazz.ts @@ -0,0 +1,22 @@ +import { EntityDict } from '../oak-app-domain'; +import { BRC } from '../types/RuntimeCxt'; + +export default interface ShipClazz { + // 下单 + eOrder(ship: EntityDict['ship']['Schema'], context: BRC): Promise; + + // 取消 + cancelOrder(ship: EntityDict['ship']['Schema'], context: BRC): Promise; + + // 查询状态(及轨迹) + getState(ship: EntityDict['ship']['Schema']): Promise<{ + iState: EntityDict['ship']['OpSchema']['iState']; + extraPaths?: EntityDict['ship']['OpSchema']['extraPaths']; + }>; + + // 返回打印数据 + getPrintInfo(ship: EntityDict['ship']['Schema']): Promise<{ + type: 'html'; + data: string; + }> +} \ No newline at end of file diff --git a/src/utils/payClazz/WechatPay/WechatPay.ts b/src/utils/payClazz/WechatPay/WechatPay.ts index cc1d83fe..2a520898 100644 --- a/src/utils/payClazz/WechatPay/WechatPay.ts +++ b/src/utils/payClazz/WechatPay/WechatPay.ts @@ -462,7 +462,6 @@ export default class WechatPay extends WechatPayDebug implements PayClazz { } uploadShipInfo(pay: Pay) { - assert(pay.entity === 'wpProduct' && pay.wpProduct?.shipping); - + // assert(pay.entity === 'wpProduct' && pay.wpProduct?.shipping); } } \ No newline at end of file