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
e3d9e953
Commit
e3d9e953
authored
Feb 26, 2020
by
jiangjiantao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
优惠券
parent
aaec373e
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
95 additions
and
35 deletions
+95
-35
actioncmd.js
const/actioncmd.js
+3
-0
home.js
pages/home/home.js
+9
-8
scan.axml
pages/scan/scan.axml
+34
-25
scan.js
pages/scan/scan.js
+47
-1
scan.json
pages/scan/scan.json
+2
-1
No files found.
const/actioncmd.js
View file @
e3d9e953
...
...
@@ -54,3 +54,6 @@ export const ACTION_LOGIN_OK = "ACTION_LOGIN_OK";
//打印上一单
export
const
ACTION_PRINT_LAST_ORDER
=
"ACTION_PRINT_LAST_ORDER"
;
//使用优惠券
export
const
ACTION_USE_COUPON
=
"ACTION_USE_COUPON"
;
\ No newline at end of file
pages/home/home.js
View file @
e3d9e953
...
...
@@ -282,14 +282,7 @@ Page({
//核销券
verifyCoupon
(
code
)
{
//语音提示已识别
var
speechContent
=
"兑换码已识别"
;
my
.
ix
.
speech
({
text
:
speechContent
,
speak
:
true
,
success
:
(
r
)
=>
{
}
});
this
.
setData
({
scanDialogDisplay
:
2
})
var
commonRequest
=
{};
...
...
@@ -315,6 +308,14 @@ Page({
this
.
setData
({
scanDialogDisplay
:
4
})
console
.
log
(
"兑换失败 ==>"
+
res
.
data
.
errorMsg
);
}
else
{
//语音提示已识别
var
speechContent
=
"兑换码已识别"
;
my
.
ix
.
speech
({
text
:
speechContent
,
speak
:
true
,
success
:
(
r
)
=>
{
}
});
var
commonRequest
=
{};
commonRequest
.
state
=
3
context
.
sendConvertCouponToBack
(
commonRequest
)
...
...
pages/scan/scan.axml
View file @
e3d9e953
<view class="pagex">
<view slot="header" class="scan-header">
<view hidden="{{memberPhone == ''}}"
>
<view hidden="{{memberPhone == ''}}">
欢迎您,{{memberPhone}}
</view>
<view hidden="{{memberPoint == 0}}">
<view hidden="{{memberPoint == 0}}">
积分:{{memberPoint}}
</view>
</view>
<scroll-view class="scan-good-body" scroll-y a:if="{{goods.length > 0}}"
>
<scroll-view class="scan-good-body" scroll-y a:if="{{goods.length > 0}}"
>
<block a:for="{{goods}}">
<view class="scan-list-bg">
<view class="good-list-item-name-font">
...
...
@@ -21,30 +21,39 @@
</view>
</view>
</block>
</scroll-view>
<view class="empty-shopcart-container" a:if="{{goods.length == 0}}">
</scroll-view>
<view class="empty-shopcart-container" a:if="{{goods.length == 0}}">
等待收银员录入商品
<image class="empty-shopcart" mode="aspectFit" src="/images/empty_shopcart.png"/>
</view>
<view slot="footer" class="scan-bottom" >
<view class="scan-bottom-item">
<view class="scan-price-total-propmt">
总额
</view>
<view class="scan-price-total">
¥{{totalPrice}}
</view>
<view class="scan-price-quantity-propmt">
(共{{totalQuantity}}件)
</view>
<image class="empty-shopcart" mode="aspectFit" src="/images/empty_shopcart.png"/>
</view>
<view class="scan-bottom-item">
<view class="scan-price-total-propmt">
已优惠
</view>
<view class="scan-disc-total">
<view slot="footer" class="scan-bottom">
<view class="scan-bottom-item">
<view class="scan-price-total-propmt">
总额
</view>
<view class="scan-price-total">
¥{{totalPrice}}
</view>
<view class="scan-price-quantity-propmt">
(共{{totalQuantity}}件)
</view>
</view>
<view class="scan-bottom-item">
<view class="scan-price-total-propmt">
已优惠
</view>
<view class="scan-disc-total">
¥{{totalDisc}}
</view>
</view>
</view>
</view>
</view>
<!-- 优惠券 -->
<scandialog displayDialog="{{scanDialogDisplay}}"
remindText="{{dialogRemindText}}"
loadingText="{{dialogLoadingText}}"
resultSuccessRemind="{{dialogResultSuccessRemind}}"
resultSuccessText="{{dialogResultSuccessText}}"
resultFailureRemind="{{dialogResultFailureRemind}}"
resultFailureText="{{dialogResultFailureText}}"
/>
</view>
\ No newline at end of file
pages/scan/scan.js
View file @
e3d9e953
...
...
@@ -7,6 +7,8 @@ import { ACTION_MEMBER } from '../../const/actioncmd'
import
{
ACTION_REQUEST_GOOD_INFO
}
from
'../../const/actioncmd'
import
{
ACTION_GO_BALANCE
}
from
'../../const/actioncmd'
import
{
ACTION_GO_HOME
}
from
'../../const/actioncmd'
import
{
ACTION_USE_COUPON
}
from
'../../const/actioncmd'
Page
({
data
:
{
...
...
@@ -16,7 +18,16 @@ Page({
totalQuantity
:
0
,
totalDisc
:
0.00
,
memberPhone
:
''
,
memberPoint
:
0
memberPoint
:
0
,
//显示弹窗,>1为显示,2loading 3 result success 4 result failed
scanDialogDisplay
:
0
,
dialogShowType
:
""
,
//弹窗类型:如refund coupon disccoupon
dialogRemindText
:
"请扫描优惠券码"
,
dialogLoadingText
:
"识别中"
,
dialogResultSuccessRemind
:
"优惠券码已识别"
,
dialogResultSuccessText
:
"恭喜您!录入成功"
,
dialogResultFailureRemind
:
"优惠券码未识别"
,
dialogResultFailureText
:
"录入失败,请稍后重试!"
,
},
onLoad
:
function
(
options
)
{
...
...
@@ -59,6 +70,19 @@ Page({
my
.
reLaunch
({
url
:
"/pages/home/home"
,
});
}
else
if
(
res
.
action
==
ACTION_CONVERT_COUPON
)
{
//优惠券
context
.
setData
({
scanDialogDisplay
:
res
.
data
.
discCouponState
,
totalDisc
:
res
.
data
.
discCouponPrice
});
var
speechContent
=
"请扫描优惠券码"
;
my
.
ix
.
speech
({
text
:
speechContent
,
speak
:
true
,
success
:
(
r
)
=>
{
}
});
}
}
...
...
@@ -72,10 +96,32 @@ Page({
//外接扫码枪事件
onKeyPress
(
r
)
{
if
(
this
.
data
.
scanDialogDisplay
!=
0
)
{
this
.
useCoupon
(
r
);
return
}
console
.
log
(
"scan onKeyPress==>"
+
r
);
this
.
getGoodInfoByBarcode
(
r
);
},
//使用优惠券
useCoupon
(
code
)
{
this
.
setData
({
scanDialogDisplay
:
2
})
setTimeout
(()
=>
{
//模拟数据 1 - 5 随机整数
let
totalDiscTemp
=
this
.
data
.
totalDisc
+
Math
.
round
(
Math
.
random
()
*
4
)
+
1
;
this
.
setData
({
scanDialogDisplay
:
0
,
totalDisc
:
totalDiscTemp
})
my
.
showToast
({
type
:
'success'
,
content
:
'优惠已录入'
,
duration
:
3000
,
success
:
()
=>
{
},
});
},
700
);
},
//获取商品信息
getGoodInfoByBarcode
(
barcode
)
{
////根据条形码查询商品接口
...
...
pages/scan/scan.json
View file @
e3d9e953
...
...
@@ -2,6 +2,7 @@
"transparentTitle"
:
"always"
,
"usingComponents"
:{
"list"
:
"mini-antui/es/list/index"
,
"list-item"
:
"mini-antui/es/list/list-item/index"
"list-item"
:
"mini-antui/es/list/list-item/index"
,
"scandialog"
:
"/custom_widgets/scandialog/scandialog"
}
}
\ 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