Commit 68773159 authored by 郭志伟's avatar 郭志伟

fix: 微信不支持location.href跳转

parent ca054818
......@@ -12,6 +12,7 @@
<login-modal />
<auth-from-xyqb v-if="showAuthXyqb !== -1" />
<net-error />
<open-brower-tip />
<public-popup
:value="isShowPublicPopup"
:title="publicPupopData.title"
......@@ -27,11 +28,13 @@ import LoginModal from "@/components/LoginModal";
import AuthFromXyqb from "@/components/AuthFromXyqb";
import PopupWithIframe from "@/components/PopupWithIframe";
import NetError from "@/components/NetError";
import OpenBrowerTip from "@/components/OpenBrowerTip";
export default {
components: {
LoginModal,
AuthFromXyqb,
NetError,
OpenBrowerTip,
PublicPopup: PopupWithIframe
},
data() {
......
......@@ -4,7 +4,7 @@
* @Description:众安50万意外险
* @Date: 2020-07-27 15:46:37
* @LastEditors: gzw
* @LastEditTime: 2020-08-28 10:48:31
* @LastEditTime: 2020-08-28 20:10:36
*/
import goodsBg from "@/assets/images/goods/detail/yiwaixian/bg.png";
import title from "@/assets/images/goods/detail/yiwaixian/title.png";
......
<template>
<cr-overlay class="user-mask" :show="isShowOpenBrower" @click="setIsShowOpenBrower(false)">
<cr-image
class="user-mask-image"
width="290px"
height="211px"
fit="cover"
src="@/assets/images/openTip.png"
/>
</cr-overlay>
</template>
<script>
import { mapState, mapActions } from "vuex";
export default {
name: "OpenBrowerTip",
computed: {
...mapState(["isShowOpenBrower"])
},
methods: {
...mapActions(["setIsShowOpenBrower"])
}
};
</script>
<style lang="less" scoped>
.user-mask {
display: flex;
flex-direction: column;
justify-content: top;
align-items: flex-end;
padding: 20px 20px 0 0;
z-index: 101;
&-image {
margin-bottom: 10px;
}
&-title {
font-size: 15px;
line-height: 24px;
font-weight: 600;
color: #ffffff;
}
&-desc {
font-size: 20px;
line-height: 24px;
font-weight: 600;
color: #ffffff;
}
}
</style>
......@@ -2,7 +2,7 @@
* @Description: 支付微信h5, jsapi, 第三方收银台,跳转)
* @Date: 2020-07-28 15:03:52
* @LastEditors: gzw
* @LastEditTime: 2020-08-28 14:25:10
* @LastEditTime: 2020-08-28 21:19:45
*/
import qs from "qs";
......@@ -62,7 +62,10 @@ function payByWeixinH5(info) {
"/payWaiting" +
qs.stringify(info.params, { encode: true, addQueryPrefix: true })
);
window.location.href = `${info.url}&redirect_url=${currentPath}`;
// window.location.href = `${info.url}&redirect_url=${currentPath}`;
const nextPage = document.createElement("a");
nextPage.setAttribute("href", `${info.url}&redirect_url=${currentPath}`);
nextPage.click();
}
/**
......@@ -81,7 +84,10 @@ function payByThirdPartyCashier(info) {
"/payWaiting" +
qs.stringify(info.params, { encode: true, addQueryPrefix: true })
);
window.location.href = `${info.url}&redirect_uri=${currentPath}`;
const nextPage = document.createElement("a");
nextPage.setAttribute("href", `${info.url}&redirect_uri=${currentPath}`);
nextPage.click();
// window.location.href = `${info.url}&redirect_uri=${currentPath}`;
}
/**
......
......@@ -13,6 +13,7 @@ export default new Vuex.Store({
isShowLogin: false,
isPayWait: false,
isShowPublicPopup: false,
isShowOpenBrower: false,
publicPupopData: {
title: "",
content: "",
......@@ -33,6 +34,9 @@ export default new Vuex.Store({
setIsPayWait(state, value) {
state.isPayWait = value;
},
setIsShowOpenBrower(state, value) {
state.isShowOpenBrower = value;
},
setAuthXyqb(state, value) {
state.showAuthXyqb = value;
localStorage.set("xyqbAuthState", value);
......@@ -59,6 +63,9 @@ export default new Vuex.Store({
setIsPayWait({ commit }, args) {
commit("setIsPayWait", args);
},
setIsShowOpenBrower({ commit }, args) {
commit("setIsShowOpenBrower", args);
},
setAuthXyqb({ commit }, args) {
commit("setAuthXyqb", args);
},
......
......@@ -20,7 +20,7 @@ export default {
this.tradeType = this.customTradeType ?? (isXyqb ? "MWEB" : isWeixinBrower ? "JSAPI" : "MWEB");
},
methods: {
...mapActions(["setIsLoading", "setIsPayWait"]),
...mapActions(["setIsLoading", "setIsPayWait", "setIsShowOpenBrower"]),
async generateOrder(detailType) {
this.setIsLoading(true);
const res = await placeOrder.create({
......@@ -34,6 +34,7 @@ export default {
},
async goPay() {
this.setIsLoading(false);
// let isThird = false;
const { tradeType, orderInfo, openId } = this;
const { payOrderNo, payType } = orderInfo;
if (!payOrderNo) {
......@@ -61,7 +62,7 @@ export default {
state: 1
}
};
} else if (tradeType === "JSAPI" && !res.payInfo.payUrl && !res.payUrl) {
} else if (tradeType === "JSAPI" && !res.payUrl && res.payInfo && !res.payInfo.payUrl) {
payInfo = res.payInfo;
} else {
payInfo = {
......@@ -72,13 +73,20 @@ export default {
state: 1
}
};
// isThird = true;
}
// if (isThird && isWeixinBrower) {
// this.setIsPayWait(false);
// this.setIsShowOpenBrower(true);
// return;
// }
payByWay(tradeType, payInfo)
.then(() => {
this.getPayResult();
})
.catch(() => {
console.log("h5支付");
return;
});
} else {
this.setIsPayWait(false);
......
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