fix: 增加获取详情 判断,减少错误接口请求

This commit is contained in:
zhangds 2024-04-28 17:33:13 +08:00
parent 73e0a4eb71
commit 0fa9f34df4
3 changed files with 54 additions and 47 deletions

View File

@ -102,26 +102,28 @@
/* 获取详情 */
function getInfo(isLoading) {
const orderNumber = sessionStorage.getItem('orderNumber');
req.axiosGet(`/key/order/detail/${orderNumber}`).then(res => {
if (isLoading) {
loading.value = true;
const clr = setTimeout(() => {
loading.value = false;
clearTimeout(clr);
}, 1000);
}
if (res.code == 200) {
const { product_name, status, show_url, card_number, card_password, use_coupon, product, mask_card_password } = res.data;
card_look_pwd.value = mask_card_password && mask_card_password.length > 16 ? mask_card_password.substring(0, 16) : mask_card_password;
goods.value = { product_name, time: res.data.goods.end_time, status, show_url, card_number, card_password, card_show: res.data.goods.card_show, use_coupon, detail_url: product.detail_url };
// 领取成功结算 5
if (bm_obj_data && !bm_obj_data.settlement_data.is_settlement && bm_obj_data.settlement_data.settlement_type === 5 && status === 2) {
settlementFun(bm_obj_data.token, bm_obj_data.settlement_data.settlement_type);
if (orderNumber) {
req.axiosGet(`/key/order/detail/${orderNumber}`).then(res => {
if (isLoading) {
loading.value = true;
const clr = setTimeout(() => {
loading.value = false;
clearTimeout(clr);
}, 1000);
}
}
});
if (res.code == 200) {
const { product_name, status, show_url, card_number, card_password, use_coupon, product, mask_card_password } = res.data;
card_look_pwd.value = mask_card_password && mask_card_password.length > 16 ? mask_card_password.substring(0, 16) : mask_card_password;
goods.value = { product_name, time: res.data.goods.end_time, status, show_url, card_number, card_password, card_show: res.data.goods.card_show, use_coupon, detail_url: product.detail_url };
// 领取成功结算 5
if (bm_obj_data && !bm_obj_data.settlement_data.is_settlement && bm_obj_data.settlement_data.settlement_type === 5 && status === 2) {
settlementFun(bm_obj_data.token, bm_obj_data.settlement_data.settlement_type);
}
}
});
}
}
/* 重新兑换 */

View File

@ -92,19 +92,21 @@
/* 获取详情 */
function getInfo(isLoading) {
const orderNumber = sessionStorage.getItem('orderNumber');
req.axiosGet(`/key/order/detail/${orderNumber}`).then(res => {
if (isLoading) {
loading.value = true;
const clr = setTimeout(() => {
loading.value = false;
clearTimeout(clr);
}, 1000);
}
if (res.code == 200) {
const { product_name, update_time, status, show_url, account, create_time, use_coupon } = res.data;
goods.value = { product_name, update_time, status, show_url, account, create_time, orderNumber, use_coupon };
}
});
if (orderNumber) {
req.axiosGet(`/key/order/detail/${orderNumber}`).then(res => {
if (isLoading) {
loading.value = true;
const clr = setTimeout(() => {
loading.value = false;
clearTimeout(clr);
}, 1000);
}
if (res.code == 200) {
const { product_name, update_time, status, show_url, account, create_time, use_coupon } = res.data;
goods.value = { product_name, update_time, status, show_url, account, create_time, orderNumber, use_coupon };
}
});
}
}
/* 重新兑换 */

View File

@ -113,23 +113,26 @@
},
//获取订单详情
getOrderDetail(id) {
req.axiosGet("/key/order/detail/" + id).then((res) => {
if (res.code == 200) {
this.orderInfo = res.data;
this.payResult = true;
if (res.data.type == 2) { //1 商品 2立减金
//channel 1支付宝 2微信
this.plaflam = res.data.product.entity.channel;//只有立减金商品才有channel字段
this.redirect_url = res.data.wechat_redirect_url;
this.payStatus = res.data.pay_status;
this.orderId = res.data.alipay_order_number;
this.is_webview = res.data.product.entity.is_webview;
this.code_batch_id = res.data.product.code_batch_id;
} else {
this.countdownFn();
if (id) {
req.axiosGet("/key/order/detail/" + id).then((res) => {
if (res.code == 200) {
this.orderInfo = res.data;
this.payResult = true;
if (res.data.type == 2) { //1 商品 2立减金
//channel 1支付宝 2微信
this.plaflam = res.data.product.entity.channel;//只有立减金商品才有channel字段
this.redirect_url = res.data.wechat_redirect_url;
this.payStatus = res.data.pay_status;
this.orderId = res.data.alipay_order_number;
this.is_webview = res.data.product.entity.is_webview;
this.code_batch_id = res.data.product.code_batch_id;
} else {
this.countdownFn();
}
}
}
}).catch();
}).catch();
}
},
//弹出框提示