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
85644c73
Commit
85644c73
authored
Feb 24, 2020
by
gaodapeng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改home页面
parent
4423a557
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
55 additions
and
47 deletions
+55
-47
home.js
pages/home/home.js
+55
-47
No files found.
pages/home/home.js
View file @
85644c73
...
...
@@ -14,6 +14,7 @@ Page({
data
:
{
//显示弹窗,>1为显示,2loading 3 result success 4 result failed
scanDialogDisplay
:
0
,
dialogShowType
:
""
,
//弹窗类型:如refund
dialogRemindText
:
"请扫描兑换码"
,
dialogLoadingText
:
"识别中"
,
dialogResultSuccessRemind
:
"兑换码已识别"
,
...
...
@@ -70,7 +71,7 @@ Page({
}
});
}
else
if
(
res
.
action
==
ACTION_DIRECT_PAYMENT
)
{
}
else
if
(
res
.
action
==
ACTION_DIRECT_PAYMENT
)
{
//直接收款
my
.
ix
.
sendBuddyMessage
({
target
:
getApp
().
globalData
.
backScreenAppId
,
...
...
@@ -89,13 +90,14 @@ Page({
console
.
log
(
"通知后屏小程序跳转到结算页面 失败 ===》 "
+
JSON
.
stringify
(
fres
));
}
})
}
else
if
(
res
.
action
==
ACTION_CONVERT_COUPON
)
{
}
else
if
(
res
.
action
==
ACTION_CONVERT_COUPON
)
{
//兑换券
this
.
setData
({
scanDialogDisplay
:
res
.
data
})
this
.
setData
({
scanDialogDisplay
:
res
.
data
})
}
else
if
(
res
.
action
==
ACTION_REFUND
)
{
//显示弹窗
context
.
setData
({
scanDialogDisplay
:
1
,
dialogShowType
:
"refund"
,
dialogRemindText
:
"请扫描订单编码"
,
dialogLoadingText
:
"识别中"
,
dialogResultSuccessRemind
:
"退款成功"
,
...
...
@@ -106,7 +108,8 @@ Page({
}
else
if
(
res
.
action
==
ACTION_GO_HOME
)
{
//home界面收到,则返回界面上
context
.
setData
({
scanDialogDisplay
:
0
scanDialogDisplay
:
0
,
dialogShowType
:
""
,
//重置类型
})
}
}
...
...
@@ -116,9 +119,14 @@ Page({
//外接扫码枪事件
onKeyPress
(
r
)
{
console
.
log
(
"scan onKeyPress==>"
+
r
);
if
(
this
.
data
.
scanDialogDisplay
!=
0
){
if
(
this
.
data
.
scanDialogDisplay
!=
0
)
{
if
(
this
.
data
.
dialogShowType
==
"refund"
)
{
refund
(
r
);
}
else
{
this
.
verifyCoupon
(
r
);
}
}
},
onHide
()
{
...
...
@@ -136,7 +144,7 @@ Page({
//核销券
verifyCoupon
(
code
)
{
this
.
setData
({
scanDialogDisplay
:
2
})
this
.
setData
({
scanDialogDisplay
:
2
})
var
commonRequest
=
{};
commonRequest
.
state
=
2
this
.
sendConvertCouponToBack
(
commonRequest
)
...
...
@@ -157,13 +165,13 @@ Page({
commonRequest
.
state
=
4
commonRequest
.
msg
=
res
.
data
.
errorMsg
context
.
sendConvertCouponToBack
(
commonRequest
)
this
.
setData
({
scanDialogDisplay
:
4
})
this
.
setData
({
scanDialogDisplay
:
4
})
console
.
log
(
"核销券失败 ==>"
+
res
.
data
.
errorMsg
);
}
else
{
var
commonRequest
=
{};
commonRequest
.
state
=
3
context
.
sendConvertCouponToBack
(
commonRequest
)
this
.
setData
({
scanDialogDisplay
:
3
})
this
.
setData
({
scanDialogDisplay
:
3
})
console
.
log
(
"核销券成功 ==>"
+
JSON
.
stringify
(
res
));
}
},
...
...
@@ -172,7 +180,7 @@ Page({
commonRequest
.
state
=
4
commonRequest
.
msg
=
"网络异常"
context
.
sendConvertCouponToBack
(
commonRequest
)
this
.
setData
({
scanDialogDisplay
:
4
})
this
.
setData
({
scanDialogDisplay
:
4
})
console
.
log
(
"核销券失败 ==>"
+
JSON
.
stringify
(
res
));
my
.
showToast
({
type
:
'exception'
,
...
...
@@ -183,14 +191,6 @@ Page({
});
},
//增加扫码内容,以及退款等操作的内容
onKeyPress
(
r
)
{
//只有在弹窗出现时才扫码
if
(
this
.
data
.
scanDialogDisplay
>
0
)
{
refund
(
r
);
}
},
refund
(
barcode
)
{
this
.
setData
({
scanDialogDisplay
:
2
})
var
request
=
api
.
createCommonRequest
();
...
...
@@ -203,10 +203,14 @@ Page({
timeout
:
30000
,
data
:
request
,
success
:
(
res
)
=>
{
if
(
res
.
data
.
success
!=
true
||
res
.
data
.
data
==
null
)
{
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
);
var
message
=
res
.
data
.
message
;
if
(
message
==
null
)
{
message
=
"退款失败,请检查退款订单号,稍后再试"
;
}
this
.
refundCallback
(
ACTION_REFUND_FAILED
,
message
);
}
else
{
this
.
setData
({
scanDialogDisplay
:
3
})
console
.
log
(
"退款成功 ==>"
+
JSON
.
stringify
(
res
.
data
));
...
...
@@ -216,12 +220,16 @@ Page({
fail
:
(
res
)
=>
{
this
.
setData
({
scanDialogDisplay
:
4
})
console
.
log
(
"退款失败 ==>"
+
JSON
.
stringify
(
res
.
data
));
this
.
refundCallback
(
ACTION_REFUND_FAILED
,
null
);
var
message
=
res
.
data
.
message
;
if
(
message
==
null
)
{
message
=
"退款失败,请检查退款订单号,稍后再试"
;
}
this
.
refundCallback
(
ACTION_REFUND_FAILED
,
message
);
}
});
},
refundCallback
(
action
,
data
)
{
refundCallback
(
action
,
data
)
{
my
.
ix
.
sendBuddyMessage
({
// 填入目标小程序的 AppID
target
:
getApp
().
globalData
.
backScreenAppId
,
...
...
@@ -241,7 +249,7 @@ Page({
},
//同步兑换券到后台
sendConvertCouponToBack
(
e
){
sendConvertCouponToBack
(
e
)
{
my
.
ix
.
sendBuddyMessage
({
// 填入目标小程序的 AppID
target
:
getApp
().
globalData
.
backScreenAppId
,
...
...
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