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
368687ce
Commit
368687ce
authored
Feb 21, 2020
by
jiangjiantao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
兑换券
parent
40dea23e
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
36 additions
and
18 deletions
+36
-18
app.json
app.json
+2
-2
actioncmd.js
const/actioncmd.js
+2
-0
home.js
pages/home/home.js
+32
-16
No files found.
app.json
View file @
368687ce
{
{
"pages"
:
[
"pages"
:
[
"pages/home/home"
,
"pages/login/login"
,
"pages/login/login"
,
"pages/paysuccess/paysuccess"
,
"pages/paysuccess/paysuccess"
,
"pages/balance/balance"
,
"pages/balance/balance"
,
"pages/scan/scan"
,
"pages/scan/scan"
"pages/home/home"
],
],
"window"
:
{
"window"
:
{
"defaultTitle"
:
""
"defaultTitle"
:
""
...
...
const/actioncmd.js
View file @
368687ce
...
@@ -34,3 +34,5 @@ export const ACTION_GET_ACCOUNT = "ACTION_GET_ACCOUNT";
...
@@ -34,3 +34,5 @@ export const ACTION_GET_ACCOUNT = "ACTION_GET_ACCOUNT";
//直接收款
//直接收款
export
const
ACTION_DIRECT_PAYMENT
=
"ACTION_DIRECT_PAYMENT"
;
export
const
ACTION_DIRECT_PAYMENT
=
"ACTION_DIRECT_PAYMENT"
;
//兑换券
export
const
ACTION_CONVERT_COUPON
=
"ACTION_CONVERT_COUPON"
;
\ No newline at end of file
pages/home/home.js
View file @
368687ce
...
@@ -4,10 +4,12 @@ import { API_USE_COUPON } from '../../const/apiurl'
...
@@ -4,10 +4,12 @@ import { API_USE_COUPON } from '../../const/apiurl'
import
{
ACTION_GO_SCAN
}
from
'../../const/actioncmd'
import
{
ACTION_GO_SCAN
}
from
'../../const/actioncmd'
import
{
ACTION_GET_ACCOUNT
}
from
'../../const/actioncmd'
import
{
ACTION_GET_ACCOUNT
}
from
'../../const/actioncmd'
import
{
ACTION_DIRECT_PAYMENT
}
from
'../../const/actioncmd'
import
{
ACTION_DIRECT_PAYMENT
}
from
'../../const/actioncmd'
import
{
ACTION_CONVERT_COUPON
}
from
'../../const/actioncmd'
Page
({
Page
({
data
:
{
data
:
{
scanDialogDisplay
:
0
//显示弹窗,>1为显示,2loading 3 result success 4 result failed
scanDialogDisplay
:
1
},
},
onLoad
()
{
onLoad
()
{
...
@@ -76,11 +78,16 @@ Page({
...
@@ -76,11 +78,16 @@ Page({
console
.
log
(
"通知后屏小程序跳转到结算页面 失败 ===》 "
+
JSON
.
stringify
(
fres
));
console
.
log
(
"通知后屏小程序跳转到结算页面 失败 ===》 "
+
JSON
.
stringify
(
fres
));
}
}
})
})
}
else
if
(
res
.
action
==
ACTION_CONVERT_COUPON
){
//兑换券
this
.
setData
({
scanDialogDisplay
:
res
.
data
})
}
}
}
}
});
});
},
},
onHide
()
{
onHide
()
{
// 页面隐藏
// 页面隐藏
//关闭后屏监听
//关闭后屏监听
...
@@ -94,27 +101,14 @@ Page({
...
@@ -94,27 +101,14 @@ Page({
}
}
},
},
homeTap
()
{
},
//显示弹窗,>1为显示,2loading 3 result success 4 result failed
showDialog
()
{
this
.
setData
({
scanDialogDisplay
:
1
}
)
console
.
log
(
this
.
data
.
scanDialogDisplay
);
},
//核销券
//核销券
verifyCoupon
(
code
)
{
verifyCoupon
(
code
)
{
this
.
setData
({
scanDialogDisplay
:
2
})
this
.
setData
({
scanDialogDisplay
:
2
})
this
.
sendConvertCouponToBack
(
2
)
var
couponRequest
=
api
.
createCommonRequest
();
var
couponRequest
=
api
.
createCommonRequest
();
couponRequest
.
couponCode
=
code
;
couponRequest
.
couponCode
=
code
;
console
.
log
(
"核销券的请求 ==>"
+
JSON
.
stringify
(
couponRequest
));
console
.
log
(
"核销券的请求 ==>"
+
JSON
.
stringify
(
couponRequest
));
let
context
=
this
;
my
.
request
({
my
.
request
({
url
:
getApp
().
globalData
.
BASE_URL
+
API_USE_COUPON
,
url
:
getApp
().
globalData
.
BASE_URL
+
API_USE_COUPON
,
method
:
'POST'
,
method
:
'POST'
,
...
@@ -123,14 +117,17 @@ Page({
...
@@ -123,14 +117,17 @@ Page({
data
:
couponRequest
,
data
:
couponRequest
,
success
:
(
res
)
=>
{
success
:
(
res
)
=>
{
if
(
res
.
data
.
success
!=
true
)
{
if
(
res
.
data
.
success
!=
true
)
{
context
.
sendConvertCouponToBack
(
4
)
this
.
setData
({
scanDialogDisplay
:
4
})
this
.
setData
({
scanDialogDisplay
:
4
})
console
.
log
(
"核销券失败 ==>"
+
res
.
data
.
message
);
console
.
log
(
"核销券失败 ==>"
+
res
.
data
.
message
);
}
else
{
}
else
{
context
.
sendConvertCouponToBack
(
3
)
this
.
setData
({
scanDialogDisplay
:
3
})
this
.
setData
({
scanDialogDisplay
:
3
})
console
.
log
(
"核销券成功 ==>"
+
JSON
.
stringify
(
res
));
console
.
log
(
"核销券成功 ==>"
+
JSON
.
stringify
(
res
));
}
}
},
},
fail
:
(
res
)
=>
{
fail
:
(
res
)
=>
{
context
.
sendConvertCouponToBack
(
4
)
this
.
setData
({
scanDialogDisplay
:
4
})
this
.
setData
({
scanDialogDisplay
:
4
})
console
.
log
(
"核销券失败 ==>"
+
JSON
.
stringify
(
res
));
console
.
log
(
"核销券失败 ==>"
+
JSON
.
stringify
(
res
));
my
.
showToast
({
my
.
showToast
({
...
@@ -143,6 +140,25 @@ Page({
...
@@ -143,6 +140,25 @@ Page({
},
},
//同步兑换券到后台
sendConvertCouponToBack
(
e
){
my
.
ix
.
sendBuddyMessage
({
// 填入目标小程序的 AppID
target
:
getApp
().
globalData
.
backScreenAppId
,
data
:
{
action
:
ACTION_CONVERT_COUPON
,
data
:
e
},
success
:
(
sres
)
=>
{
},
fail
:
(
fres
)
=>
{
sendConvertCouponToBack
(
e
)
console
.
info
(
`sendBuddyMessage failed:
${
JSON
.
stringify
(
res
)}
`
);
}
});
}
});
});
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