Commit 3891324e by xiaoqing.gu

1、添加新的登陆界面 2、修改新订单详情界面的配送时间问题

parent 928fddb8
...@@ -69,7 +69,8 @@ SOURCES += main.cpp \ ...@@ -69,7 +69,8 @@ SOURCES += main.cpp \
view/ordertypeform.cpp \ view/ordertypeform.cpp \
view/orderoptform.cpp \ view/orderoptform.cpp \
view/mainbtn.cpp \ view/mainbtn.cpp \
view/newdetailform.cpp view/newdetailform.cpp \
view/newloginform.cpp
HEADERS += \ HEADERS += \
event/fmapplication.h \ event/fmapplication.h \
...@@ -114,7 +115,8 @@ HEADERS += \ ...@@ -114,7 +115,8 @@ HEADERS += \
view/ordertypeform.h \ view/ordertypeform.h \
view/orderoptform.h \ view/orderoptform.h \
view/mainbtn.h \ view/mainbtn.h \
view/newdetailform.h view/newdetailform.h \
view/newloginform.h
DISTFILES += takeout.rc DISTFILES += takeout.rc
...@@ -134,4 +136,5 @@ FORMS += \ ...@@ -134,4 +136,5 @@ FORMS += \
view/ordertypeform.ui \ view/ordertypeform.ui \
view/orderoptform.ui \ view/orderoptform.ui \
view/mainbtn.ui \ view/mainbtn.ui \
view/newdetailform.ui view/newdetailform.ui \
view/newloginform.ui
...@@ -45,7 +45,11 @@ void NewDetailForm::InitData(OrderObject *orderObject, bool flag) ...@@ -45,7 +45,11 @@ void NewDetailForm::InitData(OrderObject *orderObject, bool flag)
ui->customerInfoLb_dec->setText(QString::fromLocal8Bit("【%1】【<font color=red>%2</font>】").arg(orderObject->customer, ui->customerInfoLb_dec->setText(QString::fromLocal8Bit("【%1】【<font color=red>%2</font>】").arg(orderObject->customer,
orderObject->phone)); orderObject->phone));
ui->addressLb_dec->setText(QString::fromLocal8Bit("【%1】【%2】").arg(orderObject->address,orderObject->address)); ui->addressLb_dec->setText(QString::fromLocal8Bit("【%1】【%2】").arg(orderObject->address,orderObject->address));
ui->deliveryInfoLb_dec->setText(QString::fromLocal8Bit("【%1】【%2】").arg(orderObject->delivery_party,QDateTime::fromTime_t(orderObject->delivery_time).toString("yyyy-MM-dd hh:mm"));
QDateTime dTime = QDateTime::fromTime_t(orderObject->delivery_time);
QString timeStr = dTime.toString(QString::fromLocal8Bit("yyyy-MM-dd hh:mm"));
ui->deliveryInfoLb_dec->setText(QString::fromLocal8Bit("【%1】【%2】").arg(orderObject->delivery_party,timeStr));
QList<DiscountObject *> list = orderObject->disList; QList<DiscountObject *> list = orderObject->disList;
QString disStr; QString disStr;
......
#include "newloginform.h"
#include "ui_newloginform.h"
#include "event/posevent.h"
#include "event/fmapplication.h"
#include "preDefine.h"
#include <QDebug>
#include <QVariantMap>
#include <QSettings>
#include <QsLog.h>
NewLoginForm::NewLoginForm(QWidget *parent) :
QDialog(parent),
ui(new Ui::NewLoginForm)
{
ui->setupUi(this);
is_login = false;
ui->label_logotitle_2->setText(QString::fromLocal8Bit("非码SaaS点餐小程序门店管理"));
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, &LoginForm::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);
_curr_lineedit = ui->lineEdit_partnerid_2;
_curr_lineedit->setFocus();
setWindowFlags(Qt::FramelessWindowHint);
m_alertForm = new AlertForm(this);
FMApplication::subscibeEvent(this, PosEvent::s_login_status);
FMApplication::subscibeEvent(this, PosEvent::s_opt_status);
FMApplication::subscibeEvent(this, PosEvent::s_show_login);
}
void NewLoginForm::onHideAlert()
{
m_alertForm->hide();
}
void NewLoginForm::onShowAlert(AlertForm::Type type, const QString &msg)
{
if(this->isVisible())
{
m_alertForm->SetContent(type, msg);
m_alertForm->show();
}
}
NewLoginForm::~NewLoginForm()
{
delete ui;
}
void NewLoginForm::SetStoreInfo()
{
QString configfile = qApp->applicationDirPath() + "/" + STOREINFO_NAME;
QString storeid = QSettings(configfile, QSettings::IniFormat).value(INI_BASE_STOREID).toString();
QString partnerid = QSettings(configfile, QSettings::IniFormat).value(INI_BASE_PARNETID).toString();
QString userid = QSettings(configfile, QSettings::IniFormat).value(INI_BASE_USERID).toString();
QString pwd = QSettings(configfile, QSettings::IniFormat).value(INI_BASE_PWD).toString();
QString stationid = QSettings(configfile, QSettings::IniFormat).value(INI_BASE_STATIONIID).toString();
if(storeid.isEmpty() || partnerid.isEmpty() || userid.isEmpty() || pwd.isEmpty() || stationid.isEmpty())
return ;
ui->lineEdit_partnerid_2->setText(partnerid);
ui->lineEdit_storeid_2->setText(storeid);
//ui->lineEdit_posno_2->setText(stationid);
ui->lineEdit_account_2->setText(userid);
ui->lineEdit_pwd_2->setText(pwd);
}
void NewLoginForm::showfull()
{
if(!is_login)
{
SetStoreInfo();
this->showFullScreen();
return ;
}
this->hide();
//emit showmainform();
DEFAULTPOSTEVENT(PosEvent::s_show_mainform, "");
}
bool NewLoginForm::event(QEvent *e)
{
if(e->type() == PosEvent::s_opt_status)
{
QVariantMap value;
GETEVENTINFO(value,e,QVariantMap);
if(value.contains(EVENT_KEY_ORDERSTATUS) && value[EVENT_KEY_ORDERSTATUS].toInt() == 0)
{
if(!this->isHidden())
onShowAlert(AlertForm::LOADING, value[EVENT_KEY_MSG].toString());
return true;
}
if(value.contains(EVENT_KEY_STATUS) && value[EVENT_KEY_STATUS].toBool() == false)
{
QLOG_INFO() << value[EVENT_KEY_MSG].toString();
if(!this->isHidden())
onShowAlert(AlertForm::ERROR, value[EVENT_KEY_MSG].toString());
}
else if(value.contains(EVENT_KEY_STATUS) && value[EVENT_KEY_STATUS].toBool() == true)
{
if(!this->isHidden())
onShowAlert(AlertForm::SUCCESS, value[EVENT_KEY_MSG].toString());
}
return true;
}
if(e->type() == PosEvent::s_show_login)
{
this->showfull();
return true;
}
if(e->type() == PosEvent::s_login_status)
{
QVariantMap value;
GETEVENTINFO(value,e,QVariantMap);
if(value.contains(EVENT_KEY_STATUS) && value[EVENT_KEY_STATUS].toBool() == false)
{
QLOG_INFO() << value[EVENT_KEY_MSG].toString();
if(!this->isHidden())
onShowAlert(AlertForm::ERROR, value[EVENT_KEY_MSG].toString());
}
else if(value.contains(EVENT_KEY_STATUS) && value[EVENT_KEY_STATUS].toBool() == true)
{
this->hide();
onHideAlert();
is_login -= true;
//emit showmainform();
DEFAULTPOSTEVENT(PosEvent::s_show_mainform, "");
}
return true;
}
return QDialog::event(e);
}
void NewLoginForm::GetCurrLineEdit()
{
_curr_lineedit = qobject_cast<ClickedLineEdit*>(sender());
}
void NewLoginForm::on_pushButton_login_2_clicked()
{
QVariantMap map;
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_storeid_2->text().isEmpty() )
{
onShowAlert(AlertForm::ERROR, QString::fromLocal8Bit("商户号/门店号/POS编号/账号/密码均不能为空"));
return ;
}
map.insert(JSON_STOREID, ui->lineEdit_storeid_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());
POSTEVENTTYPE(PosEvent::s_login_storeinfo, map, QVariantMap);
}
void NewLoginForm::number_btn_click()
{
QPushButton *btn = qobject_cast<QPushButton*>(sender());
if(btn == ui->pushButton_clear_2)
{
_curr_lineedit->clear();
}
else if(btn == ui->pushButton_del_2)
{
QString text = _curr_lineedit->text();
_curr_lineedit->setText(text.left(text.size() - 1));
}
else
{
_curr_lineedit->setText(_curr_lineedit->text() + btn->property("number").toString());
}
}
void NewLoginForm::on_pushButton_close_clicked()
{
this->hide();
//emit showfloat();
DEFAULTPOSTEVENT(PosEvent::s_show_float, "");
}
#ifndef NEWLOGINFORM_H
#define NEWLOGINFORM_H
#include <QDialog>
#include <QVariantMap>
#include "clickedLineEdit.h"
#include "alertForm.h"
namespace Ui {
class NewLoginForm;
}
class NewLoginForm : public QDialog
{
Q_OBJECT
public:
explicit NewLoginForm(QWidget *parent = 0);
~NewLoginForm();
void showfull();
virtual bool event(QEvent *e);
void onShowAlert(AlertForm::Type type, const QString &msg);
void onHideAlert();
signals:
void showfloat();
void showmainform();
void login(QVariantMap storeinfo);
public slots:
void GetCurrLineEdit();
private slots:
void on_pushButton_login_2_clicked();
void number_btn_click();
void SetStoreInfo();
void on_pushButton_close_clicked();
private:
Ui::NewLoginForm *ui;
ClickedLineEdit *_curr_lineedit;
bool is_login;
// 通知窗口
AlertForm *m_alertForm;
};
#endif // NEWLOGINFORM_H
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