Commit 88e1b6e4 by guanghui.cui

支付成功后自动关闭(默认5s)增加配置文件字段:"Pay/AutoCloseSeconds"

parent 5813f406
...@@ -71,7 +71,7 @@ ...@@ -71,7 +71,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() ) );
...@@ -140,6 +141,9 @@ void FMPePayPrivate::Init() ...@@ -140,6 +141,9 @@ void FMPePayPrivate::Init()
q->_time_out = _setting->GetInt(FMP_INIKEY_EPAYTIMEOUT); q->_time_out = _setting->GetInt(FMP_INIKEY_EPAYTIMEOUT);
q->_time_out = (q->_time_out > 60 ? q->_time_out : 60); q->_time_out = (q->_time_out > 60 ? q->_time_out : 60);
auto_close_seconds=_setting->GetInt(FMP_INIKEY_EPAYAUTOCLOSE);
auto_close_seconds=auto_close_seconds>0 ? auto_close_seconds:5;
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;
......
...@@ -80,6 +80,7 @@ public: ...@@ -80,6 +80,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;
} }
int FMPPayDialog::getPayAmount() const int FMPPayDialog::getPayAmount() const
...@@ -298,6 +302,13 @@ void FMPPayDialog::setBasicInfo(QVariantHash basicinfo) ...@@ -298,6 +302,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;
...@@ -383,6 +394,7 @@ void FMPPayDialog::setPaySuccessView(QJsonObject json) ...@@ -383,6 +394,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)
...@@ -749,3 +761,17 @@ void FMPPayDialog::on_lineEdit_textChanged(const QString &arg1) ...@@ -749,3 +761,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--;
}
...@@ -51,6 +51,7 @@ public slots: ...@@ -51,6 +51,7 @@ public slots:
void setBasicInfo(QVariantHash basicinfo); void setBasicInfo(QVariantHash basicinfo);
void timerHandle(); //定时关闭支付成功窗口
protected: protected:
void keyPressEvent(QKeyEvent *); void keyPressEvent(QKeyEvent *);
...@@ -125,6 +126,8 @@ private: ...@@ -125,6 +126,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 21 #define VER_BUILD 22
//! 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