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
4996a488
Commit
4996a488
authored
Feb 25, 2020
by
gaodapeng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix bugs
parent
da16d384
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
56 additions
and
14 deletions
+56
-14
balance.js
pages/balance/balance.js
+18
-6
home.js
pages/home/home.js
+38
-8
No files found.
pages/balance/balance.js
View file @
4996a488
...
...
@@ -13,7 +13,6 @@ Page({
qrPayShow
:
false
,
list
:
[],
orderNo
:
""
,
isCashierClosed
:
false
,
isPaying
:
false
,
},
onLoad
(
options
)
{
...
...
@@ -54,7 +53,13 @@ Page({
}
});
var
speechContent
=
totalPrice
+
"元 请刷脸或扫码支付"
;
my
.
ix
.
speech
({
text
:
speechContent
,
speak
:
true
,
success
:
(
r
)
=>
{
}
});
},
...
...
@@ -125,7 +130,6 @@ Page({
if
(
res
.
codeType
==
"F"
)
{
this
.
doPay
(
this
.
data
.
orderNo
,
res
.
barCode
);
}
else
{
this
.
data
.
isCashierClosed
=
true
;
this
.
doPay
(
this
.
data
.
orderNo
,
res
.
barCode
);
}
},
fail
:
(
res
)
=>
{
...
...
@@ -142,7 +146,6 @@ Page({
if
(
res
.
bizType
==
'RESULT_CLOSED'
||
res
.
status
==
"RESULT_CLOSE"
)
{
console
.
log
(
"收银台关闭"
);
this
.
data
.
isCashierClosed
=
true
;
//关闭监听
my
.
ix
.
offCashierEventReceive
();
if
(
this
.
data
.
isPaying
==
true
)
{
...
...
@@ -192,7 +195,17 @@ Page({
if
(
res
.
resultCode
==
1
)
{
//成功
console
.
log
(
"支付回调成功,跳转 "
);
// if(data.isCashierClosed == true){
if
(
res
.
data
.
tradeAmount
!=
null
)
{
var
speechContent
=
"成功支付"
+
res
.
data
.
tradeAmount
+
"元"
;
my
.
ix
.
speech
({
text
:
speechContent
,
speak
:
true
,
success
:
(
r
)
=>
{
}
});
}
my
.
ix
.
offCashierEventReceive
();
this
.
saveData
(
this
.
data
.
list
,
res
.
data
);
my
.
redirectTo
({
...
...
@@ -214,7 +227,6 @@ Page({
console
.
info
(
`sendBuddyMessage failed:
${
JSON
.
stringify
(
res
)}
`
);
}
});
// }
}
else
{
console
.
log
(
"支付回调失败,toast提示 "
);
my
.
ix
.
offCashierEventReceive
();
...
...
pages/home/home.js
View file @
4996a488
...
...
@@ -104,8 +104,16 @@ Page({
dialogResultSuccessText
:
"恭喜您!兑换成功"
,
dialogResultFailureRemind
:
"兑换码未识别"
,
dialogResultFailureText
:
"兑换失败,请稍后重试!"
,
})
});
if
(
res
.
data
!=
0
)
{
var
speechContent
=
"请扫描兑换码"
;
my
.
ix
.
speech
({
text
:
speechContent
,
speak
:
true
,
success
:
(
r
)
=>
{
}
});
}
}
else
if
(
res
.
action
==
ACTION_REFUND
)
{
//显示弹窗
context
.
setData
({
...
...
@@ -119,7 +127,12 @@ Page({
dialogResultFailureText
:
"退款失败!无效的订单码"
,
});
console
.
log
(
"ACTION_REFUND"
);
var
speechContent
=
"请扫描订单编码"
;
my
.
ix
.
speech
({
text
:
speechContent
,
speak
:
true
,
success
:
(
r
)
=>
{
}
});
}
else
if
(
res
.
action
==
ACTION_GO_HOME
)
{
//home界面收到,则返回界面上
context
.
setData
({
...
...
@@ -269,13 +282,22 @@ Page({
//核销券
verifyCoupon
(
code
)
{
//语音提示已识别
var
speechContent
=
"兑换码已识别"
;
my
.
ix
.
speech
({
text
:
speechContent
,
speak
:
true
,
success
:
(
r
)
=>
{
}
});
this
.
setData
({
scanDialogDisplay
:
2
})
var
commonRequest
=
{};
commonRequest
.
state
=
2
this
.
sendConvertCouponToBack
(
commonRequest
)
var
couponRequest
=
api
.
createCommonRequest
();
couponRequest
.
couponCode
=
code
;
console
.
log
(
"
核销券
的请求 ==>"
+
JSON
.
stringify
(
couponRequest
));
console
.
log
(
"
兑换码
的请求 ==>"
+
JSON
.
stringify
(
couponRequest
));
let
context
=
this
;
my
.
request
({
url
:
getApp
().
globalData
.
BASE_URL
+
API_USE_COUPON
,
...
...
@@ -284,20 +306,20 @@ Page({
timeout
:
30000
,
data
:
couponRequest
,
success
:
(
res
)
=>
{
console
.
log
(
"
核销券
成功 ==>"
+
JSON
.
stringify
(
res
));
console
.
log
(
"
兑换
成功 ==>"
+
JSON
.
stringify
(
res
));
if
(
res
.
data
.
success
!=
true
)
{
var
commonRequest
=
{};
commonRequest
.
state
=
4
commonRequest
.
msg
=
res
.
data
.
errorMsg
context
.
sendConvertCouponToBack
(
commonRequest
)
this
.
setData
({
scanDialogDisplay
:
4
})
console
.
log
(
"
核销券
失败 ==>"
+
res
.
data
.
errorMsg
);
console
.
log
(
"
兑换
失败 ==>"
+
res
.
data
.
errorMsg
);
}
else
{
var
commonRequest
=
{};
commonRequest
.
state
=
3
context
.
sendConvertCouponToBack
(
commonRequest
)
this
.
setData
({
scanDialogDisplay
:
3
})
console
.
log
(
"
核销券
成功 ==>"
+
JSON
.
stringify
(
res
));
console
.
log
(
"
兑换
成功 ==>"
+
JSON
.
stringify
(
res
));
}
},
fail
:
(
res
)
=>
{
...
...
@@ -306,7 +328,7 @@ Page({
commonRequest
.
msg
=
"网络异常"
context
.
sendConvertCouponToBack
(
commonRequest
)
this
.
setData
({
scanDialogDisplay
:
4
})
console
.
log
(
"
核销券
失败 ==>"
+
JSON
.
stringify
(
res
));
console
.
log
(
"
兑换
失败 ==>"
+
JSON
.
stringify
(
res
));
my
.
showToast
({
type
:
'exception'
,
content
:
api
.
decodeErrorMessage
(
res
.
error
),
...
...
@@ -320,6 +342,7 @@ Page({
//退款
refund
(
barcode
)
{
this
.
setData
({
scanDialogDisplay
:
2
})
var
request
=
api
.
createCommonRequest
();
request
.
tradeNo
=
barcode
;
...
...
@@ -340,6 +363,13 @@ Page({
}
this
.
refundCallback
(
ACTION_REFUND_FAILED
,
message
);
}
else
{
var
speechContent
=
"退款成功"
;
my
.
ix
.
speech
({
text
:
speechContent
,
speak
:
true
,
success
:
(
r
)
=>
{
}
});
this
.
setData
({
scanDialogDisplay
:
3
})
console
.
log
(
"退款成功 ==>"
+
JSON
.
stringify
(
res
.
data
));
this
.
refundCallback
(
ACTION_REFUND_SUCCESS
,
res
.
data
.
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