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
f5071335
Commit
f5071335
authored
Mar 04, 2020
by
pengguangpu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修复支付结果页显示bug、打印上一单商品数据多余bug;
parent
60adba16
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
85 additions
and
49 deletions
+85
-49
balance.js
pages/balance/balance.js
+41
-16
home.js
pages/home/home.js
+2
-2
paysuccess.acss
pages/paysuccess/paysuccess.acss
+2
-2
paysuccess.axml
pages/paysuccess/paysuccess.axml
+2
-2
paysuccess.js
pages/paysuccess/paysuccess.js
+38
-27
No files found.
pages/balance/balance.js
View file @
f5071335
...
@@ -15,7 +15,8 @@ Page({
...
@@ -15,7 +15,8 @@ Page({
list
:
[],
list
:
[],
orderNo
:
""
,
orderNo
:
""
,
isPaying
:
false
,
isPaying
:
false
,
//记录跳转源,默认是首页home,如果是直接收款则是direct
from
:
"home"
},
},
//回退到上一个页面
//回退到上一个页面
...
@@ -47,6 +48,7 @@ Page({
...
@@ -47,6 +48,7 @@ Page({
},
},
onLoad
(
options
)
{
onLoad
(
options
)
{
console
.
log
(
"balance onLoad==>"
+
JSON
.
stringify
(
options
));
var
totalQuantity
=
options
.
totalQuantity
var
totalQuantity
=
options
.
totalQuantity
var
totalPrice
=
options
.
totalPrice
var
totalPrice
=
options
.
totalPrice
var
totalDisc
=
options
.
totalDisc
var
totalDisc
=
options
.
totalDisc
...
@@ -68,20 +70,29 @@ Page({
...
@@ -68,20 +70,29 @@ Page({
})
})
}
}
//商品数据
//如果是直接收款,则无需获取商品信息
let
context
=
this
;
if
(
options
.
type
!=
null
&&
options
.
type
==
"direct"
)
{
my
.
getStorage
({
console
.
log
(
"直接收银,无需获取商品数据"
);
key
:
'goods'
,
this
.
setData
({
success
:
function
(
res
)
{
from
:
"direct"
console
.
log
(
"商品信息 ===》 "
+
JSON
.
stringify
(
res
));
});
context
.
setData
({
}
else
{
list
:
res
.
data
//商品数据
})
let
context
=
this
;
},
my
.
getStorage
({
fail
:
function
(
res
)
{
key
:
'goods'
,
console
.
log
(
"商品信息 ===》 "
+
JSON
.
stringify
(
res
));
success
:
function
(
res
)
{
}
console
.
log
(
"商品信息 ===》 "
+
JSON
.
stringify
(
res
));
});
context
.
setData
({
list
:
res
.
data
})
},
fail
:
function
(
res
)
{
console
.
log
(
"商品信息 ===》 "
+
JSON
.
stringify
(
res
));
}
});
}
var
speechContent
=
this
.
data
.
payPrice
+
"元"
;
var
speechContent
=
this
.
data
.
payPrice
+
"元"
;
my
.
ix
.
speech
({
my
.
ix
.
speech
({
...
@@ -125,7 +136,7 @@ Page({
...
@@ -125,7 +136,7 @@ Page({
},
},
onUnload
()
{
onUnload
()
{
console
.
log
(
"balance on
Show
"
);
console
.
log
(
"balance on
Hide
"
);
// 页面隐藏
// 页面隐藏
//关闭后屏监听
//关闭后屏监听
my
.
ix
.
offBuddyMessage
();
my
.
ix
.
offBuddyMessage
();
...
@@ -253,6 +264,20 @@ Page({
...
@@ -253,6 +264,20 @@ Page({
my
.
ix
.
offCashierEventReceive
();
my
.
ix
.
offCashierEventReceive
();
this
.
saveData
(
this
.
data
.
list
,
res
.
data
);
this
.
saveData
(
this
.
data
.
list
,
res
.
data
);
//如果是直接收款,则需抹掉本地商品数据信息
console
.
log
(
"this.data.from==>"
+
this
.
data
.
from
);
if
(
this
.
data
.
from
==
"direct"
)
{
console
.
log
(
"直接收款,抹掉商品数据"
);
my
.
setStorageSync
({
key
:
'paySuccessGoodsList'
,
data
:
null
});
my
.
setStorageSync
({
key
:
'goods'
,
data
:
null
});
}
my
.
reLaunch
({
my
.
reLaunch
({
url
:
'/pages/paysuccess/paysuccess?totalGoodsNum='
+
this
.
data
.
goodsNum
,
url
:
'/pages/paysuccess/paysuccess?totalGoodsNum='
+
this
.
data
.
goodsNum
,
});
});
...
...
pages/home/home.js
View file @
f5071335
...
@@ -82,7 +82,7 @@ Page({
...
@@ -82,7 +82,7 @@ Page({
}
else
if
(
res
.
action
==
ACTION_DIRECT_PAYMENT
)
{
}
else
if
(
res
.
action
==
ACTION_DIRECT_PAYMENT
)
{
//直接收款
//直接收款
my
.
reLaunch
({
my
.
reLaunch
({
url
:
"/pages/balance/balance?totalPrice="
+
res
.
data
+
"&totalQuantity=0&totalDisc=0"
,
url
:
"/pages/balance/balance?totalPrice="
+
res
.
data
+
"&totalQuantity=0&totalDisc=0
&type=direct
"
,
});
});
}
else
if
(
res
.
action
==
ACTION_CONVERT_COUPON
)
{
}
else
if
(
res
.
action
==
ACTION_CONVERT_COUPON
)
{
//兑换券
//兑换券
...
@@ -362,7 +362,7 @@ Page({
...
@@ -362,7 +362,7 @@ Page({
printer
.
printText
(
"订单号:"
+
printLastOrder_paySuccessResp
.
tradeNo
),
printer
.
printText
(
"订单号:"
+
printLastOrder_paySuccessResp
.
tradeNo
),
printer
.
printNowDate
(),
printer
.
printNowDate
(),
];
];
if
(
null
!=
this
.
data
.
goodsList
&&
this
.
data
.
goodsList
.
length
>
0
)
{
if
(
null
!=
printLastOrder_goodsList
&&
printLastOrder_
goodsList
.
length
>
0
)
{
cmds
.
push
(
printer
.
printDivide
(
"-"
)),
cmds
.
push
(
printer
.
printDivide
(
"-"
)),
cmds
.
push
(
printer
.
printText
(
"活动商品"
)),
cmds
.
push
(
printer
.
printText
(
"活动商品"
)),
cmds
.
push
(
printer
.
printText
(
"商品名称 "
+
" 编码 "
+
" 数量"
))
cmds
.
push
(
printer
.
printText
(
"商品名称 "
+
" 编码 "
+
" 数量"
))
...
...
pages/paysuccess/paysuccess.acss
View file @
f5071335
...
@@ -71,8 +71,8 @@ page {
...
@@ -71,8 +71,8 @@ page {
.printLoading {
.printLoading {
position: relative;
position: relative;
width:
186
rpx;
width:
220
rpx;
height: 18
6
rpx;
height: 18
9
rpx;
margin: 0 auto;
margin: 0 auto;
margin-top: 38rpx;
margin-top: 38rpx;
/* border: 2px solid red; */
/* border: 2px solid red; */
...
...
pages/paysuccess/paysuccess.axml
View file @
f5071335
...
@@ -25,8 +25,8 @@
...
@@ -25,8 +25,8 @@
</view>
</view>
</view>
</view>
<view class="printLoading">
<view class="printLoading">
<view hidden="{{!isShowPrinting}}">
<view
style="margin:0 auto;position:absolute;left:16rpx;"
hidden="{{!isShowPrinting}}">
<i-spin></i-spin>
<i-spin
></i-spin>
</view>
</view>
<view style="position:absolute;width:100%;height:100%;left:0rpx;top:0rpx;color:#000000;font-weight:bold;">
<view style="position:absolute;width:100%;height:100%;left:0rpx;top:0rpx;color:#000000;font-weight:bold;">
<view style="display: absolute;margin:0 auto;align-content: center;align-items: center;text-align:center;line-height:186rpx;">
<view style="display: absolute;margin:0 auto;align-content: center;align-items: center;text-align:center;line-height:186rpx;">
...
...
pages/paysuccess/paysuccess.js
View file @
f5071335
...
@@ -43,7 +43,7 @@ Page({
...
@@ -43,7 +43,7 @@ Page({
this
.
data
.
orderPriceFen
=
this
.
data
.
paySuccessResponse
.
tradeAmount
;
this
.
data
.
orderPriceFen
=
this
.
data
.
paySuccessResponse
.
tradeAmount
;
this
.
data
.
couponPriceFen
=
this
.
data
.
paySuccessResponse
.
mdiscount
+
this
.
data
.
paySuccessResponse
.
discount
;
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
.
payPriceFen
=
this
.
data
.
paySuccessResponse
.
tradeAmount
-
(
this
.
data
.
paySuccessResponse
.
mdiscount
+
this
.
data
.
paySuccessResponse
.
discount
);
this
.
data
.
totalCount
=
query
.
totalGoodsNum
;
this
.
data
.
totalCount
=
this
.
caculateTotalCountFromGoodsList
(
this
.
data
.
goodsList
)
;
var
miyapay
=
require
(
"../../utils/miyapay4.js"
);
var
miyapay
=
require
(
"../../utils/miyapay4.js"
);
this
.
data
.
orderPriceYuan
=
miyapay
.
fen2Yuan
(
this
.
data
.
orderPriceFen
);
this
.
data
.
orderPriceYuan
=
miyapay
.
fen2Yuan
(
this
.
data
.
orderPriceFen
);
...
@@ -58,6 +58,18 @@ Page({
...
@@ -58,6 +58,18 @@ Page({
}
}
},
},
//计算件数
caculateTotalCountFromGoodsList
(
goodsList
)
{
if
(
goodsList
==
null
||
goodsList
.
length
==
0
)
{
return
0
;
}
var
totalCount
=
0
;
for
(
var
i
=
0
;
i
<
goodsList
.
length
;
i
++
)
{
totalCount
=
totalCount
+
goodsList
[
i
].
quantity
;
}
return
totalCount
;
},
print
()
{
print
()
{
//发起打印
//发起打印
var
printer
=
require
(
"../../utils/printer.js"
);
var
printer
=
require
(
"../../utils/printer.js"
);
...
@@ -71,21 +83,21 @@ Page({
...
@@ -71,21 +83,21 @@ Page({
printer
.
printText
(
"收银员账号:"
+
this
.
data
.
paySuccessResponse
.
operatorId
),
printer
.
printText
(
"收银员账号:"
+
this
.
data
.
paySuccessResponse
.
operatorId
),
printer
.
printText
(
"订单号:"
+
this
.
data
.
paySuccessResponse
.
tradeNo
),
printer
.
printText
(
"订单号:"
+
this
.
data
.
paySuccessResponse
.
tradeNo
),
printer
.
printNowDate
(),
printer
.
printNowDate
(),
];
];
if
(
null
!=
this
.
data
.
goodsList
&&
this
.
data
.
goodsList
.
length
>
0
){
if
(
null
!=
this
.
data
.
goodsList
&&
this
.
data
.
goodsList
.
length
>
0
)
{
cmds
.
push
(
printer
.
printDivide
(
"-"
))
,
cmds
.
push
(
printer
.
printDivide
(
"-"
)),
cmds
.
push
(
printer
.
printText
(
"活动商品"
)),
cmds
.
push
(
printer
.
printText
(
"活动商品"
)),
cmds
.
push
(
printer
.
printText
(
"商品名称 "
+
" 编码 "
+
" 数量"
))
cmds
.
push
(
printer
.
printText
(
"商品名称 "
+
" 编码 "
+
" 数量"
))
for
(
var
i
=
0
;
i
<
this
.
data
.
goodsList
.
length
;
i
++
)
{
for
(
var
i
=
0
;
i
<
this
.
data
.
goodsList
.
length
;
i
++
)
{
//循环取出商品数据
//循环取出商品数据
cmds
.
push
(
printer
.
setAlign
(
printer
.
ALIGN_LEFT
));
cmds
.
push
(
printer
.
setAlign
(
printer
.
ALIGN_LEFT
));
cmds
.
push
(
printer
.
printText
(
this
.
data
.
goodsList
[
i
].
name
));
cmds
.
push
(
printer
.
printText
(
this
.
data
.
goodsList
[
i
].
name
));
cmds
.
push
(
printer
.
printTwoText
(
this
.
data
.
goodsList
[
i
].
barcode
,
this
.
data
.
goodsList
[
i
].
quantity
+
""
));
cmds
.
push
(
printer
.
printTwoText
(
this
.
data
.
goodsList
[
i
].
barcode
,
this
.
data
.
goodsList
[
i
].
quantity
+
""
));
}
}
}
}
cmds
.
push
(
printer
.
setAlign
(
printer
.
ALIGN_LEFT
));
cmds
.
push
(
printer
.
setAlign
(
printer
.
ALIGN_LEFT
));
cmds
.
push
(
printer
.
printDivide
(
"-"
));
cmds
.
push
(
printer
.
printDivide
(
"-"
));
cmds
.
push
(
printer
.
printText
(
"应收金额:"
+
this
.
data
.
orderPriceYuan
));
cmds
.
push
(
printer
.
printText
(
"应收金额:"
+
this
.
data
.
orderPriceYuan
));
...
@@ -138,7 +150,6 @@ Page({
...
@@ -138,7 +150,6 @@ Page({
if
(
printEnabledLocal
==
null
)
{
if
(
printEnabledLocal
==
null
)
{
printEnabledLocal
=
true
;
printEnabledLocal
=
true
;
}
}
//如果不打印小票,界面将有所变化
//如果不打印小票,界面将有所变化
if
(
printEnabledLocal
==
false
)
{
if
(
printEnabledLocal
==
false
)
{
this
.
setData
({
this
.
setData
({
...
@@ -174,19 +185,19 @@ Page({
...
@@ -174,19 +185,19 @@ Page({
my
.
ix
.
offBuddyMessage
();
my
.
ix
.
offBuddyMessage
();
},
},
onUnload
(){
//
onUnload(){
//清理支付数据
//
//清理支付数据
my
.
removeStorageSync
({
//
my.removeStorageSync({
key
:
'paySuccessGoodsList'
,
//
key: 'paySuccessGoodsList',
});
//
});
my
.
removeStorage
({
//
my.removeStorage({
key
:
'goods'
,
//
key: 'goods',
success
:
function
()
{
//
success: function () {
}
//
}
});
//
});
}
//
}
});
});
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