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
c4f9beb1
Commit
c4f9beb1
authored
Feb 05, 2020
by
pengguangpu
Browse files
Options
Browse Files
Download
Plain Diff
编写优惠券布局;添加打印逻辑;添加前后屏交互逻辑;
parents
5ce79ab9
5ec20fe2
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
131 additions
and
14 deletions
+131
-14
.gitignore
.gitignore
+1
-0
app.js
app.js
+21
-2
bg_coupon.png
images/bg_coupon.png
+0
-0
paysuccess.acss
pages/paysuccess/paysuccess.acss
+3
-4
paysuccess.axml
pages/paysuccess/paysuccess.axml
+23
-4
paysuccess.js
pages/paysuccess/paysuccess.js
+83
-4
No files found.
.gitignore
View file @
c4f9beb1
.tea
.tea
.tea/*
.DS_Store
.DS_Store
/.tea
/.tea
.tea/layout.json
.tea/layout.json
app.js
View file @
c4f9beb1
...
@@ -8,17 +8,36 @@ App({
...
@@ -8,17 +8,36 @@ App({
TEST_URL
:
"https://cashier.test.miyahub.net/"
,
TEST_URL
:
"https://cashier.test.miyahub.net/"
,
RELEASE_URL
:
"https://cashier.miyahub.com/"
,
RELEASE_URL
:
"https://cashier.miyahub.com/"
,
BASE_URL
:
null
,
BASE_URL
:
null
,
appId
:
"1542075029346"
,
appId
:
"1542075029346"
,
//小程序容器版本
//小程序容器版本
containerVersionCode
:
null
containerVersionCode
:
null
},
},
onLaunch
(
options
)
{
onLaunch
(
options
)
{
// 第一次打开
// 第一次打开
// options.query == {number:1}
// options.query == {number:1}
console
.
info
(
'App onLaunch'
);
console
.
info
(
'App onLaunch'
);
//初始化baseUrl
//初始化baseUrl
this
.
globalData
.
BASE_URL
=
this
.
globalData
.
TEST_URL
;
this
.
globalData
.
BASE_URL
=
this
.
globalData
.
TEST_URL
;
//获取容器版本信息
my
.
ix
.
getVersion
({
success
:
(
r
)
=>
{
console
.
log
(
"getVersion success==>"
+
JSON
.
stringify
(
r
));
getApp
().
globalData
.
containerVersionCode
=
r
.
versionCode
;
}
});
//添加后屏小程序
my
.
ix
.
addExtensionApp
({
appId
:
"****************"
,
// 填入后屏小程序的 AppID
type
:
"screen"
,
success
:
(
res
)
=>
{
console
.
log
(
"addExtensionApp success:"
,
res
)
},
fail
:
(
res
)
=>
{
console
.
log
(
"addExtensionApp fail:"
,
res
)
},
})
},
},
onShow
(
options
)
{
onShow
(
options
)
{
// 从后台被 scheme 重新打开
// 从后台被 scheme 重新打开
...
...
images/bg_coupon.png
0 → 100644
View file @
c4f9beb1
1.62 KB
pages/paysuccess/paysuccess.acss
View file @
c4f9beb1
...
@@ -78,13 +78,12 @@ page {
...
@@ -78,13 +78,12 @@ page {
/* border: 2px solid red; */
/* border: 2px solid red; */
}
}
.voucher{
.voucher
{
display:
flex
;
display:
absolute
;
position: fixed;
position: fixed;
flex-direction: column;
width: 662rpx;
width: 662rpx;
align-content: center;
align-content: center;
height: 100%;
height: 100%;
margin-
bottom: 0
rpx;
margin-
top: 43
rpx;
/* border: 2px solid red; */
/* border: 2px solid red; */
}
}
\ No newline at end of file
pages/paysuccess/paysuccess.axml
View file @
c4f9beb1
...
@@ -19,7 +19,7 @@
...
@@ -19,7 +19,7 @@
<text style="font-weight:bold;float:right;">-¥{{couponPriceYuan}}</text>
<text style="font-weight:bold;float:right;">-¥{{couponPriceYuan}}</text>
</view>
</view>
<view class="payPrice">
<view class="payPrice">
<text style="float:left;" decode=true>共计 {{}} 件 实付:</text>
<text style="float:left;" decode=true>共计 {{
totalCount
}} 件 实付:</text>
<text style="font-weight:bold;float:right;color:#F72911;">-¥{{payPriceYuan}}</text>
<text style="font-weight:bold;float:right;color:#F72911;">-¥{{payPriceYuan}}</text>
</view>
</view>
</view>
</view>
...
@@ -28,11 +28,30 @@
...
@@ -28,11 +28,30 @@
<i-spin></i-spin>
<i-spin></i-spin>
<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;">
<text>{{}}</text>
<text>{{
printerStatus
}}</text>
</view>
</view>
</view>
</view>
</view>
</view>
<view class="voucher">
<view class="voucher" hidden="{{!isShowCoupon}}">
<image mode="aspectFit" style="width:100%;height:229rpx;" src="/images/bg_coupon.png"/>
<view style="display: absolute;position: absolute;left:0rpx;top:0rpx;width:209rpx;height:229rpx;">
<view style="position: absolute;color:#ffffff;left:10rpx;top:103rpx;font-size:43rpx;">
<text >¥</text>
</view>
<view style="position: absolute;color:#ffffff;text-align:center;left:68rpx;font-weight:bold;top:80rpx;font-size:66rpx;">
<text>{{couponPriceYuan}}</text>
</view>
<view style="position: absolute;color:#ffffff;text-align:center;left:23rpx;top:145rpx;font-size:23rpx;">
<text>{{couponHint}}</text>
</view>
</view>
<view style="position: absolute;left:209rpx;top:0rpx;width:453rpx;height:229rpx;">
<view style="position: absolute;color:#ffffff;left:32rpx;top:32rpx;font-size:34rpx;width:352rpx;">
<text >{{couponName}}</text>
</view>
<view style="position: absolute;color:#ffffff;left:32rpx;bottom:32rpx;font-size:34rpx;width:352rpx;">
<text >{{couponDateDuration}}</text>
</view>
</view>
</view>
</view>
</view>
</view>
\ No newline at end of file
pages/paysuccess/paysuccess.js
View file @
c4f9beb1
Page
({
Page
({
data
:
{
data
:
{
orderPriceYuan
:
"--.--"
,
orderPriceYuan
:
"--.--"
,
couponPriceYuan
:
"--.--"
,
couponPriceYuan
:
"--.--"
,
payPriceYuan
:
"--.--"
payPriceYuan
:
"--.--"
,
totalCount
:
"0"
,
printerStatus
:
"小票打印中"
,
couponPriceYuan
:
"--.--"
,
couponHint
:
"xxxxxx"
,
couponName
:
"xxxxxxxx"
,
couponDateDuration
:
"xxxx.xx.xx-xxxx.xx.xx"
,
isShowCoupon
:
true
},
},
onLoad
()
{},
onLoad
(
query
)
{
console
.
info
(
`Page onLoad with query:
${
JSON
.
stringify
(
query
)}
`
);
},
print
()
{
//发起打印
var
printer
=
require
(
"../../utils/printer.js"
);
var
printCallbackTemp
=
this
.
printCallback
.
bind
(
this
);
var
cmds
=
[
printer
.
setAlign
(
printer
.
ALIGN_CENTER
),
printer
.
printText
(
"storeName"
),
printer
.
printDivide
(
"-"
),
printer
.
setAlign
(
printer
.
ALIGN_LEFT
),
printer
.
printText
(
"门店号:"
),
printer
.
printText
(
"收银员账号:"
),
printer
.
printText
(
"订单号:"
),
printer
.
printNowDate
(),
printer
.
printDivide
(
"-"
),
printer
.
printText
(
"活动商品"
),
printer
.
printText
(
"活动名称 "
+
" 编码 "
+
" 数量"
),
];
for
(
var
i
=
0
;
i
<
10
;
i
++
)
{
//循环取出商品数据
// cmds.push();
}
cmds
.
push
(
printer
.
printDivide
(
"-"
));
cmds
.
push
(
printer
.
printText
(
"应收金额:"
));
cmds
.
push
(
printer
.
printText
(
"支付方式实付:"
));
for
(
var
i
=
0
;
i
<
4
;
i
++
)
{
cmds
.
push
(
printer
.
feedPaper
());
}
printer
.
print
({
isCheckStatus
:
getApp
().
globalData
.
containerVersionCode
>
20
,
cmds
:
cmds
,
callback
:
printCallbackTemp
});
},
printCallback
(
res
)
{
//通知后屏打印结果
my
.
ix
.
sendBuddyMessage
({
target
:
"****************"
,
// 填入目标小程序的 AppID
data
:
res
,
success
:
(
res
)
=>
{
console
.
info
(
`sendBuddyMessage success:
${
JSON
.
stringify
(
res
)}
`
);
},
fail
:
(
res
)
=>
{
console
.
info
(
`sendBuddyMessage failed:
${
JSON
.
stringify
(
res
)}
`
);
}
});
},
onShow
()
{
//开启后屏监听
my
.
ix
.
onBuddyMessage
({
success
:
(
res
)
=>
{
console
.
info
(
`onBuddyMessage success:
${
JSON
.
stringify
(
res
)}
`
);
if
(
""
)
{
//重新打印
}
else
{
//未知指令
}
}
});
},
onHide
()
{
//关闭后屏监听
my
.
ix
.
offBuddyMessage
();
}
});
});
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