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
19b4137b
Commit
19b4137b
authored
Aug 04, 2020
by
郭志伟
Committed by
郝聪敏
Aug 05, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 支付完善
parent
e5b99baa
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
64 additions
and
68 deletions
+64
-68
pay.js
src/service/pay.js
+18
-26
index.vue
src/views/Consultant/Buy/index.vue
+10
-6
paytest.vue
src/views/paytest.vue
+36
-36
No files found.
src/service/pay.
service.
js
→
src/service/pay.js
View file @
19b4137b
...
...
@@ -2,11 +2,12 @@
* @Description: 支付微信h5, jsapi, 第三方收银台,跳转)
* @Date: 2020-07-28 15:03:52
* @LastEditors: gzw
* @LastEditTime: 2020-0
7-31 10:46:33
* @LastEditTime: 2020-0
8-04 10:30:09
*/
import
{
Notify
}
from
"
@qg/cherry-ui
"
;
import
cherry
from
"
@qg/cherry-ui
"
;
import
qs
from
"
qs
"
;
const
{
Notify
}
=
cherry
;
/**
* payByWeixinJsapi
...
...
@@ -15,33 +16,23 @@ import qs from "qs";
* @param {type}
* @return:
*/
function
payByWeixinJsapi
(
info
,
callback
)
{
function
payByWeixinJsapi
(
info
=
{}
,
callback
)
{
function
onBridgeReady
()
{
// eslint-disable-next-line no-undef
WeixinJSBridge
.
invoke
(
"
getBrandWCPayRequest
"
,
{
appId
:
info
.
appId
,
//公众号名称,由商户传入
timeStamp
:
info
.
timeStamp
,
//时间戳,自1970年以来的秒数
nonceStr
:
info
.
nonceStr
,
//随机串
package
:
`prepay_id=
${
info
.
prepayId
}
`
,
signType
:
"
MD5
"
,
//微信签名方式:
paySign
:
info
.
sign
//微信签名
},
function
(
res
)
{
if
(
res
.
err_msg
==
"
get_brand_wcpay_request:ok
"
)
{
// 使用以上方式判断前端返回,微信团队郑重提示:
//res.err_msg将在用户支付成功后返回ok,但并不保证它绝对可靠。
callback
(
"
ok
"
);
}
else
if
(
res
.
err_msg
==
"
get_brand_wcpay_request:cancel
"
)
{
// 支付取消
callback
(
"
cancel
"
);
}
else
{
// 支付失败
callback
(
"
fail
"
);
}
WeixinJSBridge
.
invoke
(
"
getBrandWCPayRequest
"
,
info
,
function
(
res
)
{
console
.
log
(
res
);
if
(
res
.
err_msg
==
"
get_brand_wcpay_request:ok
"
)
{
// 使用以上方式判断前端返回,微信团队郑重提示:
//res.err_msg将在用户支付成功后返回ok,但并不保证它绝对可靠。
callback
(
"
ok
"
);
}
else
if
(
res
.
err_msg
==
"
get_brand_wcpay_request:cancel
"
)
{
// 支付取消
callback
(
"
cancel
"
);
}
else
{
// 支付失败
callback
(
"
fail
"
);
}
);
}
);
}
if
(
typeof
WeixinJSBridge
==
"
undefined
"
)
{
if
(
document
.
addEventListener
)
{
...
...
@@ -86,6 +77,7 @@ function payByThirdPartyCashier(info) {
/**
* @description: 支付方式判断, 返回promise
* NATIVE=原生扫码支付.,APP=ap支付,,JSAPI=公众号支付/小程序支付,,MWEB=H5支付.,MICROPAY=刷卡支付,默认JSAPI
* @param {String} type 支付方式,THIRD -> 第三方,MWEB -> H5支付, JSAPI -> jsapi支付,默认支付方式,THIRD
* @param {Object/String} payInfo 支付信息
* @return {Promise} 回调
...
...
src/views/Consultant/Buy/index.vue
View file @
19b4137b
...
...
@@ -81,6 +81,7 @@
<
script
>
import
localStorage
from
"
@/service/localStorage
"
;
import
{
payByWay
}
from
"
@/service/pay
"
;
import
{
mapActions
,
mapState
}
from
"
vuex
"
;
import
{
create
,
goPay
}
from
"
@/api/consultant
"
;
import
Card
from
"
@/components/Card
"
;
...
...
@@ -100,6 +101,7 @@ export default {
remain
:
126
,
price
:
[
0.99
,
199
],
consultantOrderNo
:
""
,
tradeType
:
"
JSAPI
"
,
serviceList
:
[
{
icon
:
"
team
"
,
title
:
"
资深
"
,
sub
:
"
保险精算团队
"
},
{
icon
:
"
card
"
,
title
:
"
专属
"
,
sub
:
"
保险顾问
"
},
...
...
@@ -220,13 +222,15 @@ export default {
}
},
async
goPay
()
{
const
res
=
await
goPay
({
consultantOrderNo
:
this
.
consultantOrderNo
});
const
res
=
await
goPay
({
tradeType
:
this
.
tradeType
});
if
(
res
)
{
this
.
$notify
({
type
:
"
success
"
,
message
:
"
支付成功
"
});
setTimeout
(()
=>
{
// this.$router.push("/consultant/success");
this
.
$parent
.
getOrderInfo
();
},
2000
);
payByWay
(
this
.
tradeType
,
res
.
payInfo
).
then
(()
=>
{
this
.
$notify
({
type
:
"
success
"
,
message
:
"
支付成功
"
});
setTimeout
(()
=>
{
// this.$router.push("/consultant/success");
this
.
$parent
.
getOrderInfo
();
},
2000
);
});
}
}
}
...
...
src/views/paytest.vue
View file @
19b4137b
...
...
@@ -44,7 +44,7 @@
import
{
loginByPhone
,
getwxOpenId
}
from
"
@/api/user
"
;
import
{
placeOrder
}
from
"
@/api/order
"
;
import
cfg
from
"
@/config
"
;
import
{
payByWay
}
from
"
@/service/pay
.service
"
;
import
{
payByWay
}
from
"
@/service/pay
"
;
let
pollTimer
=
null
;
export
default
{
name
:
"
paytest
"
,
...
...
@@ -60,49 +60,49 @@ export default {
},
insuredOrderInfo
:
{
insuredUserInfo
:
{
phoneNo
:
"
13209654413
"
,
userInfoSecId
:
"
commodo
"
,
userName
:
"
罗刚
"
,
idNo
:
"
566254180010306614
"
,
phoneNo
:
"
15715416416
"
,
userName
:
"
龚秀兰
"
,
idNo
:
"
640181198708118231
"
,
longTerm
:
false
,
validEnd
:
"
1978-11-18
"
,
relation
:
"
1
"
,
socialSecurity
:
fals
e
,
email
:
"
s.yfyviye@mxxv.ki
"
,
annualIncome
:
"
17159
"
,
validEnd
:
"
2021-03-15
"
,
relation
:
"
2
"
,
socialSecurity
:
tru
e
,
email
:
"
r.icj@crtzzkdr.is
"
,
annualIncome
:
"
71067
"
,
addressCode
:
"
110100
"
,
addressDetail
:
"
海外
"
,
occupation
:
"
5
"
,
height
:
1
69
,
weight
:
58
,
addressDetail
:
"
六安市
"
,
occupation
:
"
7
"
,
height
:
1
83
,
weight
:
66
,
bankCardCode
:
"
ICBC
"
,
bankCardNo
:
"
6220549771082240618
"
bankCardNo
:
"
1815137475347541839
"
},
productNo
:
"
1
"
,
productNo
:
"
HTYLX00
1
"
,
holderUserInfo
:
{
phoneNo
:
"
13499177270
"
,
userInfoSecId
:
"
eu in
"
,
userName
:
"
崔静
"
,
idNo
:
"
16479119920330003X
"
,
longTerm
:
false
,
validEnd
:
"
1985-09-23
"
,
socialSecurity
:
false
,
email
:
"
n.ata@ueccvun.bz
"
,
annualIncome
:
"
35555
"
,
phoneNo
:
"
15664415945
"
,
userName
:
"
郭平
"
,
idNo
:
"
640181198708118231
"
,
longTerm
:
true
,
validEnd
:
"
2021-12-03
"
,
socialSecurity
:
true
,
email
:
"
y.dcqoic@bkfygg.fo
"
,
annualIncome
:
"
50401
"
,
addressCode
:
"
110100
"
,
addressDetail
:
"
白城
市
"
,
occupation
:
"
1
"
,
height
:
1
86
,
weight
:
54
,
addressDetail
:
"
通化
市
"
,
occupation
:
"
3
"
,
height
:
1
69
,
weight
:
66
,
bankCardCode
:
"
ICBC
"
,
bankCardNo
:
"
667782802278796
"
bankCardNo
:
"
9397487291495249077
"
},
productItem
:
{
insuredAmount
:
"
30万
"
,
policyPeriod
:
"
至60岁
"
,
paymentPeriod
:
"
20年
"
},
insuredAmount
:
"
57
"
,
policyPeriod
:
"
26
"
,
paymentType
:
4
,
paymentPeriod
:
"
et in
"
,
effectiveDate
:
"
2003-07-06 23:11:44
"
,
autoRenewPolicy
:
true
effectiveDate
:
"
2020-08-16 12:44:18
"
,
autoRenewPolicy
:
false
},
orderInfo
:
{},
tradeType
:
""
,
...
...
@@ -191,7 +191,7 @@ export default {
};
if
(
tradeType
===
"
JSAPI
"
)
{
payInfo
=
res
.
data
.
payInfo
;
payInfo
.
appId
=
cfg
.
wxAppId
;
//
payInfo.appId = cfg.wxAppId;
}
payByWay
(
tradeType
,
payInfo
).
then
(()
=>
{
this
.
payBack
=
1
;
...
...
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