Merge branch 'dev' into release
This commit is contained in:
commit
f00e24a71c
|
|
@ -319,10 +319,10 @@ export default OakComponent({
|
|||
});
|
||||
const ship = deposit?.ship;
|
||||
if (ship && ship.id) {
|
||||
if (ship.iState === 'receiving') {
|
||||
const transactionId = deposit?.pay$deposit?.[0]?.meta?.transaction_id;
|
||||
console.log('transaction_id', transactionId);
|
||||
if (process.env.NODE_ENV === 'development') {
|
||||
const transactionId = deposit?.pay$deposit?.[0]?.meta?.transaction_id;
|
||||
console.log('transaction_id', transactionId);
|
||||
if (process.env.NODE_ENV === 'development') {
|
||||
if (ship.iState === 'receiving') {
|
||||
await this.features.cache.operate('ship', [{
|
||||
id: await generateNewIdAsync(),
|
||||
action: 'succeedReceiving',
|
||||
|
|
@ -331,92 +331,74 @@ export default OakComponent({
|
|||
id: ship.id,
|
||||
},
|
||||
}]);
|
||||
await this.features.cache.refresh('deposit', {
|
||||
data: {
|
||||
id: 1,
|
||||
iState: 1,
|
||||
},
|
||||
filter: {
|
||||
id: unreceivedDepositId,
|
||||
}
|
||||
});
|
||||
this.setMessage({
|
||||
type: 'success',
|
||||
content: this.t('ship.success')
|
||||
});
|
||||
return;
|
||||
}
|
||||
if (transactionId) {
|
||||
if (wx.openBusinessView) {
|
||||
wx.openBusinessView({
|
||||
businessType: 'weappOrderConfirm',
|
||||
extraData: {
|
||||
transaction_id: transactionId,
|
||||
},
|
||||
success: async () => {
|
||||
console.log('success');
|
||||
const { result: 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.reRender();
|
||||
// this.setMessage({
|
||||
// type: 'warning',
|
||||
// content: this.t('ship.wait'),
|
||||
// })
|
||||
}
|
||||
},
|
||||
fail() {
|
||||
console.log('fail');
|
||||
}
|
||||
if (transactionId) {
|
||||
if (wx.openBusinessView) {
|
||||
wx.openBusinessView({
|
||||
businessType: 'weappOrderConfirm',
|
||||
extraData: {
|
||||
transaction_id: transactionId,
|
||||
},
|
||||
success: async () => {
|
||||
console.log('success');
|
||||
const { result: 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: 'warning',
|
||||
content: this.t('ship.fail'),
|
||||
type: 'success',
|
||||
content: this.t('ship.success')
|
||||
});
|
||||
},
|
||||
complete() {
|
||||
}
|
||||
});
|
||||
}
|
||||
else {
|
||||
//引导用户升级微信版本
|
||||
this.setMessage({
|
||||
type: 'warning',
|
||||
content: this.t('ship.update wechat'),
|
||||
});
|
||||
}
|
||||
else {
|
||||
console.log(mpShipState);
|
||||
this.reRender();
|
||||
// this.setMessage({
|
||||
// type: 'warning',
|
||||
// content: this.t('ship.wait'),
|
||||
// })
|
||||
}
|
||||
},
|
||||
fail: () => {
|
||||
console.log('fail');
|
||||
this.setMessage({
|
||||
type: 'warning',
|
||||
content: this.t('ship.fail'),
|
||||
});
|
||||
},
|
||||
complete: () => {
|
||||
}
|
||||
});
|
||||
}
|
||||
else {
|
||||
if (!noMessage) {
|
||||
this.setMessage({
|
||||
type: 'warning',
|
||||
content: this.t('no transactionId'),
|
||||
});
|
||||
}
|
||||
//引导用户升级微信版本
|
||||
this.setMessage({
|
||||
type: 'warning',
|
||||
content: this.t('ship.update wechat'),
|
||||
});
|
||||
}
|
||||
}
|
||||
else {
|
||||
// if (!noMessage) {
|
||||
// this.setMessage({
|
||||
// content: this.t('ship.wait'),
|
||||
// type: 'warning',
|
||||
// })
|
||||
// }
|
||||
this.reRender();
|
||||
if (!noMessage) {
|
||||
this.setMessage({
|
||||
type: 'warning',
|
||||
content: this.t('no transactionId'),
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
<view class="container">
|
||||
<l-notice-bar show="{{!!unreceivedDepositId}}" front-icon-name="notification" end-icon-name="right"
|
||||
bind:lintap="onUnreceivedDepositClickMp" bind:linicontap="onUnreceivedDepositClickMp">
|
||||
{{t('ship.unconfirm')}}
|
||||
<view style="width:100vw">{{t('ship.unconfirm')}}</view>
|
||||
</l-notice-bar>
|
||||
<view class="info" style="background-color:{{bgColor}};color:{{textColor}};">
|
||||
<view
|
||||
|
|
|
|||
|
|
@ -136,11 +136,12 @@ export default OakComponent({
|
|||
const iState = data?.iState;
|
||||
let iStateStr = this.t(`pay:v.iState.${iState}`);
|
||||
let iStateColor = iState && this.features.style.getColor('pay', 'iState', iState);
|
||||
let showDepositConfirm = false;
|
||||
let showDepositConfirm = false, depositConfirmLoading = false;
|
||||
if (data?.depositId && data?.deposit?.shipId && data?.deposit?.iState === 'shipped') {
|
||||
iStateStr = this.t('ship.shipped');
|
||||
iStateColor = this.features.style.getColor('deposit', 'iState', data?.deposit?.iState);
|
||||
showDepositConfirm = true;
|
||||
depositConfirmLoading = data?.deposit?.ship?.iState !== 'receiving';
|
||||
}
|
||||
const startPayable = iState === 'paying' && !['account', 'offlineAccount'].includes(data.entity) && (PayRoutineDict[data.entity] && PayRoutineDict[data.entity].judgeCanPay(data, this.features));
|
||||
const { mode } = this.props;
|
||||
|
|
@ -183,6 +184,7 @@ export default OakComponent({
|
|||
ship: data?.deposit?.ship,
|
||||
depositId: data?.depositId,
|
||||
showDepositConfirm,
|
||||
depositConfirmLoading,
|
||||
};
|
||||
},
|
||||
features: [{
|
||||
|
|
@ -332,8 +334,8 @@ export default OakComponent({
|
|||
if (process.env.OAK_PLATFORM === 'wechatMp') {
|
||||
const shipId = ship.id;
|
||||
const shipState = ship.iState;
|
||||
if (shipId && shipState === 'receiving') {
|
||||
if (process.env.NODE_ENV === 'development') {
|
||||
if (process.env.NODE_ENV === 'development') {
|
||||
if (shipId && shipState === 'receiving') {
|
||||
await this.features.cache.operate('ship', [{
|
||||
id: await generateNewIdAsync(),
|
||||
action: 'succeedReceiving',
|
||||
|
|
@ -342,85 +344,73 @@ export default OakComponent({
|
|||
id: shipId,
|
||||
},
|
||||
}]);
|
||||
await this.features.cache.refresh('deposit', {
|
||||
data: {
|
||||
id: 1,
|
||||
iState: 1,
|
||||
},
|
||||
filter: {
|
||||
id: depositId,
|
||||
}
|
||||
});
|
||||
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.reRender();
|
||||
this.setMessage({
|
||||
type: 'success',
|
||||
content: this.t('ship.success')
|
||||
});
|
||||
}
|
||||
else {
|
||||
console.log(mpShipState);
|
||||
// this.setMessage({
|
||||
// type: 'warning',
|
||||
// content: this.t('ship.wait'),
|
||||
// })
|
||||
this.reRender();
|
||||
}
|
||||
},
|
||||
fail() {
|
||||
console.log('fail');
|
||||
}
|
||||
if (pay.meta.transaction_id) {
|
||||
if (wx.openBusinessView) {
|
||||
wx.openBusinessView({
|
||||
businessType: 'weappOrderConfirm',
|
||||
extraData: {
|
||||
transaction_id: pay.meta.transaction_id,
|
||||
},
|
||||
success: async () => {
|
||||
console.log('success');
|
||||
const { result: 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.reRender();
|
||||
this.setMessage({
|
||||
type: 'warning',
|
||||
content: this.t('ship.fail'),
|
||||
type: 'success',
|
||||
content: this.t('ship.success')
|
||||
});
|
||||
},
|
||||
complete() {
|
||||
}
|
||||
});
|
||||
}
|
||||
else {
|
||||
//引导用户升级微信版本
|
||||
this.setMessage({
|
||||
type: 'warning',
|
||||
content: this.t('ship.update wechat'),
|
||||
});
|
||||
}
|
||||
else {
|
||||
console.log(mpShipState);
|
||||
// this.setMessage({
|
||||
// type: 'warning',
|
||||
// content: this.t('ship.wait'),
|
||||
// })
|
||||
this.reRender();
|
||||
}
|
||||
},
|
||||
fail: () => {
|
||||
console.log('fail');
|
||||
this.setMessage({
|
||||
type: 'warning',
|
||||
content: this.t('ship.fail'),
|
||||
});
|
||||
},
|
||||
complete: () => {
|
||||
}
|
||||
});
|
||||
}
|
||||
else {
|
||||
//引导用户升级微信版本
|
||||
this.setMessage({
|
||||
type: 'warning',
|
||||
content: this.t('no transactionId'),
|
||||
content: this.t('ship.update wechat'),
|
||||
});
|
||||
}
|
||||
}
|
||||
else {
|
||||
this.reRender();
|
||||
this.setMessage({
|
||||
type: 'warning',
|
||||
content: this.t('no transactionId'),
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -204,16 +204,18 @@
|
|||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
row-gap: 32rpx;
|
||||
padding: 12rpx;
|
||||
row-gap: 80rpx;
|
||||
padding: 24rpx;
|
||||
box-sizing: border-box;
|
||||
margin-top: 24rpx;
|
||||
background-color: #fff;
|
||||
border-radius: 16rpx;
|
||||
height: 30vh;
|
||||
|
||||
.depositConfrimText {
|
||||
display: flex;
|
||||
gap: 18rpx;
|
||||
line-height: 36rpx;
|
||||
line-height: 48rpx;
|
||||
font-size: 32rpx;
|
||||
}
|
||||
}
|
||||
|
|
@ -91,7 +91,7 @@
|
|||
</l-form>
|
||||
</block>
|
||||
<block wx:elif="{{pay.entity === 'wpProduct'}}">
|
||||
<view wx:if="{{pay.iState === 'paid'}}" class="paid">
|
||||
<view wx:if="{{pay.iState === 'paid' && !showDepositConfirm}}" class="paid">
|
||||
<l-icon name="success" color="green" size="140" />
|
||||
<view class="text">{{t('success')}}</view>
|
||||
</view>
|
||||
|
|
@ -110,15 +110,16 @@
|
|||
<view class="padding">
|
||||
<view wx:if="{{showDepositConfirm}}" class="depositConfrimBox">
|
||||
<view class="depositConfrimText">
|
||||
<l-icon name='warning' size="32" />
|
||||
<span>微信支付成功,请点击下方「充值确认」按钮,确认后即可正常使用余额!</span>
|
||||
<l-icon name='warning' size="36" color="#faad14" />
|
||||
<span>{{depositConfirmLoading ? t('ship.waiting.tip') : t('ship.confirming.tip')}}</span>
|
||||
</view>
|
||||
<l-button
|
||||
plain="{{true}}"
|
||||
shape="semicircle"
|
||||
size="long"
|
||||
bind:lintap="confirmShipMp"
|
||||
loading="{{depositConfirmLoading}}"
|
||||
style="width:100%"
|
||||
>
|
||||
充值确认
|
||||
{{depositConfirmLoading ? t('ship.waiting.confirm') : t('ship.confirming.confirm')}}
|
||||
</l-button>
|
||||
</view>
|
||||
</view>
|
||||
|
|
@ -169,7 +170,7 @@
|
|||
</l-button>
|
||||
</view>
|
||||
</block>
|
||||
<block wx:elif="{{!closable}}">
|
||||
<block wx:elif="{{!closable && !showDepositConfirm}}">
|
||||
<l-button
|
||||
type="default"
|
||||
size="long"
|
||||
|
|
|
|||
|
|
@ -47,7 +47,15 @@
|
|||
"wait": "状态核验中,请等待",
|
||||
"fail": "确认失败,请稍后重试",
|
||||
"update wechat": "请升级微信版本",
|
||||
"no transactionId": "暂无相关信息,请联系管理员"
|
||||
"no transactionId": "暂无相关信息,请联系管理员",
|
||||
"waiting": {
|
||||
"tip": "由于微信支付限制,充值后必须用户确认收货,正在通知微信服务器……",
|
||||
"confirm": "通知微信中……"
|
||||
},
|
||||
"confirming": {
|
||||
"tip": "由于微信支付限制,充值后必须用户确认收货,充值方可完成",
|
||||
"confirm": "确认收货"
|
||||
}
|
||||
},
|
||||
"successAt": {
|
||||
"title": "登记转账时间",
|
||||
|
|
|
|||
|
|
@ -218,7 +218,15 @@ const i18ns = [
|
|||
"wait": "状态核验中,请等待",
|
||||
"fail": "确认失败,请稍后重试",
|
||||
"update wechat": "请升级微信版本",
|
||||
"no transactionId": "暂无相关信息,请联系管理员"
|
||||
"no transactionId": "暂无相关信息,请联系管理员",
|
||||
"waiting": {
|
||||
"tip": "由于微信支付限制,充值后必须用户确认收货,正在通知微信服务器……",
|
||||
"confirm": "通知微信中……"
|
||||
},
|
||||
"confirming": {
|
||||
"tip": "由于微信支付限制,充值后必须用户确认收货,充值方可完成",
|
||||
"confirm": "确认收货"
|
||||
}
|
||||
},
|
||||
"successAt": {
|
||||
"title": "登记转账时间",
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
import { actionDefDict } from '../oak-app-domain';
|
||||
import { WechatSDK } from 'oak-external-sdk';
|
||||
import { assert } from 'oak-domain/lib/utils/assert';
|
||||
import { generateNewIdAsync } from 'oak-domain/lib/utils/uuid';
|
||||
|
|
@ -298,7 +299,7 @@ export async function getOrderShipState(context, shipId) {
|
|||
const { orderState, inComplaint } = result;
|
||||
if (!inComplaint) {
|
||||
//未处于纠纷中
|
||||
let state = undefined;
|
||||
let state = 'unknow';
|
||||
// let action = undefined;
|
||||
switch (orderState) {
|
||||
case 1: //待发货
|
||||
|
|
@ -346,35 +347,29 @@ export async function refreshMpOrderShipState(shipId, context) {
|
|||
blockTrigger: true,
|
||||
forUpdate: true
|
||||
});
|
||||
const currentState = ship.iState;
|
||||
const mpState = await getOrderShipState(context, shipId);
|
||||
// let action = undefined;
|
||||
// switch (mpState) {
|
||||
// case 'shipping': //已发货
|
||||
// action = 'ship';
|
||||
// break;
|
||||
// case 'receiving': //已收货
|
||||
// action = 'startReceiving';
|
||||
// break;
|
||||
// case 'received': //已确认
|
||||
// action = 'succeedReceiving';
|
||||
// break;
|
||||
// case 'unknow': //不明
|
||||
// action = 'unknow';
|
||||
// break;
|
||||
// default:
|
||||
// action = undefined;
|
||||
// }
|
||||
if (ship.iState !== mpState) {
|
||||
return await context.operate('ship', {
|
||||
id: await generateNewIdAsync(),
|
||||
action: 'update',
|
||||
data: {
|
||||
iState: mpState,
|
||||
},
|
||||
filter: {
|
||||
id: ship.id,
|
||||
if (currentState !== mpState) {
|
||||
let action = undefined;
|
||||
const shipActionDef = actionDefDict.ship.iState.stm;
|
||||
for (const a of Object.keys(shipActionDef)) {
|
||||
const pState = shipActionDef[a][0];
|
||||
const nState = shipActionDef[a][1];
|
||||
if (mpState === nState && pState.includes(currentState)) {
|
||||
action = a;
|
||||
break;
|
||||
}
|
||||
}, {});
|
||||
}
|
||||
if (action) {
|
||||
return await context.operate('ship', {
|
||||
id: await generateNewIdAsync(),
|
||||
action,
|
||||
data: {},
|
||||
filter: {
|
||||
id: ship.id,
|
||||
}
|
||||
}, {});
|
||||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -220,7 +220,15 @@ const i18ns = [
|
|||
"wait": "状态核验中,请等待",
|
||||
"fail": "确认失败,请稍后重试",
|
||||
"update wechat": "请升级微信版本",
|
||||
"no transactionId": "暂无相关信息,请联系管理员"
|
||||
"no transactionId": "暂无相关信息,请联系管理员",
|
||||
"waiting": {
|
||||
"tip": "由于微信支付限制,充值后必须用户确认收货,正在通知微信服务器……",
|
||||
"confirm": "通知微信中……"
|
||||
},
|
||||
"confirming": {
|
||||
"tip": "由于微信支付限制,充值后必须用户确认收货,充值方可完成",
|
||||
"confirm": "确认收货"
|
||||
}
|
||||
},
|
||||
"successAt": {
|
||||
"title": "登记转账时间",
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.notifyConfirmReceive = exports.refreshShipState = exports.refreshMpOrderShipState = exports.getOrderShipState = exports.uploadShippingInfo = exports.maskPhone = exports.shipProjection = void 0;
|
||||
const oak_app_domain_1 = require("../oak-app-domain");
|
||||
const oak_external_sdk_1 = require("oak-external-sdk");
|
||||
const assert_1 = require("oak-domain/lib/utils/assert");
|
||||
const uuid_1 = require("oak-domain/lib/utils/uuid");
|
||||
|
|
@ -303,7 +304,7 @@ async function getOrderShipState(context, shipId) {
|
|||
const { orderState, inComplaint } = result;
|
||||
if (!inComplaint) {
|
||||
//未处于纠纷中
|
||||
let state = undefined;
|
||||
let state = 'unknow';
|
||||
// let action = undefined;
|
||||
switch (orderState) {
|
||||
case 1: //待发货
|
||||
|
|
@ -352,35 +353,29 @@ async function refreshMpOrderShipState(shipId, context) {
|
|||
blockTrigger: true,
|
||||
forUpdate: true
|
||||
});
|
||||
const currentState = ship.iState;
|
||||
const mpState = await getOrderShipState(context, shipId);
|
||||
// let action = undefined;
|
||||
// switch (mpState) {
|
||||
// case 'shipping': //已发货
|
||||
// action = 'ship';
|
||||
// break;
|
||||
// case 'receiving': //已收货
|
||||
// action = 'startReceiving';
|
||||
// break;
|
||||
// case 'received': //已确认
|
||||
// action = 'succeedReceiving';
|
||||
// break;
|
||||
// case 'unknow': //不明
|
||||
// action = 'unknow';
|
||||
// break;
|
||||
// default:
|
||||
// action = undefined;
|
||||
// }
|
||||
if (ship.iState !== mpState) {
|
||||
return await context.operate('ship', {
|
||||
id: await (0, uuid_1.generateNewIdAsync)(),
|
||||
action: 'update',
|
||||
data: {
|
||||
iState: mpState,
|
||||
},
|
||||
filter: {
|
||||
id: ship.id,
|
||||
if (currentState !== mpState) {
|
||||
let action = undefined;
|
||||
const shipActionDef = oak_app_domain_1.actionDefDict.ship.iState.stm;
|
||||
for (const a of Object.keys(shipActionDef)) {
|
||||
const pState = shipActionDef[a][0];
|
||||
const nState = shipActionDef[a][1];
|
||||
if (mpState === nState && pState.includes(currentState)) {
|
||||
action = a;
|
||||
break;
|
||||
}
|
||||
}, {});
|
||||
}
|
||||
if (action) {
|
||||
return await context.operate('ship', {
|
||||
id: await (0, uuid_1.generateNewIdAsync)(),
|
||||
action,
|
||||
data: {},
|
||||
filter: {
|
||||
id: ship.id,
|
||||
}
|
||||
}, {});
|
||||
}
|
||||
}
|
||||
}
|
||||
exports.refreshMpOrderShipState = refreshMpOrderShipState;
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "oak-pay-business",
|
||||
"version": "3.0.3",
|
||||
"version": "3.0.4",
|
||||
"description": "",
|
||||
"files": [
|
||||
"lib/**/*",
|
||||
|
|
@ -30,9 +30,9 @@
|
|||
"dependencies": {
|
||||
"classnames": "^2.3.1",
|
||||
"dayjs": "^1.11.5",
|
||||
"oak-domain": "^5.1.24",
|
||||
"oak-domain": "^5.1.25",
|
||||
"oak-external-sdk": "^2.3.6",
|
||||
"oak-frontend-base": "^5.3.31",
|
||||
"oak-frontend-base": "^5.3.32",
|
||||
"oak-general-business": "~5.7.5",
|
||||
"react-markdown": "^9.0.3",
|
||||
"wechat-pay-nodejs": "^0.2.3"
|
||||
|
|
|
|||
|
|
@ -325,10 +325,10 @@ export default OakComponent({
|
|||
});
|
||||
const ship = deposit?.ship;
|
||||
if (ship && ship.id) {
|
||||
if (ship.iState === 'receiving') {
|
||||
const transactionId = (deposit?.pay$deposit?.[0]?.meta as { transaction_id: string })?.transaction_id;
|
||||
console.log('transaction_id', transactionId);
|
||||
if (process.env.NODE_ENV === 'development') {
|
||||
const transactionId = (deposit?.pay$deposit?.[0]?.meta as { transaction_id: string })?.transaction_id;
|
||||
console.log('transaction_id', transactionId);
|
||||
if (process.env.NODE_ENV === 'development') {
|
||||
if (ship.iState === 'receiving') {
|
||||
await this.features.cache.operate('ship',
|
||||
[{
|
||||
id: await generateNewIdAsync(),
|
||||
|
|
@ -339,90 +339,74 @@ export default OakComponent({
|
|||
},
|
||||
}]
|
||||
);
|
||||
await this.features.cache.refresh('deposit', {
|
||||
data: {
|
||||
id: 1,
|
||||
iState: 1,
|
||||
},
|
||||
filter: {
|
||||
id: unreceivedDepositId,
|
||||
}
|
||||
});
|
||||
|
||||
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,
|
||||
},
|
||||
success: async () => {
|
||||
console.log('success');
|
||||
const { result: 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.reRender();
|
||||
// this.setMessage({
|
||||
// type: 'warning',
|
||||
// content: this.t('ship.wait'),
|
||||
// })
|
||||
}
|
||||
},
|
||||
fail() {
|
||||
console.log('fail');
|
||||
}
|
||||
if (transactionId) {
|
||||
if ((wx as any).openBusinessView) {
|
||||
(wx as any).openBusinessView({
|
||||
businessType: 'weappOrderConfirm',
|
||||
extraData: {
|
||||
transaction_id: transactionId,
|
||||
},
|
||||
success: async () => {
|
||||
console.log('success');
|
||||
const { result: 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: 'warning',
|
||||
content: this.t('ship.fail'),
|
||||
})
|
||||
},
|
||||
complete() {
|
||||
type: 'success',
|
||||
content: this.t('ship.success')
|
||||
});
|
||||
} else {
|
||||
console.log(mpShipState);
|
||||
this.reRender();
|
||||
// this.setMessage({
|
||||
// type: 'warning',
|
||||
// content: this.t('ship.wait'),
|
||||
// })
|
||||
}
|
||||
});
|
||||
} else {
|
||||
//引导用户升级微信版本
|
||||
this.setMessage({
|
||||
type: 'warning',
|
||||
content: this.t('ship.update wechat'),
|
||||
})
|
||||
}
|
||||
},
|
||||
fail: () => {
|
||||
console.log('fail');
|
||||
this.setMessage({
|
||||
type: 'warning',
|
||||
content: this.t('ship.fail'),
|
||||
})
|
||||
},
|
||||
complete: () => {
|
||||
}
|
||||
});
|
||||
} else {
|
||||
if (!noMessage) {
|
||||
this.setMessage({
|
||||
type: 'warning',
|
||||
content: this.t('no transactionId'),
|
||||
})
|
||||
}
|
||||
//引导用户升级微信版本
|
||||
this.setMessage({
|
||||
type: 'warning',
|
||||
content: this.t('ship.update wechat'),
|
||||
})
|
||||
}
|
||||
} else {
|
||||
// if (!noMessage) {
|
||||
// this.setMessage({
|
||||
// content: this.t('ship.wait'),
|
||||
// type: 'warning',
|
||||
// })
|
||||
// }
|
||||
this.reRender();
|
||||
if (!noMessage) {
|
||||
this.setMessage({
|
||||
type: 'warning',
|
||||
content: this.t('no transactionId'),
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
<view class="container">
|
||||
<l-notice-bar show="{{!!unreceivedDepositId}}" front-icon-name="notification" end-icon-name="right"
|
||||
bind:lintap="onUnreceivedDepositClickMp" bind:linicontap="onUnreceivedDepositClickMp">
|
||||
{{t('ship.unconfirm')}}
|
||||
<view style="width:100vw">{{t('ship.unconfirm')}}</view>
|
||||
</l-notice-bar>
|
||||
<view class="info" style="background-color:{{bgColor}};color:{{textColor}};">
|
||||
<view
|
||||
|
|
|
|||
|
|
@ -204,16 +204,18 @@
|
|||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
row-gap: 32rpx;
|
||||
padding: 12rpx;
|
||||
row-gap: 80rpx;
|
||||
padding: 24rpx;
|
||||
box-sizing: border-box;
|
||||
margin-top: 24rpx;
|
||||
background-color: #fff;
|
||||
border-radius: 16rpx;
|
||||
height: 30vh;
|
||||
|
||||
.depositConfrimText {
|
||||
display: flex;
|
||||
gap: 18rpx;
|
||||
line-height: 36rpx;
|
||||
line-height: 48rpx;
|
||||
font-size: 32rpx;
|
||||
}
|
||||
}
|
||||
|
|
@ -158,11 +158,12 @@ export default OakComponent({
|
|||
const iState = data?.iState;
|
||||
let iStateStr = this.t(`pay:v.iState.${iState}`);
|
||||
let iStateColor = iState && this.features.style.getColor('pay', 'iState', iState);
|
||||
let showDepositConfirm = false;
|
||||
let showDepositConfirm = false, depositConfirmLoading = false;
|
||||
if (data?.depositId && data?.deposit?.shipId && data?.deposit?.iState === 'shipped') {
|
||||
iStateStr = this.t('ship.shipped');
|
||||
iStateColor = this.features.style.getColor('deposit', 'iState', data?.deposit?.iState);
|
||||
showDepositConfirm = true;
|
||||
depositConfirmLoading = data?.deposit?.ship?.iState !== 'receiving';
|
||||
}
|
||||
const startPayable = iState === 'paying' && !['account', 'offlineAccount'].includes(data!.entity!) && (
|
||||
PayRoutineDict[data!.entity!] && PayRoutineDict[data!.entity!]!.judgeCanPay(data as any, this.features as any)
|
||||
|
|
@ -214,6 +215,7 @@ export default OakComponent({
|
|||
ship: data?.deposit?.ship,
|
||||
depositId: data?.depositId,
|
||||
showDepositConfirm,
|
||||
depositConfirmLoading,
|
||||
};
|
||||
},
|
||||
features: [{
|
||||
|
|
@ -363,8 +365,8 @@ export default OakComponent({
|
|||
if (process.env.OAK_PLATFORM === 'wechatMp') {
|
||||
const shipId = ship.id;
|
||||
const shipState = ship.iState;
|
||||
if (shipId && shipState === 'receiving') {
|
||||
if (process.env.NODE_ENV === 'development') {
|
||||
if (process.env.NODE_ENV === 'development') {
|
||||
if (shipId && shipState === 'receiving') {
|
||||
await this.features.cache.operate('ship',
|
||||
[{
|
||||
id: await generateNewIdAsync(),
|
||||
|
|
@ -375,83 +377,72 @@ export default OakComponent({
|
|||
},
|
||||
}]
|
||||
);
|
||||
await this.features.cache.refresh('deposit', {
|
||||
data: {
|
||||
id: 1,
|
||||
iState: 1,
|
||||
},
|
||||
filter: {
|
||||
id: depositId,
|
||||
}
|
||||
});
|
||||
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.reRender();
|
||||
this.setMessage({
|
||||
type: 'success',
|
||||
content: this.t('ship.success')
|
||||
});
|
||||
} else {
|
||||
console.log(mpShipState);
|
||||
// this.setMessage({
|
||||
// type: 'warning',
|
||||
// content: this.t('ship.wait'),
|
||||
// })
|
||||
this.reRender();
|
||||
}
|
||||
},
|
||||
fail() {
|
||||
console.log('fail');
|
||||
}
|
||||
if (pay.meta.transaction_id) {
|
||||
if ((wx as any).openBusinessView) {
|
||||
(wx as any).openBusinessView({
|
||||
businessType: 'weappOrderConfirm',
|
||||
extraData: {
|
||||
transaction_id: pay.meta.transaction_id,
|
||||
},
|
||||
success: async () => {
|
||||
console.log('success');
|
||||
const { result: 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.reRender();
|
||||
this.setMessage({
|
||||
type: 'warning',
|
||||
content: this.t('ship.fail'),
|
||||
})
|
||||
},
|
||||
complete() {
|
||||
type: 'success',
|
||||
content: this.t('ship.success')
|
||||
});
|
||||
} else {
|
||||
console.log(mpShipState);
|
||||
// this.setMessage({
|
||||
// type: 'warning',
|
||||
// content: this.t('ship.wait'),
|
||||
// })
|
||||
this.reRender();
|
||||
}
|
||||
});
|
||||
} else {
|
||||
//引导用户升级微信版本
|
||||
this.setMessage({
|
||||
type: 'warning',
|
||||
content: this.t('ship.update wechat'),
|
||||
})
|
||||
}
|
||||
},
|
||||
fail: () => {
|
||||
console.log('fail');
|
||||
this.setMessage({
|
||||
type: 'warning',
|
||||
content: this.t('ship.fail'),
|
||||
})
|
||||
},
|
||||
complete: () => {
|
||||
}
|
||||
});
|
||||
} else {
|
||||
//引导用户升级微信版本
|
||||
this.setMessage({
|
||||
type: 'warning',
|
||||
content: this.t('no transactionId'),
|
||||
content: this.t('ship.update wechat'),
|
||||
})
|
||||
}
|
||||
} else {
|
||||
this.reRender();
|
||||
this.setMessage({
|
||||
type: 'warning',
|
||||
content: this.t('no transactionId'),
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -91,7 +91,7 @@
|
|||
</l-form>
|
||||
</block>
|
||||
<block wx:elif="{{pay.entity === 'wpProduct'}}">
|
||||
<view wx:if="{{pay.iState === 'paid'}}" class="paid">
|
||||
<view wx:if="{{pay.iState === 'paid' && !showDepositConfirm}}" class="paid">
|
||||
<l-icon name="success" color="green" size="140" />
|
||||
<view class="text">{{t('success')}}</view>
|
||||
</view>
|
||||
|
|
@ -110,15 +110,16 @@
|
|||
<view class="padding">
|
||||
<view wx:if="{{showDepositConfirm}}" class="depositConfrimBox">
|
||||
<view class="depositConfrimText">
|
||||
<l-icon name='warning' size="32" />
|
||||
<span>微信支付成功,请点击下方「充值确认」按钮,确认后即可正常使用余额!</span>
|
||||
<l-icon name='warning' size="36" color="#faad14" />
|
||||
<span>{{depositConfirmLoading ? t('ship.waiting.tip') : t('ship.confirming.tip')}}</span>
|
||||
</view>
|
||||
<l-button
|
||||
plain="{{true}}"
|
||||
shape="semicircle"
|
||||
size="long"
|
||||
bind:lintap="confirmShipMp"
|
||||
loading="{{depositConfirmLoading}}"
|
||||
style="width:100%"
|
||||
>
|
||||
充值确认
|
||||
{{depositConfirmLoading ? t('ship.waiting.confirm') : t('ship.confirming.confirm')}}
|
||||
</l-button>
|
||||
</view>
|
||||
</view>
|
||||
|
|
@ -169,7 +170,7 @@
|
|||
</l-button>
|
||||
</view>
|
||||
</block>
|
||||
<block wx:elif="{{!closable}}">
|
||||
<block wx:elif="{{!closable && !showDepositConfirm}}">
|
||||
<l-button
|
||||
type="default"
|
||||
size="long"
|
||||
|
|
|
|||
|
|
@ -47,7 +47,15 @@
|
|||
"wait": "状态核验中,请等待",
|
||||
"fail": "确认失败,请稍后重试",
|
||||
"update wechat": "请升级微信版本",
|
||||
"no transactionId": "暂无相关信息,请联系管理员"
|
||||
"no transactionId": "暂无相关信息,请联系管理员",
|
||||
"waiting": {
|
||||
"tip": "由于微信支付限制,充值后必须用户确认收货,正在通知微信服务器……",
|
||||
"confirm": "通知微信中……"
|
||||
},
|
||||
"confirming": {
|
||||
"tip": "由于微信支付限制,充值后必须用户确认收货,充值方可完成",
|
||||
"confirm": "确认收货"
|
||||
}
|
||||
},
|
||||
"successAt": {
|
||||
"title": "登记转账时间",
|
||||
|
|
|
|||
|
|
@ -220,7 +220,15 @@ const i18ns: I18n[] = [
|
|||
"wait": "状态核验中,请等待",
|
||||
"fail": "确认失败,请稍后重试",
|
||||
"update wechat": "请升级微信版本",
|
||||
"no transactionId": "暂无相关信息,请联系管理员"
|
||||
"no transactionId": "暂无相关信息,请联系管理员",
|
||||
"waiting": {
|
||||
"tip": "由于微信支付限制,充值后必须用户确认收货,正在通知微信服务器……",
|
||||
"confirm": "通知微信中……"
|
||||
},
|
||||
"confirming": {
|
||||
"tip": "由于微信支付限制,充值后必须用户确认收货,充值方可完成",
|
||||
"confirm": "确认收货"
|
||||
}
|
||||
},
|
||||
"successAt": {
|
||||
"title": "登记转账时间",
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { EntityDict } from '../oak-app-domain';
|
||||
import { actionDefDict, EntityDict } from '../oak-app-domain';
|
||||
import { BRC } from '../types/RuntimeCxt';
|
||||
import { WechatSDK, WechatMpInstance } from 'oak-external-sdk';
|
||||
import { assert } from 'oak-domain/lib/utils/assert';
|
||||
|
|
@ -342,7 +342,7 @@ export async function getOrderShipState(
|
|||
const { orderState, inComplaint } = result;
|
||||
if (!inComplaint) {
|
||||
//未处于纠纷中
|
||||
let state = undefined;
|
||||
let state = 'unknow';
|
||||
// let action = undefined;
|
||||
switch (orderState) {
|
||||
case 1: //待发货
|
||||
|
|
@ -393,35 +393,29 @@ export async function refreshMpOrderShipState(
|
|||
blockTrigger: true,
|
||||
forUpdate: true
|
||||
});
|
||||
const currentState = ship.iState!;
|
||||
const mpState = await getOrderShipState(context, shipId);
|
||||
// let action = undefined;
|
||||
// switch (mpState) {
|
||||
// case 'shipping': //已发货
|
||||
// action = 'ship';
|
||||
// break;
|
||||
// case 'receiving': //已收货
|
||||
// action = 'startReceiving';
|
||||
// break;
|
||||
// case 'received': //已确认
|
||||
// action = 'succeedReceiving';
|
||||
// break;
|
||||
// case 'unknow': //不明
|
||||
// action = 'unknow';
|
||||
// break;
|
||||
// default:
|
||||
// action = undefined;
|
||||
// }
|
||||
if (ship.iState !== mpState) {
|
||||
return await context.operate('ship', {
|
||||
id: await generateNewIdAsync(),
|
||||
action: 'update',
|
||||
data: {
|
||||
iState: mpState,
|
||||
},
|
||||
filter: {
|
||||
id: ship.id,
|
||||
if (currentState !== mpState) {
|
||||
let action = undefined;
|
||||
const shipActionDef = actionDefDict.ship.iState.stm;
|
||||
for (const a of Object.keys(shipActionDef)) {
|
||||
const pState = shipActionDef[a][0];
|
||||
const nState = shipActionDef[a][1];
|
||||
if (mpState === nState && pState.includes(currentState)) {
|
||||
action = a;
|
||||
break;
|
||||
}
|
||||
}, {});
|
||||
}
|
||||
if (action) {
|
||||
return await context.operate('ship', {
|
||||
id: await generateNewIdAsync(),
|
||||
action,
|
||||
data: {},
|
||||
filter: {
|
||||
id: ship.id,
|
||||
}
|
||||
}, {});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue