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
149cd9d1
Commit
149cd9d1
authored
Mar 02, 2020
by
gaodapeng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
增加收银台退出逻辑
parent
64e523c9
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
31 additions
and
21 deletions
+31
-21
balance.js
pages/balance/balance.js
+31
-21
No files found.
pages/balance/balance.js
View file @
149cd9d1
...
...
@@ -15,6 +15,7 @@ Page({
list
:
[],
orderNo
:
""
,
isPaying
:
false
,
},
//回退到上一个页面
...
...
@@ -99,36 +100,51 @@ Page({
},
onShow
()
{
console
.
log
(
"balance onShow"
);
my
.
ix
.
onBuddyMessage
({
success
:
(
res
)
=>
{
console
.
info
(
`onBuddyMessage success:
${
JSON
.
stringify
(
res
)}
`
);
if
(
res
.
action
==
ACTION_GO_SCAN
)
{
//返回扫码页
//增加跳转回去的内容
my
.
navigateBack
();
my
.
ix
.
exitApp
({
appName
:
'cashier'
});
}
else
if
(
res
.
action
==
ACTION_GO_HOME
)
{
//去首页
my
.
reLaunch
({
url
:
"/pages/home/home"
,
});
//取消操作
my
.
ix
.
exitApp
({
appName
:
'cashier'
});
}
}
});
},
onHide
()
{
},
onUnload
()
{
console
.
log
(
"balance onShow"
);
// 页面隐藏
//关闭后屏监听
my
.
ix
.
offBuddyMessage
();
},
/**
* @todo 支付结果的获取
* @todo 跳转数据的保存
*/
* 支付
*/
startPay
()
{
//开始loading
if
(
this
.
data
.
isPaying
==
true
)
{
return
}
my
.
showLoading
({});
this
.
setData
({
isPaying
:
true
,
})
//获取order
var
payAmount
=
payUtils
.
yuan2Fen
(
this
.
data
.
payPrice
);
payUtils
.
getOrder
(
payAmount
,
this
.
data
.
list
,
function
(
res
)
{
...
...
@@ -140,6 +156,10 @@ Page({
orderNo
:
res
.
data
});
this
.
payWithOpenCashier
(
res
.
data
);
}
else
{
this
.
setData
({
isPaying
:
false
});
}
}
}.
bind
(
this
));
...
...
@@ -167,12 +187,16 @@ Page({
this
.
doPay
(
this
.
data
.
orderNo
,
res
.
barCode
);
}
},
fail
:
(
res
)
=>
{
console
.
log
(
"收银台启动失败 ==>"
+
JSON
.
stringify
(
res
));
my
.
hideLoading
();
my
.
showToast
({
type
:
'exception'
,
content
:
api
.
decodeErrorMessage
(
res
.
error
),
duration
:
2000
});
this
.
setData
({
isPaying
:
false
});
}
});
//收银台回调
...
...
@@ -183,23 +207,9 @@ Page({
console
.
log
(
"收银台关闭"
);
//关闭监听
my
.
ix
.
offCashierEventReceive
();
if
(
this
.
data
.
isPaying
==
true
)
{
//如果正在支付中,则等待支付结果返回
}
else
{
//跳转支付结果页面,说明支付已完成,无论取消支付还是支付成功等都跳转支付结果页
// if (this.data.actualPayPriceYuan != null) {
// my.redirectTo({
// //payPrice和couponPrice需要考虑支付宝优惠
// url: '/pages/paysuccess/paysuccess?orderPrice=' + this.data.totalPrice + "&couponPrice=" + this.data.couponPrice + "&payPrice=" + this.data.payPrice+"&totalCount="+this.data.totalCount,
// });
// } else {
// //说明用户取消了支付
// my.redirectTo({
// url: '/pages/paysuccess/paysuccess?payFailedMsg=' + "用户取消" + "&payPriceYuan=" + this.data.payPriceYuan,
// });
// }
}
this
.
setData
({
isPaying
:
false
});
}
else
if
(
res
.
bizType
==
'RESULT_BTN_FUNCTION'
)
console
.
log
(
"收银台自定义按钮按下"
);
else
if
(
res
.
bizType
==
'RESULT_MEMBER'
)
...
...
@@ -243,7 +253,7 @@ Page({
my
.
ix
.
offCashierEventReceive
();
this
.
saveData
(
this
.
data
.
list
,
res
.
data
);
my
.
re
directTo
({
my
.
re
Launch
({
url
:
'/pages/paysuccess/paysuccess?totalGoodsNum='
+
this
.
data
.
goodsNum
,
});
...
...
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