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
f53a33e8
Commit
f53a33e8
authored
Feb 13, 2020
by
pengguangpu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加支付成功页本地数据获取逻辑;
parent
0341da15
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
32 additions
and
14 deletions
+32
-14
paysuccess.js
pages/paysuccess/paysuccess.js
+31
-13
api.js
utils/api.js
+1
-1
No files found.
pages/paysuccess/paysuccess.js
View file @
f53a33e8
...
...
@@ -13,20 +13,33 @@ Page({
couponName
:
"xxxxxxxx"
,
couponDateDuration
:
"xxxx.xx.xx-xxxx.xx.xx"
,
isShowCoupon
:
false
,
isShowPrinting
:
true
isShowPrinting
:
true
,
goodsList
:
[],
payChannel
:
"未知"
,
paySuccessResponse
:
null
},
onLoad
(
query
)
{
console
.
info
(
`Page onLoad with query:
${
JSON
.
stringify
(
query
)}
`
);
//从本地获取相关数据
this
.
data
.
goodsList
.
push
(
my
.
getStorageSync
({
key
:
'paySuccessGoodsList'
}).
data
);
this
.
data
.
paySuccessResponse
=
my
.
getStorageSync
({
key
:
'paySuccessResponse'
}).
data
;
//单位转换&赋值
this
.
data
.
orderPriceFen
=
query
.
orderPrice
;
this
.
data
.
couponPriceFen
=
query
.
couponPrice
;
this
.
data
.
payPriceFen
=
query
.
payPrice
;
this
.
data
.
orderPriceFen
=
this
.
data
.
paySuccessResponse
.
tradeAmount
;
this
.
data
.
couponPriceFen
=
this
.
data
.
paySuccessResponse
.
mdiscount
+
this
.
data
.
paySuccessResponse
.
discount
;
this
.
data
.
payPriceFen
=
this
.
data
.
paySuccessResponse
.
tradeAmount
-
(
this
.
data
.
paySuccessResponse
.
mdiscount
+
this
.
data
.
paySuccessResponse
.
discount
)
;
this
.
data
.
totalCount
=
query
.
totalCount
;
var
miyapay
=
require
(
"../../utils/miyapay4.js"
);
this
.
data
.
orderPriceYuan
=
miyapay
.
fen2Yuan
(
this
.
data
.
orderPriceFen
);
this
.
data
.
couponPriceYuan
=
miyapay
.
fen2Yuan
(
this
.
data
.
couponPriceFen
);
this
.
data
.
payPriceYuan
=
miyapay
.
fen2Yuan
(
this
.
data
.
payPriceFen
);
//支付渠道
if
(
this
.
data
.
paySuccessResponse
.
channel
==
1
)
{
this
.
data
.
payChannel
=
"微信"
;
}
else
if
(
this
.
data
.
paySuccessResponse
.
channel
==
3
)
{
this
.
data
.
payChannel
=
"支付宝"
;
}
},
print
()
{
...
...
@@ -35,24 +48,29 @@ Page({
var
printCallbackTemp
=
this
.
printCallback
.
bind
(
this
);
var
cmds
=
[
printer
.
setAlign
(
printer
.
ALIGN_CENTER
),
printer
.
printText
(
"storeName"
),
printer
.
printText
(
getApp
().
globalData
.
localAccountInfo
.
storeName
),
printer
.
printDivide
(
"-"
),
printer
.
setAlign
(
printer
.
ALIGN_LEFT
),
printer
.
printText
(
"门店号:"
),
printer
.
printText
(
"收银员账号:"
),
printer
.
printText
(
"订单号:"
),
printer
.
printText
(
"门店号:"
+
this
.
paySuccessResponse
.
storeId
),
printer
.
printText
(
"收银员账号:"
+
this
.
paySuccessResponse
.
operatorId
),
printer
.
printText
(
"订单号:"
+
this
.
paySuccessResponse
.
tradeNo
),
printer
.
printNowDate
(),
printer
.
printDivide
(
"-"
),
printer
.
printText
(
"活动商品"
),
printer
.
printText
(
"
活动
名称 "
+
" 编码 "
+
" 数量"
),
printer
.
printText
(
"
商品
名称 "
+
" 编码 "
+
" 数量"
),
];
for
(
var
i
=
0
;
i
<
10
;
i
++
)
{
for
(
var
i
=
0
;
i
<
this
.
data
.
goodsList
.
length
;
i
++
)
{
//循环取出商品数据
// cmds.push();
cmds
.
push
(
printer
.
setAlign
(
printer
.
ALIGN_LEFT
));
cmds
.
push
(
printer
.
printText
(
goodsList
[
i
].
goodsName
));
cmds
.
push
(
printer
.
printText
(
goodsList
[
i
].
barcode
));
cmds
.
push
(
printer
.
setAlign
(
printer
.
ALIGN_RIGHT
));
cmds
.
push
(
printer
.
printText
(
goodsList
[
i
].
goodsCount
));
}
cmds
.
push
(
printer
.
setAlign
(
printer
.
ALIGN_LEFT
));
cmds
.
push
(
printer
.
printDivide
(
"-"
));
cmds
.
push
(
printer
.
printText
(
"应收金额:"
));
cmds
.
push
(
printer
.
printText
(
"支付方式实付:"
));
cmds
.
push
(
printer
.
printText
(
"应收金额:"
+
this
.
data
.
orderPriceYuan
));
cmds
.
push
(
printer
.
printText
(
"支付方式实付:"
+
this
.
data
.
payPriceYuan
));
for
(
var
i
=
0
;
i
<
4
;
i
++
)
{
cmds
.
push
(
printer
.
feedPaper
());
}
...
...
utils/api.js
View file @
f53a33e8
...
...
@@ -18,7 +18,7 @@ function login({ baseUrl, name, password, callback }) {
timeout
:
30000
,
data
:
loginRequest
,
success
:
(
res
)
=>
{
console
.
log
(
"login success==>"
+
JSON
.
stringify
(
res
));
console
.
log
(
"login success==>"
+
JSON
.
stringify
(
res
.
data
));
if
(
callback
!=
null
)
{
if
(
res
.
data
.
success
!=
true
)
{
...
...
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