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
4423a557
Commit
4423a557
authored
Feb 24, 2020
by
jiangjiantao
Browse files
Options
Browse Files
Download
Plain Diff
前屏登录通知后屏
parents
3bdaf5be
ace69fb7
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
109 additions
and
15 deletions
+109
-15
actioncmd.js
const/actioncmd.js
+10
-1
apiurl.js
const/apiurl.js
+3
-1
home.axml
pages/home/home.axml
+7
-7
home.js
pages/home/home.js
+89
-6
No files found.
const/actioncmd.js
View file @
4423a557
...
...
@@ -37,5 +37,14 @@ export const ACTION_DIRECT_PAYMENT = "ACTION_DIRECT_PAYMENT";
//兑换券
export
const
ACTION_CONVERT_COUPON
=
"ACTION_CONVERT_COUPON"
;
//退款操作
export
const
ACTION_REFUND
=
"ACTION_REFUND"
;
//退款成功
export
const
ACTION_REFUND_SUCCESS
=
"ACTION_REFUND_SUCCESS"
;
//退款失败
export
const
ACTION_REFUND_FAILED
=
"ACTION_REFUND_FAILED"
;
//登录完成
export
const
ACTION_LOGIN_OK
=
"ACTION_LOGIN_OK"
;
\ No newline at end of file
export
const
ACTION_LOGIN_OK
=
"ACTION_LOGIN_OK"
;
const/apiurl.js
View file @
4423a557
...
...
@@ -9,4 +9,6 @@ export const API_CREATE_ORDER = "order/create";
//支付接口
export
const
API_PAY
=
"pay/micropay"
;
//查询支付结果
export
const
API_QUERY
=
"order/query"
;
\ No newline at end of file
export
const
API_QUERY
=
"order/query"
;
export
const
API_REFUND
=
"order/refund"
;
\ No newline at end of file
pages/home/home.axml
View file @
4423a557
<view class="page" >
<view class="bg" onTap="homeTap"/>
<!-- 弹窗 -->
<scandialog displayDialog="{{scanDialogDisplay}}"
remindText="请扫描兑换码"
loadingText="识别中"
resultSuccessRemind="兑换码已识别"
resultSuccessText="恭喜您!兑换成功 "
resultFailureRemind="兑换码未识别"
resultFailureText="兑换失败,请稍后重试!"
remindText="{{dialogRemindText}}"
loadingText="{{dialogLoadingText}}"
resultSuccessRemind="{{dialogResultSuccessRemind}}"
resultSuccessText="{{dialogResultSuccessText}}"
resultFailureRemind="{{dialogResultFailureRemind}}"
resultFailureText="{{dialogResultFailureText}}"
/>
</view>
\ No newline at end of file
pages/home/home.js
View file @
4423a557
...
...
@@ -5,22 +5,33 @@ import { ACTION_GO_SCAN } from '../../const/actioncmd'
import
{
ACTION_GET_ACCOUNT
}
from
'../../const/actioncmd'
import
{
ACTION_DIRECT_PAYMENT
}
from
'../../const/actioncmd'
import
{
ACTION_CONVERT_COUPON
}
from
'../../const/actioncmd'
import
{
ACTION_GO_HOME
}
from
'../../const/actioncmd'
import
{
ACTION_REFUND
}
from
'../../const/actioncmd'
import
{
ACTION_REFUND_FAILED
}
from
'../../const/actioncmd'
import
{
ACTION_REFUND_SUCCESS
}
from
'../../const/actioncmd'
Page
({
data
:
{
//显示弹窗,>1为显示,2loading 3 result success 4 result failed
scanDialogDisplay
:
0
scanDialogDisplay
:
0
,
dialogRemindText
:
"请扫描兑换码"
,
dialogLoadingText
:
"识别中"
,
dialogResultSuccessRemind
:
"兑换码已识别"
,
dialogResultSuccessText
:
"恭喜您!兑换成功"
,
dialogResultFailureRemind
:
"兑换码未识别"
,
dialogResultFailureText
:
"兑换失败,请稍后重试!"
,
},
onLoad
()
{
},
onShow
(){
onShow
()
{
let
context
=
this
;
my
.
ix
.
onBuddyMessage
({
success
:
(
res
)
=>
{
console
.
info
(
`onBuddyMessage success:
${
JSON
.
stringify
(
res
)}
`
);
if
(
res
.
action
==
ACTION_GO_SCAN
)
{
if
(
res
.
action
==
ACTION_GO_SCAN
)
{
my
.
ix
.
sendBuddyMessage
({
// 填入目标小程序的 AppID
target
:
getApp
().
globalData
.
backScreenAppId
,
...
...
@@ -39,10 +50,10 @@ Page({
console
.
info
(
`sendBuddyMessage failed:
${
JSON
.
stringify
(
res
)}
`
);
}
});
}
else
if
(
res
.
action
==
ACTION_GET_ACCOUNT
)
{
}
else
if
(
res
.
action
==
ACTION_GET_ACCOUNT
)
{
var
message
=
{
data
:
getApp
().
globalData
.
localAccountInfo
,
action
:
ACTION_GET_ACCOUNT
data
:
getApp
().
globalData
.
localAccountInfo
,
action
:
ACTION_GET_ACCOUNT
}
my
.
ix
.
sendBuddyMessage
({
// 填入目标小程序的 AppID
...
...
@@ -81,6 +92,22 @@ Page({
}
else
if
(
res
.
action
==
ACTION_CONVERT_COUPON
){
//兑换券
this
.
setData
({
scanDialogDisplay
:
res
.
data
})
}
else
if
(
res
.
action
==
ACTION_REFUND
)
{
//显示弹窗
context
.
setData
({
scanDialogDisplay
:
1
,
dialogRemindText
:
"请扫描订单编码"
,
dialogLoadingText
:
"识别中"
,
dialogResultSuccessRemind
:
"退款成功"
,
dialogResultSuccessText
:
"退款完成!会在1~2个工作日 返还到您的付款账户"
,
dialogResultFailureRemind
:
"退款失败"
,
dialogResultFailureText
:
"退款失败!无效的订单码"
,
});
}
else
if
(
res
.
action
==
ACTION_GO_HOME
)
{
//home界面收到,则返回界面上
context
.
setData
({
scanDialogDisplay
:
0
})
}
}
});
...
...
@@ -156,6 +183,62 @@ Page({
});
},
//增加扫码内容,以及退款等操作的内容
onKeyPress
(
r
)
{
//只有在弹窗出现时才扫码
if
(
this
.
data
.
scanDialogDisplay
>
0
)
{
refund
(
r
);
}
},
refund
(
barcode
)
{
this
.
setData
({
scanDialogDisplay
:
2
})
var
request
=
api
.
createCommonRequest
();
request
.
tradeNo
=
barcode
;
my
.
request
({
url
:
getApp
().
globalData
.
BASE_URL
+
API_REFUND
,
method
:
'POST'
,
dataType
:
'json'
,
timeout
:
30000
,
data
:
request
,
success
:
(
res
)
=>
{
if
(
res
.
data
.
success
!=
true
||
res
.
data
.
data
==
null
)
{
this
.
setData
({
scanDialogDisplay
:
4
})
console
.
log
(
"退款失败 ==>"
+
JSON
.
stringify
(
res
.
data
));
this
.
refundCallback
(
ACTION_REFUND_FAILED
,
null
);
}
else
{
this
.
setData
({
scanDialogDisplay
:
3
})
console
.
log
(
"退款成功 ==>"
+
JSON
.
stringify
(
res
.
data
));
this
.
refundCallback
(
ACTION_REFUND_SUCCESS
,
res
.
data
.
data
);
}
},
fail
:
(
res
)
=>
{
this
.
setData
({
scanDialogDisplay
:
4
})
console
.
log
(
"退款失败 ==>"
+
JSON
.
stringify
(
res
.
data
));
this
.
refundCallback
(
ACTION_REFUND_FAILED
,
null
);
}
});
},
refundCallback
(
action
,
data
){
my
.
ix
.
sendBuddyMessage
({
// 填入目标小程序的 AppID
target
:
getApp
().
globalData
.
backScreenAppId
,
data
:
{
action
:
action
,
data
:
data
},
success
:
(
res
)
=>
{
console
.
info
(
`sendBuddyMessage success:
${
JSON
.
stringify
(
res
)}
`
);
//跳转到扫码页面
},
fail
:
(
res
)
=>
{
console
.
info
(
`sendBuddyMessage failed:
${
JSON
.
stringify
(
res
)}
`
);
}
});
},
//同步兑换券到后台
sendConvertCouponToBack
(
e
){
...
...
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