Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
T
takeaway
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
shuai.liu
takeaway
Commits
0c740c8d
Commit
0c740c8d
authored
Jul 23, 2018
by
刘帅
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1. 新订单打印 2. 配置悬浮窗闪烁提示方式
parent
60160aa2
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
109 additions
and
5 deletions
+109
-5
component/process.cpp
+25
-4
fmTakeaway/floatform.cpp
+15
-1
fmTakeaway/floatform.h
+3
-0
fmTakeaway/mainwindow.cpp
+50
-0
fmTakeaway/mainwindow.h
+7
-0
fmTakeaway/tools/configManage.h
+9
-0
No files found.
component/process.cpp
View file @
0c740c8d
...
@@ -64,8 +64,13 @@ QList<QVariantMap> Process::toDstFormat(QJsonDocument docSrc)
...
@@ -64,8 +64,13 @@ QList<QVariantMap> Process::toDstFormat(QJsonDocument docSrc)
else
if
(
status
==
1
||
status
==
2
||
status
==
4
||
status
==
6
||
status
==
200
)
else
if
(
status
==
1
||
status
==
2
||
status
==
4
||
status
==
6
||
status
==
200
)
{
{
dstMap
.
insert
(
QString
(
"type"
),
QString
(
"3"
));
dstMap
.
insert
(
QString
(
"type"
),
QString
(
"3"
));
bodyMap
.
insert
(
"amount"
,
order
[
"product_fee"
].
toInt
());
//明细金额
// 说明:
bodyMap
.
insert
(
"pay"
,
order
[
"user_fee"
].
toInt
()
-
order
[
"send_fee"
].
toInt
());
//用户实付金额-配送费
// amount 明细金额,即所有商品price之和 + 打包费
// pay 用户实付金额-配送费 + 外卖平台承担的优惠金额
bodyMap
.
insert
(
"amount"
,
order
[
"product_fee"
].
toInt
());
bodyMap
.
insert
(
"pay"
,
order
[
"user_fee"
].
toInt
()
-
order
[
"send_fee"
].
toInt
()
+
order
[
"dis_platform_fee"
].
toInt
());
bodyMap
.
insert
(
"source"
,
order
[
"channel"
].
toString
()
==
"eleme"
?
1
:
2
);
//-- 1饿了么 2 美团
bodyMap
.
insert
(
"source"
,
order
[
"channel"
].
toString
()
==
"eleme"
?
1
:
2
);
//-- 1饿了么 2 美团
...
@@ -74,12 +79,28 @@ QList<QVariantMap> Process::toDstFormat(QJsonDocument docSrc)
...
@@ -74,12 +79,28 @@ QList<QVariantMap> Process::toDstFormat(QJsonDocument docSrc)
{
{
QVariantMap
product
=
variant
.
toMap
();
QVariantMap
product
=
variant
.
toMap
();
QVariantMap
item
;
QVariantMap
item
;
item
.
insert
(
"code"
,
product
[
"pid"
].
toString
());
item
.
insert
(
"code"
,
product
[
"pid"
].
toString
());
item
.
insert
(
"num"
,
product
[
"product_amount"
].
toInt
());
if
(
!
product
[
"pid"
].
toString
().
trimmed
().
compare
(
"011002"
))
// 鲜奶小方商品特殊处理
item
.
insert
(
"price"
,
product
[
"price"
].
toInt
());
{
item
.
insert
(
"num"
,
product
[
"product_amount"
].
toInt
()
*
2
);
item
.
insert
(
"price"
,
product
[
"price"
].
toInt
()
/
2
);
}
else
{
item
.
insert
(
"num"
,
product
[
"product_amount"
].
toInt
());
item
.
insert
(
"price"
,
product
[
"price"
].
toInt
());
}
item
.
insert
(
"memo"
,
product
[
"property_tags"
].
toString
());
item
.
insert
(
"memo"
,
product
[
"property_tags"
].
toString
());
itemlist
<<
item
;
itemlist
<<
item
;
}
}
// 103015 外卖餐盒费
QVariantMap
package_fee
;
package_fee
.
insert
(
"code"
,
"103015"
);
package_fee
.
insert
(
"num"
,
1
);
package_fee
.
insert
(
"price"
,
200
);
package_fee
.
insert
(
"memo"
,
"餐盒费"
);
itemlist
<<
package_fee
;
QJsonDocument
doc
=
QJsonDocument
::
fromVariant
(
itemlist
);
QJsonDocument
doc
=
QJsonDocument
::
fromVariant
(
itemlist
);
bodyMap
.
insert
(
"itemlist"
,
doc
.
toVariant
());
bodyMap
.
insert
(
"itemlist"
,
doc
.
toVariant
());
}
}
...
...
fmTakeaway/floatform.cpp
View file @
0c740c8d
...
@@ -66,7 +66,8 @@ void FloatForm::remind(const QString &operation)
...
@@ -66,7 +66,8 @@ void FloatForm::remind(const QString &operation)
m_soundFile
=
QString
(
"%1/wav/%2.wav"
).
arg
(
g_appDir
,
operation
);
m_soundFile
=
QString
(
"%1/wav/%2.wav"
).
arg
(
g_appDir
,
operation
);
QSound
::
play
(
m_soundFile
);
QSound
::
play
(
m_soundFile
);
m_remindIndex
=
0
;
m_remindIndex
=
0
;
m_remindTimer
.
start
(
8000
);
if
(
!
ConfigManage
::
Instance
().
bAlwaysBlink
())
m_remindTimer
.
start
(
8000
);
m_animation
.
start
();
m_animation
.
start
();
}
}
}
}
...
@@ -76,6 +77,12 @@ void FloatForm::mousePressEvent(QMouseEvent *event)
...
@@ -76,6 +77,12 @@ void FloatForm::mousePressEvent(QMouseEvent *event)
{
{
m_bMouseMoved
=
false
;
m_bMouseMoved
=
false
;
m_lastMousePos
=
event
->
globalPos
();
m_lastMousePos
=
event
->
globalPos
();
if
(
ConfigManage
::
Instance
().
bAlwaysBlink
()
&&
m_animation
.
state
()
==
QAbstractAnimation
::
Running
)
{
setWindowOpacity
(
1
);
m_animation
.
stop
();
}
}
}
void
FloatForm
::
mouseMoveEvent
(
QMouseEvent
*
event
)
void
FloatForm
::
mouseMoveEvent
(
QMouseEvent
*
event
)
...
@@ -99,3 +106,10 @@ void FloatForm::mouseReleaseEvent(QMouseEvent *event)
...
@@ -99,3 +106,10 @@ void FloatForm::mouseReleaseEvent(QMouseEvent *event)
qobject_cast
<
QWidget
*>
(
parent
())
->
show
();
qobject_cast
<
QWidget
*>
(
parent
())
->
show
();
}
}
}
}
void
FloatForm
::
hide
()
{
if
(
m_animation
.
state
()
==
QAbstractAnimation
::
Running
)
m_animation
.
stop
();
QDialog
::
hide
();
}
fmTakeaway/floatform.h
View file @
0c740c8d
...
@@ -39,6 +39,9 @@ private:
...
@@ -39,6 +39,9 @@ private:
QTimer
m_remindTimer
;
QTimer
m_remindTimer
;
int
m_remindIndex
;
int
m_remindIndex
;
QPropertyAnimation
m_animation
;
QPropertyAnimation
m_animation
;
public
Q_SLOTS
:
void
hide
();
};
};
#endif // FLOATFORM_H
#endif // FLOATFORM_H
fmTakeaway/mainwindow.cpp
View file @
0c740c8d
...
@@ -4,11 +4,13 @@
...
@@ -4,11 +4,13 @@
#include "flowControl.h"
#include "flowControl.h"
#include "util.h"
#include "util.h"
#include "configManage.h"
#include "configManage.h"
#include "printlib.h"
#include "QsLog.h"
#include "QsLog.h"
#include <QDateTime>
#include <QDateTime>
#include <QHBoxLayout>
#include <QHBoxLayout>
#include <QScrollBar>
#include <QScrollBar>
#include <QDir>
#if _MSC_VER >= 1600
#if _MSC_VER >= 1600
#pragma execution_character_set("utf-8")
#pragma execution_character_set("utf-8")
...
@@ -300,6 +302,53 @@ void MainWindow::_SetTablesSortEnable(bool bEnable)
...
@@ -300,6 +302,53 @@ void MainWindow::_SetTablesSortEnable(bool bEnable)
}
}
}
}
void
MainWindow
::
_PrintNewOrder
(
OrderObject
*
orderObj
)
{
if
(
orderObj
->
status
==
2
)
{
if
(
!
_IsPrinted
(
orderObj
->
order_id
))
{
QFile
file
(
QApplication
::
applicationDirPath
()
+
"/print_configruation.txt"
);
if
(
!
file
.
open
(
QIODevice
::
ReadOnly
|
QIODevice
::
Text
))
{
QLOG_ERROR
()
<<
"read print configruation failed!"
;
return
;
}
QString
error
;
PrintLib
::
GetInstance
().
DoPrint
(
QString
::
fromLocal8Bit
(
file
.
readAll
()),
orderObj
,
error
);
}
else
{
QLOG_DEBUG
()
<<
orderObj
->
order_id
<<
" printed."
;
}
}
}
bool
MainWindow
::
_IsPrinted
(
QString
order_id
)
{
QString
fileName
=
QCoreApplication
::
applicationDirPath
()
+
"/printer/"
+
QDate
::
currentDate
().
toString
(
"yyyy-MM-dd"
)
+
"/printed.txt"
;
QFile
file
(
fileName
);
QDir
().
mkpath
(
QFileInfo
(
fileName
).
absolutePath
());
if
(
!
file
.
open
(
QIODevice
::
ReadWrite
|
QIODevice
::
Text
))
{
qDebug
()
<<
"read printed failed!"
;
return
false
;
}
QTextStream
in
(
&
file
);
QString
String
=
in
.
readLine
();
//返回文件的一行,不包含换行符。
while
(
!
String
.
isNull
())
{
if
(
order_id
==
String
)
return
true
;
String
=
in
.
readLine
();
}
in
<<
order_id
<<
endl
;
return
false
;
}
void
MainWindow
::
onUpdateOrderDisplay
(
OrderObject
*
orderObj
)
void
MainWindow
::
onUpdateOrderDisplay
(
OrderObject
*
orderObj
)
{
{
// 关闭排序否则插入数据会有问题
// 关闭排序否则插入数据会有问题
...
@@ -341,6 +390,7 @@ void MainWindow::onUpdateOrderDisplay(OrderObject *orderObj)
...
@@ -341,6 +390,7 @@ void MainWindow::onUpdateOrderDisplay(OrderObject *orderObj)
}
}
}
}
_PrintNewOrder
(
orderObj
);
// 插入订单
// 插入订单
orderObj
->
table
=
table
;
orderObj
->
table
=
table
;
table
->
insertRow
(
0
);
table
->
insertRow
(
0
);
...
...
fmTakeaway/mainwindow.h
View file @
0c740c8d
...
@@ -64,6 +64,13 @@ private:
...
@@ -64,6 +64,13 @@ private:
* */
* */
void
_SetTablesSortEnable
(
bool
bEnable
);
void
_SetTablesSortEnable
(
bool
bEnable
);
/* 功能:打印新接单,检查是否打印过,没有的话进行打印
* 参数:
* 返回:NULL
* */
void
_PrintNewOrder
(
OrderObject
*
orderObj
);
bool
_IsPrinted
(
QString
order_id
);
private
slots
:
private
slots
:
/* 功能:响应按钮点击*/
/* 功能:响应按钮点击*/
void
onTabBtnClicked
();
void
onTabBtnClicked
();
...
...
fmTakeaway/tools/configManage.h
View file @
0c740c8d
...
@@ -19,6 +19,15 @@ public:
...
@@ -19,6 +19,15 @@ public:
return
m_clientIni
->
value
(
"client/bAutoConfirm"
).
toBool
()
?
1
:
0
;
return
m_clientIni
->
value
(
"client/bAutoConfirm"
).
toBool
()
?
1
:
0
;
}
}
/* 功能:获取是否悬浮窗一直闪烁
* 参数:NULL
* 返回:是否悬浮窗一直闪烁
* */
inline
int
bAlwaysBlink
()
{
return
m_clientIni
->
value
(
"client/bAlwaysBlink"
).
toBool
()
?
1
:
0
;
}
/* 功能:获取是否有门店管理
/* 功能:获取是否有门店管理
* 参数:NULL
* 参数:NULL
* 返回:是否有门店管理
* 返回:是否有门店管理
...
...
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