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
xiaojing.zhang
fmPOS
Commits
7f6b32d2
Commit
7f6b32d2
authored
Mar 16, 2017
by
LIDINGDA\ldd
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1.数据库添加营业日字段;2.添加收银员pos编号营业日获取设置;3.规范界面输入
parent
168bb6ab
Show whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
138 additions
and
47 deletions
+138
-47
fmp_epay/fmp_epay.cpp
+9
-0
fmp_epay/fmp_epay.h
+3
-0
fmp_epay/fmp_epay_checkmodel.h
+1
-1
fmp_epay/fmp_epay_def.h
+3
-0
fmp_epay/fmp_epay_i.h
+0
-1
fmp_epay/fmp_epay_p.cpp
+24
-12
fmp_epay/fmp_epay_p.h
+3
-2
fmp_epay/fmp_epayview_dialog.cpp
+84
-20
fmp_epay/fmp_epayview_dialog.h
+8
-8
fmp_epay/fmp_epayview_wait.ui
+2
-2
fmp_epay/version.h
+1
-1
No files found.
fmp_epay/fmp_epay.cpp
View file @
7f6b32d2
#
include
"fmp_epay_p.h"
#
include
"fmp_epay_p.h"
#include "fmp_epay_def.h"
#include "fmp_epay_def.h"
#include "fmp_pe_handlers.h"
#include "fmp_pe_handlers.h"
#include <QDateTime>
class
ctkPluginContext
;
class
ctkPluginContext
;
...
@@ -10,6 +11,7 @@ FMPePay::FMPePay(ctkPluginContext *context)
...
@@ -10,6 +11,7 @@ FMPePay::FMPePay(ctkPluginContext *context)
_inited
(
false
),
_inited
(
false
),
_databasename
(
DEFAULT_EPAY_DATABASENAME
),
_databasename
(
DEFAULT_EPAY_DATABASENAME
),
_table
(
DEFAULT_EPAY_TABLE
),
_table
(
DEFAULT_EPAY_TABLE
),
_businessdate
(
QDateTime
::
currentDateTime
().
toString
(
"yyyyMMdd"
)),
d_ptr
(
new
FMPePayPrivate
(
this
))
d_ptr
(
new
FMPePayPrivate
(
this
))
{
{
FMPStartEventHandler
*
ste_handler
=
new
FMPStartEventHandler
(
_ctx
,
this
);
FMPStartEventHandler
*
ste_handler
=
new
FMPStartEventHandler
(
_ctx
,
this
);
...
@@ -28,3 +30,10 @@ int FMPePay::Pay()
...
@@ -28,3 +30,10 @@ int FMPePay::Pay()
Q_D
(
FMPePay
);
Q_D
(
FMPePay
);
return
d
->
Pay
();
return
d
->
Pay
();
}
}
void
FMPePay
::
SetBasicInfo
(
QVariantHash
hash
)
{
Q_D
(
FMPePay
);
this
->
_businessdate
=
hash
[
FMP_BASIC_BUSINESSDATE
].
toString
();
d
->
SetBasicInfo
(
hash
);
}
fmp_epay/fmp_epay.h
View file @
7f6b32d2
...
@@ -18,11 +18,14 @@ public:
...
@@ -18,11 +18,14 @@ public:
int
StopService
();
int
StopService
();
int
Pay
();
int
Pay
();
void
SetBasicInfo
(
QVariantHash
hash
);
private
:
private
:
bool
_inited
;
bool
_inited
;
QString
_url
;
QString
_url
;
QString
_databasename
;
QString
_databasename
;
QString
_table
;
QString
_table
;
QString
_businessdate
;
FMPePayPrivate
*
d_ptr
;
FMPePayPrivate
*
d_ptr
;
};
};
...
...
fmp_epay/fmp_epay_checkmodel.h
View file @
7f6b32d2
...
@@ -19,7 +19,7 @@ public:
...
@@ -19,7 +19,7 @@ public:
return
d
.
toString
().
toFloat
()
/
100
;
return
d
.
toString
().
toFloat
()
/
100
;
}
}
if
((
idx
.
column
()
==
1
1
)
&&
role
==
Qt
::
DisplayRole
)
{
if
((
idx
.
column
()
==
1
2
)
&&
role
==
Qt
::
DisplayRole
)
{
QVariant
d
=
QSqlTableModel
::
data
(
idx
,
role
);
QVariant
d
=
QSqlTableModel
::
data
(
idx
,
role
);
if
(
d
.
toBool
())
{
if
(
d
.
toBool
())
{
return
QString
::
fromLocal8Bit
(
"已退款"
);
return
QString
::
fromLocal8Bit
(
"已退款"
);
...
...
fmp_epay/fmp_epay_def.h
View file @
7f6b32d2
...
@@ -36,6 +36,7 @@
...
@@ -36,6 +36,7 @@
#define SQL_KEY_PAYID "pay_id"
#define SQL_KEY_PAYID "pay_id"
#define SQL_KEY_PAYTRANSID "pay_transId"
#define SQL_KEY_PAYTRANSID "pay_transId"
#define SQL_KEY_TRANSID "trans_id"
#define SQL_KEY_TRANSID "trans_id"
#define SQL_KEY_BUSSINEDATE "business_date"
#define SQL_KEY_CODE "code"
#define SQL_KEY_CODE "code"
#define SQL_KEY_FMID "fmId"
#define SQL_KEY_FMID "fmId"
#define SQL_KEY_EBCODE "pay_ebcode"
#define SQL_KEY_EBCODE "pay_ebcode"
...
@@ -46,6 +47,8 @@
...
@@ -46,6 +47,8 @@
#define DEFAULT_EPAY_DATABASENAME "fmp_test.db"
#define DEFAULT_EPAY_DATABASENAME "fmp_test.db"
#define DEFAULT_EPAY_TABLE "fmp_pay"
#define DEFAULT_EPAY_TABLE "fmp_pay"
//基础信息 营业日/操作员/pos编号
#define FMP_BASIC_BUSINESSDATE "businessdate"
#endif // FMP_EPAY_DEF
#endif // FMP_EPAY_DEF
...
...
fmp_epay/fmp_epay_i.h
View file @
7f6b32d2
...
@@ -12,7 +12,6 @@ class FMPePayInterface : public FMPluginInterface
...
@@ -12,7 +12,6 @@ class FMPePayInterface : public FMPluginInterface
public
:
public
:
explicit
FMPePayInterface
(
ctkPluginContext
*
ctx
)
:
FMPluginInterface
(
ctx
)
{}
explicit
FMPePayInterface
(
ctkPluginContext
*
ctx
)
:
FMPluginInterface
(
ctx
)
{}
virtual
int
Pay
()
=
0
;
virtual
int
Pay
()
=
0
;
// /**
// /**
// * @brief ShowPayDialog
// * @brief ShowPayDialog
// * 呈现支付主界面
// * 呈现支付主界面
...
...
fmp_epay/fmp_epay_p.cpp
View file @
7f6b32d2
...
@@ -98,6 +98,7 @@ void FMPePayPrivate::onShowPayWnd()
...
@@ -98,6 +98,7 @@ void FMPePayPrivate::onShowPayWnd()
"mcoupon_amount integer, "
"mcoupon_amount integer, "
"alipay_amount integer, "
"alipay_amount integer, "
"invoice_amount integer, "
"invoice_amount integer, "
"business_date varchar(30), "
"isrefund boolean"
"isrefund boolean"
")"
;
")"
;
...
@@ -114,17 +115,16 @@ void FMPePayPrivate::onShowPayWnd()
...
@@ -114,17 +115,16 @@ void FMPePayPrivate::onShowPayWnd()
_model
=
new
FMPPayCheckModel
(
NULL
,
_db
->
getDb
());
_model
=
new
FMPPayCheckModel
(
NULL
,
_db
->
getDb
());
_model
->
setTable
(
q
->
_table
);
_model
->
setTable
(
q
->
_table
);
_model
->
setEditStrategy
(
QSqlTableModel
::
OnManualSubmit
);
_model
->
setEditStrategy
(
QSqlTableModel
::
OnManualSubmit
);
_model
->
setHeaderData
(
0
,
Qt
::
Horizontal
,
QString
::
fromLocal8Bit
(
"非码交易号"
));
_model
->
setHeaderData
(
2
,
Qt
::
Horizontal
,
QString
::
fromLocal8Bit
(
"三方交易号"
));
_model
->
setHeaderData
(
4
,
Qt
::
Horizontal
,
QString
::
fromLocal8Bit
(
"交易渠道"
));
_model
->
setHeaderData
(
6
,
Qt
::
Horizontal
,
QString
::
fromLocal8Bit
(
"金额(元)"
));
_model
->
setHeaderData
(
11
,
Qt
::
Horizontal
,
QString
::
fromLocal8Bit
(
"已退款"
));
}
}
if
(
_payDialog
==
nullptr
)
{
if
(
_payDialog
==
nullptr
)
{
QVariantHash
hash
;
hash
[
FMP_BASIC_BUSINESSDATE
]
=
q
->
_businessdate
;
_setting
=
q
->
GetService
<
FMPSettingsInterface
>
(
q
->
_ctx
);
_setting
=
q
->
GetService
<
FMPSettingsInterface
>
(
q
->
_ctx
);
_payDialog
=
new
FMPPayDialog
(
this
,
_logger
);
_payDialog
=
new
FMPPayDialog
(
this
,
_logger
,
hash
);
}
}
_payDialog
->
show
();
_payDialog
->
show
();
...
@@ -135,11 +135,12 @@ QSqlTableModel *FMPePayPrivate::model() const
...
@@ -135,11 +135,12 @@ QSqlTableModel *FMPePayPrivate::model() const
return
_model
;
return
_model
;
}
}
void
FMPePayPrivate
::
ControlPayJson
(
QString
sum
,
QString
code
,
QString
date
)
void
FMPePayPrivate
::
ControlPayJson
(
QString
sum
,
QString
code
)
{
{
Q_Q
(
FMPePay
);
Q_Q
(
FMPePay
);
QtConcurrent
::
run
(
[
q
,
sum
,
code
,
date
,
this
]()
QtConcurrent
::
run
(
[
q
,
sum
,
code
,
this
]()
{
{
if
(
_reverse_flag
)
if
(
_reverse_flag
)
{
{
...
@@ -147,7 +148,7 @@ void FMPePayPrivate::ControlPayJson(QString sum, QString code, QString date)
...
@@ -147,7 +148,7 @@ void FMPePayPrivate::ControlPayJson(QString sum, QString code, QString date)
return
;
return
;
}
}
if
(
!
GetPayJson
(
sum
,
code
,
date
))
if
(
!
GetPayJson
(
sum
,
code
))
{
{
emit
error
(
QString
::
fromLocal8Bit
(
"获取门店信息失败"
));
emit
error
(
QString
::
fromLocal8Bit
(
"获取门店信息失败"
));
return
;
return
;
...
@@ -166,6 +167,7 @@ void FMPePayPrivate::ControlPayJson(QString sum, QString code, QString date)
...
@@ -166,6 +167,7 @@ void FMPePayPrivate::ControlPayJson(QString sum, QString code, QString date)
{
{
outjson
.
insert
(
SQL_KEY_ISREFUND
,
false
);
outjson
.
insert
(
SQL_KEY_ISREFUND
,
false
);
outjson
.
insert
(
SQL_KEY_CODE
,
code
);
outjson
.
insert
(
SQL_KEY_CODE
,
code
);
outjson
.
insert
(
SQL_KEY_BUSSINEDATE
,
q
->
_businessdate
);
outjson
.
insert
(
SQL_KEY_TRANSID
,
_current_json
[
SQL_KEY_TRANSID
].
toString
());
outjson
.
insert
(
SQL_KEY_TRANSID
,
_current_json
[
SQL_KEY_TRANSID
].
toString
());
_db
->
insert
(
q
->
_table
,
outjson
.
toVariantHash
());
_db
->
insert
(
q
->
_table
,
outjson
.
toVariantHash
());
...
@@ -238,6 +240,14 @@ bool FMPePayPrivate::CheckReturnJson(QByteArray data, QJsonObject &returnjson)
...
@@ -238,6 +240,14 @@ bool FMPePayPrivate::CheckReturnJson(QByteArray data, QJsonObject &returnjson)
return
true
;
return
true
;
}
}
void
FMPePayPrivate
::
SetBasicInfo
(
QVariantHash
hash
)
{
Q_Q
(
FMPePay
);
if
(
_payDialog
!=
NULL
)
_payDialog
->
setBasicInfo
(
hash
);
}
void
FMPePayPrivate
::
GetCheckMode
(
QString
sum
)
void
FMPePayPrivate
::
GetCheckMode
(
QString
sum
)
{
{
QString
sql
=
QString
(
"fmId like '%%%1%%' or pay_transId like '%%%1%%'"
).
arg
(
sum
);
QString
sql
=
QString
(
"fmId like '%%%1%%' or pay_transId like '%%%1%%'"
).
arg
(
sum
);
...
@@ -350,8 +360,10 @@ void FMPePayPrivate::ControlReverseJson()
...
@@ -350,8 +360,10 @@ void FMPePayPrivate::ControlReverseJson()
qDebug
()
<<
_current_json
;
qDebug
()
<<
_current_json
;
}
}
bool
FMPePayPrivate
::
GetPayJson
(
const
QString
&
sum
,
const
QString
&
code
,
const
QString
&
date
)
bool
FMPePayPrivate
::
GetPayJson
(
const
QString
&
sum
,
const
QString
&
code
)
{
{
Q_Q
(
FMPePay
);
_current_json
=
QJsonObject
::
fromVariantMap
(
QVariantMap
()
);
_current_json
=
QJsonObject
::
fromVariantMap
(
QVariantMap
()
);
QJsonObject
transaction
;
QJsonObject
transaction
;
...
@@ -375,7 +387,7 @@ bool FMPePayPrivate::GetPayJson(const QString& sum, const QString& code, const Q
...
@@ -375,7 +387,7 @@ bool FMPePayPrivate::GetPayJson(const QString& sum, const QString& code, const Q
_current_json
.
insert
(
FMP_EPAY_VER
,
ver
);
_current_json
.
insert
(
FMP_EPAY_VER
,
ver
);
_current_json
.
insert
(
FMP_EPAY_REQUESTTYPE
,
72
);
_current_json
.
insert
(
FMP_EPAY_REQUESTTYPE
,
72
);
_current_json
.
insert
(
FMP_EPAY_BUSINESSDATE
,
date
);
_current_json
.
insert
(
FMP_EPAY_BUSINESSDATE
,
q
->
_business
date
);
_current_json
.
insert
(
FMP_EPAY_CLIENTREQCOUNT
,
(
int
)((
++
s_ClientReqCount
)
%=
10000000
));
_current_json
.
insert
(
FMP_EPAY_CLIENTREQCOUNT
,
(
int
)((
++
s_ClientReqCount
)
%=
10000000
));
_current_json
.
insert
(
FMP_EPAY_STOREID
,
storeid
);
_current_json
.
insert
(
FMP_EPAY_STOREID
,
storeid
);
_current_json
.
insert
(
FMP_EPAY_STATIONID
,
station
);
_current_json
.
insert
(
FMP_EPAY_STATIONID
,
station
);
...
...
fmp_epay/fmp_epay_p.h
View file @
7f6b32d2
...
@@ -24,7 +24,7 @@ public:
...
@@ -24,7 +24,7 @@ public:
int
Pay
();
int
Pay
();
void
ControlPayJson
(
QString
sum
,
QString
code
,
QString
date
);
void
ControlPayJson
(
QString
sum
,
QString
code
);
void
ControlRefundJson
(
QString
sum
,
QString
code
);
void
ControlRefundJson
(
QString
sum
,
QString
code
);
...
@@ -39,12 +39,13 @@ private:
...
@@ -39,12 +39,13 @@ private:
void
GetReverseJson
();
void
GetReverseJson
();
bool
GetPayJson
(
const
QString
&
sum
,
const
QString
&
code
,
const
QString
&
date
);
bool
GetPayJson
(
const
QString
&
sum
,
const
QString
&
code
);
bool
HttpPost
(
QJsonObject
&
outjson
,
QJsonObject
json
,
QString
&
error
,
int
timeout
=
60
);
bool
HttpPost
(
QJsonObject
&
outjson
,
QJsonObject
json
,
QString
&
error
,
int
timeout
=
60
);
bool
CheckReturnJson
(
QByteArray
data
,
QJsonObject
&
returnjson
);
bool
CheckReturnJson
(
QByteArray
data
,
QJsonObject
&
returnjson
);
void
SetBasicInfo
(
QVariantHash
hash
);
signals
:
signals
:
void
showPayWnd
();
void
showPayWnd
();
...
...
fmp_epay/fmp_epayview_dialog.cpp
View file @
7f6b32d2
...
@@ -11,7 +11,7 @@
...
@@ -11,7 +11,7 @@
#include <QStyledItemDelegate>
#include <QStyledItemDelegate>
FMPPayDialog
::
FMPPayDialog
(
FMPePayPrivate
*
control
,
FMPLoggerInterface
*
logger
,
QWidget
*
parent
)
:
FMPPayDialog
::
FMPPayDialog
(
FMPePayPrivate
*
control
,
FMPLoggerInterface
*
logger
,
Q
VariantHash
basicinfo
,
Q
Widget
*
parent
)
:
_logger
(
logger
),
_logger
(
logger
),
_control
(
control
),
_control
(
control
),
QDialog
(
parent
),
QDialog
(
parent
),
...
@@ -20,6 +20,9 @@ FMPPayDialog::FMPPayDialog(FMPePayPrivate *control, FMPLoggerInterface *logger,
...
@@ -20,6 +20,9 @@ FMPPayDialog::FMPPayDialog(FMPePayPrivate *control, FMPLoggerInterface *logger,
ui
->
setupUi
(
this
);
ui
->
setupUi
(
this
);
QString
businessdate
=
basicinfo
[
FMP_BASIC_BUSINESSDATE
].
toString
();
ui
->
label_date
->
setText
(
businessdate
.
insert
(
4
,
"-"
).
insert
(
7
,
"-"
));
_wait
=
NULL
;
_wait
=
NULL
;
this
->
setWindowFlags
(
windowFlags
()
|
Qt
::
WindowStaysOnTopHint
|
Qt
::
FramelessWindowHint
);
this
->
setWindowFlags
(
windowFlags
()
|
Qt
::
WindowStaysOnTopHint
|
Qt
::
FramelessWindowHint
);
...
@@ -45,8 +48,6 @@ FMPPayDialog::FMPPayDialog(FMPePayPrivate *control, FMPLoggerInterface *logger,
...
@@ -45,8 +48,6 @@ FMPPayDialog::FMPPayDialog(FMPePayPrivate *control, FMPLoggerInterface *logger,
connect
(
_control
,
&
FMPePayPrivate
::
error
,
this
,
&
FMPPayDialog
::
showErrorMsg
);
connect
(
_control
,
&
FMPePayPrivate
::
error
,
this
,
&
FMPPayDialog
::
showErrorMsg
);
connect
(
_control
,
&
FMPePayPrivate
::
finished
,
this
,
&
FMPPayDialog
::
showSuccessMsg
);
connect
(
_control
,
&
FMPePayPrivate
::
finished
,
this
,
&
FMPPayDialog
::
showSuccessMsg
);
getBusinessDate
();
ui
->
lineedit_num
->
setFocus
();
ui
->
lineedit_num
->
setFocus
();
_current_LineEdit
=
ui
->
lineedit_num
;
_current_LineEdit
=
ui
->
lineedit_num
;
...
@@ -55,7 +56,15 @@ FMPPayDialog::FMPPayDialog(FMPePayPrivate *control, FMPLoggerInterface *logger,
...
@@ -55,7 +56,15 @@ FMPPayDialog::FMPPayDialog(FMPePayPrivate *control, FMPLoggerInterface *logger,
QSqlTableModel
*
model
=
_control
->
model
();
QSqlTableModel
*
model
=
_control
->
model
();
model
->
setHeaderData
(
0
,
Qt
::
Horizontal
,
QString
::
fromLocal8Bit
(
"非码交易号"
));
model
->
setHeaderData
(
2
,
Qt
::
Horizontal
,
QString
::
fromLocal8Bit
(
"三方交易号"
));
model
->
setHeaderData
(
4
,
Qt
::
Horizontal
,
QString
::
fromLocal8Bit
(
"交易渠道"
));
model
->
setHeaderData
(
6
,
Qt
::
Horizontal
,
QString
::
fromLocal8Bit
(
"金额(元)"
));
model
->
setHeaderData
(
11
,
Qt
::
Horizontal
,
QString
::
fromLocal8Bit
(
"营业日期"
));
model
->
setHeaderData
(
12
,
Qt
::
Horizontal
,
QString
::
fromLocal8Bit
(
"退款"
));
ui
->
tableView
->
setModel
(
model
);
ui
->
tableView
->
setModel
(
model
);
ui
->
tableView
->
hideColumn
(
1
);
ui
->
tableView
->
hideColumn
(
1
);
ui
->
tableView
->
hideColumn
(
3
);
ui
->
tableView
->
hideColumn
(
3
);
ui
->
tableView
->
hideColumn
(
5
);
ui
->
tableView
->
hideColumn
(
5
);
...
@@ -69,11 +78,11 @@ FMPPayDialog::FMPPayDialog(FMPePayPrivate *control, FMPLoggerInterface *logger,
...
@@ -69,11 +78,11 @@ FMPPayDialog::FMPPayDialog(FMPePayPrivate *control, FMPLoggerInterface *logger,
ui
->
tableView
->
verticalHeader
()
->
setVisible
(
false
);
ui
->
tableView
->
verticalHeader
()
->
setVisible
(
false
);
QHeaderView
*
header
=
ui
->
tableView
->
horizontalHeader
();
QHeaderView
*
header
=
ui
->
tableView
->
horizontalHeader
();
ui
->
tableView
->
setColumnWidth
(
0
,
22
0
);
ui
->
tableView
->
setColumnWidth
(
0
,
18
0
);
ui
->
tableView
->
setColumnWidth
(
2
,
2
6
0
);
ui
->
tableView
->
setColumnWidth
(
2
,
2
2
0
);
ui
->
tableView
->
setColumnWidth
(
4
,
120
);
ui
->
tableView
->
setColumnWidth
(
4
,
120
);
ui
->
tableView
->
setColumnWidth
(
5
,
8
0
);
ui
->
tableView
->
setColumnWidth
(
6
,
10
0
);
ui
->
tableView
->
setColumnWidth
(
6
,
6
0
);
ui
->
tableView
->
setColumnWidth
(
11
,
10
0
);
header
->
setVisible
(
true
);
header
->
setVisible
(
true
);
header
->
setStretchLastSection
(
true
);
header
->
setStretchLastSection
(
true
);
...
@@ -82,11 +91,18 @@ FMPPayDialog::FMPPayDialog(FMPePayPrivate *control, FMPLoggerInterface *logger,
...
@@ -82,11 +91,18 @@ FMPPayDialog::FMPPayDialog(FMPePayPrivate *control, FMPLoggerInterface *logger,
QRegExpValidator
*
pReg
=
new
QRegExpValidator
(
rx
,
this
);
QRegExpValidator
*
pReg
=
new
QRegExpValidator
(
rx
,
this
);
ui
->
lineedit_num
->
setValidator
(
pReg
);
ui
->
lineedit_num
->
setValidator
(
pReg
);
QRegExp
rxs
(
"^[A-Za-z0-9]+$"
);
QRegExpValidator
*
pRegs
=
new
QRegExpValidator
(
rxs
,
this
);
ui
->
lineedit_code
->
setValidator
(
pRegs
);
setPayView
();
setPayView
();
}
}
void
FMPPayDialog
::
showErrorMsg
(
QString
errormsg
)
void
FMPPayDialog
::
showErrorMsg
(
QString
errormsg
)
{
{
//ui->lineedit_num->clear();
ui
->
lineedit_code
->
clear
();
if
(
errormsg
==
""
)
if
(
errormsg
==
""
)
errormsg
=
QString
(
""
);
errormsg
=
QString
(
""
);
...
@@ -98,6 +114,9 @@ void FMPPayDialog::showErrorMsg(QString errormsg)
...
@@ -98,6 +114,9 @@ void FMPPayDialog::showErrorMsg(QString errormsg)
void
FMPPayDialog
::
showSuccessMsg
(
QJsonObject
json
)
void
FMPPayDialog
::
showSuccessMsg
(
QJsonObject
json
)
{
{
ui
->
lineedit_num
->
clear
();
ui
->
lineedit_code
->
clear
();
if
(
!
_wait
->
isHidden
())
if
(
!
_wait
->
isHidden
())
_wait
->
hide
();
_wait
->
hide
();
...
@@ -108,17 +127,11 @@ void FMPPayDialog::showSuccessMsg(QJsonObject json)
...
@@ -108,17 +127,11 @@ void FMPPayDialog::showSuccessMsg(QJsonObject json)
else
else
setRefundSuccessView
(
json
);
setRefundSuccessView
(
json
);
}
}
void
FMPPayDialog
::
setBasicInfo
(
QVariantHash
basicinfo
)
void
FMPPayDialog
::
setBusinessDate
(
QString
date
)
{
{
//调用设置模块设置营业日
QString
date
=
basicinfo
[
FMP_BASIC_BUSINESSDATE
].
toString
();
qDebug
()
<<
"set BusinessDate success"
;
}
void
FMPPayDialog
::
getBusinessDate
()
ui
->
label_date
->
setText
(
date
.
insert
(
4
,
"-"
).
insert
(
7
,
"-"
));
{
//利用设置模块获取营业日并显示
qDebug
()
<<
"get BusinessDate success"
;
}
}
FMPPayDialog
::~
FMPPayDialog
()
FMPPayDialog
::~
FMPPayDialog
()
...
@@ -236,14 +249,55 @@ void FMPPayDialog::setRefundView()
...
@@ -236,14 +249,55 @@ void FMPPayDialog::setRefundView()
void
FMPPayDialog
::
on_btn_num_clicked
()
void
FMPPayDialog
::
on_btn_num_clicked
()
{
{
QRegExp
rx
(
"^(([1-9]+)|([0-9]+\.[0-9]{1,2}))$"
);
QString
num_str
=
qobject_cast
<
QPushButton
*>
(
sender
())
->
text
();
QString
num_str
=
qobject_cast
<
QPushButton
*>
(
sender
())
->
text
();
if
(
rx
.
exactMatch
(
_current_LineEdit
->
text
().
append
(
num_str
))
/*&& _current_LineEdit->text().append(num_str).compare("0.00") != 0*/
)
if
(
_current_LineEdit
==
ui
->
lineedit_num
&&
CheckLineEditSum
(
_current_LineEdit
->
text
().
append
(
num_str
))
)
{
{
_current_LineEdit
->
setText
(
_current_LineEdit
->
text
().
append
(
num_str
));
_current_LineEdit
->
setText
(
_current_LineEdit
->
text
().
append
(
num_str
));
}
}
if
(
_current_LineEdit
==
ui
->
lineedit_code
&&
CheckLineEditCode
(
_current_LineEdit
->
text
().
append
(
num_str
)))
{
_current_LineEdit
->
setText
(
_current_LineEdit
->
text
().
append
(
num_str
));
}
}
bool
FMPPayDialog
::
CheckLineEditSum
(
QString
sum
)
{
if
(
sum
.
compare
(
"0.00"
)
==
0
||
sum
.
compare
(
"00"
)
==
0
)
return
false
;
if
(
sum
.
contains
(
"."
))
{
QStringList
list
=
sum
.
split
(
"."
);
if
(
list
.
size
()
==
2
)
{
QString
tmp
=
list
.
value
(
1
);
if
(
tmp
.
size
()
>
2
)
return
false
;
}
else
return
false
;
}
return
true
;
}
bool
FMPPayDialog
::
CheckLineEditCode
(
QString
code
)
{
int
i
=
0
;
while
(
i
<
code
.
size
())
{
if
(
!
((
code
[
i
]
>=
'a'
&&
code
[
i
]
<=
'z'
)
||
(
code
[
i
]
>=
'A'
&&
code
[
i
]
<=
'Z'
)
||
(
code
[
i
]
>=
'0'
&&
code
[
i
]
<=
'9'
)))
break
;
++
i
;
}
return
(
i
==
code
.
size
());
}
}
void
FMPPayDialog
::
on_btn_pay_clicked
()
void
FMPPayDialog
::
on_btn_pay_clicked
()
...
@@ -265,11 +319,21 @@ void FMPPayDialog::on_btn_confirm_clicked()
...
@@ -265,11 +319,21 @@ void FMPPayDialog::on_btn_confirm_clicked()
}
}
if
(
ui
->
lineedit_num
->
text
()
==
""
||
ui
->
lineedit_num
->
text
().
toDouble
()
<
0.01
||
ui
->
lineedit_code
->
text
()
==
""
||
ui
->
lineedit_code
->
text
().
size
()
<
15
)
{
ui
->
lineedit_num
->
clear
();
ui
->
lineedit_code
->
clear
();
_wait
->
SetContent
(
FMPPayWait
::
ERROR
,
QString
::
fromLocal8Bit
(
"金额或条码错误
\n
请重新输入"
));
_wait
->
show
();
return
;
}
if
(
ui
->
btn_pay
->
isChecked
())
if
(
ui
->
btn_pay
->
isChecked
())
{
{
_wait
->
SetContent
(
FMPPayWait
::
LOADING
,
QString
::
fromLocal8Bit
(
"支付中..."
));
_wait
->
SetContent
(
FMPPayWait
::
LOADING
,
QString
::
fromLocal8Bit
(
"支付中..."
));
_control
->
ControlPayJson
(
ui
->
lineedit_num
->
text
(),
ui
->
lineedit_code
->
text
()
,
ui
->
label_date
->
text
()
);
_control
->
ControlPayJson
(
ui
->
lineedit_num
->
text
(),
ui
->
lineedit_code
->
text
());
}
}
else
else
...
...
fmp_epay/fmp_epayview_dialog.h
View file @
7f6b32d2
...
@@ -3,6 +3,7 @@
...
@@ -3,6 +3,7 @@
#include <QJsonObject>
#include <QJsonObject>
#include <QJsonArray>
#include <QJsonArray>
#include <QVariantHash>
#include <QJsonDocument>
#include <QJsonDocument>
#include <QModelIndex>
#include <QModelIndex>
#include <QDateTime>
#include <QDateTime>
...
@@ -14,7 +15,6 @@
...
@@ -14,7 +15,6 @@
#include "fmp_epayview_focuslineedit.h"
#include "fmp_epayview_focuslineedit.h"
class
FMPePayPrivate
;
class
FMPePayPrivate
;
class
FMPSettingsInterface
;
class
FMPLoggerInterface
;
class
FMPLoggerInterface
;
namespace
Ui
{
namespace
Ui
{
...
@@ -26,7 +26,7 @@ class FMPPayDialog : public QDialog
...
@@ -26,7 +26,7 @@ class FMPPayDialog : public QDialog
Q_OBJECT
Q_OBJECT
public
:
public
:
explicit
FMPPayDialog
(
FMPePayPrivate
*
control
,
FMPLoggerInterface
*
logger
,
QWidget
*
parent
=
0
);
explicit
FMPPayDialog
(
FMPePayPrivate
*
control
,
FMPLoggerInterface
*
logger
,
Q
VariantHash
basicinfo
,
Q
Widget
*
parent
=
0
);
~
FMPPayDialog
();
~
FMPPayDialog
();
public
slots
:
public
slots
:
...
@@ -36,6 +36,8 @@ public slots:
...
@@ -36,6 +36,8 @@ public slots:
void
onSelectionChanged
(
QModelIndex
idx
);
void
onSelectionChanged
(
QModelIndex
idx
);
void
setBasicInfo
(
QVariantHash
basicinfo
);
protected
:
protected
:
void
keyPressEvent
(
QKeyEvent
*
);
void
keyPressEvent
(
QKeyEvent
*
);
...
@@ -75,21 +77,19 @@ private:
...
@@ -75,21 +77,19 @@ private:
void
setCheckView
();
void
setCheckView
();
void
getBusinessDate
();
void
setBusinessDate
(
QString
date
);
void
setPaySuccessView
(
QJsonObject
json
);
void
setPaySuccessView
(
QJsonObject
json
);
void
setRefundSuccessView
(
QJsonObject
json
);
void
setRefundSuccessView
(
QJsonObject
json
);
bool
CheckLineEditSum
(
QString
sum
);
bool
CheckLineEditCode
(
QString
code
);
private
:
private
:
Ui
::
FMPPayDialog
*
ui
;
Ui
::
FMPPayDialog
*
ui
;
FMPFocusLineEdit
*
_current_LineEdit
;
FMPFocusLineEdit
*
_current_LineEdit
;
FMPSettingsInterface
*
_settings
;
FMPePayPrivate
*
_control
;
FMPePayPrivate
*
_control
;
FMPPayWait
*
_wait
;
FMPPayWait
*
_wait
;
...
...
fmp_epay/fmp_epayview_wait.ui
View file @
7f6b32d2
...
@@ -200,13 +200,13 @@ background-color: rgb(148, 148, 148);
...
@@ -200,13 +200,13 @@ background-color: rgb(148, 148, 148);
<property
name=
"minimumSize"
>
<property
name=
"minimumSize"
>
<size>
<size>
<width>
161
</width>
<width>
161
</width>
<height>
41
</height>
<height>
0
</height>
</size>
</size>
</property>
</property>
<property
name=
"maximumSize"
>
<property
name=
"maximumSize"
>
<size>
<size>
<width>
16777215
</width>
<width>
16777215
</width>
<height>
41
</height>
<height>
16777215
</height>
</size>
</size>
</property>
</property>
<property
name=
"font"
>
<property
name=
"font"
>
...
...
fmp_epay/version.h
View file @
7f6b32d2
...
@@ -5,7 +5,7 @@
...
@@ -5,7 +5,7 @@
#define VER_MINOR 1
#define VER_MINOR 1
#define VER_REVISION 0
#define VER_REVISION 0
#define VER_BUILD 1
4
#define VER_BUILD 1
5
//! Convert version numbers to string
//! Convert version numbers to string
#define _STR(S) #S
#define _STR(S) #S
...
...
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