Commit 0db73d38 authored by 郭志伟's avatar 郭志伟

Merge branch 'fix/goods' into 'master'

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

See merge request !122
parents ca054818 68773159
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
<login-modal /> <login-modal />
<auth-from-xyqb v-if="showAuthXyqb !== -1" /> <auth-from-xyqb v-if="showAuthXyqb !== -1" />
<net-error /> <net-error />
<open-brower-tip />
<public-popup <public-popup
:value="isShowPublicPopup" :value="isShowPublicPopup"
:title="publicPupopData.title" :title="publicPupopData.title"
...@@ -27,11 +28,13 @@ import LoginModal from "@/components/LoginModal"; ...@@ -27,11 +28,13 @@ import LoginModal from "@/components/LoginModal";
import AuthFromXyqb from "@/components/AuthFromXyqb"; import AuthFromXyqb from "@/components/AuthFromXyqb";
import PopupWithIframe from "@/components/PopupWithIframe"; import PopupWithIframe from "@/components/PopupWithIframe";
import NetError from "@/components/NetError"; import NetError from "@/components/NetError";
import OpenBrowerTip from "@/components/OpenBrowerTip";
export default { export default {
components: { components: {
LoginModal, LoginModal,
AuthFromXyqb, AuthFromXyqb,
NetError, NetError,
OpenBrowerTip,
PublicPopup: PopupWithIframe PublicPopup: PopupWithIframe
}, },
data() { data() {
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
* @Description:众安50万意外险 * @Description:众安50万意外险
* @Date: 2020-07-27 15:46:37 * @Date: 2020-07-27 15:46:37
* @LastEditors: gzw * @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 goodsBg from "@/assets/images/goods/detail/yiwaixian/bg.png";
import title from "@/assets/images/goods/detail/yiwaixian/title.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 @@ ...@@ -2,7 +2,7 @@
* @Description: 支付微信h5, jsapi, 第三方收银台,跳转) * @Description: 支付微信h5, jsapi, 第三方收银台,跳转)
* @Date: 2020-07-28 15:03:52 * @Date: 2020-07-28 15:03:52
* @LastEditors: gzw * @LastEditors: gzw
* @LastEditTime: 2020-08-28 14:25:10 * @LastEditTime: 2020-08-28 21:19:45
*/ */
import qs from "qs"; import qs from "qs";
...@@ -62,7 +62,10 @@ function payByWeixinH5(info) { ...@@ -62,7 +62,10 @@ function payByWeixinH5(info) {
"/payWaiting" + "/payWaiting" +
qs.stringify(info.params, { encode: true, addQueryPrefix: true }) 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) { ...@@ -81,7 +84,10 @@ function payByThirdPartyCashier(info) {
"/payWaiting" + "/payWaiting" +
qs.stringify(info.params, { encode: true, addQueryPrefix: true }) 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({ ...@@ -13,6 +13,7 @@ export default new Vuex.Store({
isShowLogin: false, isShowLogin: false,
isPayWait: false, isPayWait: false,
isShowPublicPopup: false, isShowPublicPopup: false,
isShowOpenBrower: false,
publicPupopData: { publicPupopData: {
title: "", title: "",
content: "", content: "",
...@@ -33,6 +34,9 @@ export default new Vuex.Store({ ...@@ -33,6 +34,9 @@ export default new Vuex.Store({
setIsPayWait(state, value) { setIsPayWait(state, value) {
state.isPayWait = value; state.isPayWait = value;
}, },
setIsShowOpenBrower(state, value) {
state.isShowOpenBrower = value;
},
setAuthXyqb(state, value) { setAuthXyqb(state, value) {
state.showAuthXyqb = value; state.showAuthXyqb = value;
localStorage.set("xyqbAuthState", value); localStorage.set("xyqbAuthState", value);
...@@ -59,6 +63,9 @@ export default new Vuex.Store({ ...@@ -59,6 +63,9 @@ export default new Vuex.Store({
setIsPayWait({ commit }, args) { setIsPayWait({ commit }, args) {
commit("setIsPayWait", args); commit("setIsPayWait", args);
}, },
setIsShowOpenBrower({ commit }, args) {
commit("setIsShowOpenBrower", args);
},
setAuthXyqb({ commit }, args) { setAuthXyqb({ commit }, args) {
commit("setAuthXyqb", args); commit("setAuthXyqb", args);
}, },
......
...@@ -20,7 +20,7 @@ export default { ...@@ -20,7 +20,7 @@ export default {
this.tradeType = this.customTradeType ?? (isXyqb ? "MWEB" : isWeixinBrower ? "JSAPI" : "MWEB"); this.tradeType = this.customTradeType ?? (isXyqb ? "MWEB" : isWeixinBrower ? "JSAPI" : "MWEB");
}, },
methods: { methods: {
...mapActions(["setIsLoading", "setIsPayWait"]), ...mapActions(["setIsLoading", "setIsPayWait", "setIsShowOpenBrower"]),
async generateOrder(detailType) { async generateOrder(detailType) {
this.setIsLoading(true); this.setIsLoading(true);
const res = await placeOrder.create({ const res = await placeOrder.create({
...@@ -34,6 +34,7 @@ export default { ...@@ -34,6 +34,7 @@ export default {
}, },
async goPay() { async goPay() {
this.setIsLoading(false); this.setIsLoading(false);
// let isThird = false;
const { tradeType, orderInfo, openId } = this; const { tradeType, orderInfo, openId } = this;
const { payOrderNo, payType } = orderInfo; const { payOrderNo, payType } = orderInfo;
if (!payOrderNo) { if (!payOrderNo) {
...@@ -61,7 +62,7 @@ export default { ...@@ -61,7 +62,7 @@ export default {
state: 1 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; payInfo = res.payInfo;
} else { } else {
payInfo = { payInfo = {
...@@ -72,13 +73,20 @@ export default { ...@@ -72,13 +73,20 @@ export default {
state: 1 state: 1
} }
}; };
// isThird = true;
} }
// if (isThird && isWeixinBrower) {
// this.setIsPayWait(false);
// this.setIsShowOpenBrower(true);
// return;
// }
payByWay(tradeType, payInfo) payByWay(tradeType, payInfo)
.then(() => { .then(() => {
this.getPayResult(); this.getPayResult();
}) })
.catch(() => { .catch(() => {
console.log("h5支付"); console.log("h5支付");
return;
}); });
} else { } else {
this.setIsPayWait(false); 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