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