Commit 1a997b69 by xiaoqing.gu

1、悬浮框左右展开 2、退单table页增加退单数量显示 3、修改新登陆界面 4、增加长按悬浮框显示扫码点餐

parent 57a21699
......@@ -34,6 +34,8 @@ QEvent::Type PosEvent::s_driver_order_status = static_cast<QEvent::Type>(QEvent:
QEvent::Type PosEvent::s_get_driver_info = static_cast<QEvent::Type>(QEvent::registerEventType());
QEvent::Type PosEvent::s_need_get_driver_info = static_cast<QEvent::Type>(QEvent::registerEventType());
QEvent::Type PosEvent::s_show_pickup = static_cast<QEvent::Type>(QEvent::registerEventType());
PosEvent::PosEvent(Type e):QEvent(e)
{
//qDebug() << "------event : " << this;
......
......@@ -121,6 +121,9 @@ public:
static Type s_driver_order_status; //拉取到骑手信息并缓存后,推送事件,展示界面响应事件,展示图标
static Type s_get_driver_info; //登陆拉取骑手信息后,推送事件,posorderpool响应事件,将骑手信息缓存
static Type s_need_get_driver_info; //收到消息中心推送的cmd=5的消息的时候,推送的事件
//---------------------长按悬浮框显示扫码点餐界面--------
static Type s_show_pickup;
private:
//事件携带的信息,该内存你应当在堆中分配
void *_info;
......
......@@ -7,6 +7,7 @@
#include "model/posstallspool.h"
#include "view/mainForm.h"
#include "view/floatForm.h"
#include "view/newfloatform.h"
#include "view/newmainform.h"
#include "control/orderlocalizework.h"
#include "control/orderpushwork.h"
......@@ -242,7 +243,8 @@ int main(int argc, char *argv[])
NewLoginForm loginform;
NewMainForm mainform;
FloatForm floatform;
// FloatForm floatform;
NewFloatForm floatform;
mainform.MyShow();
loginform.showfull();
#endif
......
......@@ -64,6 +64,7 @@
#define INI_POSNO "info/posNo"
#define INI_PASSWORD "info/password"
#define INI_AUTOCONFIRM "info/autoconfirm"
#define INI_REMEMBERPWD "info/rememberPwd"
#define INI_AUTOLOGIN "info/autologin"
#define INI_UIVISIBLE "Ui/visible"
......
......@@ -84,7 +84,8 @@ SOURCES += main.cpp \
model/prtmodelpool.cpp \
view/newchangeshiftsform.cpp \
base/Arithmetic/cretopt.cpp \
control/driverinfogetwork.cpp
control/driverinfogetwork.cpp \
view/newfloatform.cpp
HEADERS += \
event/fmapplication.h \
......@@ -143,7 +144,8 @@ HEADERS += \
control/prtmodelgetwork.h \
model/prtmodelpool.h \
view/newchangeshiftsform.h \
control/driverinfogetwork.h
control/driverinfogetwork.h \
view/newfloatform.h
DISTFILES += takeout.rc
......@@ -167,7 +169,8 @@ FORMS += \
view/prttypeform.ui \
view/newloginform.ui \
view/newpickupform.ui \
view/newchangeshiftsform.ui
view/newchangeshiftsform.ui \
view/newfloatform.ui
CONFIG(release, debug|release){
QMAKE_LFLAGS += /DEBUG
......
......@@ -4,6 +4,9 @@
#include <QMouseEvent>
#include <qDebug>
#include "event/posevent.h"
#include "event/fmapplication.h"
#include "model/posorderpool.h"
#include "QsLog.h"
......@@ -13,6 +16,9 @@ MainBtn::MainBtn(QWidget *parent) :
{
ui->setupUi(this);
_checked = false;
FMApplication::subscibeEvent(this, PosEvent::s_change_order);
FMApplication::subscibeEvent(this, PosEvent::s_delete_order);
}
MainBtn::~MainBtn()
......@@ -170,7 +176,59 @@ void MainBtn::SetText(QString data, QString type)
}
}
QString MainBtn::getMainBtnType() const
{
return _type;
}
QString MainBtn::info() const
{
return _info;
}
//bool MainBtn::event(QEvent *e)
//{
// if(e->type() == PosEvent::s_change_order)
// {
// QLOG_DEBUG() << "MainBtn PosEvent::s_change_order:";
// QString orderid;
// GETEVENTINFO(orderid,e,QString);
// int tk_new = 0, tk_make = 0, tk_send = 0, tk_refund = 0;
// int self_new = 0, self_make = 0, self_refund = 0;
// PosOrderPool::GetOrderNum(tk_new, tk_make, tk_send, tk_refund, self_new, self_make, self_refund);
// QLOG_DEBUG() << "tk_new" << tk_new << "tk_make" << tk_make << "tk_send" << tk_send << "self_new" << self_new << "self_make" << self_make;
// QLOG_DEBUG() << "tk_refund" << tk_refund << "self_refund" << self_refund;
// if(_type.compare("refund",Qt::CaseInsensitive) == 0)
// {
// _info = QString::fromUtf8("\xE9\x80\x80\xE5\x8D\x95") + QString("(%1)").arg(QString::number(tk_refund + self_refund));
// }
// return true;
// }
// if(e->type() == PosEvent::s_delete_order)
// {
// QLOG_DEBUG() << "MainBtn PosEvent::s_delete_order:";
// int tk_new = 0, tk_make = 0, tk_send = 0, tk_refund = 0;
// int self_new = 0, self_make = 0, self_refund = 0;
// PosOrderPool::GetOrderNum(tk_new, tk_make, tk_send, tk_refund, self_new, self_make, self_refund);
// QLOG_DEBUG() << "tk_new" << tk_new << "tk_make" << tk_make << "tk_send" << tk_send << "self_new" << self_new << "self_make" << self_make;
// QLOG_DEBUG() << "tk_refund" << tk_refund << "self_refund" << self_refund;
// if(_type.compare("refund",Qt::CaseInsensitive) == 0)
// {
// _info = QString::fromUtf8("\xE9\x80\x80\xE5\x8D\x95") + QString("(%1)").arg(QString::number(tk_refund + self_refund));
// }
// return true;
// }
// return QWidget::event(e);
//}
......@@ -21,8 +21,12 @@ public:
void SetText(QString data, QString type);
QString getMainBtnType() const;
QString info() const;
// virtual bool event(QEvent *e);
signals:
void clicked();
private:
......
#ifndef NEWFLOATFORM_H
#define NEWFLOATFORM_H
#include <QDialog>
#include <QMouseEvent>
#include <QTimer>
#include <QSize>
#include <QPropertyAnimation>
#include <QSound>
namespace Ui {
class NewFloatForm;
}
class NewFloatForm : public QDialog
{
Q_OBJECT
public:
explicit NewFloatForm(QWidget *parent = 0);
~NewFloatForm();
virtual bool event(QEvent *e);
protected:
void mouseMoveEvent(QMouseEvent * event);
void mousePressEvent(QMouseEvent * event);
void mouseReleaseEvent(QMouseEvent * event);
private:
QSize desktopSize;
Ui::NewFloatForm *ui;
// 记录左键按下去后是否移动过
bool m_bMouseMove;
// 记录左键是否按下去
bool m_bMousePress;
// 拖动前鼠标坐标
QPoint m_lastMousePos;
// 此次拖动一共移动的距离
QPoint m_absMove;
// 记录正常状态图片的大小
QSize m_imgNormalSize;
// 记录提示状态图片的大小
QSize m_imgRemindSize;
// 记录是否正在提示
bool m_bReminding;
// 闪烁动画
QPropertyAnimation m_animation;
// 记录音频文件
QString m_remindWav;
// 声音的间隔
int m_wavPlayInterval;
// 置顶定时器
QTimer m_raiseTimer;
QTimer m_remindTimer;
//长按悬浮框计时定时器
QTimer m_clickTimer;
//计时1s加1
int m_num;
// 是否登录成功
bool m_is_login;
//停止标识
bool m_play_flag;
//
/* 功能:初始化
* 参数:NULL
* 返回:NULL
* */
void _Init();
/* 功能:界面展示
* 参数:[1] -1界面展示; 0新订单; 1新退单
* 返回:NULL
* */
void InitWidget(int flag = -1);
private slots:
/* 功能:闪烁
* 参数:NULL
* 返回:NULL
* */
void _Blink();
/* 功能:声音
* 参数:NULL
* 返回:NULL
* */
void _PlayWav();
//udp广播声音播控
void _UdpRadio(QString songName, int type, int time);
//悬浮框大小自适应不同屏幕分辨率
void resetGrid(QDialog *widget,double factorx,double factory);
void OnUpdate();
signals:
/* 功能:通知主窗口显示
* 参数:NULL
* 返回:NULL
* */
void showMainForm();
public slots:
/* 功能:开启提示
* 参数:[1]提示类型 0新订单1申请退款
* 返回:NULL
* */
void onStartRemind(int type);
/* 功能:关闭提示
* 参数:NULL
* 返回:NULL
* */
void onStopRemind();
/* 功能:显示窗口
* 参数:NULL
* 返回:NULL
* */
void onShow();
};
#endif // NEWFLOATFORM_H
......@@ -26,21 +26,34 @@ NewLoginForm::NewLoginForm(QWidget *parent) :
connect(ui->lineEdit_account_2, &ClickedLineEdit::clicked, this, &NewLoginForm::GetCurrLineEdit);
connect(ui->lineEdit_partnerid_2, &ClickedLineEdit::clicked, this, &NewLoginForm::GetCurrLineEdit);
connect(ui->lineEdit_pwd_2, &ClickedLineEdit::clicked, this, &NewLoginForm::GetCurrLineEdit);
connect(ui->lineEdit_posno_2, &ClickedLineEdit::clicked, this, &NewLoginForm::GetCurrLineEdit);
// connect(ui->lineEdit_posno_2, &ClickedLineEdit::clicked, this, &NewLoginForm::GetCurrLineEdit);
connect(ui->lineEdit_storeid_2, &ClickedLineEdit::clicked, this, &NewLoginForm::GetCurrLineEdit);
connect(ui->pushButton_10, &QPushButton::clicked, this, &NewLoginForm::number_btn_click);
connect(ui->pushButton_11, &QPushButton::clicked, this, &NewLoginForm::number_btn_click);
connect(ui->pushButton_12, &QPushButton::clicked, this, &NewLoginForm::number_btn_click);
connect(ui->pushButton_13, &QPushButton::clicked, this, &NewLoginForm::number_btn_click);
connect(ui->pushButton_14, &QPushButton::clicked, this, &NewLoginForm::number_btn_click);
connect(ui->pushButton_15, &QPushButton::clicked, this, &NewLoginForm::number_btn_click);
connect(ui->pushButton_16, &QPushButton::clicked, this, &NewLoginForm::number_btn_click);
connect(ui->pushButton_17, &QPushButton::clicked, this, &NewLoginForm::number_btn_click);
connect(ui->pushButton_18, &QPushButton::clicked, this, &NewLoginForm::number_btn_click);
connect(ui->pushButton_19, &QPushButton::clicked, this, &NewLoginForm::number_btn_click);
connect(ui->pushButton_clear_2, &QPushButton::clicked, this, &NewLoginForm::number_btn_click);
connect(ui->pushButton_del_2, &QPushButton::clicked, this, &NewLoginForm::number_btn_click);
// connect(ui->pushButton_10, &QPushButton::clicked, this, &NewLoginForm::number_btn_click);
// connect(ui->pushButton_11, &QPushButton::clicked, this, &NewLoginForm::number_btn_click);
// connect(ui->pushButton_12, &QPushButton::clicked, this, &NewLoginForm::number_btn_click);
// connect(ui->pushButton_13, &QPushButton::clicked, this, &NewLoginForm::number_btn_click);
// connect(ui->pushButton_14, &QPushButton::clicked, this, &NewLoginForm::number_btn_click);
// connect(ui->pushButton_15, &QPushButton::clicked, this, &NewLoginForm::number_btn_click);
// connect(ui->pushButton_16, &QPushButton::clicked, this, &NewLoginForm::number_btn_click);
// connect(ui->pushButton_17, &QPushButton::clicked, this, &NewLoginForm::number_btn_click);
// connect(ui->pushButton_18, &QPushButton::clicked, this, &NewLoginForm::number_btn_click);
// connect(ui->pushButton_19, &QPushButton::clicked, this, &NewLoginForm::number_btn_click);
// connect(ui->pushButton_clear_2, &QPushButton::clicked, this, &NewLoginForm::number_btn_click);
// connect(ui->pushButton_del_2, &QPushButton::clicked, this, &NewLoginForm::number_btn_click);
connect(ui->pushButton_num0, &QPushButton::clicked, this, &NewLoginForm::number_btn_click);
connect(ui->pushButton_num1, &QPushButton::clicked, this, &NewLoginForm::number_btn_click);
connect(ui->pushButton_num2, &QPushButton::clicked, this, &NewLoginForm::number_btn_click);
connect(ui->pushButton_num3, &QPushButton::clicked, this, &NewLoginForm::number_btn_click);
connect(ui->pushButton_num4, &QPushButton::clicked, this, &NewLoginForm::number_btn_click);
connect(ui->pushButton_num5, &QPushButton::clicked, this, &NewLoginForm::number_btn_click);
connect(ui->pushButton_num6, &QPushButton::clicked, this, &NewLoginForm::number_btn_click);
connect(ui->pushButton_num7, &QPushButton::clicked, this, &NewLoginForm::number_btn_click);
connect(ui->pushButton_num8, &QPushButton::clicked, this, &NewLoginForm::number_btn_click);
connect(ui->pushButton_num9, &QPushButton::clicked, this, &NewLoginForm::number_btn_click);
connect(ui->pushButton_clearBtn, &QPushButton::clicked, this, &NewLoginForm::number_btn_click);
connect(ui->pushButton_delBtn, &QPushButton::clicked, this, &NewLoginForm::number_btn_click);
_curr_lineedit = ui->lineEdit_partnerid_2;
_curr_lineedit->setFocus();
......@@ -52,9 +65,12 @@ NewLoginForm::NewLoginForm(QWidget *parent) :
QString configfile = qApp->applicationDirPath() + "/" + CONFIG_NAME;
m_autologin = QSettings(configfile, QSettings::IniFormat).value(INI_AUTOLOGIN, 0).toInt();
m_rememberPwd = QSettings(configfile, QSettings::IniFormat).value(INI_REMEMBERPWD, 0).toInt();
if(m_autologin)
ui->checkBox_2->setChecked(true);
if(m_rememberPwd)
ui->checkBox_rememberPwd->setChecked(true);
FMApplication::subscibeEvent(this, PosEvent::s_login_status);
FMApplication::subscibeEvent(this, PosEvent::s_opt_status);
......@@ -96,9 +112,12 @@ void NewLoginForm::SetStoreInfo()
ui->lineEdit_partnerid_2->setText(partnerid);
ui->lineEdit_storeid_2->setText(storeid);
ui->lineEdit_posno_2->setText(stationid);
// ui->lineEdit_posno_2->setText(stationid);
ui->lineEdit_account_2->setText(userid);
ui->lineEdit_pwd_2->setText(pwd);
if(ui->checkBox_rememberPwd->isChecked())
ui->lineEdit_pwd_2->setText(pwd);
}
void NewLoginForm::showfull()
......@@ -202,14 +221,21 @@ void NewLoginForm::on_pushButton_login_2_clicked()
else
QSettings(configfile, QSettings::IniFormat).setValue(INI_AUTOLOGIN, 0);
if(ui->checkBox_rememberPwd->isChecked())
QSettings(configfile, QSettings::IniFormat).setValue(INI_REMEMBERPWD, 1);
else
QSettings(configfile, QSettings::IniFormat).setValue(INI_REMEMBERPWD, 0);
QLOG_DEBUG() << "configfile" << configfile;
QVariantMap map;
if(ui->lineEdit_pwd_2->text().isEmpty())
return;
if(ui->lineEdit_account_2->text().isEmpty() ||
ui->lineEdit_pwd_2->text().isEmpty() ||
ui->lineEdit_partnerid_2->text().isEmpty() ||
ui->lineEdit_posno_2->text().isEmpty() ||
/*ui->lineEdit_posno_2->text().isEmpty() ||*/
ui->lineEdit_storeid_2->text().isEmpty() )
{
onShowAlert(AlertForm::ERROR, QString::fromLocal8Bit("商户号/门店号/POS编号/账号/密码均不能为空"));
......@@ -217,7 +243,7 @@ void NewLoginForm::on_pushButton_login_2_clicked()
}
map.insert(JSON_STOREID, ui->lineEdit_storeid_2->text());
map.insert(JSON_STATIONID, ui->lineEdit_posno_2->text());
// map.insert(JSON_STATIONID, ui->lineEdit_posno_2->text());
map.insert(JSON_KEY_USERID, ui->lineEdit_account_2->text());
map.insert(JSON_KEY_PWD, ui->lineEdit_pwd_2->text());
map.insert(JSON_KEY_PARTNERID, ui->lineEdit_partnerid_2->text());
......@@ -249,11 +275,13 @@ void NewLoginForm::number_btn_click()
{
QPushButton *btn = qobject_cast<QPushButton*>(sender());
if(btn == ui->pushButton_clear_2)
// if(btn == ui->pushButton_clear_2)
if(btn == ui->pushButton_clearBtn)
{
_curr_lineedit->clear();
}
else if(btn == ui->pushButton_del_2)
// else if(btn == ui->pushButton_del_2)
else if(btn == ui->pushButton_delBtn)
{
QString text = _curr_lineedit->text();
......
......@@ -49,7 +49,11 @@ private:
// 通知窗口
AlertForm *m_alertForm;
//自动登录标志位
int m_autologin;
//记住密码标志位
int m_rememberPwd;
};
#endif // NEWLOGINFORM_H
......@@ -50,6 +50,7 @@ NewMainForm::NewMainForm(QWidget *parent) :
FMApplication::subscibeEvent(this, PosEvent::s_network_outtime);
FMApplication::subscibeEvent(this, PosEvent::s_show_stalls);
FMApplication::subscibeEvent(this,PosEvent::s_driver_order_status);
FMApplication::subscibeEvent(this,PosEvent::s_show_pickup);
//this->show();
this->showFullScreen();
......@@ -515,7 +516,8 @@ void NewMainForm::ClassifyOrderWithOrderStatus(int order_status)
void NewMainForm::InitMainBtn()
{
ui->newmainbtn_order->SetText("\xE8\xAE\xA2\xE5\x8D\x95\xE7\xAE\xA1\xE7\x90\x86", MAIN_ORDER);
ui->newmainbtn_refund->SetText("\xE9\x80\x80\xE5\x8D\x95", MAIN_REFUND);
// ui->newmainbtn_refund->SetText("\xE9\x80\x80\xE5\x8D\x95", MAIN_REFUND);
ui->newmainbtn_refund->SetText("\xE9\x80\x80\xE5\x8D\x95\x28\x30\x29", MAIN_REFUND);
ui->newmainbtn_shifts->SetText("\xE4\xBA\xA4\xE6\x8E\xA5\xE7\x8F\xAD", MAIN_SHIFT);
ui->newmainbtn_set->SetText("\xE8\xAE\xBE\xE7\xBD\xAE", MAIN_SET);
ui->newmainbtn_scan->SetText("\xE6\x89\xAB\xE7\xA0\x81\xE5\x8F\x96\xE9\xA4\x90", MAIN_SCAN);
......@@ -602,6 +604,21 @@ bool NewMainForm::event(QEvent *e)
InsertTableWidget(order);
}
int tk_new = 0, tk_make = 0, tk_send = 0, tk_refund = 0;
int self_new = 0, self_make = 0, self_refund = 0;
PosOrderPool::GetOrderNum(tk_new, tk_make, tk_send, tk_refund, self_new, self_make, self_refund);
QLOG_DEBUG() << "tk_new" << tk_new << "tk_make" << tk_make << "tk_send" << tk_send << "self_new" << self_new << "self_make" << self_make;
QLOG_DEBUG() << "tk_refund" << tk_refund << "self_refund" << self_refund;
foreach (auto var, _main_btn) {
if(var->getMainBtnType().compare("refund",Qt::CaseInsensitive) == 0)
{
var->SetText((QString::fromUtf8("\xE9\x80\x80\xE5\x8D\x95") + QString("(%1)").arg(QString::number(tk_refund + self_refund))), MAIN_REFUND);
}
}
return true;
}
......@@ -663,6 +680,22 @@ bool NewMainForm::event(QEvent *e)
DeleteTableWidget(value[EVENT_KEY_ORDERID].toString());
_order_indexs.remove(value[EVENT_KEY_ORDERID].toString());
}
int tk_new = 0, tk_make = 0, tk_send = 0, tk_refund = 0;
int self_new = 0, self_make = 0, self_refund = 0;
PosOrderPool::GetOrderNum(tk_new, tk_make, tk_send, tk_refund, self_new, self_make, self_refund);
QLOG_DEBUG() << "tk_new" << tk_new << "tk_make" << tk_make << "tk_send" << tk_send << "self_new" << self_new << "self_make" << self_make;
QLOG_DEBUG() << "tk_refund" << tk_refund << "self_refund" << self_refund;
foreach (auto var, _main_btn) {
if(var->getMainBtnType().compare("refund",Qt::CaseInsensitive) == 0)
{
var->SetText((QString::fromUtf8("\xE9\x80\x80\xE5\x8D\x95") + QString("(%1)").arg(QString::number(tk_refund + self_refund))), MAIN_REFUND);
}
}
return true;
}
......@@ -740,6 +773,13 @@ bool NewMainForm::event(QEvent *e)
return true;
}
if(e->type() == PosEvent::s_show_pickup)
{
this->showFullScreen();
InitWidget(MAIN_SCAN);
return true;
}
return QWidget::event(e);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment