Commit 54b23d72 by guanghui.cui

支付成功后自动关闭

parent cd2b790f
...@@ -83,7 +83,7 @@ ...@@ -83,7 +83,7 @@
#define FMP_INIKEY_EPAYTIMEOUT "Pay/Timeout" #define FMP_INIKEY_EPAYTIMEOUT "Pay/Timeout"
#define FMP_INIKEY_EPAYURL "Pay/Server" #define FMP_INIKEY_EPAYURL "Pay/Server"
#define FMP_INIKEY_EPAYAUTOCLOSE "Pay/AutoCloseSeconds"
#endif // FMP_EPAY_DEF #endif // FMP_EPAY_DEF
...@@ -38,7 +38,8 @@ FMPePayPrivate::FMPePayPrivate(FMPePay *parent) ...@@ -38,7 +38,8 @@ FMPePayPrivate::FMPePayPrivate(FMPePay *parent)
_watcher(nullptr), _watcher(nullptr),
_reverse_flag(false), _reverse_flag(false),
_is_api(false), _is_api(false),
_api_abort(false) _api_abort(false),
auto_close_seconds(0)
{ {
_watcher = new QFutureWatcher<QByteArray>(); _watcher = new QFutureWatcher<QByteArray>();
connect( _watcher, SIGNAL( finished() ), this, SLOT( witedata() ) ); connect( _watcher, SIGNAL( finished() ), this, SLOT( witedata() ) );
...@@ -143,6 +144,9 @@ void FMPePayPrivate::Init() ...@@ -143,6 +144,9 @@ void FMPePayPrivate::Init()
hash[FMP_EPAY_PARTNERID] = q->_partner_id; hash[FMP_EPAY_PARTNERID] = q->_partner_id;
hash[FMP_EPAY_TIMEOUT] = q->_time_out; hash[FMP_EPAY_TIMEOUT] = q->_time_out;
auto_close_seconds=_setting->GetInt(FMP_INIKEY_EPAYAUTOCLOSE);
auto_close_seconds=auto_close_seconds>0 ? auto_close_seconds:5;
if (!_is_api) { if (!_is_api) {
q->_store_id = _setting->GetString(FMP_INIKEY_LOGINSTOREID); q->_store_id = _setting->GetString(FMP_INIKEY_LOGINSTOREID);
q->_station_id = _setting->GetString(FMP_INIKEY_LOGINPOSID); q->_station_id = _setting->GetString(FMP_INIKEY_LOGINPOSID);
......
...@@ -87,6 +87,7 @@ public: ...@@ -87,6 +87,7 @@ public:
FMPSettingsInterface *_setting; FMPSettingsInterface *_setting;
int auto_close_seconds; //支付成功后自动关闭窗口秒数
private: private:
QJsonObject _origin_request; QJsonObject _origin_request;
QJsonObject _docked_request; QJsonObject _docked_request;
......
...@@ -173,6 +173,10 @@ FMPPayDialog::FMPPayDialog(FMPePayPrivate *control, QVariantHash basicinfo, QWid ...@@ -173,6 +173,10 @@ FMPPayDialog::FMPPayDialog(FMPePayPrivate *control, QVariantHash basicinfo, QWid
ui->btn_refund->setEnabled(false); ui->btn_refund->setEnabled(false);
ui->btn_pay->setEnabled(false); ui->btn_pay->setEnabled(false);
} }
_wnd_close_timer=new QTimer(this);
connect(_wnd_close_timer,SIGNAL(timeout()),this,SLOT(timerHandle()));
_seconds=_control->auto_close_seconds;
} }
void FMPPayDialog::show() void FMPPayDialog::show()
...@@ -292,6 +296,13 @@ void FMPPayDialog::setBasicInfo(QVariantHash basicinfo) ...@@ -292,6 +296,13 @@ void FMPPayDialog::setBasicInfo(QVariantHash basicinfo)
FMPPayDialog::~FMPPayDialog() FMPPayDialog::~FMPPayDialog()
{ {
if(_wnd_close_timer){
if(_wnd_close_timer->isActive()){
_wnd_close_timer->stop();
}
delete _wnd_close_timer;
}
if(_wait != NULL) if(_wait != NULL)
{ {
delete _wait; delete _wait;
...@@ -377,6 +388,7 @@ void FMPPayDialog::setPaySuccessView(QJsonObject json) ...@@ -377,6 +388,7 @@ void FMPPayDialog::setPaySuccessView(QJsonObject json)
PlayAnimation(findChild<QWidget *>(_curt_btn->property("pageName").toString()), ui->wdg_success_main, RightToLeft); PlayAnimation(findChild<QWidget *>(_curt_btn->property("pageName").toString()), ui->wdg_success_main, RightToLeft);
ui->btn_success_confirm->setFocus(); ui->btn_success_confirm->setFocus();
_wnd_close_timer->start(1000);
} }
void FMPPayDialog::setRefundSuccessView(QJsonObject json) void FMPPayDialog::setRefundSuccessView(QJsonObject json)
...@@ -740,3 +752,17 @@ void FMPPayDialog::on_lineEdit_textChanged(const QString &arg1) ...@@ -740,3 +752,17 @@ 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::timerHandle()
{
QString btnText=QString::fromLocal8Bit("确定(");
btnText+=QString::number(_seconds);
btnText+=")";
ui->btn_success_confirm->setText(btnText);
if(_seconds <=0 && _wnd_close_timer->isActive()){
_wnd_close_timer->stop();
on_btn_success_confirm_clicked();
}
_seconds--;
}
...@@ -49,6 +49,7 @@ public slots: ...@@ -49,6 +49,7 @@ public slots:
void setBasicInfo(QVariantHash basicinfo); void setBasicInfo(QVariantHash basicinfo);
void timerHandle(); //定时关闭支付成功窗口
protected: protected:
void keyPressEvent(QKeyEvent *); void keyPressEvent(QKeyEvent *);
...@@ -85,6 +86,7 @@ private slots: ...@@ -85,6 +86,7 @@ private slots:
void on_lineEdit_textChanged(const QString &arg1); void on_lineEdit_textChanged(const QString &arg1);
void reject(); void reject();
public: public:
void setPayView(); void setPayView();
...@@ -123,6 +125,8 @@ private: ...@@ -123,6 +125,8 @@ private:
bool _b_mouse_pressed; bool _b_mouse_pressed;
bool _is_api; bool _is_api;
QPoint _mMovePosition; QPoint _mMovePosition;
QTimer *_wnd_close_timer;
int _seconds;
}; };
#endif // DIALOG_H #endif // DIALOG_H
...@@ -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 19 #define VER_BUILD 21
//! 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