Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
D
doublescreen-front
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
pengguangpu
doublescreen-front
Commits
dd25744f
Commit
dd25744f
authored
Feb 13, 2020
by
gaodapeng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改支付内容
parent
137c5dcb
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
42 additions
and
39 deletions
+42
-39
balance.js
pages/balance/balance.js
+39
-37
payUtils.js
utils/payUtils.js
+3
-2
No files found.
pages/balance/balance.js
View file @
dd25744f
...
@@ -45,7 +45,7 @@ Page({
...
@@ -45,7 +45,7 @@ Page({
payUtils
.
getOrder
(
/*this.data.payPrice*/
1
,
this
.
data
.
list
,
function
(
res
){
payUtils
.
getOrder
(
/*this.data.payPrice*/
1
,
this
.
data
.
list
,
function
(
res
){
if
(
res
!=
null
){
if
(
res
!=
null
){
console
.
log
(
"callback调用,res="
+
JSON
.
stringify
(
res
));
console
.
log
(
"callback调用,res="
+
JSON
.
stringify
(
res
));
if
(
res
.
resultCode
==
1
){
if
(
res
.
resultCode
==
1
){
this
.
setData
({
this
.
setData
({
orderNo
:
res
.
data
orderNo
:
res
.
data
...
@@ -57,43 +57,10 @@ Page({
...
@@ -57,43 +57,10 @@ Page({
}.
bind
(
this
));
}.
bind
(
this
));
},
},
//调用收款接口
doPay
(
orderNo
,
payCode
)
{
console
.
log
(
"doPay调用"
);
this
.
setData
({
isPaying
:
true
});
//使用barCode来当面付
payUtils
.
startPay
(
orderNo
,
payCode
,
1
,
this
.
data
.
list
,
function
(
res
){
my
.
hideLoading
();
console
.
log
(
"支付回调 ===>"
+
JSON
.
stringify
(
res
));
this
.
setData
({
isPaying
:
false
});
if
(
res
==
null
){
return
;
}
if
(
res
.
code
>
0
){
//成功
console
.
log
(
"支付回调成功,跳转 "
);
// if(data.isCashierClosed == true){
my
.
ix
.
offCashierEventReceive
();
my
.
redirectTo
({
url
:
'/pages/paysuccess/paysuccess?orderPrice='
+
this
.
data
.
totalPrice
+
"&couponPrice="
+
this
.
data
.
couponPrice
+
"&payPrice="
+
this
.
data
.
payPrice
+
"&totalCount="
+
this
.
data
.
totalCount
,
});
// }
}
else
{
console
.
log
(
"支付回调失败,toast提示 "
);
my
.
ix
.
offCashierEventReceive
();
my
.
showToast
({
type
:
'fail'
,
content
:
res
.
data
,
duration
:
2000
});
}
}.
bind
(
this
));
},
/**
/**
* 打开收银台,进行扫码收款
* 打开收银台,进行扫码收款
*/
*/
payWithOpenCashier
(
orderNo
){
payWithOpenCashier
(){
try
{
try
{
console
.
info
(
"收银台版本"
+
my
.
ix
.
getVersionSync
({
console
.
info
(
"收银台版本"
+
my
.
ix
.
getVersionSync
({
packageName
:
'zoloz.phone.android.alipay.com.dragonfly'
packageName
:
'zoloz.phone.android.alipay.com.dragonfly'
...
@@ -107,10 +74,10 @@ Page({
...
@@ -107,10 +74,10 @@ Page({
success
:
(
res
)
=>
{
success
:
(
res
)
=>
{
console
.
log
(
"收银台启动回调 success==>"
+
JSON
.
stringify
(
res
));
console
.
log
(
"收银台启动回调 success==>"
+
JSON
.
stringify
(
res
));
if
(
res
.
codeType
==
"F"
)
{
if
(
res
.
codeType
==
"F"
)
{
this
.
doPay
(
orderNo
,
res
.
barCode
);
this
.
doPay
(
this
.
data
.
orderNo
,
res
.
barCode
);
}
else
{
}
else
{
this
.
data
.
isCashierClosed
=
true
;
this
.
data
.
isCashierClosed
=
true
;
this
.
doPay
(
orderNo
,
res
.
barCode
);
this
.
doPay
(
this
.
data
.
orderNo
,
res
.
barCode
);
}
}
},
fail
:(
res
)
=>
{
},
fail
:(
res
)
=>
{
my
.
showToast
({
my
.
showToast
({
...
@@ -159,4 +126,39 @@ Page({
...
@@ -159,4 +126,39 @@ Page({
},
},
//调用收款接口
doPay
(
orderNo
,
payCode
)
{
console
.
log
(
"doPay调用"
);
this
.
setData
({
isPaying
:
true
});
//使用barCode来当面付
payUtils
.
startPay
(
orderNo
,
payCode
,
1
,
this
.
data
.
list
,
function
(
res
){
my
.
hideLoading
();
console
.
log
(
"支付回调 ===>"
+
JSON
.
stringify
(
res
));
this
.
setData
({
isPaying
:
false
});
if
(
res
==
null
){
return
;
}
if
(
res
.
code
>
0
){
//成功
console
.
log
(
"支付回调成功,跳转 "
);
// if(data.isCashierClosed == true){
my
.
ix
.
offCashierEventReceive
();
my
.
redirectTo
({
url
:
'/pages/paysuccess/paysuccess?orderPrice='
+
this
.
data
.
totalPrice
+
"&couponPrice="
+
this
.
data
.
couponPrice
+
"&payPrice="
+
this
.
data
.
payPrice
+
"&totalCount="
+
this
.
data
.
totalCount
,
});
// }
}
else
{
console
.
log
(
"支付回调失败,toast提示 "
);
my
.
ix
.
offCashierEventReceive
();
my
.
showToast
({
type
:
'fail'
,
content
:
res
.
data
,
duration
:
2000
});
}
}.
bind
(
this
));
},
});
});
utils/payUtils.js
View file @
dd25744f
...
@@ -193,8 +193,9 @@ function pay(tradeNo, payCode, payPrice, list, callback, retryCount){
...
@@ -193,8 +193,9 @@ function pay(tradeNo, payCode, payPrice, list, callback, retryCount){
data
:
payRequest
,
data
:
payRequest
,
success
:
(
res
)
=>
{
success
:
(
res
)
=>
{
//增加数据判断,增加重试
//增加数据判断,增加重试
if
(
res
==
null
||
res
.
data
==
null
||
res
.
data
.
success
!=
true
||
res
.
data
.
data
==
null
)
{
console
.
log
(
"支付接口回调 ==>"
+
JSON
.
stringify
(
res
));
console
.
log
(
"支付未成功 ==>"
+
res
.
data
.
message
);
if
(
res
==
null
||
res
.
data
==
null
||
res
.
data
.
success
!=
true
/*||res.data.data == null*/
)
{
console
.
log
(
"支付未成功 ==>"
+
JSON
.
stringify
(
res
.
data
.
message
));
retryOrFailed
(
tradeNo
,
payCode
,
payPrice
,
list
,
callback
,
retryCount
);
retryOrFailed
(
tradeNo
,
payCode
,
payPrice
,
list
,
callback
,
retryCount
);
}
else
{
}
else
{
console
.
log
(
"支付返回值 ==>"
+
JSON
.
stringify
(
res
.
data
));
console
.
log
(
"支付返回值 ==>"
+
JSON
.
stringify
(
res
.
data
));
...
...
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