增加支付延迟,修复首页公告不显示
This commit is contained in:
parent
64b7c90278
commit
16c36577e7
|
|
@ -607,23 +607,6 @@ async function goldPay(data) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 异步等待函数:随机等待 300-600ms(包含边界值)
|
|
||||||
* @returns {Promise<number>} 成功后返回实际等待的毫秒数(方便调试或日志记录)
|
|
||||||
*/
|
|
||||||
function randomWait() {
|
|
||||||
// 1. 生成 300-600 之间的随机整数(含 300 和 600)
|
|
||||||
const waitTime = Math.floor(Math.random() * (600 - 300 + 1)) + 300;
|
|
||||||
|
|
||||||
// 2. 返回 Promise,延迟 waitTime 后 resolve
|
|
||||||
return new Promise((resolve) => {
|
|
||||||
setTimeout(() => {
|
|
||||||
resolve(waitTime); // resolve 实际等待时间,便于后续使用
|
|
||||||
}, waitTime);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
//确认支付
|
//确认支付
|
||||||
async function payConfirm() {
|
async function payConfirm() {
|
||||||
const [type, num] = popup.payType.split('-');
|
const [type, num] = popup.payType.split('-');
|
||||||
|
|
@ -653,22 +636,21 @@ async function payConfirm() {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
if (res) {
|
if (res) {
|
||||||
uni.showLoading()
|
|
||||||
console.log('等待开始');
|
|
||||||
const start=Date.now()
|
|
||||||
await randomWait()
|
|
||||||
const end=Date.now()
|
|
||||||
console.log('等待结束');
|
|
||||||
console.log('等待时间',end-start);
|
|
||||||
uni.hideLoading()
|
|
||||||
if (type == 'gold') {
|
if (type == 'gold') {
|
||||||
goldPay({
|
goldPay({
|
||||||
orderId: res.orders.ordersId
|
orderId: res.orders.ordersId
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
|
uni.showLoading()
|
||||||
|
console.log('延迟开始')
|
||||||
|
setTimeout(()=>{
|
||||||
|
uni.hideLoading()
|
||||||
|
console.log('延迟结束')
|
||||||
payOrder({
|
payOrder({
|
||||||
orderId: res.orders.ordersId
|
orderId: res.orders.ordersId
|
||||||
});
|
});
|
||||||
|
},200)
|
||||||
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -165,6 +165,7 @@ onReachBottom(() => {
|
||||||
// 公告
|
// 公告
|
||||||
async function getMsg() {
|
async function getMsg() {
|
||||||
let res = await messageselectMessage();
|
let res = await messageselectMessage();
|
||||||
|
console.log('res',res)
|
||||||
let arr = [];
|
let arr = [];
|
||||||
let ids = uni.getStorageSync('ids');
|
let ids = uni.getStorageSync('ids');
|
||||||
res.list.forEach((ele) => {
|
res.list.forEach((ele) => {
|
||||||
|
|
@ -177,7 +178,7 @@ async function getMsg() {
|
||||||
arr.push(ele);
|
arr.push(ele);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
datas.noticeList = arr;
|
datas.noticeList = res.list;
|
||||||
if (arr.length) {
|
if (arr.length) {
|
||||||
if (ids.length) {
|
if (ids.length) {
|
||||||
uni.setStorageSync('ids', [...uni.getStorageSync('ids'), datas.noticeList[datas.cloneNum].id]);
|
uni.setStorageSync('ids', [...uni.getStorageSync('ids'), datas.noticeList[datas.cloneNum].id]);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue