添加actionAuth,充值小程序收货确认组件
This commit is contained in:
parent
5700b0d1c0
commit
b24405f557
|
|
@ -60,15 +60,22 @@ const checkers = [
|
|||
type: 'row',
|
||||
action: ['startReceiving', 'succeedReceiving'],
|
||||
filter: {
|
||||
shipOrder$ship: {
|
||||
order: {
|
||||
pay$order: {
|
||||
wpProduct: {
|
||||
needReceiving: true
|
||||
$or: [
|
||||
{
|
||||
type: 'virtual',
|
||||
},
|
||||
{
|
||||
shipOrder$ship: {
|
||||
order: {
|
||||
pay$order: {
|
||||
wpProduct: {
|
||||
needReceiving: true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
|
|
|
|||
|
|
@ -220,6 +220,116 @@ export default OakComponent({
|
|||
},
|
||||
gotoHistoryMp() {
|
||||
this.props.onGoToHistory();
|
||||
},
|
||||
async onUnreceivedDepositClickMp() {
|
||||
const { unreceivedDepositId } = this.state;
|
||||
const { data: deposits } = await this.features.cache.refresh('deposit', {
|
||||
data: {
|
||||
id: 1,
|
||||
iState: 1,
|
||||
pay$deposit: {
|
||||
$entity: 'pay',
|
||||
data: {
|
||||
id: 1,
|
||||
meta: 1,
|
||||
iState: 1,
|
||||
entity: 1,
|
||||
entityId: 1,
|
||||
},
|
||||
filter: {
|
||||
entity: 'wpProduct',
|
||||
iState: 'paid',
|
||||
}
|
||||
},
|
||||
shipId: 1,
|
||||
ship: {
|
||||
id: 1,
|
||||
iState: 1,
|
||||
}
|
||||
},
|
||||
filter: {
|
||||
id: unreceivedDepositId,
|
||||
}
|
||||
});
|
||||
const ship = deposits?.[0]?.ship;
|
||||
if (ship && ship.id && ship.iState === 'receiving') {
|
||||
const transactionId = ship.deposit$ship?.[0]?.pay$deposit?.[0]?.meta?.transaction_id;
|
||||
console.log('transaction_id', transactionId);
|
||||
if (process.env.NODE_ENV === 'development') {
|
||||
await this.features.cache.operate('ship', [{
|
||||
id: await generateNewIdAsync(),
|
||||
action: 'succeedReceiving',
|
||||
data: {},
|
||||
filter: {
|
||||
id: ship.id,
|
||||
},
|
||||
}]);
|
||||
this.setMessage({
|
||||
type: 'success',
|
||||
content: this.t('ship.success')
|
||||
});
|
||||
return;
|
||||
}
|
||||
if (transactionId) {
|
||||
if (wx.openBusinessView) {
|
||||
wx.openBusinessView({
|
||||
businessType: 'weappOrderConfirm',
|
||||
extraData: {
|
||||
transaction_id: transactionId,
|
||||
},
|
||||
async success() {
|
||||
console.log('success');
|
||||
const mpShipState = await this.features.cache.exec('getMpShipState', {
|
||||
shipId: ship.id,
|
||||
});
|
||||
if (mpShipState === 'received') {
|
||||
await this.features.cache.operate('ship', [{
|
||||
id: await generateNewIdAsync(),
|
||||
action: 'succeedReceiving',
|
||||
data: {},
|
||||
filter: {
|
||||
id: ship.id,
|
||||
},
|
||||
}]);
|
||||
this.setMessage({
|
||||
type: 'success',
|
||||
content: this.t('ship.success')
|
||||
});
|
||||
}
|
||||
else {
|
||||
console.log(mpShipState);
|
||||
this.setMessage({
|
||||
type: 'warning',
|
||||
content: this.t('ship.wait'),
|
||||
});
|
||||
}
|
||||
},
|
||||
fail() {
|
||||
console.log('fail');
|
||||
this.setMessage({
|
||||
type: 'warning',
|
||||
content: this.t('ship.fail'),
|
||||
});
|
||||
},
|
||||
complete() {
|
||||
}
|
||||
});
|
||||
}
|
||||
else {
|
||||
//引导用户升级微信版本
|
||||
this.setMessage({
|
||||
type: 'warning',
|
||||
content: this.t('ship.update wechat'),
|
||||
});
|
||||
}
|
||||
}
|
||||
else {
|
||||
this.setMessage({
|
||||
type: 'warning',
|
||||
content: this.t('no transactionId'),
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
data: {
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
<view class="container">
|
||||
<l-notice-bar show="{{unreceivedDepositId}}" front-icon-name="notification" end-icon-name="right">
|
||||
您有未确认的充值,请尽快前往确认
|
||||
<l-notice-bar show="{{unreceivedDepositId}}" front-icon-name="notification" end-icon-name="right"
|
||||
bind:lintap="onUnreceivedDepositClickMp" bind:linicontap="onUnreceivedDepositClickMp">
|
||||
{{t('ship.unconfirm')}}
|
||||
</l-notice-bar>
|
||||
<view class="info" style="background-color:{{bgColor}};color:{{textColor}};">
|
||||
<view
|
||||
|
|
|
|||
|
|
@ -17,5 +17,13 @@
|
|||
"maxOverflow": "充值金额不得高于%{value}元",
|
||||
"minOverflow": "充值金额不得低于%{value}元"
|
||||
},
|
||||
"yuan": "(元)"
|
||||
"yuan": "(元)",
|
||||
"ship": {
|
||||
"unconfirm": "您有未确认的充值,请尽快前往确认",
|
||||
"success": "充值确认成功",
|
||||
"wait": "状态核验中,请等待",
|
||||
"fail": "确认失败,请稍后重试",
|
||||
"update wechat": "请升级微信版本",
|
||||
"no transactionId": "暂无相关信息,请联系管理员"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -71,40 +71,44 @@ export function registerFrontendPayRoutine(entity, routine, projection, judgeCan
|
|||
judgeCanPay,
|
||||
};
|
||||
}
|
||||
const baseProjection = {
|
||||
id: 1,
|
||||
applicationId: 1,
|
||||
price: 1,
|
||||
meta: 1,
|
||||
iState: 1,
|
||||
paid: 1,
|
||||
refunded: 1,
|
||||
timeoutAt: 1,
|
||||
forbidRefundAt: 1,
|
||||
externalId: 1,
|
||||
orderId: 1,
|
||||
depositId: 1,
|
||||
deposit: {
|
||||
id: 1,
|
||||
accountId: 1,
|
||||
price: 1,
|
||||
loss: 1,
|
||||
iState: 1,
|
||||
shipId: 1,
|
||||
ship: {
|
||||
id: 1,
|
||||
iState: 1,
|
||||
}
|
||||
},
|
||||
order: {
|
||||
id: 1,
|
||||
creatorId: 1,
|
||||
},
|
||||
entity: 1,
|
||||
entityId: 1,
|
||||
creatorId: 1,
|
||||
phantom3: 1,
|
||||
};
|
||||
export default OakComponent({
|
||||
entity: 'pay',
|
||||
isList: false,
|
||||
projection: () => {
|
||||
const baseProjection = {
|
||||
id: 1,
|
||||
applicationId: 1,
|
||||
price: 1,
|
||||
meta: 1,
|
||||
iState: 1,
|
||||
paid: 1,
|
||||
refunded: 1,
|
||||
timeoutAt: 1,
|
||||
forbidRefundAt: 1,
|
||||
externalId: 1,
|
||||
orderId: 1,
|
||||
depositId: 1,
|
||||
deposit: {
|
||||
id: 1,
|
||||
accountId: 1,
|
||||
price: 1,
|
||||
loss: 1,
|
||||
iState: 1,
|
||||
shipId: 1,
|
||||
},
|
||||
order: {
|
||||
id: 1,
|
||||
creatorId: 1,
|
||||
},
|
||||
entity: 1,
|
||||
entityId: 1,
|
||||
creatorId: 1,
|
||||
phantom3: 1,
|
||||
};
|
||||
for (const k in PayRoutineDict) {
|
||||
merge(baseProjection, PayRoutineDict[k].projection);
|
||||
}
|
||||
|
|
@ -174,6 +178,7 @@ export default OakComponent({
|
|||
oakExecutable: this.tryExecute(),
|
||||
iStateStr,
|
||||
shipId: data?.deposit?.shipId,
|
||||
ship: data?.deposit?.ship,
|
||||
depositId: data?.depositId,
|
||||
};
|
||||
},
|
||||
|
|
@ -317,17 +322,119 @@ export default OakComponent({
|
|||
this.update({
|
||||
externalId: null,
|
||||
});
|
||||
},
|
||||
async confirmShipMp(shipId, shipState) {
|
||||
//小程序唤起确认收货组件
|
||||
if (process.env.OAK_PLATFORM === 'wechatMp') {
|
||||
const { pay, } = this.state;
|
||||
if (shipId && shipState === 'receiving') {
|
||||
if (process.env.NODE_ENV === 'development') {
|
||||
await this.features.cache.operate('ship', [{
|
||||
id: await generateNewIdAsync(),
|
||||
action: 'succeedReceiving',
|
||||
data: {},
|
||||
filter: {
|
||||
id: shipId,
|
||||
},
|
||||
}]);
|
||||
this.setMessage({
|
||||
type: 'success',
|
||||
content: this.t('ship.success')
|
||||
});
|
||||
return;
|
||||
}
|
||||
if (pay.meta.transaction_id) {
|
||||
if (wx.openBusinessView) {
|
||||
wx.openBusinessView({
|
||||
businessType: 'weappOrderConfirm',
|
||||
extraData: {
|
||||
transaction_id: pay.meta.transaction_id,
|
||||
},
|
||||
async success() {
|
||||
console.log('success');
|
||||
const mpShipState = await this.features.cache.exec('getMpShipState', {
|
||||
shipId,
|
||||
});
|
||||
if (mpShipState === 'received') {
|
||||
await this.features.cache.operate('ship', [{
|
||||
id: await generateNewIdAsync(),
|
||||
action: 'succeedReceiving',
|
||||
data: {},
|
||||
filter: {
|
||||
id: shipId,
|
||||
},
|
||||
}]);
|
||||
this.setMessage({
|
||||
type: 'success',
|
||||
content: this.t('ship.success')
|
||||
});
|
||||
}
|
||||
else {
|
||||
console.log(mpShipState);
|
||||
this.setMessage({
|
||||
type: 'warning',
|
||||
content: this.t('ship.wait'),
|
||||
});
|
||||
}
|
||||
},
|
||||
fail() {
|
||||
console.log('fail');
|
||||
this.setMessage({
|
||||
type: 'warning',
|
||||
content: this.t('ship.fail'),
|
||||
});
|
||||
},
|
||||
complete() {
|
||||
}
|
||||
});
|
||||
}
|
||||
else {
|
||||
//引导用户升级微信版本
|
||||
this.setMessage({
|
||||
type: 'warning',
|
||||
content: this.t('ship.update wechat'),
|
||||
});
|
||||
}
|
||||
}
|
||||
else {
|
||||
this.setMessage({
|
||||
type: 'warning',
|
||||
content: this.t('no transactionId'),
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
lifetimes: {
|
||||
async ready() {
|
||||
const { oakId } = this.props;
|
||||
assert(typeof oakId === 'string');
|
||||
const unsub = await this.subDataEvents([`${DATA_SUBSCRIBER_KEYS.payStateChanged}-${oakId}`]);
|
||||
const unsub = await this.subDataEvents([`${DATA_SUBSCRIBER_KEYS.payStateChanged}-${oakId}`], async (event, opRecords) => {
|
||||
for (const record of opRecords) {
|
||||
if (record.a === 'succeedPaying') {
|
||||
const { e, d } = record;
|
||||
if (e === 'pay' && d.iState === 'paid') {
|
||||
await this.features.cache.refresh('pay', {
|
||||
data: baseProjection,
|
||||
filter: {
|
||||
id: oakId,
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
this.setState({
|
||||
unsub,
|
||||
});
|
||||
},
|
||||
async mature() {
|
||||
const { ship } = this.state;
|
||||
if (ship?.id && ship?.iState === 'receiving') {
|
||||
await this.confirmShipMp(ship.id, ship.iState);
|
||||
}
|
||||
},
|
||||
detached() {
|
||||
const { unsub, unsubShip } = this.state;
|
||||
unsub && unsub();
|
||||
|
|
@ -356,51 +463,10 @@ export default OakComponent({
|
|||
if (process.env.OAK_PLATFORM === 'wechatMp') {
|
||||
//在充值虚拟发货成功后,小程序唤起确认收货组件
|
||||
for (const record of opRecords) {
|
||||
if (record.a === 'u') {
|
||||
if (record.a === 'startReceiving') {
|
||||
const { e, d } = record;
|
||||
const { pay } = this.state;
|
||||
if (e === 'ship' && d.iState === 'receiving' && pay.meta.transaction_id) {
|
||||
if (wx.openBusinessView) {
|
||||
wx.openBusinessView({
|
||||
businessType: 'weappOrderConfirm',
|
||||
extraData: {
|
||||
transaction_id: pay.meta.transaction_id,
|
||||
},
|
||||
async success() {
|
||||
console.log('success');
|
||||
const mpShipState = await this.features.cache.exec('getMpShipState', {
|
||||
shipId: next.shipId,
|
||||
});
|
||||
if (mpShipState === 'received') {
|
||||
await this.execute(undefined, {
|
||||
type: 'success',
|
||||
context: this.t('depositSuccess')
|
||||
}, undefined, [{
|
||||
entity: 'ship',
|
||||
operation: {
|
||||
id: await generateNewIdAsync(),
|
||||
action: 'succeedReceiving',
|
||||
data: {},
|
||||
filter: {
|
||||
id: next.shipId,
|
||||
},
|
||||
},
|
||||
}]);
|
||||
}
|
||||
else {
|
||||
console.log(mpShipState);
|
||||
}
|
||||
},
|
||||
fail() {
|
||||
console.log('fail');
|
||||
},
|
||||
complete() {
|
||||
}
|
||||
});
|
||||
}
|
||||
else {
|
||||
//引导用户升级微信版本
|
||||
}
|
||||
if (e === 'ship' && d.iState === 'receiving') {
|
||||
await this.confirmShipMp(next.shipId, d.iState);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -42,11 +42,15 @@
|
|||
"placeholder": "一般是一长串数字加字母"
|
||||
},
|
||||
"ship": {
|
||||
"shipped": "待确认"
|
||||
"shipped": "待确认",
|
||||
"success": "充值确认成功",
|
||||
"wait": "状态核验中,请等待",
|
||||
"fail": "确认失败,请稍后重试",
|
||||
"update wechat": "请升级微信版本",
|
||||
"no transactionId": "暂无相关信息,请联系管理员"
|
||||
},
|
||||
"successAt": {
|
||||
"title": "登记转账时间",
|
||||
"tips": "转帐时间可能会影响退款的期限,尽量设置准确"
|
||||
},
|
||||
"depositSuccess": "充值成功"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -73,6 +73,17 @@ const actionAuths = [
|
|||
id: 'user-acc-wdtransfer',
|
||||
pathId: 'user-acc-wdtransfer',
|
||||
deActions: ['select', 'create'],
|
||||
},
|
||||
//ship
|
||||
{
|
||||
id: 'user-deposit-ship',
|
||||
pathId: 'user-deposit-ship',
|
||||
deActions: ['select', 'succeedReceiving', 'reject'],
|
||||
},
|
||||
{
|
||||
id: 'creator-deposit-ship',
|
||||
pathId: 'creator-deposit-ship',
|
||||
deActions: ['select', 'succeedReceiving', 'reject'],
|
||||
}
|
||||
];
|
||||
export default actionAuths;
|
||||
|
|
|
|||
|
|
@ -25,7 +25,15 @@ const i18ns = [
|
|||
"maxOverflow": "充值金额不得高于%{value}元",
|
||||
"minOverflow": "充值金额不得低于%{value}元"
|
||||
},
|
||||
"yuan": "(元)"
|
||||
"yuan": "(元)",
|
||||
"ship": {
|
||||
"unconfirm": "您有未确认的充值,请尽快前往确认",
|
||||
"success": "充值确认成功",
|
||||
"wait": "状态核验中,请等待",
|
||||
"fail": "确认失败,请稍后重试",
|
||||
"update wechat": "请升级微信版本",
|
||||
"no transactionId": "暂无相关信息,请联系管理员"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
|
|
@ -205,13 +213,17 @@ const i18ns = [
|
|||
"placeholder": "一般是一长串数字加字母"
|
||||
},
|
||||
"ship": {
|
||||
"shipped": "待确认"
|
||||
"shipped": "待确认",
|
||||
"success": "充值确认成功",
|
||||
"wait": "状态核验中,请等待",
|
||||
"fail": "确认失败,请稍后重试",
|
||||
"update wechat": "请升级微信版本",
|
||||
"no transactionId": "暂无相关信息,请联系管理员"
|
||||
},
|
||||
"successAt": {
|
||||
"title": "登记转账时间",
|
||||
"tips": "转帐时间可能会影响退款的期限,尽量设置准确"
|
||||
},
|
||||
"depositSuccess": "充值成功"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
|
|
|
|||
|
|
@ -103,6 +103,20 @@ const paths = [
|
|||
destEntity: 'withdrawTransfer',
|
||||
value: 'withdraw.account.user',
|
||||
recursive: false,
|
||||
}
|
||||
},
|
||||
{
|
||||
id: 'user-deposit-ship',
|
||||
sourceEntity: 'user',
|
||||
destEntity: 'ship',
|
||||
value: 'deposit$ship.account.user',
|
||||
recursive: false,
|
||||
},
|
||||
{
|
||||
id: 'creator-deposit-ship',
|
||||
sourceEntity: 'user',
|
||||
destEntity: 'ship',
|
||||
value: 'deposit$ship.creator',
|
||||
recursive: false,
|
||||
},
|
||||
];
|
||||
export default paths;
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ const triggers = [
|
|||
entity: 'deposit',
|
||||
name: '当受发货限制的deposit充值成功后,计算相应的account以及system account中的余额变化',
|
||||
action: 'succeed',
|
||||
when: 'after',
|
||||
when: 'before',
|
||||
asRoot: true,
|
||||
fn: async ({ operation }, context) => {
|
||||
const { data, filter } = operation;
|
||||
|
|
@ -55,6 +55,7 @@ const triggers = [
|
|||
const [deposit] = deposits;
|
||||
const { pay$deposit: pays, price, loss, shipId } = deposit;
|
||||
let cnt = 1;
|
||||
let accountOpers = [];
|
||||
if (shipId) {
|
||||
assert(pays);
|
||||
for (const pay of pays) {
|
||||
|
|
@ -100,20 +101,18 @@ const triggers = [
|
|||
},
|
||||
}, {});
|
||||
}
|
||||
const accountOpers = [
|
||||
{
|
||||
accountOpers.push({
|
||||
id: await generateNewIdAsync(),
|
||||
data: {
|
||||
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',
|
||||
}
|
||||
];
|
||||
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', {
|
||||
|
|
@ -140,7 +139,10 @@ const triggers = [
|
|||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
if (accountOpers && accountOpers.length > 0) {
|
||||
data.accountOper$entity = accountOpers;
|
||||
}
|
||||
return cnt;
|
||||
}
|
||||
}
|
||||
];
|
||||
|
|
|
|||
|
|
@ -479,7 +479,7 @@ 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.needReceiving) {
|
||||
if (entity === 'wpProduct' && wpProduct && wpProduct.type === 'mp' && wpProduct.needReceiving) {
|
||||
//小程序支付受到发货限制,对deposit执行ship并级联创建虚拟发货的ship,系统账户的金额变化延后至确认收货后操作
|
||||
if (depositId) {
|
||||
//充值deposit执行ship,并创建关联的虚拟ship
|
||||
|
|
|
|||
|
|
@ -59,7 +59,7 @@ const triggers = [
|
|||
}
|
||||
},
|
||||
{
|
||||
// todo,deposit的ship和 shipClazz中有配置wechatShip且可获取openId的order的ship
|
||||
// deposit的ship和 shipClazz中有配置wechatShip且可获取openId的order的ship
|
||||
entity: 'ship',
|
||||
name: '当虚拟的ship变为shipping状态时,调用小程序发货信息录入接口',
|
||||
action: 'ship',
|
||||
|
|
@ -232,7 +232,7 @@ const triggers = [
|
|||
const { entity, entityId, extraShipId } = ship;
|
||||
if (entity && entityId && extraShipId) {
|
||||
const shipClazz = await getShipClazz(entity, entityId, context);
|
||||
await shipClazz.cancelOrder(extraShipId, context);
|
||||
await shipClazz.cancelOrder(id, context);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
@ -342,5 +342,44 @@ const triggers = [
|
|||
}
|
||||
},
|
||||
},
|
||||
{
|
||||
name: '当虚拟ship确认收货后更新deposit状态',
|
||||
entity: 'ship',
|
||||
action: 'succeedReceiving',
|
||||
when: 'commit',
|
||||
asRoot: true,
|
||||
fn: async ({ ids }, context, option) => {
|
||||
assert(ids.length === 1);
|
||||
const id = ids[0];
|
||||
const [ship] = await context.select('ship', {
|
||||
data: {
|
||||
id: 1,
|
||||
type: 1,
|
||||
deposit$ship: {
|
||||
$entity: 'deposit',
|
||||
data: {
|
||||
id: 1,
|
||||
iState: 1,
|
||||
}
|
||||
}
|
||||
},
|
||||
filter: {
|
||||
id
|
||||
}
|
||||
}, { dontCollect: true, forUpdate: true });
|
||||
const { type, deposit$ship: deposits } = ship;
|
||||
if (type === 'virtual' && deposits && deposits.length > 0) {
|
||||
const [deposit] = deposits;
|
||||
await context.operate('deposit', {
|
||||
id: await generateNewIdAsync(),
|
||||
action: 'succeed',
|
||||
data: {},
|
||||
filter: {
|
||||
id: deposit.id,
|
||||
}
|
||||
}, option);
|
||||
}
|
||||
},
|
||||
},
|
||||
];
|
||||
export default triggers;
|
||||
|
|
|
|||
|
|
@ -6,6 +6,6 @@ import { BRC } from '../types/RuntimeCxt';
|
|||
* @param context
|
||||
* @param refunds
|
||||
*/
|
||||
export declare function updateWithdrawState(context: BRC, id: string): Promise<1 | 0>;
|
||||
export declare function updateWithdrawState(context: BRC, id: string): Promise<0 | 1>;
|
||||
declare const triggers: Trigger<EntityDict, 'withdraw', BRC>[];
|
||||
export default triggers;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import WechatPay from './WechatPay';
|
||||
import WechatPayDebug from './WechatPay.debug';
|
||||
declare const _default: typeof WechatPay | typeof WechatPayDebug;
|
||||
declare const _default: typeof WechatPayDebug | typeof WechatPay;
|
||||
export default _default;
|
||||
|
|
|
|||
|
|
@ -62,15 +62,22 @@ const checkers = [
|
|||
type: 'row',
|
||||
action: ['startReceiving', 'succeedReceiving'],
|
||||
filter: {
|
||||
shipOrder$ship: {
|
||||
order: {
|
||||
pay$order: {
|
||||
wpProduct: {
|
||||
needReceiving: true
|
||||
$or: [
|
||||
{
|
||||
type: 'virtual',
|
||||
},
|
||||
{
|
||||
shipOrder$ship: {
|
||||
order: {
|
||||
pay$order: {
|
||||
wpProduct: {
|
||||
needReceiving: true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
|
|
|
|||
|
|
@ -75,6 +75,17 @@ const actionAuths = [
|
|||
id: 'user-acc-wdtransfer',
|
||||
pathId: 'user-acc-wdtransfer',
|
||||
deActions: ['select', 'create'],
|
||||
},
|
||||
//ship
|
||||
{
|
||||
id: 'user-deposit-ship',
|
||||
pathId: 'user-deposit-ship',
|
||||
deActions: ['select', 'succeedReceiving', 'reject'],
|
||||
},
|
||||
{
|
||||
id: 'creator-deposit-ship',
|
||||
pathId: 'creator-deposit-ship',
|
||||
deActions: ['select', 'succeedReceiving', 'reject'],
|
||||
}
|
||||
];
|
||||
exports.default = actionAuths;
|
||||
|
|
|
|||
|
|
@ -27,7 +27,15 @@ const i18ns = [
|
|||
"maxOverflow": "充值金额不得高于%{value}元",
|
||||
"minOverflow": "充值金额不得低于%{value}元"
|
||||
},
|
||||
"yuan": "(元)"
|
||||
"yuan": "(元)",
|
||||
"ship": {
|
||||
"unconfirm": "您有未确认的充值,请尽快前往确认",
|
||||
"success": "充值确认成功",
|
||||
"wait": "状态核验中,请等待",
|
||||
"fail": "确认失败,请稍后重试",
|
||||
"update wechat": "请升级微信版本",
|
||||
"no transactionId": "暂无相关信息,请联系管理员"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
|
|
@ -207,13 +215,17 @@ const i18ns = [
|
|||
"placeholder": "一般是一长串数字加字母"
|
||||
},
|
||||
"ship": {
|
||||
"shipped": "待确认"
|
||||
"shipped": "待确认",
|
||||
"success": "充值确认成功",
|
||||
"wait": "状态核验中,请等待",
|
||||
"fail": "确认失败,请稍后重试",
|
||||
"update wechat": "请升级微信版本",
|
||||
"no transactionId": "暂无相关信息,请联系管理员"
|
||||
},
|
||||
"successAt": {
|
||||
"title": "登记转账时间",
|
||||
"tips": "转帐时间可能会影响退款的期限,尽量设置准确"
|
||||
},
|
||||
"depositSuccess": "充值成功"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
|
|
|
|||
|
|
@ -105,6 +105,20 @@ const paths = [
|
|||
destEntity: 'withdrawTransfer',
|
||||
value: 'withdraw.account.user',
|
||||
recursive: false,
|
||||
}
|
||||
},
|
||||
{
|
||||
id: 'user-deposit-ship',
|
||||
sourceEntity: 'user',
|
||||
destEntity: 'ship',
|
||||
value: 'deposit$ship.account.user',
|
||||
recursive: false,
|
||||
},
|
||||
{
|
||||
id: 'creator-deposit-ship',
|
||||
sourceEntity: 'user',
|
||||
destEntity: 'ship',
|
||||
value: 'deposit$ship.creator',
|
||||
recursive: false,
|
||||
},
|
||||
];
|
||||
exports.default = paths;
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ const triggers = [
|
|||
entity: 'deposit',
|
||||
name: '当受发货限制的deposit充值成功后,计算相应的account以及system account中的余额变化',
|
||||
action: 'succeed',
|
||||
when: 'after',
|
||||
when: 'before',
|
||||
asRoot: true,
|
||||
fn: async ({ operation }, context) => {
|
||||
const { data, filter } = operation;
|
||||
|
|
@ -58,6 +58,7 @@ const triggers = [
|
|||
const [deposit] = deposits;
|
||||
const { pay$deposit: pays, price, loss, shipId } = deposit;
|
||||
let cnt = 1;
|
||||
let accountOpers = [];
|
||||
if (shipId) {
|
||||
(0, assert_1.default)(pays);
|
||||
for (const pay of pays) {
|
||||
|
|
@ -103,20 +104,18 @@ const triggers = [
|
|||
},
|
||||
}, {});
|
||||
}
|
||||
const accountOpers = [
|
||||
{
|
||||
accountOpers.push({
|
||||
id: await (0, uuid_1.generateNewIdAsync)(),
|
||||
data: {
|
||||
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',
|
||||
}
|
||||
];
|
||||
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', {
|
||||
|
|
@ -143,7 +142,10 @@ const triggers = [
|
|||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
if (accountOpers && accountOpers.length > 0) {
|
||||
data.accountOper$entity = accountOpers;
|
||||
}
|
||||
return cnt;
|
||||
}
|
||||
}
|
||||
];
|
||||
|
|
|
|||
|
|
@ -482,7 +482,7 @@ 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.needReceiving) {
|
||||
if (entity === 'wpProduct' && wpProduct && wpProduct.type === 'mp' && wpProduct.needReceiving) {
|
||||
//小程序支付受到发货限制,对deposit执行ship并级联创建虚拟发货的ship,系统账户的金额变化延后至确认收货后操作
|
||||
if (depositId) {
|
||||
//充值deposit执行ship,并创建关联的虚拟ship
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@ const triggers = [
|
|||
}
|
||||
},
|
||||
{
|
||||
// todo,deposit的ship和 shipClazz中有配置wechatShip且可获取openId的order的ship
|
||||
// deposit的ship和 shipClazz中有配置wechatShip且可获取openId的order的ship
|
||||
entity: 'ship',
|
||||
name: '当虚拟的ship变为shipping状态时,调用小程序发货信息录入接口',
|
||||
action: 'ship',
|
||||
|
|
@ -143,7 +143,7 @@ const triggers = [
|
|||
}
|
||||
}
|
||||
if (needUpload) {
|
||||
// await (0, ship_1.uploadShippingInfo)(shipId, context);
|
||||
await (0, ship_1.uploadShippingInfo)(shipId, context);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
|
@ -235,7 +235,7 @@ const triggers = [
|
|||
const { entity, entityId, extraShipId } = ship;
|
||||
if (entity && entityId && extraShipId) {
|
||||
const shipClazz = await (0, shipClazz_1.getShipClazz)(entity, entityId, context);
|
||||
await shipClazz.cancelOrder(extraShipId, context);
|
||||
await shipClazz.cancelOrder(id, context);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
@ -345,5 +345,44 @@ const triggers = [
|
|||
}
|
||||
},
|
||||
},
|
||||
{
|
||||
name: '当虚拟ship确认收货后更新deposit状态',
|
||||
entity: 'ship',
|
||||
action: 'succeedReceiving',
|
||||
when: 'commit',
|
||||
asRoot: true,
|
||||
fn: async ({ ids }, context, option) => {
|
||||
(0, assert_1.default)(ids.length === 1);
|
||||
const id = ids[0];
|
||||
const [ship] = await context.select('ship', {
|
||||
data: {
|
||||
id: 1,
|
||||
type: 1,
|
||||
deposit$ship: {
|
||||
$entity: 'deposit',
|
||||
data: {
|
||||
id: 1,
|
||||
iState: 1,
|
||||
}
|
||||
}
|
||||
},
|
||||
filter: {
|
||||
id
|
||||
}
|
||||
}, { dontCollect: true, forUpdate: true });
|
||||
const { type, deposit$ship: deposits } = ship;
|
||||
if (type === 'virtual' && deposits && deposits.length > 0) {
|
||||
const [deposit] = deposits;
|
||||
await context.operate('deposit', {
|
||||
id: await (0, uuid_1.generateNewIdAsync)(),
|
||||
action: 'succeed',
|
||||
data: {},
|
||||
filter: {
|
||||
id: deposit.id,
|
||||
}
|
||||
}, option);
|
||||
}
|
||||
},
|
||||
},
|
||||
];
|
||||
exports.default = triggers;
|
||||
|
|
|
|||
|
|
@ -6,6 +6,6 @@ import { BRC } from '../types/RuntimeCxt';
|
|||
* @param context
|
||||
* @param refunds
|
||||
*/
|
||||
export declare function updateWithdrawState(context: BRC, id: string): Promise<1 | 0>;
|
||||
export declare function updateWithdrawState(context: BRC, id: string): Promise<0 | 1>;
|
||||
declare const triggers: Trigger<EntityDict, 'withdraw', BRC>[];
|
||||
export default triggers;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import WechatPay from './WechatPay';
|
||||
import WechatPayDebug from './WechatPay.debug';
|
||||
declare const _default: typeof WechatPay | typeof WechatPayDebug;
|
||||
declare const _default: typeof WechatPayDebug | typeof WechatPay;
|
||||
export default _default;
|
||||
|
|
|
|||
|
|
@ -67,15 +67,22 @@ const checkers: Checker<EntityDict, 'ship', RuntimeCxt>[] = [
|
|||
type: 'row',
|
||||
action: ['startReceiving', 'succeedReceiving'],
|
||||
filter: {
|
||||
shipOrder$ship: {
|
||||
order: {
|
||||
pay$order: {
|
||||
wpProduct: {
|
||||
needReceiving: true
|
||||
$or: [
|
||||
{
|
||||
type: 'virtual',
|
||||
},
|
||||
{
|
||||
shipOrder$ship: {
|
||||
order: {
|
||||
pay$order: {
|
||||
wpProduct: {
|
||||
needReceiving: true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
|
|
|
|||
|
|
@ -224,6 +224,117 @@ export default OakComponent({
|
|||
},
|
||||
gotoHistoryMp() {
|
||||
this.props.onGoToHistory!();
|
||||
},
|
||||
async onUnreceivedDepositClickMp() {
|
||||
const { unreceivedDepositId } = this.state;
|
||||
const { data: deposits } = await this.features.cache.refresh('deposit', {
|
||||
data: {
|
||||
id: 1,
|
||||
iState: 1,
|
||||
pay$deposit: {
|
||||
$entity: 'pay',
|
||||
data: {
|
||||
id: 1,
|
||||
meta: 1,
|
||||
iState: 1,
|
||||
entity: 1,
|
||||
entityId: 1,
|
||||
},
|
||||
filter: {
|
||||
entity: 'wpProduct',
|
||||
iState: 'paid',
|
||||
}
|
||||
},
|
||||
shipId: 1,
|
||||
ship: {
|
||||
id: 1,
|
||||
iState: 1,
|
||||
}
|
||||
},
|
||||
filter: {
|
||||
id: unreceivedDepositId,
|
||||
}
|
||||
});
|
||||
const ship = deposits?.[0]?.ship;
|
||||
if (ship && ship.id && ship.iState === 'receiving') {
|
||||
const transactionId = (ship.deposit$ship?.[0]?.pay$deposit?.[0]?.meta as { transaction_id: string })?.transaction_id;
|
||||
console.log('transaction_id', transactionId);
|
||||
if (process.env.NODE_ENV === 'development') {
|
||||
await this.features.cache.operate('ship',
|
||||
[{
|
||||
id: await generateNewIdAsync(),
|
||||
action: 'succeedReceiving',
|
||||
data: {},
|
||||
filter: {
|
||||
id: ship.id,
|
||||
},
|
||||
}]
|
||||
);
|
||||
this.setMessage({
|
||||
type: 'success',
|
||||
content: this.t('ship.success')
|
||||
});
|
||||
return;
|
||||
}
|
||||
if (transactionId) {
|
||||
if ((wx as any).openBusinessView) {
|
||||
(wx as any).openBusinessView({
|
||||
businessType: 'weappOrderConfirm',
|
||||
extraData: {
|
||||
transaction_id: transactionId,
|
||||
},
|
||||
async success() {
|
||||
console.log('success');
|
||||
const mpShipState = await this.features.cache.exec('getMpShipState', {
|
||||
shipId: ship.id,
|
||||
})
|
||||
if (mpShipState === 'received') {
|
||||
await this.features.cache.operate('ship',
|
||||
[{
|
||||
id: await generateNewIdAsync(),
|
||||
action: 'succeedReceiving',
|
||||
data: {},
|
||||
filter: {
|
||||
id: ship.id,
|
||||
},
|
||||
}]
|
||||
);
|
||||
this.setMessage({
|
||||
type: 'success',
|
||||
content: this.t('ship.success')
|
||||
});
|
||||
} else {
|
||||
console.log(mpShipState);
|
||||
this.setMessage({
|
||||
type: 'warning',
|
||||
content: this.t('ship.wait'),
|
||||
})
|
||||
}
|
||||
},
|
||||
fail() {
|
||||
console.log('fail');
|
||||
this.setMessage({
|
||||
type: 'warning',
|
||||
content: this.t('ship.fail'),
|
||||
})
|
||||
},
|
||||
complete() {
|
||||
}
|
||||
});
|
||||
} else {
|
||||
//引导用户升级微信版本
|
||||
this.setMessage({
|
||||
type: 'warning',
|
||||
content: this.t('ship.update wechat'),
|
||||
})
|
||||
}
|
||||
} else {
|
||||
this.setMessage({
|
||||
type: 'warning',
|
||||
content: this.t('no transactionId'),
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
data: {
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
<view class="container">
|
||||
<l-notice-bar show="{{unreceivedDepositId}}" front-icon-name="notification" end-icon-name="right">
|
||||
您有未确认的充值,请尽快前往确认
|
||||
<l-notice-bar show="{{unreceivedDepositId}}" front-icon-name="notification" end-icon-name="right"
|
||||
bind:lintap="onUnreceivedDepositClickMp" bind:linicontap="onUnreceivedDepositClickMp">
|
||||
{{t('ship.unconfirm')}}
|
||||
</l-notice-bar>
|
||||
<view class="info" style="background-color:{{bgColor}};color:{{textColor}};">
|
||||
<view
|
||||
|
|
|
|||
|
|
@ -17,5 +17,13 @@
|
|||
"maxOverflow": "充值金额不得高于%{value}元",
|
||||
"minOverflow": "充值金额不得低于%{value}元"
|
||||
},
|
||||
"yuan": "(元)"
|
||||
"yuan": "(元)",
|
||||
"ship": {
|
||||
"unconfirm": "您有未确认的充值,请尽快前往确认",
|
||||
"success": "充值确认成功",
|
||||
"wait": "状态核验中,请等待",
|
||||
"fail": "确认失败,请稍后重试",
|
||||
"update wechat": "请升级微信版本",
|
||||
"no transactionId": "暂无相关信息,请联系管理员"
|
||||
}
|
||||
}
|
||||
|
|
@ -92,40 +92,45 @@ export function registerFrontendPayRoutine<ED extends EntityDict & BaseEntityDic
|
|||
};
|
||||
}
|
||||
|
||||
const baseProjection: EntityDict['pay']['Projection'] = {
|
||||
id: 1,
|
||||
applicationId: 1,
|
||||
price: 1,
|
||||
meta: 1,
|
||||
iState: 1,
|
||||
paid: 1,
|
||||
refunded: 1,
|
||||
timeoutAt: 1,
|
||||
forbidRefundAt: 1,
|
||||
externalId: 1,
|
||||
orderId: 1,
|
||||
depositId: 1,
|
||||
deposit: {
|
||||
id: 1,
|
||||
accountId: 1,
|
||||
price: 1,
|
||||
loss: 1,
|
||||
iState: 1,
|
||||
shipId: 1,
|
||||
ship: {
|
||||
id: 1,
|
||||
iState: 1,
|
||||
}
|
||||
},
|
||||
order: {
|
||||
id: 1,
|
||||
creatorId: 1,
|
||||
},
|
||||
entity: 1,
|
||||
entityId: 1,
|
||||
creatorId: 1,
|
||||
phantom3: 1,
|
||||
};
|
||||
|
||||
export default OakComponent({
|
||||
entity: 'pay',
|
||||
isList: false,
|
||||
projection: () => {
|
||||
const baseProjection: EntityDict['pay']['Projection'] = {
|
||||
id: 1,
|
||||
applicationId: 1,
|
||||
price: 1,
|
||||
meta: 1,
|
||||
iState: 1,
|
||||
paid: 1,
|
||||
refunded: 1,
|
||||
timeoutAt: 1,
|
||||
forbidRefundAt: 1,
|
||||
externalId: 1,
|
||||
orderId: 1,
|
||||
depositId: 1,
|
||||
deposit: {
|
||||
id: 1,
|
||||
accountId: 1,
|
||||
price: 1,
|
||||
loss: 1,
|
||||
iState: 1,
|
||||
shipId: 1,
|
||||
},
|
||||
order: {
|
||||
id: 1,
|
||||
creatorId: 1,
|
||||
},
|
||||
entity: 1,
|
||||
entityId: 1,
|
||||
creatorId: 1,
|
||||
phantom3: 1,
|
||||
};
|
||||
for (const k in PayRoutineDict) {
|
||||
merge(baseProjection, PayRoutineDict[k].projection);
|
||||
}
|
||||
|
|
@ -204,6 +209,7 @@ export default OakComponent({
|
|||
oakExecutable: this.tryExecute(),
|
||||
iStateStr,
|
||||
shipId: data?.deposit?.shipId,
|
||||
ship: data?.deposit?.ship,
|
||||
depositId: data?.depositId,
|
||||
};
|
||||
},
|
||||
|
|
@ -347,17 +353,121 @@ export default OakComponent({
|
|||
this.update({
|
||||
externalId: null,
|
||||
});
|
||||
},
|
||||
async confirmShipMp(shipId: string, shipState: EntityDict['ship']['Schema']['iState']) {
|
||||
//小程序唤起确认收货组件
|
||||
if (process.env.OAK_PLATFORM === 'wechatMp') {
|
||||
const { pay, } = this.state;
|
||||
if (shipId && shipState === 'receiving') {
|
||||
if (process.env.NODE_ENV === 'development') {
|
||||
await this.features.cache.operate('ship',
|
||||
[{
|
||||
id: await generateNewIdAsync(),
|
||||
action: 'succeedReceiving',
|
||||
data: {},
|
||||
filter: {
|
||||
id: shipId,
|
||||
},
|
||||
}]
|
||||
);
|
||||
this.setMessage({
|
||||
type: 'success',
|
||||
content: this.t('ship.success')
|
||||
});
|
||||
return;
|
||||
}
|
||||
if (pay.meta.transaction_id) {
|
||||
if ((wx as any).openBusinessView) {
|
||||
(wx as any).openBusinessView({
|
||||
businessType: 'weappOrderConfirm',
|
||||
extraData: {
|
||||
transaction_id: pay.meta.transaction_id,
|
||||
},
|
||||
async success() {
|
||||
console.log('success');
|
||||
const mpShipState = await this.features.cache.exec('getMpShipState', {
|
||||
shipId,
|
||||
})
|
||||
if (mpShipState === 'received') {
|
||||
await this.features.cache.operate('ship',
|
||||
[{
|
||||
id: await generateNewIdAsync(),
|
||||
action: 'succeedReceiving',
|
||||
data: {},
|
||||
filter: {
|
||||
id: shipId,
|
||||
},
|
||||
}]
|
||||
);
|
||||
this.setMessage({
|
||||
type: 'success',
|
||||
content: this.t('ship.success')
|
||||
});
|
||||
} else {
|
||||
console.log(mpShipState);
|
||||
this.setMessage({
|
||||
type: 'warning',
|
||||
content: this.t('ship.wait'),
|
||||
})
|
||||
}
|
||||
},
|
||||
fail() {
|
||||
console.log('fail');
|
||||
this.setMessage({
|
||||
type: 'warning',
|
||||
content: this.t('ship.fail'),
|
||||
})
|
||||
},
|
||||
complete() {
|
||||
}
|
||||
});
|
||||
} else {
|
||||
//引导用户升级微信版本
|
||||
this.setMessage({
|
||||
type: 'warning',
|
||||
content: this.t('ship.update wechat'),
|
||||
})
|
||||
}
|
||||
} else {
|
||||
this.setMessage({
|
||||
type: 'warning',
|
||||
content: this.t('no transactionId'),
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
lifetimes: {
|
||||
async ready() {
|
||||
const { oakId } = this.props;
|
||||
assert(typeof oakId === 'string');
|
||||
const unsub = await this.subDataEvents([`${DATA_SUBSCRIBER_KEYS.payStateChanged}-${oakId}`]);
|
||||
const unsub = await this.subDataEvents([`${DATA_SUBSCRIBER_KEYS.payStateChanged}-${oakId}`],
|
||||
async (event: string, opRecords: OpRecord<ED>[]) => {
|
||||
for (const record of opRecords) {
|
||||
if (record.a === 'succeedPaying') {
|
||||
const { e, d } = record;
|
||||
if (e === 'pay' && d.iState === 'paid') {
|
||||
await this.features.cache.refresh('pay', {
|
||||
data: baseProjection,
|
||||
filter: {
|
||||
id: oakId,
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
this.setState({
|
||||
unsub,
|
||||
})
|
||||
},
|
||||
async mature() {
|
||||
const { ship } = this.state;
|
||||
if (ship?.id && ship?.iState === 'receiving') {
|
||||
await this.confirmShipMp(ship.id, ship.iState);
|
||||
}
|
||||
},
|
||||
detached() {
|
||||
const { unsub, unsubShip } = this.state;
|
||||
unsub && unsub();
|
||||
|
|
@ -387,54 +497,10 @@ export default OakComponent({
|
|||
if (process.env.OAK_PLATFORM === 'wechatMp') {
|
||||
//在充值虚拟发货成功后,小程序唤起确认收货组件
|
||||
for (const record of opRecords) {
|
||||
if (record.a === 'u') {
|
||||
if (record.a === 'startReceiving') {
|
||||
const { e, d } = record;
|
||||
const { pay } = this.state;
|
||||
if (e === 'ship' && d.iState === 'receiving' && pay.meta.transaction_id) {
|
||||
if ((wx as any).openBusinessView) {
|
||||
(wx as any).openBusinessView({
|
||||
businessType: 'weappOrderConfirm',
|
||||
extraData: {
|
||||
transaction_id: pay.meta.transaction_id,
|
||||
},
|
||||
async success() {
|
||||
console.log('success');
|
||||
const mpShipState = await this.features.cache.exec('getMpShipState', {
|
||||
shipId: next.shipId,
|
||||
})
|
||||
if (mpShipState === 'received') {
|
||||
await this.execute(
|
||||
undefined,
|
||||
{
|
||||
type: 'success',
|
||||
context: this.t('depositSuccess')
|
||||
},
|
||||
undefined,
|
||||
[{
|
||||
entity: 'ship',
|
||||
operation: {
|
||||
id: await generateNewIdAsync(),
|
||||
action: 'succeedReceiving',
|
||||
data: {},
|
||||
filter: {
|
||||
id: next.shipId,
|
||||
},
|
||||
},
|
||||
}]);
|
||||
} else {
|
||||
console.log(mpShipState);
|
||||
}
|
||||
},
|
||||
fail() {
|
||||
console.log('fail');
|
||||
},
|
||||
complete() {
|
||||
}
|
||||
});
|
||||
} else {
|
||||
//引导用户升级微信版本
|
||||
}
|
||||
|
||||
if (e === 'ship' && d.iState === 'receiving') {
|
||||
await this.confirmShipMp(next.shipId, d.iState);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -42,11 +42,15 @@
|
|||
"placeholder": "一般是一长串数字加字母"
|
||||
},
|
||||
"ship": {
|
||||
"shipped": "待确认"
|
||||
"shipped": "待确认",
|
||||
"success": "充值确认成功",
|
||||
"wait": "状态核验中,请等待",
|
||||
"fail": "确认失败,请稍后重试",
|
||||
"update wechat": "请升级微信版本",
|
||||
"no transactionId": "暂无相关信息,请联系管理员"
|
||||
},
|
||||
"successAt": {
|
||||
"title": "登记转账时间",
|
||||
"tips": "转帐时间可能会影响退款的期限,尽量设置准确"
|
||||
},
|
||||
"depositSuccess": "充值成功"
|
||||
}
|
||||
}
|
||||
|
|
@ -75,6 +75,17 @@ const actionAuths: ActionAuth[] = [
|
|||
id: 'user-acc-wdtransfer',
|
||||
pathId: 'user-acc-wdtransfer',
|
||||
deActions: ['select', 'create'],
|
||||
},
|
||||
//ship
|
||||
{
|
||||
id: 'user-deposit-ship',
|
||||
pathId: 'user-deposit-ship',
|
||||
deActions: ['select', 'succeedReceiving', 'reject'],
|
||||
},
|
||||
{
|
||||
id: 'creator-deposit-ship',
|
||||
pathId: 'creator-deposit-ship',
|
||||
deActions: ['select', 'succeedReceiving', 'reject'],
|
||||
}
|
||||
];
|
||||
|
||||
|
|
|
|||
|
|
@ -27,7 +27,15 @@ const i18ns: I18n[] = [
|
|||
"maxOverflow": "充值金额不得高于%{value}元",
|
||||
"minOverflow": "充值金额不得低于%{value}元"
|
||||
},
|
||||
"yuan": "(元)"
|
||||
"yuan": "(元)",
|
||||
"ship": {
|
||||
"unconfirm": "您有未确认的充值,请尽快前往确认",
|
||||
"success": "充值确认成功",
|
||||
"wait": "状态核验中,请等待",
|
||||
"fail": "确认失败,请稍后重试",
|
||||
"update wechat": "请升级微信版本",
|
||||
"no transactionId": "暂无相关信息,请联系管理员"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
|
|
@ -207,13 +215,17 @@ const i18ns: I18n[] = [
|
|||
"placeholder": "一般是一长串数字加字母"
|
||||
},
|
||||
"ship": {
|
||||
"shipped": "待确认"
|
||||
"shipped": "待确认",
|
||||
"success": "充值确认成功",
|
||||
"wait": "状态核验中,请等待",
|
||||
"fail": "确认失败,请稍后重试",
|
||||
"update wechat": "请升级微信版本",
|
||||
"no transactionId": "暂无相关信息,请联系管理员"
|
||||
},
|
||||
"successAt": {
|
||||
"title": "登记转账时间",
|
||||
"tips": "转帐时间可能会影响退款的期限,尽量设置准确"
|
||||
},
|
||||
"depositSuccess": "充值成功"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
|
|
|
|||
|
|
@ -106,7 +106,21 @@ const paths: Path[] = [
|
|||
destEntity: 'withdrawTransfer',
|
||||
value: 'withdraw.account.user',
|
||||
recursive: false,
|
||||
}
|
||||
},
|
||||
{
|
||||
id: 'user-deposit-ship',
|
||||
sourceEntity: 'user',
|
||||
destEntity: 'ship',
|
||||
value: 'deposit$ship.account.user',
|
||||
recursive: false,
|
||||
},
|
||||
{
|
||||
id: 'creator-deposit-ship',
|
||||
sourceEntity: 'user',
|
||||
destEntity: 'ship',
|
||||
value: 'deposit$ship.creator',
|
||||
recursive: false,
|
||||
},
|
||||
];
|
||||
|
||||
export default paths;
|
||||
Loading…
Reference in New Issue