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
93544b52
Commit
93544b52
authored
Feb 19, 2020
by
gaodapeng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
增加跳转到结算页面的内容。增加支付成功失败的状态
parent
ee0f3a2e
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
76 additions
and
2 deletions
+76
-2
actioncmd.js
const/actioncmd.js
+7
-1
balance.js
pages/balance/balance.js
+54
-0
scan.js
pages/scan/scan.js
+15
-1
No files found.
const/actioncmd.js
View file @
93544b52
...
...
@@ -17,4 +17,10 @@ export const ACTION_REQUEST_GOOD_INFO = "ACTION_REQUEST_GOOD_INFO";
export
const
ACTION_GO_SCAN
=
"ACTION_GO_SCAN"
;
//获取店铺信息
export
const
ACTION_STORE_INFO
=
"ACTION_STORE_INFO"
;
\ No newline at end of file
export
const
ACTION_STORE_INFO
=
"ACTION_STORE_INFO"
;
//支付成功
export
const
ACTION_ON_PAY_SUCCESS
=
"ACTION_ON_PAY_SUCCESS"
;
//支付失败
export
const
ACTION_ON_PAY_FAILED
=
"ACTION_ON_PAY_FAILED"
;
pages/balance/balance.js
View file @
93544b52
var
api
=
require
(
"../../utils/api.js"
);
var
payUtils
=
require
(
"../../utils/payUtils.js"
);
import
{
ACTION_GO_SCAN
}
from
'../../const/actioncmd'
import
{
ACTION_ON_PAY_SUCCESS
}
from
'../../const/actioncmd'
import
{
ACTION_ON_PAY_FAILED
}
from
'../../const/actioncmd'
Page
({
data
:
{
...
...
@@ -55,6 +58,26 @@ Page({
},
onshow
(){
my
.
ix
.
onBuddyMessage
({
success
:
(
res
)
=>
{
console
.
info
(
`onBuddyMessage success:
${
JSON
.
stringify
(
res
)}
`
);
if
(
res
.
action
==
ACTION_GO_SCAN
){
//增加跳转回去的内容
}
else
{
//未知指令
}
}
});
},
onHide
()
{
// 页面隐藏
//关闭后屏监听
my
.
ix
.
offBuddyMessage
();
},
/**
* @todo 支付结果的获取
* @todo 跳转数据的保存
...
...
@@ -171,6 +194,22 @@ Page({
my
.
redirectTo
({
url
:
'/pages/paysuccess/paysuccess'
,
});
//发送支付成功到后屏
my
.
ix
.
sendBuddyMessage
({
// 填入目标小程序的 AppID
target
:
getApp
().
globalData
.
backScreenAppId
,
data
:
{
action
:
ACTION_ON_PAY_SUCCESS
,
data
:
res
.
data
},
success
:
(
res
)
=>
{
console
.
info
(
`sendBuddyMessage success:
${
JSON
.
stringify
(
res
)}
`
);
},
fail
:
(
res
)
=>
{
console
.
info
(
`sendBuddyMessage failed:
${
JSON
.
stringify
(
res
)}
`
);
}
});
// }
}
else
{
console
.
log
(
"支付回调失败,toast提示 "
);
...
...
@@ -180,6 +219,21 @@ Page({
content
:
res
.
message
,
duration
:
2000
});
//发送支付失败到后屏
my
.
ix
.
sendBuddyMessage
({
// 填入目标小程序的 AppID
target
:
getApp
().
globalData
.
backScreenAppId
,
data
:
{
action
:
ACTION_ON_PAY_FAILED
,
data
:
null
},
success
:
(
res
)
=>
{
console
.
info
(
`sendBuddyMessage success:
${
JSON
.
stringify
(
res
)}
`
);
},
fail
:
(
res
)
=>
{
console
.
info
(
`sendBuddyMessage failed:
${
JSON
.
stringify
(
res
)}
`
);
}
});
}
}.
bind
(
this
));
},
...
...
pages/scan/scan.js
View file @
93544b52
...
...
@@ -49,9 +49,23 @@ Page({
})
}
}
else
if
(
res
.
action
==
ACTION_GO_BALANCE
)
{
}
else
if
(
res
.
action
==
ACTION_GO_BALANCE
)
{
//去结算页面
context
.
goBalance
();
my
.
ix
.
sendBuddyMessage
({
target
:
getApp
().
globalData
.
backScreenAppId
,
data
:
{
action
:
ACTION_GO_BALANCE
,
data
:
null
},
success
:
(
res
)
=>
{
console
.
log
(
"发送商品数据到后屏小程序成功 ===》"
+
JSON
.
stringify
(
res
));
},
fail
:
(
res
)
=>
{
console
.
log
(
"发送商品数据到后屏小程序 失败 ===》 "
+
JSON
.
stringify
(
res
));
//发送失败重试
}
})
}
else
if
(
res
.
action
==
ACTION_REQUEST_GOOD_INFO
){
//去结算页面
context
.
getGoodInfoByBarcode
(
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