Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
D
doublescreen-back
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-back
Commits
d10ddffd
Commit
d10ddffd
authored
Feb 26, 2020
by
jiangjiantao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
优惠券功能
parent
e33bedc8
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
233 additions
and
152 deletions
+233
-152
actioncmd.js
const/actioncmd.js
+3
-0
index.acss
pages/index/index.acss
+161
-135
index.axml
pages/index/index.axml
+25
-6
index.js
pages/index/index.js
+44
-11
No files found.
const/actioncmd.js
View file @
d10ddffd
...
@@ -52,6 +52,9 @@ export const ACTION_REFUND_FAILED = "ACTION_REFUND_FAILED";
...
@@ -52,6 +52,9 @@ export const ACTION_REFUND_FAILED = "ACTION_REFUND_FAILED";
//打印上一单
//打印上一单
export
const
ACTION_PRINT_LAST_ORDER
=
"ACTION_PRINT_LAST_ORDER"
;
export
const
ACTION_PRINT_LAST_ORDER
=
"ACTION_PRINT_LAST_ORDER"
;
//使用优惠券
export
const
ACTION_USE_COUPON
=
"ACTION_USE_COUPON"
;
const
FLOW_IDLE
=
"idle"
;
const
FLOW_IDLE
=
"idle"
;
const
FLOW_COLLECTIONS
=
"collections"
;
const
FLOW_COLLECTIONS
=
"collections"
;
const
FLOW_REFUND
=
"refund"
;
const
FLOW_REFUND
=
"refund"
;
...
...
pages/index/index.acss
View file @
d10ddffd
.login-waiting-page{
.login-waiting-page
{
width: 100%;
width: 100%;
height: 100%;
height: 100%;
display: flex;
display: flex;
...
@@ -8,12 +8,12 @@
...
@@ -8,12 +8,12 @@
position: absolute
position: absolute
}
}
.login-waiting-left{
.login-waiting-left
{
width: 50%;
width: 50%;
height: 100%;
height: 100%;
}
}
.login-waiting-right{
.login-waiting-right
{
width: 50%;
width: 50%;
height: 100%;
height: 100%;
background-color: white;
background-color: white;
...
@@ -23,7 +23,7 @@
...
@@ -23,7 +23,7 @@
align-items: center
align-items: center
}
}
.login-waiting-right-image{
.login-waiting-right-image
{
width: 287rpx;
width: 287rpx;
height: 204rpx;
height: 204rpx;
}
}
...
@@ -360,9 +360,28 @@
...
@@ -360,9 +360,28 @@
font-family: AlibabaPuHuiTiB;
font-family: AlibabaPuHuiTiB;
color: rgba(0, 122, 255, 1);
color: rgba(0, 122, 255, 1);
line-height: 49px;
line-height: 49px;
/* margin-left: 15rpx; */
}
/* 价格容器 */
.total-price-container {
display: flex;
flex-direction: row;
margin-left: 15rpx;
margin-left: 15rpx;
}
}
/* 优惠券抵扣金额 */
.pay-coupon {
font-size: 18rpx;
font-family: DINAlternate-Bold, DINAlternate;
font-weight: bold;
color: rgba(249, 97, 70, 1);
line-height: 18rpx;
margin-left: 5rpx;
}
/* 去付款 */
/* 去付款 */
.go-pay {
.go-pay {
...
@@ -573,6 +592,7 @@
...
@@ -573,6 +592,7 @@
width: 252rpx;
width: 252rpx;
height: 60rpx;
height: 60rpx;
}
}
/* 确定 兑换成功 */
/* 确定 兑换成功 */
.sure-use-coupon {
.sure-use-coupon {
...
@@ -714,6 +734,7 @@
...
@@ -714,6 +734,7 @@
}
}
/* 兑换券成功文本 */
/* 兑换券成功文本 */
.scan-coupon-text-success {
.scan-coupon-text-success {
font-size: 26rpx;
font-size: 26rpx;
font-family: PingFangSC-Medium, PingFang SC;
font-family: PingFangSC-Medium, PingFang SC;
...
@@ -724,17 +745,18 @@
...
@@ -724,17 +745,18 @@
}
}
/* 兑换券失败文本 */
/* 兑换券失败文本 */
.scan-coupon-text-fail {
.scan-coupon-text-fail {
font-size: 26rpx;
font-size: 26rpx;
font-family: PingFangSC-Medium, PingFang SC;
font-family: PingFangSC-Medium, PingFang SC;
font-weight: 500;
font-weight: 500;
color:
rgba(255,0,0,
1);
color:
rgba(255, 0, 0,
1);
line-height: 26rpx;
line-height: 26rpx;
margin-top: 24rpx;
margin-top: 24rpx;
}
}
/* 兑换券失败容器*/
/* 兑换券失败容器*/
.failure-operation {
.failure-operation {
width: 100%;
width: 100%;
height: 62rpx;
height: 62rpx;
...
@@ -745,31 +767,35 @@
...
@@ -745,31 +767,35 @@
}
}
/* 兑换券 关闭 */
/* 兑换券 关闭 */
.close-use-coupon{
width:252rpx;
.close-use-coupon {
height:60rpx;
width: 252rpx;
height: 60rpx;
margin-right: 18rpx;
margin-right: 18rpx;
}
}
/* 兑换券 再次兑换 */
/* 兑换券 再次兑换 */
.again-use-coupon{
width:252rpx;
.again-use-coupon {
height:60rpx;
width: 252rpx;
height: 60rpx;
margin-left: 18rpx;
margin-left: 18rpx;
}
}
/* 兑换券失败描述 */
/* 兑换券失败描述 */
.scan-coupon-text-fail-desr{
font-size:22rpx;
.scan-coupon-text-fail-desr {
font-family:PingFangSC-Regular,PingFang SC;
font-size: 22rpx;
font-weight:400;
font-family: PingFangSC-Regular, PingFang SC;
color:rgba(91,105,129,1);
font-weight: 400;
line-height:22rpx;
color: rgba(91, 105, 129, 1);
line-height: 22rpx;
margin-top: 15rpx
margin-top: 15rpx
}
}
/* 操作结果页面 */
/* 操作结果页面 */
.operateTopView{
.operateTopView
{
position: relative;
position: relative;
width: 750rpx;
width: 750rpx;
height: 60rpx;
height: 60rpx;
...
@@ -778,7 +804,7 @@
...
@@ -778,7 +804,7 @@
box-shadow: 0rpx 2rpx 7rpx 0rpx rgba(153, 153, 153, 0.16);
box-shadow: 0rpx 2rpx 7rpx 0rpx rgba(153, 153, 153, 0.16);
}
}
.operateBodyView{
.operateBodyView
{
position: relative;
position: relative;
display: flex;
display: flex;
flex-direction: column;
flex-direction: column;
...
@@ -788,32 +814,32 @@
...
@@ -788,32 +814,32 @@
background: #ffffff;
background: #ffffff;
}
}
.operateResultIcon{
.operateResultIcon
{
position: relative;
position: relative;
width: 84rpx;
width: 84rpx;
height: 84rpx;
height: 84rpx;
margin-top: 35rpx;
margin-top: 35rpx;
}
}
.operateResultText{
.operateResultText
{
font-size:
26rpx;
font-size:
26rpx;
font-family:PingFangSC-Medium,
PingFang SC;
font-family: PingFangSC-Medium,
PingFang SC;
font-weight:
500;
font-weight:
500;
color:rgba(0,122,255,
1);
color: rgba(0, 122, 255,
1);
line-height:
26rpx;
line-height:
26rpx;
margin-top: 23rpx;
margin-top: 23rpx;
}
}
.operateResultDesc{
.operateResultDesc
{
font-size:
21rpx;
font-size:
21rpx;
font-family:PingFangSC-Regular,
PingFang SC;
font-family: PingFangSC-Regular,
PingFang SC;
font-weight:
400;
font-weight:
400;
color:rgba(91,105,129,
1);
color: rgba(91, 105, 129,
1);
line-height:
21rpx;
line-height:
21rpx;
margin-top: 19rpx;
margin-top: 19rpx;
}
}
.operateResultBtnContainer{
.operateResultBtnContainer
{
width: auto;
width: auto;
height: auto;
height: auto;
display: flex;
display: flex;
...
@@ -821,53 +847,53 @@
...
@@ -821,53 +847,53 @@
margin-top: 54rpx;
margin-top: 54rpx;
}
}
.operateResultConfirmBtn{
.operateResultConfirmBtn
{
width:
246rpx;
width:
246rpx;
height:
59rpx;
height:
59rpx;
background:rgba(0,122,255,
1);
background: rgba(0, 122, 255,
1);
border-radius:
5rpx;
border-radius:
5rpx;
border:1rpx solid rgba(151,151,151,
1);
border: 1rpx solid rgba(151, 151, 151,
1);
flex-direction: row;
flex-direction: row;
display: flex;
display: flex;
align-items: center;
align-items: center;
}
}
.operateResultConfirmBtnText{
.operateResultConfirmBtnText
{
font-size:
23rpx;
font-size:
23rpx;
font-family:PingFangSC-Medium,
PingFang SC;
font-family: PingFangSC-Medium,
PingFang SC;
font-weight:
500;
font-weight:
500;
color:rgba(255,255,255,
1);
color: rgba(255, 255, 255,
1);
line-height:
33rpx;
line-height:
33rpx;
text-align: center;
text-align: center;
width: 100%;
width: 100%;
height: auto;
height: auto;
}
}
.operateResultCloseBtn{
.operateResultCloseBtn
{
width:
246rpx;
width:
246rpx;
height:
59rpx;
height:
59rpx;
background:rgba(255,255,255,
1);
background: rgba(255, 255, 255,
1);
border-radius:
5rpx;
border-radius:
5rpx;
border:1rpx solid rgba(0,122,255,
1);
border: 1rpx solid rgba(0, 122, 255,
1);
flex-direction: row;
flex-direction: row;
display: flex;
display: flex;
margin-right:35rpx;
margin-right: 35rpx;
align-items: center;
align-items: center;
}
}
.operateResultCloseBtnText{
.operateResultCloseBtnText
{
font-size:
23rpx;
font-size:
23rpx;
font-family:PingFangSC-Medium,
PingFang SC;
font-family: PingFangSC-Medium,
PingFang SC;
font-weight:
500;
font-weight:
500;
color:rgba(0,122,255,
1);
color: rgba(0, 122, 255,
1);
line-height:
33rpx;
line-height:
33rpx;
text-align: center;
text-align: center;
width: 100%;
width: 100%;
height: auto;
height: auto;
}
}
/**打印上一单*/
/**打印上一单*/
.printLastOrderPage {
.printLastOrderPage {
display: flex;
display: flex;
flex-direction: column;
flex-direction: column;
...
...
pages/index/index.axml
View file @
d10ddffd
...
@@ -162,26 +162,45 @@
...
@@ -162,26 +162,45 @@
</view>
</view>
<view class="operating-bottom">
<view class="operating-bottom">
<text class="total-num">共{{totalQuantity}}件商品,合计金额</text>
<text class="total-num">共{{totalQuantity}}件商品,合计金额</text>
<view class="total-price-container">
<text class="pay-price">¥{{totalPrice}}</text>
<text class="pay-price">¥{{totalPrice}}</text>
<text class="pay-coupon" a:if="{{discCouponPrice != 0}}">-¥{{discCouponPrice}}</text>
</view>
<button class="go-pay" size="default" type="primary" onTap="goPay">收款</button>
<button class="go-pay" size="default" type="primary" onTap="goPay">收款</button>
</view>
</view>
</view>
</view>
</view>
</view>
</view>
</view>
<!-- 扫描优惠券 -->
<!-- 扫描优惠券 -->
<view class="page-coupon" a:if="{{
couponUseing
}}">
<view class="page-coupon" a:if="{{
discCouponState != 0 && discCouponState != 3
}}">
<view class="coupon-top">
<view class="coupon-top">
<view class="coupon-back-container" onTap="co
uponBack
">
<view class="coupon-back-container" onTap="co
nvertCouponClose" a:if="{{discCouponState == 1}}
">
<image class="coupon-back-icon" mode="aspectFit" src="/images/icon_back.png"/>
<image class="coupon-back-icon" mode="aspectFit" src="/images/icon_back.png"/>
<text class="coupon-back-text">返回</text>
<text class="coupon-back-text">返回</text>
</view>
</view>
<view class="coupon-title">优惠券</view>
<view class="coupon-title"
a:if="{{discCouponState == 1}}"
>优惠券</view>
<view></view>
<view></view>
</view>
</view>
<view class="coupon-bottom">
<!-- 等待扫描 -->
<view class="coupon-bottom" a:if="{{discCouponState == 1}}">
<text class="scan-coupon-text">等待顾客扫描优惠券码…</text>
<text class="scan-coupon-text">等待顾客扫描优惠券码…</text>
<image class="scan-coupon-guide" mode="aspectFit" src="/images/scan_guide.png"/>
<image class="scan-coupon-guide" mode="aspectFit" src="/images/scan_guide.png"/>
<button class="cancel-use-coupon" size="default" type="ghost" onTap="couponBack">取消</button>
<button class="cancel-use-coupon" size="default" type="ghost" onTap="couponBack">关闭</button>
</view>
<!-- 录入中 -->
<view class="coupon-bottom" a:if="{{discCouponState == 2}}">
<text class="scan-coupon-text">正在录入优惠券…</text>
<image class="scan-coupon-guide" mode="aspectFit" src="/images/scan_guide.png"/>
</view>
<!-- 录入失败 -->
<view class="coupon-bottom-fail" a:if="{{discCouponState == 4}}">
<image class="scan-coupon-fail" mode="aspectFit" src="/images/icon_failed.png"/>
<text class="scan-coupon-text-fail">录入失败</text>
<text class="scan-coupon-text-fail-desr">{{discCouponMsg}}</text>
<view class="failure-operation">
<button class="close-use-coupon" type="ghost" size="default" onTap="couponBack">关闭</button>
<button class="again-use-coupon" type="primary" size="default" onTap="useCoupon">重新录入</button>
</view>
</view>
</view>
</view>
</view>
</view>
</view>
...
...
pages/index/index.js
View file @
d10ddffd
...
@@ -45,15 +45,15 @@ Page({
...
@@ -45,15 +45,15 @@ Page({
payPriceFen
:
0
,
payPriceFen
:
0
,
/**商品扫码页相关参数 */
/**商品扫码页相关参数 */
//是否正在用券
//优惠券 0关闭 录入券弹窗 1等待录入 2.录入中 3.录入成功 4.录入失败
couponUseing
:
false
,
discCouponState
:
0
,
discCouponMsg
:
"录入失败!无效的优惠券码"
,
discCouponPrice
:
0
,
//兑换券 0关闭兑换券弹窗 1等待兑换 2.兑换中 3.兑换成功 4.兑换失败
//兑换券 0关闭兑换券弹窗 1等待兑换 2.兑换中 3.兑换成功 4.兑换失败
convertCouponState
:
0
,
convertCouponState
:
0
,
convertCouponMsg
:
"兑换失败!无效的兑换码"
,
convertCouponMsg
:
"兑换失败!无效的兑换码"
,
//是否正在用券
couponUseing
:
false
,
//0代表弹窗关闭 1代表手动输入条码弹窗 2代表会员 3.收款 4.退款
//0代表弹窗关闭 1代表手动输入条码弹窗 2代表会员 3.收款 4.退款
scene
:
0
,
scene
:
0
,
//总数量
//总数量
...
@@ -216,22 +216,32 @@ Page({
...
@@ -216,22 +216,32 @@ Page({
//打印上一单结果返回
//打印上一单结果返回
//获取到打印结果
//获取到打印结果
var
printLastOrderResult
=
res
.
data
;
var
printLastOrderResult
=
res
.
data
;
this
.
setData
({
context
.
setData
({
printLastOrderIsPrinting
:
false
printLastOrderIsPrinting
:
false
});
});
if
(
printLastOrderResult
.
code
==
0
)
{
if
(
printLastOrderResult
.
code
==
0
)
{
//打印成功
//打印成功
this
.
setData
({
context
.
setData
({
printLastOrderIsPrintSuccess
:
true
,
printLastOrderIsPrintSuccess
:
true
,
printLastOrderPrintStatusHint
:
"打印完成"
printLastOrderPrintStatusHint
:
"打印完成"
});
});
}
else
{
}
else
{
//打印失败
//打印失败
this
.
setData
({
context
.
setData
({
printLastOrderIsPrintSuccess
:
false
,
printLastOrderIsPrintSuccess
:
false
,
printLastOrderPrintStatusHint
:
"打印失败"
printLastOrderPrintStatusHint
:
"打印失败"
});
});
}
}
}
else
if
(
res
.
action
==
ACTION_USE_COUPON
){
//优惠券
let
coupon
=
res
.
data
let
discCouponPrice
=
context
.
data
.
discCouponPrice
discCouponPrice
=
discCouponPrice
+
coupon
.
discCouponPrice
context
.
setData
({
discCouponState
:
coupon
.
discCouponState
,
discCouponMsg
:
coupon
.
discCouponMsg
,
discCouponPrice
:
discCouponPrice
})
}
}
}
}
...
@@ -429,7 +439,6 @@ Page({
...
@@ -429,7 +439,6 @@ Page({
},
},
fail
:
(
res
)
=>
{
fail
:
(
res
)
=>
{
console
.
log
(
"发送收银事件到前屏小程序 失败 ===》 "
+
JSON
.
stringify
(
res
));
console
.
log
(
"发送收银事件到前屏小程序 失败 ===》 "
+
JSON
.
stringify
(
res
));
},
},
});
});
},
},
...
@@ -446,6 +455,9 @@ Page({
...
@@ -446,6 +455,9 @@ Page({
totalDisc
:
0.00
,
totalDisc
:
0.00
,
goods
:
[
goods
:
[
],
],
discCouponState
:
0
,
discCouponMsg
:
""
,
discCouponPrice
:
0
,
})
})
var
commonRequest
=
{
var
commonRequest
=
{
...
@@ -718,6 +730,25 @@ Page({
...
@@ -718,6 +730,25 @@ Page({
},
},
//发送优惠券到前屏
sendDiscCouponToFront
(
res
)
{
let
context
=
this
;
my
.
ix
.
sendBuddyMessage
({
target
:
getApp
().
globalData
.
frontScreenAppId
,
data
:
{
action
:
ACTION_USE_COUPON
,
data
:
res
},
success
:
(
sres
)
=>
{
console
.
log
(
"优惠通知前屏 成功 ===》"
+
JSON
.
stringify
(
sres
));
},
fail
:
(
fres
)
=>
{
console
.
log
(
"优惠券通知前屏 失败 ===》 "
+
JSON
.
stringify
(
fres
));
context
.
sendDiscCouponToFront
(
res
)
}
})
},
//发生兑换券到前屏
//发生兑换券到前屏
sendConvertCouponToFront
(
res
)
{
sendConvertCouponToFront
(
res
)
{
let
context
=
this
;
let
context
=
this
;
...
@@ -739,11 +770,13 @@ Page({
...
@@ -739,11 +770,13 @@ Page({
//用券返回
//用券返回
couponBack
(
e
)
{
couponBack
(
e
)
{
this
.
setData
({
couponUseing
:
false
})
this
.
setData
({
discCouponState
:
0
})
this
.
sendDiscCouponToFront
(
0
)
},
},
//使用券
//使用券
useCoupon
(
e
)
{
useCoupon
(
e
)
{
// this.setData({ couponUseing: true })
this
.
setData
({
discCouponState
:
1
})
this
.
sendDiscCouponToFront
(
1
)
},
},
//发送退款金额.以分为单位
//发送退款金额.以分为单位
...
...
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