Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
F
fmPOS
Overview
Overview
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
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
zhenfei.zhang
fmPOS
Commits
6222412f
Commit
6222412f
authored
Sep 07, 2018
by
gujin.wang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1,为卡券核销添加等待画面 2,添加对折扣券的支持
parent
2461d574
Show whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
136 additions
and
62 deletions
+136
-62
fmp_redeem/consumokdialog.ui
+4
-6
fmp_redeem/consumptiondialog.cpp
+39
-1
fmp_redeem/consumptiondialog.h
+7
-2
fmp_redeem/consumptiondialog.ui
+6
-6
fmp_redeem/errcodedialog.ui
+3
-4
fmp_redeem/fmp_redeem.cpp
+18
-26
fmp_redeem/fmp_redeem.h
+0
-1
fmp_redeem/storedialog.cpp
+17
-6
fmp_redeem/storedialog.h
+1
-0
fmp_redeem/storedialog.ui
+41
-10
release/bins/log/fmp.log.1
+0
-0
No files found.
fmp_redeem/consumokdialog.ui
View file @
6222412f
...
...
@@ -36,7 +36,7 @@
border-top-left-radius:12px;
border-top-right-radius:12px;
}
/**/
#topNoConsumeWidget{
background-image: url(:/img/bg_no_exchange.png);
border:none;
...
...
@@ -50,7 +50,7 @@
border-top-left-radius:12px;
border-top-right-radius:12px;
}
/**/
#labActName{
font-size:30px;
font-family:
"
微软雅黑
"
;
...
...
@@ -77,15 +77,13 @@
#btnCannel{
border:none;
b
ackground
-image: url(:/img/btn_canel.png);
b
order
-image: url(:/img/btn_canel.png);
}
/**/
#btnConsumOk{
border:none;
b
ackground
-image: url(:/img/consumption_ok.png);
b
order
-image: url(:/img/consumption_ok.png);
}
/**/
</string>
</property>
<layout
class=
"QHBoxLayout"
name=
"horizontalLayout_2"
>
...
...
fmp_redeem/consumptiondialog.cpp
View file @
6222412f
#
include
"consumptiondialog.h"
#include "ui_consumptiondialog.h"
#include <QTimer>
ConsumptionDialog
::
ConsumptionDialog
(
QWidget
*
parent
,
Qt
::
WindowFlags
f
)
:
QDialog
(
parent
,
f
),
ui
(
new
Ui
::
ConsumptionDialog
)
{
ui
->
setupUi
(
this
);
timer
=
Q_NULLPTR
;
setWindowTitle
(
QString
::
fromLocal8Bit
(
"非码卡券"
));
setWindowFlags
(
windowFlags
()
|
Qt
::
WindowStaysOnTopHint
|
Qt
::
FramelessWindowHint
);
setAutoFillBackground
(
false
);
//这个不设置的话就背景变黑
...
...
@@ -18,6 +20,10 @@ ConsumptionDialog::ConsumptionDialog(QWidget * parent, Qt::WindowFlags f) :
ConsumptionDialog
::~
ConsumptionDialog
()
{
if
(
timer
->
isActive
())
timer
->
stop
();
timer
->
deleteLater
();
timer
=
Q_NULLPTR
;
delete
ui
;
}
...
...
@@ -61,6 +67,38 @@ bool ConsumptionDialog::ShowForHasConsum(const QString& act_name, const QString&
return
false
;
}
void
ConsumptionDialog
::
ShowForWaiting
(
const
QString
&
act_name
,
const
QString
&
code_name
,
const
QString
&
time_name
,
const
QString
&
coupon
,
QWidget
*
parent
)
{
ui
->
topNoConsumeWidget
->
setObjectName
(
"topNoConsumeWidget"
);
ui
->
topNoConsumeWidget
->
setStyleSheet
(
ui
->
topNoConsumeWidget
->
styleSheet
());
ui
->
btnConsumption
->
setObjectName
(
"btnConsumNull"
);
ui
->
btnConsumption
->
setStyleSheet
(
ui
->
btnConsumption
->
styleSheet
());
ui
->
btnConsumption
->
setEnabled
(
false
);
setData
(
act_name
,
code_name
,
time_name
,
coupon
);
show
();
timer
=
new
QTimer
(
this
);
connect
(
timer
,
SIGNAL
(
timeout
()),
this
,
SLOT
(
OnTimeout
()));
timer
->
start
(
1000
);
}
void
ConsumptionDialog
::
OnTimeout
()
{
static
int
i
=
0
;
i
++
;
if
(
i
>
3
)
{
ui
->
labActName
->
setText
(
QString
::
fromLocal8Bit
(
"请稍后"
));
i
=
0
;
}
else
{
QString
txt
=
ui
->
labActName
->
text
();
txt
.
append
(
"."
);
ui
->
labActName
->
setText
(
txt
);
}
}
void
ConsumptionDialog
::
setData
(
const
QString
&
act_name
,
const
QString
&
code_name
,
const
QString
&
time_name
,
const
QString
&
coupon
)
{
ui
->
labCode
->
setText
(
coupon
);
...
...
fmp_redeem/consumptiondialog.h
View file @
6222412f
#ifndef CONSUMPTIONDIALOG_H
#
ifndef
CONSUMPTIONDIALOG_H
#define CONSUMPTIONDIALOG_H
#include <QDialog>
#include <QTimer>
class
WorkObject
;
namespace
Ui
{
...
...
@@ -21,6 +21,10 @@ public:
void
setData
(
const
QString
&
act_name
,
const
QString
&
code_name
,
const
QString
&
time_name
,
const
QString
&
coupon
);
static
bool
ShowForUnConsum
(
const
QString
&
act_name
,
const
QString
&
code_name
,
const
QString
&
time_name
,
const
QString
&
coupon
,
QWidget
*
parent
=
0
);
static
bool
ShowForHasConsum
(
const
QString
&
act_name
,
const
QString
&
code_name
,
const
QString
&
time_name
,
const
QString
&
coupon
,
QWidget
*
parent
=
0
);
void
ShowForWaiting
(
const
QString
&
act_name
,
const
QString
&
code_name
,
const
QString
&
time_name
,
const
QString
&
coupon
,
QWidget
*
parent
=
0
);
private
slots
:
void
OnTimeout
();
signals
:
void
sgBtnOk
();
...
...
@@ -28,6 +32,7 @@ signals:
private
:
Ui
::
ConsumptionDialog
*
ui
;
QTimer
*
timer
;
};
#endif // CONSUMPTIONDIALOG_H
fmp_redeem/consumptiondialog.ui
View file @
6222412f
...
...
@@ -50,6 +50,7 @@
border-top-left-radius:12px;
border-top-right-radius:12px;
}
/**/
#labActName{
/*font: 30 bold
"
微软雅黑
"
;*/
...
...
@@ -81,18 +82,17 @@
#btnCannel{
border:none;
b
ackground
-image: url(:/img/btn_canel.png);
b
order
-image: url(:/img/btn_canel.png);
}
/**/
#btnConsumption{
border:none;
b
ackground
-image: url(:/img/btn_consumption.png);
b
order
-image: url(:/img/btn_consumption.png);
}
#btnConsumNull{
border:none;
background-image: url(:/img/btn_consumption_invalid.png);
}
/**/
</string>
border-image: url(:/img/btn_consumption_invalid.png);
}
</string>
</property>
<layout
class=
"QVBoxLayout"
name=
"verticalLayout"
>
<property
name=
"spacing"
>
...
...
fmp_redeem/errcodedialog.ui
View file @
6222412f
...
...
@@ -87,17 +87,16 @@
/*label*/
#btnCannel{
border:none;
b
ackground
-image: url(:/img/btn_canel.png);
b
order
-image: url(:/img/btn_canel.png);
}
/**/
#btnConsumption{
border:none;
b
ackground
-image: url(:/img/btn_consumption.png);
b
order
-image: url(:/img/btn_consumption.png);
}
#btnConsumNull{
border:none;
background-image: url(:/img/btn_consumption_invalid.png);
border-image: url(:/img/btn_consumption_invalid.png);
}
/**/
</string>
</property>
...
...
fmp_redeem/fmp_redeem.cpp
View file @
6222412f
...
...
@@ -135,8 +135,10 @@ QJsonObject FMPRedeem::Redeem(const QJsonArray& productsInfo)
{
_store_id
=
storeDialog
.
storeId
;
_station_id
=
storeDialog
.
posId
;
_partner_id
=
storeDialog
.
partnerId
.
toInt
();
settings
.
setValue
(
FMP_INIKEY_LOGINSTOREID
,
_store_id
);
settings
.
setValue
(
FMP_INIKEY_LOGINPOSID
,
_station_id
);
settings
.
setValue
(
FMP_INIKEY_LOGINPARTNERID
,
_partner_id
);
}
else
{
...
...
@@ -219,6 +221,10 @@ QJsonObject FMPRedeem::SendRequest(const QByteArray &reqData)
timer
.
setSingleShot
(
true
);
connect
(
&
timer
,
&
QTimer
::
timeout
,
&
loop
,
&
QEventLoop
::
quit
);
timer
.
start
(
1000
*
30
);
ConsumptionDialog
cd
;
connect
(
&
cd
,
SIGNAL
(
rejected
()),
&
loop
,
SLOT
(
quit
()));
connect
(
&
timer
,
SIGNAL
(
timeout
()),
&
cd
,
SLOT
(
reject
()));
cd
.
ShowForWaiting
(
QString
::
fromLocal8Bit
(
"请稍后"
),
""
,
""
,
""
);
loop
.
exec
();
if
(
timer
.
isActive
())
...
...
@@ -246,6 +252,7 @@ QJsonObject FMPRedeem::SendRequest(const QByteArray &reqData)
}
reply
->
deleteLater
();
FMP_DEBUG
()
<<
"Server response: "
<<
QJsonDocument
(
retJson
).
toJson
(
QJsonDocument
::
Compact
);
return
retJson
;
}
...
...
@@ -279,29 +286,15 @@ QJsonObject FMPRedeem::ShowForUnConsum(QJsonObject json)
transaction
[
"code"
]
=
coupon
;
transaction
[
"ebcode"
]
=
ebcode
;
//得到该券所对应商品id,目前一张券只对应一种商品
QString
canUsedProduct
=
SearchJsonObject
(
json
,
"pid"
).
toString
();
//遍历传入的商品信息,查找是否有相同的商品id,
//若有则进行核销,否则,直接返回失败
int
i
;
for
(
i
=
0
;
i
<
_products_info
.
size
();
i
++
){
QJsonObject
obj
=
_products_info
[
i
].
toObject
();
if
(
obj
[
"pid"
].
toString
()
==
canUsedProduct
)
break
;
}
if
(
i
>=
_products_info
.
size
())
{
//不存在对应商品
return
ShowForMismatch
(
json
);
}
QJsonArray
products
;
for
(
int
i
=
0
;
i
<
_products_info
.
size
();
i
++
)
{
QJsonObject
product
;
product
.
insert
(
"seq"
,
1
);
product
.
insert
(
"pid"
,
_products_info
[
i
].
toObject
()[
"pid"
]);
product
.
insert
(
"consume_num"
,
_products_info
[
i
].
toObject
()[
"consume_num"
]);
products
.
append
(
product
);
}
transaction
[
"products"
]
=
products
;
transactions
.
append
(
transaction
);
...
...
@@ -317,6 +310,14 @@ QJsonObject FMPRedeem::ShowForUnConsum(QJsonObject json)
_redeem_json
[
"transactions"
]
=
transactions
;
}
if
(
couponType
==
3
){
//折扣券
QJsonObject
transaction
;
transaction
[
"code"
]
=
coupon
;
transaction
[
"ebcode"
]
=
ebcode
;
QJsonArray
transactions
;
transactions
.
append
(
transaction
);
_redeem_json
[
"transactions"
]
=
transactions
;
}
QByteArray
reqData
=
QJsonDocument
(
_redeem_json
).
toJson
();
reqData
=
CheckSendArray
(
reqData
);
...
...
@@ -391,15 +392,6 @@ QJsonObject FMPRedeem::ShowForErr(QJsonObject json)
return
json
;
}
QJsonObject
FMPRedeem
::
ShowForMismatch
(
QJsonObject
json
)
{
ErrCodeDialog
::
showForMismatch
(
_coupon
,
QString
::
fromLocal8Bit
(
"券和商品不匹配"
));
QJsonObject
mismatch
;
mismatch
[
"statusCode"
]
=
31
;
mismatch
[
"msg"
]
=
QString
::
fromLocal8Bit
(
"券和商品不匹配"
);
return
mismatch
;
}
QJsonObject
FMPRedeem
::
GetRedeemJson
()
const
{
return
_redeem_json
;
...
...
fmp_redeem/fmp_redeem.h
View file @
6222412f
...
...
@@ -47,7 +47,6 @@ private:
QJsonObject
ShowForInvalid
(
QJsonObject
json
);
QJsonObject
ShowForExpird
(
QJsonObject
json
);
QJsonObject
ShowForErr
(
QJsonObject
json
);
QJsonObject
ShowForMismatch
(
QJsonObject
json
);
int
ZH_caclChkValue
(
char
*
pJsonData
,
int
startPos
,
int
endPos
);
QByteArray
CheckSendArray
(
QByteArray
&
jsonArray
);
QJsonValue
SearchJsonObject
(
QJsonObject
&
searchJson
,
QString
searchKey
);
...
...
fmp_redeem/storedialog.cpp
View file @
6222412f
...
...
@@ -21,6 +21,8 @@ StoreDialog::StoreDialog(QWidget *parent) :
ui
->
storeIdEdit
->
installEventFilter
(
this
);
ui
->
posIdEdit
->
installEventFilter
(
this
);
ui
->
partnerEdit
->
installEventFilter
(
this
);
ui
->
partnerEdit
->
setFocus
();
QTimer
::
singleShot
(
1000
,
this
,
&
StoreDialog
::
timeOut
);
}
...
...
@@ -52,8 +54,9 @@ void StoreDialog::ShowKeyBoard()
void
StoreDialog
::
GetId
()
{
storeId
=
ui
->
storeIdEdit
->
text
();
posId
=
ui
->
posIdEdit
->
text
();
storeId
=
ui
->
storeIdEdit
->
text
().
trimmed
();
posId
=
ui
->
posIdEdit
->
text
().
trimmed
();
partnerId
=
ui
->
partnerEdit
->
text
().
trimmed
();
FMPKeyBoardInterface
*
keyboard
=
FMP
::
GetService
<
FMPKeyBoardInterface
>
();
keyboard
->
StartService
();
keyboard
->
HideKeyBoard
();
...
...
@@ -63,7 +66,7 @@ void StoreDialog::GetId()
void
StoreDialog
::
textChanged
(
const
QString
&
text
)
{
Q_UNUSED
(
text
);
if
(
ui
->
storeIdEdit
->
text
().
isEmpty
()
||
ui
->
posIdEdit
->
text
().
isEmpty
())
if
(
ui
->
storeIdEdit
->
text
().
trimmed
().
isEmpty
()
||
ui
->
posIdEdit
->
text
().
trimmed
().
isEmpty
()
||
ui
->
partnerEdit
->
text
().
trimmed
().
isEmpty
())
{
ui
->
okBtn
->
setEnabled
(
false
);
}
...
...
@@ -89,7 +92,7 @@ void StoreDialog::timeOut()
::
AttachThreadInput
(
dwCurID
,
dwForeID
,
FALSE
);
setFocus
();
ui
->
storeId
Edit
->
setFocus
();
ui
->
partner
Edit
->
setFocus
();
}
bool
StoreDialog
::
eventFilter
(
QObject
*
obj
,
QEvent
*
event
)
...
...
@@ -112,9 +115,17 @@ bool StoreDialog::eventFilter(QObject *obj, QEvent *event)
}
return
false
;
}
else
{
return
QDialog
::
eventFilter
(
obj
,
event
);
else
if
(
obj
==
ui
->
partnerEdit
)
{
if
(
event
->
type
()
==
QEvent
::
FocusIn
)
{
FMPKeyBoardInterface
*
keyboard
=
FMP
::
GetService
<
FMPKeyBoardInterface
>
();
keyboard
->
StartService
();
keyboard
->
setLineEdit
(
ui
->
partnerEdit
);
}
return
false
;
}
return
QDialog
::
eventFilter
(
obj
,
event
);
}
void
StoreDialog
::
CloseKeyBoard
()
...
...
fmp_redeem/storedialog.h
View file @
6222412f
...
...
@@ -28,6 +28,7 @@ private slots:
public
:
QString
storeId
;
QString
posId
;
QString
partnerId
;
private
:
Ui
::
StoreDialog
*
ui
;
...
...
fmp_redeem/storedialog.ui
View file @
6222412f
...
...
@@ -7,7 +7,7 @@
<x>
0
</x>
<y>
0
</y>
<width>
367
</width>
<height>
2
02
</height>
<height>
2
44
</height>
</rect>
</property>
<property
name=
"windowTitle"
>
...
...
@@ -26,7 +26,7 @@
background: rgb(231,68,59);
}
#storeIdLabel,#posIdLabel
#storeIdLabel,#posIdLabel
,#partnerLabel
{
font: 75 15pt
"
微软雅黑
"
;
color: rgb(57, 57, 57);
...
...
@@ -70,7 +70,7 @@ QPushButton:!enabled {
</rect>
</property>
<property
name=
"text"
>
<string>
请输入门店
号和POS编号
</string>
<string>
请输入门店
信息
</string>
</property>
<property
name=
"alignment"
>
<set>
Qt::AlignCenter
</set>
...
...
@@ -80,7 +80,7 @@ QPushButton:!enabled {
<property
name=
"geometry"
>
<rect>
<x>
5
</x>
<y>
4
8
</y>
<y>
9
8
</y>
<width>
101
</width>
<height>
31
</height>
</rect>
...
...
@@ -93,7 +93,7 @@ QPushButton:!enabled {
<property
name=
"geometry"
>
<rect>
<x>
120
</x>
<y>
4
8
</y>
<y>
9
8
</y>
<width>
161
</width>
<height>
32
</height>
</rect>
...
...
@@ -103,7 +103,7 @@ QPushButton:!enabled {
<property
name=
"geometry"
>
<rect>
<x>
5
</x>
<y>
97
</y>
<y>
145
</y>
<width>
101
</width>
<height>
31
</height>
</rect>
...
...
@@ -116,7 +116,7 @@ QPushButton:!enabled {
<property
name=
"geometry"
>
<rect>
<x>
120
</x>
<y>
98
</y>
<y>
146
</y>
<width>
161
</width>
<height>
32
</height>
</rect>
...
...
@@ -126,7 +126,7 @@ QPushButton:!enabled {
<property
name=
"geometry"
>
<rect>
<x>
290
</x>
<y>
42
</y>
<y>
50
</y>
<width>
72
</width>
<height>
52
</height>
</rect>
...
...
@@ -139,7 +139,7 @@ QPushButton:!enabled {
<property
name=
"geometry"
>
<rect>
<x>
124
</x>
<y>
1
4
0
</y>
<y>
1
9
0
</y>
<width>
72
</width>
<height>
52
</height>
</rect>
...
...
@@ -152,7 +152,7 @@ QPushButton:!enabled {
<property
name=
"geometry"
>
<rect>
<x>
210
</x>
<y>
1
4
0
</y>
<y>
1
9
0
</y>
<width>
72
</width>
<height>
52
</height>
</rect>
...
...
@@ -161,7 +161,38 @@ QPushButton:!enabled {
<string>
取消
</string>
</property>
</widget>
<widget
class=
"QLabel"
name=
"partnerLabel"
>
<property
name=
"geometry"
>
<rect>
<x>
6
</x>
<y>
49
</y>
<width>
101
</width>
<height>
31
</height>
</rect>
</property>
<property
name=
"text"
>
<string>
商户号
</string>
</property>
</widget>
<widget
class=
"QLineEdit"
name=
"partnerEdit"
>
<property
name=
"geometry"
>
<rect>
<x>
120
</x>
<y>
49
</y>
<width>
161
</width>
<height>
32
</height>
</rect>
</property>
</widget>
</widget>
<tabstops>
<tabstop>
partnerEdit
</tabstop>
<tabstop>
storeIdEdit
</tabstop>
<tabstop>
posIdEdit
</tabstop>
<tabstop>
okBtn
</tabstop>
<tabstop>
cancelBtn
</tabstop>
<tabstop>
keyBtn
</tabstop>
</tabstops>
<resources/>
<connections/>
</ui>
release/bins/log/fmp.log.1
deleted
100644 → 0
View file @
2461d574
This source diff could not be displayed because it is too large. You can
view the blob
instead.
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