Commit 19e203df authored by 郝聪敏's avatar 郝聪敏

Merge branch 'feature/fix_pay_bug' into 'master'

fix: 保单详情页调用支付结果

See merge request !131
parents 430f52f8 8d649dce
......@@ -100,7 +100,6 @@ axios.interceptors.response.use(
return Promise.resolve(res);
}
console.error("axios:", err.message, err);
// 提示网络错误时尝试重试
if (
err.message === "Network Error" &&
......
......@@ -89,7 +89,7 @@ export default {
this.isPayWait = false;
}
},
getPayResult() {
getPayResult(expectResult) {
const { payOrderNo, payType, orderNo } = this.orderInfo;
placeOrder.polling({ payOrderNo, payOrderType: payType || 1 }).then(async payRes => {
if (!payRes.result && payRes.payState === 2) {
......@@ -97,17 +97,22 @@ export default {
this.getPayResult();
}, 3000);
} else {
// 保单详情页支付需重新调用保单接口
if (this.$route.name === "PolicyDetail") {
this.getPolicy();
return;
}
// expectResult为true时期望支付结果成功,否则继续执行
if (expectResult && !payRes?.result) return;
// 清除定时器
if (this.timer) clearInterval(this.timer);
// 根据状态跳转页面
const status = await this.getPolicyStatus(orderNo);
if (["6.2-3", "6.1-3"].includes(status)) {
this.$router.replace(`/policy/success/${orderNo}`);
return;
}
// 保单详情页支付需重新调用保单接口
if (this.$route.name === "PolicyDetail") {
this.getPolicy();
return;
}
this.$router.replace({
path: "/policy/detail/" + orderNo + "?isWxH5=" + this.orderInfo.isWxH5 || ""
});
......
......@@ -9,13 +9,12 @@
import Guarantee from "./Types/Guarantee";
import Refund from "./Types/Refund";
import policyStatusMixin from "../mixin/policyStatus.mixin";
import detailPayMixin from "@/views/Goods/Detail/modules/detailPay.mixin";
import { getPolicyDetail } from "@/api/policy";
let timer = null;
export default {
name: "PolicyList",
mixins: [policyStatusMixin],
mixins: [policyStatusMixin, detailPayMixin],
provide() {
return {
getPolicy: this.getPolicy
......@@ -31,19 +30,20 @@ export default {
cardConfig: {
component: ""
}
}
},
timer: null
};
},
async created() {
await this.getPolicy();
if (this.$route?.query?.isWxH5 && this.policy?.cardConfig?.key === "4") {
if (this.$route?.query?.isWxH5) {
this.$dialog({
message: "请确认是否已经完成了微信免密支付签约",
onCancel: () => {
timer = setInterval(this.getPolicy, 3000);
this.timer = setInterval(() => this.getPayResult(true), 3000);
},
onConfirm: () => {
timer = setInterval(this.getPolicy, 3000);
this.timer = setInterval(() => this.getPayResult(true), 3000);
}
});
}
......@@ -55,7 +55,7 @@ export default {
}
},
beforeDestroy() {
clearTimeout(timer);
clearInterval(this.timer);
}
};
</script>
......
......@@ -233,7 +233,7 @@ export default {
params.userInfoSecId = this.information?.userInfoSecId;
await updateFamily(params);
this.$notify({ type: "success", message: "修改成功" });
this.$router.push("/user/family");
this.$router.back(-1);
}
},
onConfirm(picker, res) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment