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
1b0a4998
Commit
1b0a4998
authored
Feb 21, 2020
by
jiangjiantao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
兑换券
parent
368687ce
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
9 deletions
+26
-9
app.json
app.json
+2
-2
home.js
pages/home/home.js
+24
-7
No files found.
app.json
View file @
1b0a4998
{
"pages"
:
[
"pages/home/home"
,
"pages/login/login"
,
"pages/paysuccess/paysuccess"
,
"pages/balance/balance"
,
"pages/scan/scan"
"pages/scan/scan"
,
"pages/home/home"
],
"window"
:
{
"defaultTitle"
:
""
...
...
pages/home/home.js
View file @
1b0a4998
...
...
@@ -9,7 +9,7 @@ import { ACTION_CONVERT_COUPON } from '../../const/actioncmd'
Page
({
data
:
{
//显示弹窗,>1为显示,2loading 3 result success 4 result failed
scanDialogDisplay
:
1
scanDialogDisplay
:
0
},
onLoad
()
{
...
...
@@ -86,7 +86,13 @@ Page({
});
},
//外接扫码枪事件
onKeyPress
(
r
)
{
console
.
log
(
"scan onKeyPress==>"
+
r
);
if
(
this
.
data
.
scanDialogDisplay
!=
0
){
this
.
verifyCoupon
(
r
);
}
},
onHide
()
{
// 页面隐藏
...
...
@@ -104,7 +110,9 @@ Page({
//核销券
verifyCoupon
(
code
)
{
this
.
setData
({
scanDialogDisplay
:
2
})
this
.
sendConvertCouponToBack
(
2
)
var
commonRequest
=
{};
commonRequest
.
state
=
2
this
.
sendConvertCouponToBack
(
commonRequest
)
var
couponRequest
=
api
.
createCommonRequest
();
couponRequest
.
couponCode
=
code
;
console
.
log
(
"核销券的请求 ==>"
+
JSON
.
stringify
(
couponRequest
));
...
...
@@ -116,18 +124,27 @@ Page({
timeout
:
30000
,
data
:
couponRequest
,
success
:
(
res
)
=>
{
console
.
log
(
"核销券成功 ==>"
+
JSON
.
stringify
(
res
));
if
(
res
.
data
.
success
!=
true
)
{
context
.
sendConvertCouponToBack
(
4
)
var
commonRequest
=
{};
commonRequest
.
state
=
4
commonRequest
.
msg
=
res
.
data
.
errorMsg
context
.
sendConvertCouponToBack
(
commonRequest
)
this
.
setData
({
scanDialogDisplay
:
4
})
console
.
log
(
"核销券失败 ==>"
+
res
.
data
.
message
);
console
.
log
(
"核销券失败 ==>"
+
res
.
data
.
errorMsg
);
}
else
{
context
.
sendConvertCouponToBack
(
3
)
var
commonRequest
=
{};
commonRequest
.
state
=
3
context
.
sendConvertCouponToBack
(
commonRequest
)
this
.
setData
({
scanDialogDisplay
:
3
})
console
.
log
(
"核销券成功 ==>"
+
JSON
.
stringify
(
res
));
}
},
fail
:
(
res
)
=>
{
context
.
sendConvertCouponToBack
(
4
)
var
commonRequest
=
{};
commonRequest
.
state
=
4
commonRequest
.
msg
=
"网络异常"
context
.
sendConvertCouponToBack
(
commonRequest
)
this
.
setData
({
scanDialogDisplay
:
4
})
console
.
log
(
"核销券失败 ==>"
+
JSON
.
stringify
(
res
));
my
.
showToast
({
...
...
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