Commit e7673af9 by guanghui.cui

强制关闭窗口及处理

parent 001f074f
...@@ -6,9 +6,25 @@ FMPCashConfirmDialog::FMPCashConfirmDialog(QWidget *parent) : ...@@ -6,9 +6,25 @@ FMPCashConfirmDialog::FMPCashConfirmDialog(QWidget *parent) :
ui(new Ui::FMPCashConfirmDialog) ui(new Ui::FMPCashConfirmDialog)
{ {
ui->setupUi(this); ui->setupUi(this);
setWindowFlags(Qt::FramelessWindowHint | windowFlags());
this->setAttribute(Qt::WA_DeleteOnClose);
connect(ui->pushButton_cancel, SIGNAL(clicked()), parent, SLOT(on_cash_cancel()));
connect(ui->pushButton_ok, SIGNAL(clicked()), parent, SLOT(on_cash_pay()));
} }
FMPCashConfirmDialog::~FMPCashConfirmDialog() FMPCashConfirmDialog::~FMPCashConfirmDialog()
{ {
delete ui; delete ui;
} }
void FMPCashConfirmDialog::on_pushButton_cancel_clicked()
{
this->close();
}
void FMPCashConfirmDialog::SetContent(const QString& money)
{
ui->label_money->setText(QString("%1").arg(money));
}
...@@ -15,6 +15,10 @@ public: ...@@ -15,6 +15,10 @@ public:
explicit FMPCashConfirmDialog(QWidget *parent = 0); explicit FMPCashConfirmDialog(QWidget *parent = 0);
~FMPCashConfirmDialog(); ~FMPCashConfirmDialog();
void SetContent(const QString& money);
private slots:
void on_pushButton_cancel_clicked();
private: private:
Ui::FMPCashConfirmDialog *ui; Ui::FMPCashConfirmDialog *ui;
}; };
......
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0"> <ui version="4.0">
<class>FMPCashConfirmDialog</class> <class>FMPCashConfirmDialog</class>
<widget class="QDialog" name="FMPCashConfirmDialog"> <widget class="QDialog" name="FMPCashConfirmDialog">
...@@ -5,13 +6,107 @@ ...@@ -5,13 +6,107 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>400</width> <width>251</width>
<height>300</height> <height>205</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
<string>Dialog</string> <string>Dialog</string>
</property> </property>
<property name="styleSheet">
<string notr="true">QWidget {
color: rgb(100, 100, 100);
font: normal 22px &quot;微软雅黑&quot;;
}
#FMPCashConfirmDialog
{
background-color: rgb(255, 255, 255);
}</string>
</property>
<widget class="QLabel" name="label_warn">
<property name="geometry">
<rect>
<x>30</x>
<y>20</y>
<width>181</width>
<height>31</height>
</rect>
</property>
<property name="styleSheet">
<string notr="true">font: normal 22px &quot;Microsoft YaHei&quot;;</string>
</property>
<property name="text">
<string>请确认已收现金:</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
<widget class="QLabel" name="label_money">
<property name="geometry">
<rect>
<x>80</x>
<y>70</y>
<width>81</width>
<height>30</height>
</rect>
</property>
<property name="styleSheet">
<string notr="true">font: bold 24px &quot;Microsoft YaHei&quot;;
color: red;</string>
</property>
<property name="text">
<string>123</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
<widget class="QPushButton" name="pushButton_cancel">
<property name="geometry">
<rect>
<x>150</x>
<y>120</y>
<width>75</width>
<height>41</height>
</rect>
</property>
<property name="styleSheet">
<string notr="true">#pushButton_cancel
{
font: normal 22px &quot;微软雅黑&quot;;
border-radius: 8px;
background-color: rgb(93, 144, 236);
color: rgb(255, 255, 255);
}</string>
</property>
<property name="text">
<string>取消</string>
</property>
</widget>
<widget class="QPushButton" name="pushButton_ok">
<property name="geometry">
<rect>
<x>20</x>
<y>120</y>
<width>75</width>
<height>41</height>
</rect>
</property>
<property name="styleSheet">
<string notr="true">#pushButton_ok
{
font: normal 22px &quot;微软雅黑&quot;;
border-radius: 8px;
background-color: rgb(93, 144, 236);
color: rgb(255, 255, 255);
}</string>
</property>
<property name="text">
<string>确定</string>
</property>
</widget>
</widget> </widget>
<resources/> <resources/>
<connections/> <connections/>
......
...@@ -56,3 +56,10 @@ void FMPePay::SetBasicInfo(QVariantHash hash) ...@@ -56,3 +56,10 @@ void FMPePay::SetBasicInfo(QVariantHash hash)
this->_businessdate = hash[FMP_BASIC_BUSINESSDATE].toString(); this->_businessdate = hash[FMP_BASIC_BUSINESSDATE].toString();
d->SetBasicInfo(hash); d->SetBasicInfo(hash);
} }
void FMPePay::ControlPayJson(const QByteArray json)
{
Q_D(FMPePay);
qDebug() << "json:"<<json;
d->ParsePayJson(json);
}
...@@ -22,6 +22,7 @@ public: ...@@ -22,6 +22,7 @@ public:
virtual ~FMPePay(); virtual ~FMPePay();
void SetBasicInfo(QVariantHash hash); void SetBasicInfo(QVariantHash hash);
void ControlPayJson(const QByteArray json);
protected slots: protected slots:
void InitService(); void InitService();
......
...@@ -19,7 +19,10 @@ SOURCES += \ ...@@ -19,7 +19,10 @@ SOURCES += \
fmp_epayview_wait.cpp \ fmp_epayview_wait.cpp \
fmp_database.cpp \ fmp_database.cpp \
fmp_pe_handlers.cpp \ fmp_pe_handlers.cpp \
fmnumpad.cpp fmnumpad.cpp \
fmp_payfailed_dialog.cpp \
fmp_cashconfirm_dialog.cpp \
fmp_forceclose_dialog.cpp
HEADERS +=\ HEADERS +=\
fmp_epay.h \ fmp_epay.h \
...@@ -33,7 +36,10 @@ HEADERS +=\ ...@@ -33,7 +36,10 @@ HEADERS +=\
fmp_database.h \ fmp_database.h \
fmp_epay_checkmodel.h \ fmp_epay_checkmodel.h \
fmp_pe_handlers.h \ fmp_pe_handlers.h \
fmnumpad.h fmnumpad.h \
fmp_payfailed_dialog.h \
fmp_cashconfirm_dialog.h \
fmp_forceclose_dialog.h
unix { unix {
target.path = /usr/lib target.path = /usr/lib
...@@ -81,4 +87,7 @@ else { ...@@ -81,4 +87,7 @@ else {
FORMS += \ FORMS += \
fmp_epayview_dialog.ui \ fmp_epayview_dialog.ui \
fmp_epayview_wait.ui \ fmp_epayview_wait.ui \
fmnumpad.ui fmnumpad.ui \
fmp_payfailed_dialog.ui \
fmp_cashconfirm_dialog.ui \
fmp_forceclose_dialog.ui
...@@ -29,6 +29,10 @@ signals: ...@@ -29,6 +29,10 @@ signals:
protected slots: protected slots:
void OnTriggerInit() { FMPluginInterface::OnTriggerInit(); } void OnTriggerInit() { FMPluginInterface::OnTriggerInit(); }
void OnTriggerUninit() { FMPluginInterface::OnTriggerUninit(); } void OnTriggerUninit() { FMPluginInterface::OnTriggerUninit(); }
public:
virtual void ControlPayJson(const QByteArray json) = 0;
// /** // /**
// * @brief ShowPayDialog // * @brief ShowPayDialog
// * 呈现支付主界面 // * 呈现支付主界面
......
...@@ -93,7 +93,7 @@ void FMPePayPrivate::Init() ...@@ -93,7 +93,7 @@ void FMPePayPrivate::Init()
{ {
Q_Q(FMPePay); Q_Q(FMPePay);
q->_inited = true; q->_inited = true;
_wakeupByMonitor=false;
clearorder(); clearorder();
if(_network == nullptr) if(_network == nullptr)
...@@ -210,13 +210,15 @@ void FMPePayPrivate::ControlPayJson(QString sum, QString code) ...@@ -210,13 +210,15 @@ void FMPePayPrivate::ControlPayJson(QString sum, QString code)
} }
FMP_INFO() << "pay json : " << _current_json; FMP_INFO() << "pay json : " << _current_json;
qDebug()<<"pay json ::"<<QJsonDocument(_current_json).toJson();
QString errors; QString errors;
QJsonObject outjson; QJsonObject outjson;
if(!HttpPost(outjson, _current_json ,errors, q->_time_out)) if(!HttpPost(outjson, _current_json ,errors, q->_time_out))
{ {
qDebug()<<"errors json ::"<<QJsonDocument(outjson).toJson();
emit error(errors); emit error(errors);
} }
else else
{ {
...@@ -228,7 +230,17 @@ void FMPePayPrivate::ControlPayJson(QString sum, QString code) ...@@ -228,7 +230,17 @@ void FMPePayPrivate::ControlPayJson(QString sum, QString code)
_db->insert(q->_table, outjson.toVariantHash()); _db->insert(q->_table, outjson.toVariantHash());
emit finished(outjson); emit finished(outjson);
if(_wakeupByMonitor){
//返回支付结果json
FMPProps props;
props["pay_result"] = QJsonDocument(outjson).toJson();
qDebug()<<"pay json ::"<<QJsonDocument(outjson).toJson();
q->PostEvent("payResult",props);
//_wakeupByMonitor=false;
}
} }
}); });
} }
...@@ -472,13 +484,26 @@ void FMPePayPrivate::ControlReverseJson() ...@@ -472,13 +484,26 @@ void FMPePayPrivate::ControlReverseJson()
bool FMPePayPrivate::GetPayJson(const QString& sum, const QString& code) bool FMPePayPrivate::GetPayJson(const QString& sum, const QString& code)
{ {
Q_Q(FMPePay);
if (_wakeupByMonitor) {
_current_json[FMP_EPAY_STOREID]=q->_store_id;
_current_json[FMP_EPAY_PARTNERID]=q->_partner_id.toInt();
QJsonArray _array = _current_json["transactions"].toArray();
QJsonObject transactions=_array.at(0).toObject();
transactions["amount"]=(int)((sum.toDouble() + 0.005) * 100);
transactions[FMP_EPAY_TRANSTRACTION_CODE]=code;
_array[0] = transactions;
_current_json["transactions"] = _array;
FMP_INFO() << "modify json : " << _current_json;
qDebug()<<"json2:"<<QJsonDocument(_current_json).toJson();
}
else{
_current_json = QJsonObject::fromVariantMap( QVariantMap() ); _current_json = QJsonObject::fromVariantMap( QVariantMap() );
QJsonObject transaction; QJsonObject transaction;
QJsonArray transactionarry; QJsonArray transactionarry;
/** /**
* settings get store infomation(or return false) * settings get store infomation(or return false)
**/ **/
...@@ -501,7 +526,7 @@ bool FMPePayPrivate::GetPayJson(const QString& sum, const QString& code) ...@@ -501,7 +526,7 @@ bool FMPePayPrivate::GetPayJson(const QString& sum, const QString& code)
_current_json.insert( FMP_EPAY_OPERATORID, q->_operator_id); _current_json.insert( FMP_EPAY_OPERATORID, q->_operator_id);
_current_json.insert( FMP_EPAY_TRANSID, QDateTime::currentDateTime().toString("yyyyMMddhhmmsszzz")); _current_json.insert( FMP_EPAY_TRANSID, QDateTime::currentDateTime().toString("yyyyMMddhhmmsszzz"));
_current_json.insert( FMP_EPAY_TRANSTRACTION, transactionarry); _current_json.insert( FMP_EPAY_TRANSTRACTION, transactionarry);
}
return true; return true;
} }
...@@ -552,3 +577,58 @@ void FMPePayPrivate::GetReverseJson() ...@@ -552,3 +577,58 @@ void FMPePayPrivate::GetReverseJson()
{ {
_current_json[FMP_EPAY_REQUESTTYPE] = 3; _current_json[FMP_EPAY_REQUESTTYPE] = 3;
} }
void FMPePayPrivate::ParsePayJson(const QByteArray &json)
{
// Q_Q(FMPePay);
QString error;
QJsonParseError jsonError;
QJsonDocument jsonDoc = QJsonDocument::fromJson( json, &jsonError);
if(jsonError.error == QJsonParseError::NoError)
{
QJsonObject jsonObject = jsonDoc.object();
QJsonArray _array = jsonObject["transactions"].toArray();
QJsonObject transactions=_array.at(0).toObject();
int order_amount = transactions["amount"].toInt();
_current_json=jsonObject;
qDebug()<<"json2:" << jsonObject;
if(_payDialog == NULL)
Init();
if(_payDialog != NULL)
_payDialog->setEditNum(order_amount);
_wakeupByMonitor=true;
}else
{
error = "invalid data";
}
}
bool FMPePayPrivate::IsByWakeup()
{
return _wakeupByMonitor;
}
void FMPePayPrivate::ClosePayWindow(int type)
{
Q_Q(FMPePay);
_wakeupByMonitor=false;
//返回支付结果json;发送给socket
FMPProps props;
//状态码:101 现金支付
//状态码:102 socket异常关闭(这个在监控端处理)
//状态码:103 程序强制关闭
if(type==1)
props["pay_result"] = "{\"statusCode\":101}";
else if(type==2)
props["pay_result"] = "{\"statusCode\":103}";
q->PostEvent("payResult",props);
}
void FMPePayPrivate::SetWakeupFlag(bool status)
{
_wakeupByMonitor=status;
}
...@@ -33,6 +33,11 @@ public: ...@@ -33,6 +33,11 @@ public:
void GetMode(); void GetMode();
bool IsByWakeup();
void SetWakeupFlag(bool status);
void ClosePayWindow(int type=1);
QSqlTableModel *model() const; QSqlTableModel *model() const;
private: private:
...@@ -51,6 +56,8 @@ private: ...@@ -51,6 +56,8 @@ private:
void SetBasicInfo(QVariantHash hash); void SetBasicInfo(QVariantHash hash);
void clearorder(); void clearorder();
void ParsePayJson(const QByteArray &json);
signals: signals:
void error(QString errormsg); void error(QString errormsg);
...@@ -69,10 +76,9 @@ public: ...@@ -69,10 +76,9 @@ public:
FMPNetworkInterface *_network; FMPNetworkInterface *_network;
private: private:
bool _wakeupByMonitor;
QJsonObject _current_json; QJsonObject _current_json;
QByteArray _pay_json;
bool _reverse_flag; bool _reverse_flag;
......
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
#include "fmp_epay_p.h" #include "fmp_epay_p.h"
#include "fmp_epay_checkmodel.h" #include "fmp_epay_checkmodel.h"
#include "fmp_epay_plugin_p.h" #include "fmp_epay_plugin_p.h"
#include "fmp_forceclose_dialog.h"
#include <QDebug> #include <QDebug>
#include <fmp_settings_i.h> #include <fmp_settings_i.h>
...@@ -13,6 +14,7 @@ ...@@ -13,6 +14,7 @@
#include <QMouseEvent> #include <QMouseEvent>
#include <Windows.h> #include <Windows.h>
#include <QDesktopWidget> #include <QDesktopWidget>
#include <QMessageBox>
#include <QPropertyAnimation> #include <QPropertyAnimation>
...@@ -24,6 +26,7 @@ FMPPayDialog::FMPPayDialog(FMPePayPrivate *control, QVariantHash basicinfo, QWid ...@@ -24,6 +26,7 @@ FMPPayDialog::FMPPayDialog(FMPePayPrivate *control, QVariantHash basicinfo, QWid
{ {
ui->setupUi(this); ui->setupUi(this);
setAttribute(Qt::WA_QuitOnClose, false); setAttribute(Qt::WA_QuitOnClose, false);
//this->setWindowIconText(QString::fromLocal8Bit("非码支付")); //this->setWindowIconText(QString::fromLocal8Bit("非码支付"));
this->setWindowTitle(QString::fromLocal8Bit("非码支付")); this->setWindowTitle(QString::fromLocal8Bit("非码支付"));
...@@ -42,7 +45,8 @@ FMPPayDialog::FMPPayDialog(FMPePayPrivate *control, QVariantHash basicinfo, QWid ...@@ -42,7 +45,8 @@ FMPPayDialog::FMPPayDialog(FMPePayPrivate *control, QVariantHash basicinfo, QWid
_is_amt = false; _is_amt = false;
this->setWindowFlags( windowFlags() | Qt::WindowStaysOnTopHint | Qt::FramelessWindowHint); this->setWindowFlags( windowFlags() | Qt::WindowStaysOnTopHint | Qt::FramelessWindowHint);
this->setWindowFlags(Qt::FramelessWindowHint); this->setWindowState(Qt::WindowActive);
// this->setWindowFlags(Qt::FramelessWindowHint);
connect(ui->btn_num0, &QPushButton::clicked, this, &FMPPayDialog::onBtnNumClicked); connect(ui->btn_num0, &QPushButton::clicked, this, &FMPPayDialog::onBtnNumClicked);
connect(ui->btn_num00, &QPushButton::clicked, this, &FMPPayDialog::onBtnNumClicked); connect(ui->btn_num00, &QPushButton::clicked, this, &FMPPayDialog::onBtnNumClicked);
...@@ -149,13 +153,16 @@ FMPPayDialog::FMPPayDialog(FMPePayPrivate *control, QVariantHash basicinfo, QWid ...@@ -149,13 +153,16 @@ FMPPayDialog::FMPPayDialog(FMPePayPrivate *control, QVariantHash basicinfo, QWid
ui->wdg_pay_main->move(0, 0); ui->wdg_pay_main->move(0, 0);
setPayView(); setPayView();
} }
void FMPPayDialog::show() void FMPPayDialog::show()
{ {
showNormal(); showNormal();
HWND hForeWnd = ::GetForegroundWindow();
DWORD dwForeID = ::GetWindowThreadProcessId(hForeWnd,NULL);
DWORD dwCurID = ::GetCurrentThreadId();
::AttachThreadInput(dwCurID,dwForeID,TRUE);
::SetForegroundWindow((HWND)effectiveWinId()); ::SetForegroundWindow((HWND)effectiveWinId());
::SetWindowPos( (HWND)effectiveWinId(), HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_SHOWWINDOW); ::SetWindowPos( (HWND)effectiveWinId(), HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_SHOWWINDOW);
...@@ -163,7 +170,7 @@ void FMPPayDialog::show() ...@@ -163,7 +170,7 @@ void FMPPayDialog::show()
showNormal(); showNormal();
::SetForegroundWindow((HWND)effectiveWinId()); ::SetForegroundWindow((HWND)effectiveWinId());
::AttachThreadInput(dwCurID,dwForeID,FALSE);
QDesktopWidget w; QDesktopWidget w;
QRect rc = w.availableGeometry(); QRect rc = w.availableGeometry();
setGeometry((rc.width() - width()) / 2, (rc.height() - height()) / 2, width(), height()); setGeometry((rc.width() - width()) / 2, (rc.height() - height()) / 2, width(), height());
...@@ -574,6 +581,7 @@ void FMPPayDialog::onBtnConfirmClicked() ...@@ -574,6 +581,7 @@ void FMPPayDialog::onBtnConfirmClicked()
(ui->lineedit_code->text().size() < 15 && ui->lineedit_code_refund->text().size() < 15) (ui->lineedit_code->text().size() < 15 && ui->lineedit_code_refund->text().size() < 15)
) )
{ {
if(!_control->IsByWakeup())
ui->lineedit_num->clear(); ui->lineedit_num->clear();
ui->lineedit_code->clear(); ui->lineedit_code->clear();
ui->lineedit_num_refund->clear(); ui->lineedit_num_refund->clear();
...@@ -615,8 +623,23 @@ void FMPPayDialog::on_btn_clear_clicked() ...@@ -615,8 +623,23 @@ void FMPPayDialog::on_btn_clear_clicked()
void FMPPayDialog::on_btn_close_clicked() void FMPPayDialog::on_btn_close_clicked()
{ {
if(_control->IsByWakeup())
{
if(_success_flag){
this->hide();
_control->Uninit();
}
else{
fmp_forceClose_dialog *_force_close=new fmp_forceClose_dialog(this);
_force_close->setModal(true);
_force_close->show();
}
}
else{
this->hide(); this->hide();
_control->Uninit(); _control->Uninit();
}
} }
void FMPPayDialog::onLineeditCodeGetFocus() void FMPPayDialog::onLineeditCodeGetFocus()
...@@ -705,7 +728,7 @@ void FMPPayDialog::setEditNum(int num) ...@@ -705,7 +728,7 @@ void FMPPayDialog::setEditNum(int num)
ui->lineedit_code->setFocus(); ui->lineedit_code->setFocus();
ui->lineedit_num->setEnabled(false); ui->lineedit_num->setEnabled(false);
ui->btn_close->setVisible(false); // ui->btn_close->setVisible(false);
ui->btn_check->setVisible(false); ui->btn_check->setVisible(false);
ui->btn_refund->setVisible(false); ui->btn_refund->setVisible(false);
} }
...@@ -716,6 +739,12 @@ void FMPPayDialog::on_cash_pay() ...@@ -716,6 +739,12 @@ void FMPPayDialog::on_cash_pay()
this->close(); this->close();
} }
void FMPPayDialog::on_force_close()
{
_control->ClosePayWindow(2);
this->close();
}
void FMPPayDialog::closeEvent(QCloseEvent * event) void FMPPayDialog::closeEvent(QCloseEvent * event)
{ {
if(_control->IsByWakeup()) if(_control->IsByWakeup())
......
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
#include <QLineEdit> #include <QLineEdit>
#include "fmp_epayview_wait.h" #include "fmp_epayview_wait.h"
#include "fmp_epayview_focuslineedit.h" #include "fmp_epayview_focuslineedit.h"
#include "fmp_payfailed_dialog.h"
class FMPePayPrivate; class FMPePayPrivate;
class FMPLoggerInterface; class FMPLoggerInterface;
...@@ -49,6 +50,12 @@ public slots: ...@@ -49,6 +50,12 @@ public slots:
void setBasicInfo(QVariantHash basicinfo); void setBasicInfo(QVariantHash basicinfo);
void setEditNum(int num);
void on_cash_pay();
void on_force_close();
protected: protected:
void keyPressEvent(QKeyEvent *); void keyPressEvent(QKeyEvent *);
...@@ -101,6 +108,8 @@ private: ...@@ -101,6 +108,8 @@ private:
//----------- //-----------
void PlayAnimation(QWidget* target0, QWidget* target1, Movemode movemode); void PlayAnimation(QWidget* target0, QWidget* target1, Movemode movemode);
void closeEvent(QCloseEvent * event);
private: private:
Ui::FMPPayDialog *ui; Ui::FMPPayDialog *ui;
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>786</width> <width>786</width>
<height>624</height> <height>630</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
......
#include "fmp_forceclose_dialog.h"
#include "ui_fmp_forceclose_dialog.h"
fmp_forceClose_dialog::fmp_forceClose_dialog(QWidget *parent) :
QDialog(parent),
ui(new Ui::fmp_forceClose_dialog)
{
ui->setupUi(this);
setWindowFlags(Qt::FramelessWindowHint | windowFlags());
this->setAttribute(Qt::WA_DeleteOnClose);
connect(ui->pushButton_ok, SIGNAL(clicked()), parent, SLOT(on_force_close()));
}
fmp_forceClose_dialog::~fmp_forceClose_dialog()
{
delete ui;
}
void fmp_forceClose_dialog::on_pushButton_ok_clicked()
{
}
void fmp_forceClose_dialog::on_pushButton_cancel_clicked()
{
this->close();
}
#ifndef FMP_FORCECLOSE_DIALOG_H
#define FMP_FORCECLOSE_DIALOG_H
#include <QDialog>
namespace Ui {
class fmp_forceClose_dialog;
}
class fmp_forceClose_dialog : public QDialog
{
Q_OBJECT
public:
explicit fmp_forceClose_dialog(QWidget *parent = 0);
~fmp_forceClose_dialog();
private slots:
void on_pushButton_ok_clicked();
void on_pushButton_cancel_clicked();
private:
Ui::fmp_forceClose_dialog *ui;
};
#endif // FMP_FORCECLOSE_DIALOG_H
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>fmp_forceClose_dialog</class>
<widget class="QDialog" name="fmp_forceClose_dialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>400</width>
<height>212</height>
</rect>
</property>
<property name="windowTitle">
<string>Dialog</string>
</property>
<property name="styleSheet">
<string notr="true">QWidget {
color: rgb(100, 100, 100);
font: normal 22px &quot;微软雅黑&quot;;
}
#fmp_forceClose_dialog
{
background-color: rgb(255, 255, 255);
}</string>
</property>
<widget class="QLabel" name="label_warn">
<property name="geometry">
<rect>
<x>40</x>
<y>40</y>
<width>321</width>
<height>31</height>
</rect>
</property>
<property name="styleSheet">
<string notr="true"/>
</property>
<property name="text">
<string>收银尚未完成,确定要关闭吗?</string>
</property>
</widget>
<widget class="QPushButton" name="pushButton_ok">
<property name="geometry">
<rect>
<x>60</x>
<y>110</y>
<width>91</width>
<height>41</height>
</rect>
</property>
<property name="styleSheet">
<string notr="true">#pushButton_ok
{
font: normal 22px &quot;微软雅黑&quot;;
border-radius: 8px;
background-color: rgb(93, 144, 236);
color: rgb(255, 255, 255);
}</string>
</property>
<property name="text">
<string>确定</string>
</property>
</widget>
<widget class="QPushButton" name="pushButton_cancel">
<property name="geometry">
<rect>
<x>220</x>
<y>110</y>
<width>91</width>
<height>41</height>
</rect>
</property>
<property name="styleSheet">
<string notr="true">#pushButton_cancel
{
font: normal 22px &quot;微软雅黑&quot;;
border-radius: 8px;
background-color: rgb(93, 144, 236);
color: rgb(255, 255, 255);
}</string>
</property>
<property name="text">
<string>取消</string>
</property>
</widget>
</widget>
<resources/>
<connections/>
</ui>
...@@ -6,9 +6,42 @@ FMPPayFailedDialog::FMPPayFailedDialog(QWidget *parent) : ...@@ -6,9 +6,42 @@ FMPPayFailedDialog::FMPPayFailedDialog(QWidget *parent) :
ui(new Ui::FMPPayFailedDialog) ui(new Ui::FMPPayFailedDialog)
{ {
ui->setupUi(this); ui->setupUi(this);
setWindowFlags(Qt::FramelessWindowHint | windowFlags());
this->setAttribute(Qt::WA_DeleteOnClose);
connect(this, SIGNAL(cash_pay()), parent, SLOT(on_cash_pay()));
} }
FMPPayFailedDialog::~FMPPayFailedDialog() FMPPayFailedDialog::~FMPPayFailedDialog()
{ {
delete ui; delete ui;
} }
void FMPPayFailedDialog::on_pushButton_retry_clicked()
{
close();
}
void FMPPayFailedDialog::on_pushButton_cash_clicked()
{
FMPCashConfirmDialog *_CashConfirm=new FMPCashConfirmDialog(this);
_CashConfirm->setModal(true);
_CashConfirm->show();
_CashConfirm->SetContent(_money);
}
void FMPPayFailedDialog::on_cash_cancel()
{
this->close();
}
void FMPPayFailedDialog::on_cash_pay()
{
emit cash_pay();
}
void FMPPayFailedDialog::SetContent(const QString& msg,const QString& money)
{
_money=money;
ui->label_warn->setText(QString("本次支付没有成功[%1]").arg(msg));
}
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
#define FMP_PAYFAILED_DIALOG_H #define FMP_PAYFAILED_DIALOG_H
#include <QDialog> #include <QDialog>
#include "fmp_cashconfirm_dialog.h"
namespace Ui { namespace Ui {
class FMPPayFailedDialog; class FMPPayFailedDialog;
...@@ -15,6 +16,21 @@ public: ...@@ -15,6 +16,21 @@ public:
explicit FMPPayFailedDialog(QWidget *parent = 0); explicit FMPPayFailedDialog(QWidget *parent = 0);
~FMPPayFailedDialog(); ~FMPPayFailedDialog();
void SetContent(const QString& msg,const QString& money);
public slots:
void on_cash_cancel();
void on_cash_pay();
private slots:
void on_pushButton_retry_clicked();
void on_pushButton_cash_clicked();
signals:
void cash_pay();
private:
QString _money;
private: private:
Ui::FMPPayFailedDialog *ui; Ui::FMPPayFailedDialog *ui;
}; };
......
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0"> <ui version="4.0">
<class>FMPPayFailedDialog</class> <class>FMPPayFailedDialog</class>
<widget class="QDialog" name="FMPPayFailedDialog"> <widget class="QDialog" name="FMPPayFailedDialog">
...@@ -5,13 +6,110 @@ ...@@ -5,13 +6,110 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>400</width> <width>431</width>
<height>300</height> <height>198</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
<string>Dialog</string> <string>Dialog</string>
</property> </property>
<property name="styleSheet">
<string notr="true">#FMPPayFailedDialog
{
background-color: rgb(255, 255, 255);
}</string>
</property>
<widget class="QPushButton" name="pushButton_cash">
<property name="geometry">
<rect>
<x>250</x>
<y>120</y>
<width>121</width>
<height>51</height>
</rect>
</property>
<property name="styleSheet">
<string notr="true">#pushButton_cash
{
font: normal 22px &quot;微软雅黑&quot;;
border-radius: 8px;
background-color: rgb(93, 144, 236);
color: rgb(255, 255, 255);
}</string>
</property>
<property name="text">
<string>现金埋单</string>
</property>
</widget>
<widget class="QPushButton" name="pushButton_retry">
<property name="geometry">
<rect>
<x>50</x>
<y>120</y>
<width>121</width>
<height>51</height>
</rect>
</property>
<property name="styleSheet">
<string notr="true">#pushButton_retry
{
font: normal 22px &quot;微软雅黑&quot;;
border-radius: 8px;
background-color: rgb(93, 144, 236);
color: rgb(255, 255, 255);
}</string>
</property>
<property name="text">
<string>重新扫码</string>
</property>
<property name="default">
<bool>true</bool>
</property>
</widget>
<widget class="QLabel" name="label_warn">
<property name="geometry">
<rect>
<x>10</x>
<y>10</y>
<width>401</width>
<height>61</height>
</rect>
</property>
<property name="styleSheet">
<string notr="true">color: rgb(100, 100, 100);
font: 22px &quot;微软雅黑&quot;;
</string>
</property>
<property name="text">
<string>本次支付没有成功(错误:%1)</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
<widget class="QLabel" name="label">
<property name="geometry">
<rect>
<x>10</x>
<y>80</y>
<width>401</width>
<height>31</height>
</rect>
</property>
<property name="styleSheet">
<string notr="true">color: rgb(100, 100, 100);
font: 22px &quot;微软雅黑&quot;;</string>
</property>
<property name="text">
<string>请重新扫码</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</widget> </widget>
<resources/> <resources/>
<connections/> <connections/>
......
...@@ -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 11 #define VER_BUILD 13
//! Convert version numbers to string //! Convert version numbers to string
#define _STR(S) #S #define _STR(S) #S
......
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