Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
mongo-ui
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ui
mongo-ui
Commits
e2303f39
Commit
e2303f39
authored
Aug 24, 2020
by
郭志伟
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: H5支付问题修复
parent
92c11cbc
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
18 deletions
+21
-18
pay.js
src/service/pay.js
+20
-17
detailPay.mixin.js
src/views/Goods/Detail/modules/detailPay.mixin.js
+1
-1
No files found.
src/service/pay.js
View file @
e2303f39
...
...
@@ -2,11 +2,11 @@
* @Description: 支付微信h5, jsapi, 第三方收银台,跳转)
* @Date: 2020-07-28 15:03:52
* @LastEditors: gzw
* @LastEditTime: 2020-08-
13 14:14:32
* @LastEditTime: 2020-08-
24 19:59:04
*/
// import cherry from "@qg/cherry-ui";
//
import qs from "qs";
import
qs
from
"
qs
"
;
// const { Notify } = cherry;
/**
...
...
@@ -55,12 +55,12 @@ function payByWeixinJsapi(info = {}, callback) {
* @param {type}
* @return:
*/
function
payByWeixinH5
()
{
// if (
info.url) return;
//
const currentPath = encodeURIComponent(
//
window.location.href + qs.stringify(info.params, { encode: true, addQueryPrefix: true })
//
);
//
window.location.href = `${info.url}&redirect_url=${currentPath}`;
function
payByWeixinH5
(
info
)
{
if
(
!
info
.
url
)
return
;
const
currentPath
=
encodeURIComponent
(
window
.
location
.
href
+
qs
.
stringify
(
info
.
params
,
{
encode
:
true
,
addQueryPrefix
:
true
})
);
window
.
location
.
href
=
`
${
info
.
url
}
&redirect_url=
${
currentPath
}
`
;
}
/**
...
...
@@ -71,12 +71,12 @@ function payByWeixinH5() {
* @param {type}
* @return:
*/
function
payByThirdPartyCashier
()
{
// if (
info.url) return;
//
const currentPath = encodeURIComponent(
//
window.location.href + qs.stringify(info.params, { encode: true, addQueryPrefix: true })
//
);
//
window.location.href = `${info.url}&redirect_uri=${currentPath}`;
function
payByThirdPartyCashier
(
info
)
{
if
(
!
info
.
url
)
return
;
const
currentPath
=
encodeURIComponent
(
window
.
location
.
href
+
qs
.
stringify
(
info
.
params
,
{
encode
:
true
,
addQueryPrefix
:
true
})
);
window
.
location
.
href
=
`
${
info
.
url
}
&redirect_uri=
${
currentPath
}
`
;
}
/**
...
...
@@ -88,7 +88,7 @@ function payByThirdPartyCashier() {
*/
export
function
payByWay
(
type
=
"
THIRD
"
,
payInfo
)
{
return
new
Promise
(
resolve
=>
{
if
(
type
===
"
JSAPI
"
)
{
if
(
type
===
"
JSAPI
"
&&
!
payInfo
.
url
)
{
payByWeixinJsapi
(
payInfo
,
function
()
{
// if (e === "ok") {
// Notify({ type: "success", message: "支付成功" });
...
...
@@ -98,10 +98,13 @@ export function payByWay(type = "THIRD", payInfo) {
resolve
();
});
}
else
if
(
type
===
"
MWEB
"
)
{
payByWeixinH5
(
payInfo
);
if
(
payInfo
.
url
.
indexOf
(
"
weixin
"
)
>
-
1
)
{
payByWeixinH5
(
payInfo
);
}
else
{
payByThirdPartyCashier
(
payInfo
);
}
resolve
();
}
else
{
payByThirdPartyCashier
(
payInfo
);
resolve
();
}
});
...
...
src/views/Goods/Detail/modules/detailPay.mixin.js
View file @
e2303f39
...
...
@@ -60,7 +60,7 @@ export default {
state
:
1
}
};
}
else
if
(
tradeType
===
"
JSAPI
"
)
{
}
else
if
(
tradeType
===
"
JSAPI
"
&&
!
res
.
payUrl
)
{
payInfo
=
res
.
payInfo
;
}
else
{
payInfo
=
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment