Compare commits

..

2 Commits

2 changed files with 51 additions and 9 deletions

View File

@ -121,15 +121,57 @@ export default {
} }
}, },
/* 立即领取 */ /* 立即领取 */
receive() { async receive() {
if (this.loading) return; let self = this;
this.loading = true; if (this.goods.err_code != 0) {
let data = { return showToast(this.goods.reason);
key: localStorage.getItem("key"), }
goods_id: this.goodsInfo.entity.goods_id, const params = {
code_batch_id: this.goodsInfo.code_batch_id, id: [this.goodsID],
token: localStorage.getItem("token"), key:
localStorage.getItem("key") ||
"rPBVzOCs0FN4P7jNMqHo5IVfb0oaAyigbfNBmCKnavs=",
account: "123",
name: "123",
}; };
const res = await EXCHANGE(params);
if (res.code === 200 && res.data.length) {
const data = res.data[0];
if (data.code === 200) {
// window.location.href = data.path;
self.orderPolling();
} else {
showToast(data.message);
}
// res.data.forEach(item => {
// if(item.id === self.goodsID && item.code != 0) {
// showToast(self.message)
// }
// })
} else {
showToast(res.message);
}
},
async orderPolling() {
const that = this;
const params = {
key: localStorage.getItem("key"),
id: [localStorage.getItem("id")],
};
const res = await ORDER_QUERY();
if (res && res.code === 200) {
if (res.data.status === 2) {
return await this.getData();
} else {
setTimeout(() => {
that.orderPolling();
}, 3000);
}
} else {
setTimeout(() => {
that.orderPolling();
}, 3000);
}
}, },
// //
publicCollection(order_number: string) { publicCollection(order_number: string) {

View File

@ -245,7 +245,7 @@ export default {
const res = await EXCHANGE(params); const res = await EXCHANGE(params);
if (res.code === 200 && res.data.length) { if (res.code === 200 && res.data.length) {
const data = res.data[0]; const data = res.data[0];
if (data.code === 0) { if (data.code === 200) {
// window.location.href = data.path; // window.location.href = data.path;
self.orderPolling(); self.orderPolling();
} else { } else {