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
d5765a1d
Commit
d5765a1d
authored
Feb 13, 2020
by
gaodapeng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
删除重复内容,优化界面和代码
parent
0c9d686c
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
34 additions
and
60 deletions
+34
-60
balance.acss
pages/balance/balance.acss
+9
-0
balance.axml
pages/balance/balance.axml
+1
-2
balance.js
pages/balance/balance.js
+12
-57
payUtils.js
utils/payUtils.js
+12
-1
No files found.
pages/balance/balance.acss
View file @
d5765a1d
...
...
@@ -14,12 +14,21 @@ page{
color: #ffffff;
position:relative;
margin-top: 91rpx;
font-size:34rpx;
font-family:PingFangSC-Medium,PingFang SC;
font-weight:500;
color:rgba(255,255,255,1);
line-height:38rpx;
}
.payPrice{
color: #ffffff;
font-size: 94rpx;
margin-top: 8rpx;
font-family:PingFangSC-Semibold,PingFang SC;
font-weight:600;
color:rgba(255,255,255,1);
line-height:113rpx;
}
.priceDetailRow{
display: flex;
...
...
pages/balance/balance.axml
View file @
d5765a1d
<view class="page">
<image mode="aspectFit" src="/images/bg_balance.png" style="width:750rpx;height:504rpx"/>
<view style="position:absolute;width:100%;height:auto;left:0rpx;top:0rpx;display:flex;flex-direction:column;align-items:center">
<view class="goodsRemind">共计{{goodsNum}}件商品,应付总额</view>
<view class="payPrice">¥{{payPrice}}</view>
...
...
@@ -14,7 +13,7 @@
</view>
</view>
<view style="font-size:38rpx;width:300rpx;color:rgba(0,0,0,0.85);font-weight:500;font-family:PingFangSC-Medium,PingFang SC;opacity:0.85;margin:75rpx auto;">请选择支付方式</view>
<view style="font-size:38rpx;width:300rpx;color:rgba(0,0,0,0.85);font-weight:500;font-family:PingFangSC-Medium,PingFang SC;opacity:0.85;margin:75rpx auto;
margin-top:579rpx
">请选择支付方式</view>
<view style="width:750rpx;margin-top:78rpx;justify-content:space-between;display:flex;flex-direction:row;box-sizing:border-box;padding-left:96rpx;padding-right:96rpx;">
<view class="payWayContainer" onTap="startPay">
...
...
pages/balance/balance.js
View file @
d5765a1d
...
...
@@ -17,6 +17,9 @@ Page({
var
totalQuantity
=
options
.
totalQuantity
var
totalPrice
=
options
.
totalPrice
var
totalDisc
=
options
.
totalDisc
this
.
setData
({
list
:
options
.
goods
,
});
if
(
totalQuantity
!=
null
)
{
this
.
setData
({
...
...
@@ -29,6 +32,7 @@ Page({
this
.
setData
({
payPrice
:
totalPrice
,
totalPrice
:
totalPrice
,
couponPrice
:
totalDisc
,
})
}
...
...
@@ -50,24 +54,6 @@ Page({
},
/**
* 保存最近支付成功的相关信息,每次支付成功都需刷新
* @param paySuccessGoodsList 支付成功的商品列表信息
* @param paySuccessResponse 支付成功响应,即云中台返回响应中的data信息
*/
saveData
(
paySuccessGoodsList
,
paySuccessResponse
)
{
my
.
setStorageSync
({
key
:
'paySuccessGoodsList'
,
data
:
paySuccessGoodsList
});
my
.
setStorageSync
({
key
:
'paySuccessResponse'
,
data
:
paySuccessResponse
});
},
/**
* @todo 支付结果的获取
...
...
@@ -78,7 +64,8 @@ Page({
my
.
showLoading
({});
//获取order
payUtils
.
getOrder
(
/*this.data.payPrice*/
1
,
this
.
data
.
list
,
function
(
res
){
var
payAmount
=
payUtils
.
yuan2Fen
(
this
.
data
.
payPrice
);
payUtils
.
getOrder
(
/*payAmount*/
1
,
this
.
data
.
list
,
function
(
res
){
if
(
res
!=
null
){
console
.
log
(
"callback调用,res="
+
JSON
.
stringify
(
res
));
...
...
@@ -92,41 +79,6 @@ Page({
}.
bind
(
this
));
},
//调用收款接口
doPay
(
orderNo
,
payCode
)
{
console
.
log
(
"doPay调用"
+
orderNo
);
this
.
setData
({
isPaying
:
true
});
//使用barCode来当面付
payUtils
.
startPay
(
orderNo
,
payCode
,
1
,
this
.
data
.
list
,
function
(
res
){
my
.
hideLoading
();
console
.
log
(
"支付回调 ===>"
+
JSON
.
stringify
(
res
));
this
.
setData
({
isPaying
:
false
});
if
(
res
==
null
){
return
;
}
if
(
res
.
resultCode
==
1
){
//成功
console
.
log
(
"支付回调成功,跳转 "
);
// if(data.isCashierClosed == true){
my
.
ix
.
offCashierEventReceive
();
my
.
redirectTo
({
url
:
'/pages/paysuccess/paysuccess?orderPrice='
+
this
.
data
.
totalPrice
+
"&couponPrice="
+
this
.
data
.
couponPrice
+
"&payPrice="
+
this
.
data
.
payPrice
+
"&totalCount="
+
this
.
data
.
totalCount
,
});
// }
}
else
{
console
.
log
(
"支付回调失败 ===》 "
+
res
.
message
);
my
.
ix
.
offCashierEventReceive
();
my
.
showToast
({
type
:
'fail'
,
content
:
res
.
message
,
duration
:
2000
});
}
}.
bind
(
this
));
},
/**
* 打开收银台,进行扫码收款
*/
...
...
@@ -196,12 +148,14 @@ Page({
},
//调用收款接口
//调用收款接口
doPay
(
orderNo
,
payCode
)
{
console
.
log
(
"doPay调用"
);
this
.
setData
({
isPaying
:
true
});
//使用barCode来当面付
payUtils
.
startPay
(
orderNo
,
payCode
,
1
,
this
.
data
.
list
,
function
(
res
){
var
payAmount
=
payUtils
.
yuan2Fen
(
this
.
data
.
payPrice
);
payUtils
.
startPay
(
orderNo
,
payCode
,
/*payAmount*/
1
,
this
.
data
.
list
,
function
(
res
){
my
.
hideLoading
();
console
.
log
(
"支付回调 ===>"
+
JSON
.
stringify
(
res
));
this
.
setData
({
isPaying
:
false
});
...
...
@@ -215,7 +169,7 @@ Page({
my
.
ix
.
offCashierEventReceive
();
this
.
saveData
(
this
.
data
.
list
,
res
);
my
.
redirectTo
({
url
:
'/pages/paysuccess/paysuccess
?orderPrice='
+
this
.
data
.
totalPrice
+
"&couponPrice="
+
this
.
data
.
couponPrice
+
"&payPrice="
+
this
.
data
.
payPrice
+
"&totalCount="
+
this
.
data
.
totalCount
,
url
:
'/pages/paysuccess/paysuccess
'
,
});
// }
}
else
{
...
...
@@ -230,6 +184,7 @@ Page({
}.
bind
(
this
));
},
/**
* 保存最近支付成功的相关信息,每次支付成功都需刷新
* @param paySuccessGoodsList 支付成功的商品列表信息
...
...
utils/payUtils.js
View file @
d5765a1d
...
...
@@ -331,5 +331,16 @@ function queryPayState(tradeNo, callback){
});
}
function
fen2Yuan
(
num
)
{
if
(
typeof
num
!==
"number"
||
isNaN
(
num
))
return
null
;
return
(
num
/
100
).
toFixed
(
2
);
}
function
yuan2Fen
(
yuan
)
{
return
parseInt
(
yuan
*
100
);
}
module
.
exports
.
startPay
=
startPay
;
module
.
exports
.
getOrder
=
getOrder
;
\ No newline at end of file
module
.
exports
.
getOrder
=
getOrder
;
module
.
exports
.
fen2Yuan
=
fen2Yuan
;
module
.
exports
.
yuan2Fen
=
yuan2Fen
;
\ No newline at end of file
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