Compare commits

...

2 Commits

2 changed files with 51 additions and 9 deletions

View File

@ -121,15 +121,57 @@ export default {
}
},
/* 立即领取 */
receive() {
if (this.loading) return;
this.loading = true;
let data = {
key: localStorage.getItem("key"),
goods_id: this.goodsInfo.entity.goods_id,
code_batch_id: this.goodsInfo.code_batch_id,
token: localStorage.getItem("token"),
async receive() {
let self = this;
if (this.goods.err_code != 0) {
return showToast(this.goods.reason);
}
const params = {
id: [this.goodsID],
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) {

View File

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