Commit 41a0daec authored by 郭志伟's avatar 郭志伟

Merge branch 'fix/policy_fix' into 'master'

fix:追加支付中遮罩

See merge request !65
parents 1071ac40 7ea955b2
...@@ -6,6 +6,9 @@ ...@@ -6,6 +6,9 @@
<div class="loading-container" v-if="isLoading"> <div class="loading-container" v-if="isLoading">
<cr-loading class="loading" size="24px">加载中...</cr-loading> <cr-loading class="loading" size="24px">加载中...</cr-loading>
</div> </div>
<div class="loading-container pay" v-if="isPayWait">
<cr-loading class="loading" size="24px" vertical>支付中</cr-loading>
</div>
<login-modal /> <login-modal />
<auth-from-xyqb v-if="showAuthXyqb !== -1" /> <auth-from-xyqb v-if="showAuthXyqb !== -1" />
<net-error /> <net-error />
...@@ -28,7 +31,7 @@ export default { ...@@ -28,7 +31,7 @@ export default {
}; };
}, },
computed: { computed: {
...mapState(["isLoading", "showAuthXyqb"]) ...mapState(["isLoading", "showAuthXyqb", "isPayWait"])
}, },
watch: { watch: {
$route(to, from) { $route(to, from) {
...@@ -90,7 +93,7 @@ export default { ...@@ -90,7 +93,7 @@ export default {
display: flex; display: flex;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
z-index: 9999; z-index: 999;
.loading { .loading {
padding: 6px; padding: 6px;
border-radius: 6px; border-radius: 6px;
...@@ -101,5 +104,15 @@ export default { ...@@ -101,5 +104,15 @@ export default {
color: #fff; color: #fff;
} }
} }
&.pay {
z-index: 1000;
background-color: #fff;
.loading {
padding: 15px 25px;
@{deep} .cr-loading--text {
margin-top: 25px;
}
}
}
} }
</style> </style>
...@@ -79,11 +79,12 @@ axios.interceptors.response.use( ...@@ -79,11 +79,12 @@ axios.interceptors.response.use(
if (response.data.code === "0") return response.data.data; if (response.data.code === "0") return response.data.data;
Notify({ type: "danger", message: response.data.msg || "后端服务异常" }); Notify({ type: "danger", message: response.data.msg || "后端服务异常" });
store.dispatch("setIsPayWait", false);
return Promise.reject(response.data); return Promise.reject(response.data);
}, },
err => { err => {
afterRequest(); afterRequest();
store.dispatch("setIsPayWait", false);
// 判断是否取消请求 // 判断是否取消请求
if (err.message === "取消重复请求") { if (err.message === "取消重复请求") {
const res = { const res = {
......
...@@ -11,6 +11,7 @@ export default new Vuex.Store({ ...@@ -11,6 +11,7 @@ export default new Vuex.Store({
activeIdx: 0, activeIdx: 0,
isLoading: false, isLoading: false,
isShowLogin: false, isShowLogin: false,
isPayWait: false,
showAuthXyqb: isXyqb ? localStorage.get("xyqbAuthState") || 1 : -1 // 1 已获取信息未授权,2 打开授权弹框, 3 拒绝授权,4 允许授权, -1 非信用钱包环境 showAuthXyqb: isXyqb ? localStorage.get("xyqbAuthState") || 1 : -1 // 1 已获取信息未授权,2 打开授权弹框, 3 拒绝授权,4 允许授权, -1 非信用钱包环境
}, },
mutations: { mutations: {
...@@ -23,6 +24,9 @@ export default new Vuex.Store({ ...@@ -23,6 +24,9 @@ export default new Vuex.Store({
setIsShowLogin(state, value) { setIsShowLogin(state, value) {
state.isShowLogin = value; state.isShowLogin = value;
}, },
setIsPayWait(state, value) {
state.isPayWait = value;
},
setAuthXyqb(state, value) { setAuthXyqb(state, value) {
state.showAuthXyqb = value; state.showAuthXyqb = value;
localStorage.set("xyqbAuthState", value); localStorage.set("xyqbAuthState", value);
...@@ -38,6 +42,9 @@ export default new Vuex.Store({ ...@@ -38,6 +42,9 @@ export default new Vuex.Store({
setIsShowLogin({ commit }, args) { setIsShowLogin({ commit }, args) {
commit("setIsShowLogin", args); commit("setIsShowLogin", args);
}, },
setIsPayWait({ commit }, args) {
commit("setIsPayWait", args);
},
setAuthXyqb({ commit }, args) { setAuthXyqb({ commit }, args) {
commit("setAuthXyqb", args); commit("setAuthXyqb", args);
} }
......
...@@ -218,9 +218,6 @@ export default { ...@@ -218,9 +218,6 @@ export default {
this.$forceUpdate(); this.$forceUpdate();
} }
} }
},
familyList() {
this.relationChange();
} }
}, },
computed: { computed: {
...@@ -265,24 +262,20 @@ export default { ...@@ -265,24 +262,20 @@ export default {
this.selfInfoReadonly = true; this.selfInfoReadonly = true;
} }
}); });
let userArray = this.familyList.filter(item => { let userArray = this.familyList.filter(
if (item.userInfoSecId === sessionStorage.getItem(this.detailType + "userInfoSecId")) { item => item.userInfoSecId === sessionStorage.getItem(this.detailType + "userInfoSecId")
this.formData.relation = "" + item.relation; );
return item;
}
});
if (!userArray.length) { if (!userArray.length) {
userArray = this.familyList.filter(item => item.relation === +relation); userArray = this.familyList.filter(item => item.relation === +relation);
} else { } else {
this.formData.relation = sessionStorage.getItem(this.detailType + "relation"); this.formData.relation = sessionStorage.getItem(this.detailType + "relation");
sessionStorage.removeItem(this.detailType + "userInfoSecId");
sessionStorage.removeItem(this.detailType + "relation");
} }
let [name, idNo, userInfoSecId, socialSecurity] = ["", "", "", ""]; let [name, idNo, userInfoSecId, socialSecurity] = ["", "", "", ""];
if ( if (
relation === relation ===
(localStorage.get(this.autoSaveKey) && localStorage.get(this.autoSaveKey).relation) (localStorage.get(this.autoSaveKey) && localStorage.get(this.autoSaveKey).relation)
) { ) {
sessionStorage.removeItem(this.detailType + "userInfoSecId");
const { const {
name: cachename, name: cachename,
idNo: cacheidNo, idNo: cacheidNo,
...@@ -329,6 +322,7 @@ export default { ...@@ -329,6 +322,7 @@ export default {
// //
} }
} }
// sessionStorage.removeItem(this.detailType + "relation");
}, },
async getFamilyList() { async getFamilyList() {
this.mongoToken = localStorage.get("mongoToken"); this.mongoToken = localStorage.get("mongoToken");
...@@ -341,6 +335,9 @@ export default { ...@@ -341,6 +335,9 @@ export default {
this.getSaveInfoHandler(this.autoSaveKey, AUTO_SAVE_TARGET); this.getSaveInfoHandler(this.autoSaveKey, AUTO_SAVE_TARGET);
} else { } else {
let relation = this.formData.relation; let relation = this.formData.relation;
if (sessionStorage.getItem(this.detailType + "relation")) {
relation = sessionStorage.getItem(this.detailType + "relation");
}
(this.showAuthXyqb || this.mongoToken) && this.relationChange(relation); (this.showAuthXyqb || this.mongoToken) && this.relationChange(relation);
} }
} }
......
...@@ -19,8 +19,9 @@ export default { ...@@ -19,8 +19,9 @@ export default {
this.tradeType = this.customTradeType ?? (isXyqb ? "MWEB" : isWeixinBrower ? "JSAPI" : "MWEB"); this.tradeType = this.customTradeType ?? (isXyqb ? "MWEB" : isWeixinBrower ? "JSAPI" : "MWEB");
}, },
methods: { methods: {
...mapActions(["setIsLoading"]), ...mapActions(["setIsLoading", "setIsPayWait"]),
async generateOrder() { async generateOrder() {
this.setIsLoading(true);
const res = await placeOrder.create({ const res = await placeOrder.create({
...this.subFormData ...this.subFormData
}); });
...@@ -30,6 +31,7 @@ export default { ...@@ -30,6 +31,7 @@ export default {
} }
}, },
async goPay() { async goPay() {
this.setIsLoading(false);
const { tradeType, orderInfo, openId } = this; const { tradeType, orderInfo, openId } = this;
const { payOrderNo, payType } = orderInfo; const { payOrderNo, payType } = orderInfo;
if (!payOrderNo) { if (!payOrderNo) {
...@@ -44,6 +46,7 @@ export default { ...@@ -44,6 +46,7 @@ export default {
if (openId && tradeType === "JSAPI") { if (openId && tradeType === "JSAPI") {
params.openId = openId; params.openId = openId;
} }
this.setIsPayWait(true);
const res = await placeOrder.pay(params); const res = await placeOrder.pay(params);
if (res) { if (res) {
let payInfo = { let payInfo = {
...@@ -61,19 +64,21 @@ export default { ...@@ -61,19 +64,21 @@ export default {
payByWay(tradeType, payInfo).then(() => { payByWay(tradeType, payInfo).then(() => {
this.getPayResult(); this.getPayResult();
}); });
} else {
this.setIsPayWait(false);
} }
}, },
getPayResult() { getPayResult() {
const { payOrderNo, orderNo } = this.orderInfo; const { payOrderNo, orderNo } = this.orderInfo;
this.setIsLoading(true);
placeOrder.polling({ payOrderNo, payOrderType: 1 }).then(payRes => { placeOrder.polling({ payOrderNo, payOrderType: 1 }).then(payRes => {
if (!payRes.result && payRes.payState === 2) { if (!payRes.result && payRes.payState === 2) {
this.payTimer = setTimeout(() => { this.payTimer = setTimeout(() => {
this.getPayResult(); this.getPayResult();
}, 3000); }, 3000);
} else { } else {
this.setIsPayWait(false);
this.setIsLoading(false); this.setIsLoading(false);
this.$router.push({ path: "/policy/detail/" + orderNo }); this.$router.replace({ path: "/policy/detail/" + orderNo });
} }
}); });
} }
......
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