小程序确认收货提示修改

This commit is contained in:
lxy 2025-04-07 10:33:35 +08:00
parent 32f57e300a
commit 70ed1ca5a6
4 changed files with 150 additions and 124 deletions

View File

@ -252,81 +252,89 @@ export default OakComponent({
}
});
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')
if (ship && ship.id) {
if (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,
});
}
else {
console.log(mpShipState);
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.wait'),
content: this.t('ship.fail'),
});
},
complete() {
}
},
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('ship.update wechat'),
content: this.t('no transactionId'),
});
}
}
else {
this.setMessage({
content: this.t('ship.wait'),
type: 'warning',
content: this.t('no transactionId'),
});
}
}

View File

@ -403,6 +403,12 @@ export default OakComponent({
});
}
}
else {
this.setMessage({
type: 'warning',
content: this.t('ship.wait'),
});
}
}
}
},

View File

@ -256,82 +256,89 @@ export default OakComponent({
}
});
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);
if (ship && ship.id) {
if (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.wait'),
content: this.t('ship.fail'),
})
},
complete() {
}
},
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('ship.update wechat'),
content: this.t('no transactionId'),
})
}
} else {
this.setMessage({
content: this.t('ship.wait'),
type: 'warning',
content: this.t('no transactionId'),
})
}
}

View File

@ -434,6 +434,11 @@ export default OakComponent({
content: this.t('no transactionId'),
})
}
} else {
this.setMessage({
type: 'warning',
content: this.t('ship.wait'),
})
}
}
}