红包对接

This commit is contained in:
zhangguoping 2024-09-03 14:49:52 +08:00
parent 2bab4b56eb
commit 17a97a4f6a
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 {