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

fix: H5支付跳转

parent 8b5c1f44
...@@ -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 11:56:33 * @LastEditTime: 2020-08-28 13:22:33
*/ */
import qs from "qs"; import qs from "qs";
...@@ -55,7 +55,7 @@ function payByWeixinJsapi(info = {}, callback) { ...@@ -55,7 +55,7 @@ function payByWeixinJsapi(info = {}, callback) {
*/ */
function payByWeixinH5(info) { function payByWeixinH5(info) {
if (!info.url) return; if (!info.url) return;
info.params.isXyqb = isXyqb; info.params.isXyqb = isXyqb ? 1 : 0;
const currentPath = encodeURIComponent( const currentPath = encodeURIComponent(
window.location.origin + window.location.origin +
"/payWaiting" + "/payWaiting" +
...@@ -74,7 +74,7 @@ function payByWeixinH5(info) { ...@@ -74,7 +74,7 @@ function payByWeixinH5(info) {
*/ */
function payByThirdPartyCashier(info) { function payByThirdPartyCashier(info) {
if (!info.url) return; if (!info.url) return;
info.params.isXyqb = isXyqb; info.params.isXyqb = isXyqb ? 1 : 0;
const currentPath = encodeURIComponent( const currentPath = encodeURIComponent(
window.location.origin + window.location.origin +
"/payWaiting" + "/payWaiting" +
...@@ -91,7 +91,7 @@ function payByThirdPartyCashier(info) { ...@@ -91,7 +91,7 @@ function payByThirdPartyCashier(info) {
* @return {Promise} 回调 * @return {Promise} 回调
*/ */
export function payByWay(type = "THIRD", payInfo) { export function payByWay(type = "THIRD", payInfo) {
return new Promise(resolve => { return new Promise((resolve, reject) => {
if (type === "JSAPI" && !payInfo.url) { if (type === "JSAPI" && !payInfo.url) {
payByWeixinJsapi(payInfo, function() { payByWeixinJsapi(payInfo, function() {
// if (e === "ok") { // if (e === "ok") {
...@@ -104,10 +104,12 @@ export function payByWay(type = "THIRD", payInfo) { ...@@ -104,10 +104,12 @@ export function payByWay(type = "THIRD", payInfo) {
} else { } else {
if (payInfo.url.indexOf("tenpay") > -1) { if (payInfo.url.indexOf("tenpay") > -1) {
payByWeixinH5(payInfo); payByWeixinH5(payInfo);
reject();
} else { } else {
payByThirdPartyCashier(payInfo); payByThirdPartyCashier(payInfo);
reject();
} }
resolve(); // resolve();
} }
}); });
} }
...@@ -73,9 +73,13 @@ export default { ...@@ -73,9 +73,13 @@ export default {
} }
}; };
} }
payByWay(tradeType, payInfo).then(() => { payByWay(tradeType, payInfo)
this.getPayResult(); .then(() => {
}); this.getPayResult();
})
.catch(() => {
console.log("h5支付");
});
} else { } else {
this.setIsPayWait(false); this.setIsPayWait(false);
} }
......
...@@ -15,8 +15,8 @@ export default { ...@@ -15,8 +15,8 @@ export default {
mounted() { mounted() {
this.setIsPayWait(true); this.setIsPayWait(true);
this.orderInfo = this.$route.query; this.orderInfo = this.$route.query;
if (this.orderInfo.isXyqb) { if (this.orderInfo.isXyqb == 1) {
window.location.href = "xyqb://"; window.location.href = "xyqb://my";
return; return;
} }
if (!this.orderInfo.payOrderNo) { if (!this.orderInfo.payOrderNo) {
......
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