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