Commit 001f074f by guanghui.cui

花之林支付对接

parent 8835dd27
#include "fmp_cashconfirm_dialog.h"
#include "ui_fmp_cashconfirm_dialog.h"
FMPCashConfirmDialog::FMPCashConfirmDialog(QWidget *parent) :
QDialog(parent),
ui(new Ui::FMPCashConfirmDialog)
{
ui->setupUi(this);
}
FMPCashConfirmDialog::~FMPCashConfirmDialog()
{
delete ui;
}
#ifndef FMP_CASHCONFIRM_DIALOG_H
#define FMP_CASHCONFIRM_DIALOG_H
#include <QDialog>
namespace Ui {
class FMPCashConfirmDialog;
}
class FMPCashConfirmDialog : public QDialog
{
Q_OBJECT
public:
explicit FMPCashConfirmDialog(QWidget *parent = 0);
~FMPCashConfirmDialog();
private:
Ui::FMPCashConfirmDialog *ui;
};
#endif // FMP_CASHCONFIRM_DIALOG_H
<ui version="4.0">
<class>FMPCashConfirmDialog</class>
<widget class="QDialog" name="FMPCashConfirmDialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>400</width>
<height>300</height>
</rect>
</property>
<property name="windowTitle">
<string>Dialog</string>
</property>
</widget>
<resources/>
<connections/>
</ui>
...@@ -472,7 +472,6 @@ void FMPePayPrivate::ControlReverseJson() ...@@ -472,7 +472,6 @@ void FMPePayPrivate::ControlReverseJson()
bool FMPePayPrivate::GetPayJson(const QString& sum, const QString& code) bool FMPePayPrivate::GetPayJson(const QString& sum, const QString& code)
{ {
Q_Q(FMPePay);
_current_json = QJsonObject::fromVariantMap( QVariantMap() ); _current_json = QJsonObject::fromVariantMap( QVariantMap() );
......
...@@ -24,7 +24,7 @@ FMPPayDialog::FMPPayDialog(FMPePayPrivate *control, QVariantHash basicinfo, QWid ...@@ -24,7 +24,7 @@ FMPPayDialog::FMPPayDialog(FMPePayPrivate *control, QVariantHash basicinfo, QWid
{ {
ui->setupUi(this); ui->setupUi(this);
setAttribute(Qt::WA_QuitOnClose, false);
//this->setWindowIconText(QString::fromLocal8Bit("非码支付")); //this->setWindowIconText(QString::fromLocal8Bit("非码支付"));
this->setWindowTitle(QString::fromLocal8Bit("非码支付")); this->setWindowTitle(QString::fromLocal8Bit("非码支付"));
...@@ -90,12 +90,11 @@ FMPPayDialog::FMPPayDialog(FMPePayPrivate *control, QVariantHash basicinfo, QWid ...@@ -90,12 +90,11 @@ FMPPayDialog::FMPPayDialog(FMPePayPrivate *control, QVariantHash basicinfo, QWid
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);
connect(this, &FMPPayDialog::rejected, this, &FMPPayDialog::on_btn_close_clicked);
ui->lineedit_num->setFocus(); ui->lineedit_num->setFocus();
_current_LineEdit = ui->lineedit_num; _current_LineEdit = ui->lineedit_num;
ui->tableView->setEditTriggers(QAbstractItemView::NoEditTriggers); ui->tableView->setEditTriggers(QAbstractItemView::NoEditTriggers);
ui->tableView->setItemDelegate(new FMPPayItemDelegate); ui->tableView->setItemDelegate(new FMPPayItemDelegate);
connect(ui->tableView, SIGNAL(clicked(QModelIndex)), SLOT(onSelectionChanged(QModelIndex))); connect(ui->tableView, SIGNAL(clicked(QModelIndex)), SLOT(onSelectionChanged(QModelIndex)));
...@@ -241,10 +240,21 @@ void FMPPayDialog::showErrorMsg(QString errormsg) ...@@ -241,10 +240,21 @@ void FMPPayDialog::showErrorMsg(QString errormsg)
if(errormsg == "") if(errormsg == "")
errormsg = QString(""); errormsg = QString("");
if(_control->IsByWakeup()){
if(_wait)
_wait->hide();
FMPPayFailedDialog *_pay_failed=new FMPPayFailedDialog(this);
_pay_failed->setModal(true);
_pay_failed->show();
_pay_failed->SetContent(errormsg,ui->lineedit_num->text());
}
else{
_wait->SetContent(FMPPayWait::ERRORS, errormsg); _wait->SetContent(FMPPayWait::ERRORS, errormsg);
if(_wait->isHidden()) if(_wait->isHidden())
_wait->show(); _wait->show();
}
} }
void FMPPayDialog::showSuccessMsg(QJsonObject json) void FMPPayDialog::showSuccessMsg(QJsonObject json)
...@@ -261,6 +271,11 @@ void FMPPayDialog::showSuccessMsg(QJsonObject json) ...@@ -261,6 +271,11 @@ void FMPPayDialog::showSuccessMsg(QJsonObject json)
setPaySuccessView(json); setPaySuccessView(json);
else else
setRefundSuccessView(json); setRefundSuccessView(json);
if(_control->IsByWakeup()){
ui->btn_check->setEnabled(false);
ui->btn_refund->setEnabled(false);
ui->btn_pay->setEnabled(false);
}
} }
void FMPPayDialog::setBasicInfo(QVariantHash basicinfo) void FMPPayDialog::setBasicInfo(QVariantHash basicinfo)
{ {
...@@ -553,7 +568,6 @@ void FMPPayDialog::onBtnConfirmClicked() ...@@ -553,7 +568,6 @@ void FMPPayDialog::onBtnConfirmClicked()
_wait->setModal(true); _wait->setModal(true);
} }
if((ui->lineedit_num->text() == "" && ui->lineedit_num_refund->text() == "") || if((ui->lineedit_num->text() == "" && ui->lineedit_num_refund->text() == "") ||
(ui->lineedit_num->text().toDouble() < 0.01 && ui->lineedit_num_refund->text().toDouble() < 0.01)|| (ui->lineedit_num->text().toDouble() < 0.01 && ui->lineedit_num_refund->text().toDouble() < 0.01)||
(ui->lineedit_code->text() == "" && ui->lineedit_code_refund->text() == "") || (ui->lineedit_code->text() == "" && ui->lineedit_code_refund->text() == "") ||
...@@ -617,9 +631,17 @@ void FMPPayDialog::on_btn_success_confirm_clicked() ...@@ -617,9 +631,17 @@ void FMPPayDialog::on_btn_success_confirm_clicked()
return ; return ;
} }
if(_curt_btn->property("index").toInt() == 0) if(_curt_btn->property("index").toInt() == 0){
setPayView(); setPayView();
//点击确定按钮,关闭窗口
if(_control->IsByWakeup()){
_control->SetWakeupFlag(false);
this->close();
return;
}
}
if(_curt_btn->property("index").toInt() == 1) if(_curt_btn->property("index").toInt() == 1)
setRefundView(); setRefundView();
...@@ -674,3 +696,30 @@ void FMPPayDialog::on_lineEdit_textChanged(const QString &arg1) ...@@ -674,3 +696,30 @@ void FMPPayDialog::on_lineEdit_textChanged(const QString &arg1)
_control->GetCheckMode(arg1); _control->GetCheckMode(arg1);
ui->pushButton_2->setEnabled(false); ui->pushButton_2->setEnabled(false);
} }
void FMPPayDialog::setEditNum(int num)
{
float amount=num/100.00;
ui->lineedit_num->setText(QString::number(amount, 'f', 2));
ui->lineedit_num->clearFocus();
ui->lineedit_code->setFocus();
ui->lineedit_num->setEnabled(false);
ui->btn_close->setVisible(false);
ui->btn_check->setVisible(false);
ui->btn_refund->setVisible(false);
}
void FMPPayDialog::on_cash_pay()
{
_control->ClosePayWindow();
this->close();
}
void FMPPayDialog::closeEvent(QCloseEvent * event)
{
if(_control->IsByWakeup())
event->ignore();
else
QDialog::closeEvent(event);
}
#include "fmp_payfailed_dialog.h"
#include "ui_fmp_payfailed_dialog.h"
FMPPayFailedDialog::FMPPayFailedDialog(QWidget *parent) :
QDialog(parent),
ui(new Ui::FMPPayFailedDialog)
{
ui->setupUi(this);
}
FMPPayFailedDialog::~FMPPayFailedDialog()
{
delete ui;
}
#ifndef FMP_PAYFAILED_DIALOG_H
#define FMP_PAYFAILED_DIALOG_H
#include <QDialog>
namespace Ui {
class FMPPayFailedDialog;
}
class FMPPayFailedDialog : public QDialog
{
Q_OBJECT
public:
explicit FMPPayFailedDialog(QWidget *parent = 0);
~FMPPayFailedDialog();
private:
Ui::FMPPayFailedDialog *ui;
};
#endif // FMP_PAYFAILED_DIALOG_H
<ui version="4.0">
<class>FMPPayFailedDialog</class>
<widget class="QDialog" name="FMPPayFailedDialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>400</width>
<height>300</height>
</rect>
</property>
<property name="windowTitle">
<string>Dialog</string>
</property>
</widget>
<resources/>
<connections/>
</ui>
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