Commit 032d7e1c by Carwyn

1.重做 “界面调整,修复点击崩溃bug修复,动画可配置,任务栏小框显示汉字标题,查询实时响应,修复未选择退款bug”

parent d75b38fb
......@@ -9,6 +9,7 @@ FMPePay::FMPePay(ctkPluginContext *context)
: FMPePayInterface(context),
_url(DEFAULT_EPAY_RWQUESTURL),
_inited(false),
_needanimation(false),
_databasename(DEFAULT_EPAY_DATABASENAME),
_table(DEFAULT_EPAY_TABLE),
_businessdate(QDateTime::currentDateTime().toString("yyyy-MM-dd")),
......@@ -32,6 +33,8 @@ int FMPePay::StopService()
int FMPePay::Pay()
{
if (_inited) return FMP_SUCCESS;
Q_D(FMPePay);
return d->Pay();
}
......
......@@ -25,6 +25,7 @@ public:
void SetBasicInfo(QVariantHash hash);
private:
bool _inited;
bool _needanimation;
QString _url;
QString _databasename;
QString _table;
......
......@@ -49,12 +49,12 @@ public:
}
QWidget * createEditor(QWidget *parent,
const QStyleOptionViewItem &option,
const QModelIndex &index) const Q_DECL_OVERRIDE
{
return 0;
}
// QWidget * createEditor(QWidget *parent,
// const QStyleOptionViewItem &option,
// const QModelIndex &index) const Q_DECL_OVERRIDE
// {
// return 0;
// }
QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const
{
......
......@@ -13,6 +13,7 @@
#define FMP_EPAY_TRANSTRACTION "transactions"
#define FMP_EPAY_TRANSTRACTION_AMOUNT "amount"
#define FMP_EPAY_TRANSTRACTION_CODE "code"
#define FMP_EPAY_ANIMATION "needanimation"
//支付返回
#define FMP_RPAY_PAY_RETURN_PAYID "pay_id"
......
......@@ -63,13 +63,34 @@ FMPePayPrivate::~FMPePayPrivate()
int FMPePayPrivate::StopService()
{
Q_Q(FMPePay);
q->_inited = false;
if(_watcher != nullptr){
delete _watcher;
_watcher = nullptr;
}
if(_payDialog != nullptr) {
delete _payDialog;
_payDialog = nullptr;
}
if(_model != nullptr){
delete _model;
_model = nullptr;
}
if(_db != nullptr){
delete _db;
_db = nullptr;
}
return FMP_SUCCESS;
}
int FMPePayPrivate::Pay()
{
Q_Q(FMPePay);
q->_inited = true;
connect(this, SIGNAL(showPayWnd()), this, SLOT(onShowPayWnd()));
emit showPayWnd();
return FMP_SUCCESS;
......@@ -150,6 +171,7 @@ void FMPePayPrivate::onShowPayWnd()
QVariantHash hash;
hash[FMP_EPAY_ANIMATION] = q->_needanimation;
hash[FMP_EPAY_BUSINESSDATE] = q->_businessdate;
hash[FMP_EPAY_STOREID] = q->_store_id;
hash[FMP_EPAY_STATIONID] = q->_station_id;
......@@ -323,8 +345,6 @@ bool FMPePayPrivate::CheckReturnJson(QByteArray data, QJsonObject &returnjson)
void FMPePayPrivate::SetBasicInfo(QVariantHash hash)
{
Q_Q(FMPePay);
if(_payDialog != NULL)
_payDialog->setBasicInfo(hash);
}
......@@ -338,7 +358,6 @@ void FMPePayPrivate::GetCheckMode(QString sum)
void FMPePayPrivate::GetMode()
{
Q_Q(FMPePay);
_model->setFilter(QString(""));
_model->select();
}
......
......@@ -3,6 +3,7 @@
#include "fmp_epay_def.h"
#include "fmp_epay_p.h"
#include "fmp_epay_checkmodel.h"
#include "fmp_epay_plugin_p.h"
#include <QDebug>
#include <fmp_settings_i.h>
......@@ -23,8 +24,13 @@ FMPPayDialog::FMPPayDialog(FMPePayPrivate *control, FMPLoggerInterface *logger,
ui->setupUi(this);
//this->setWindowIconText(QString::fromLocal8Bit("非码支付"));
this->setWindowTitle(QString::fromLocal8Bit("非码支付"));
_b_mouse_pressed = false;
_needanimation = basicinfo[FMP_EPAY_ANIMATION].toBool();
ui->label_date->setText(QString::fromLocal8Bit("当前营业日 : ") + basicinfo[FMP_EPAY_BUSINESSDATE].toString());
ui->label_storeid->setText(QString::fromLocal8Bit("门店号:") + basicinfo[FMP_EPAY_STOREID].toString());
ui->label_posno->setText(QString::fromLocal8Bit("POS编号:") + basicinfo[FMP_EPAY_STATIONID].toString());
......@@ -76,9 +82,11 @@ FMPPayDialog::FMPPayDialog(FMPePayPrivate *control, FMPLoggerInterface *logger,
connect(ui->btn_check, &QPushButton::clicked, this, &FMPPayDialog::onWidgetChange);
connect(ui->btn_refund, &QPushButton::clicked, this, &FMPPayDialog::onWidgetChange);
connect(_control, &FMPePayPrivate::error, this, &FMPPayDialog::showErrorMsg);
connect(_control, &FMPePayPrivate::finished, this, &FMPPayDialog::showSuccessMsg);
ui->lineedit_num->setFocus();
_current_LineEdit = ui->lineedit_num;
......@@ -119,7 +127,7 @@ FMPPayDialog::FMPPayDialog(FMPePayPrivate *control, FMPLoggerInterface *logger,
header->setVisible(true);
header->setStretchLastSection(true);
QRegExp rx("^(([1-9]+)|([0-9]+\.[0-9]{1,2}))$");
QRegExp rx("^(([1-9]+)|([0-9]+.[0-9]{1,2}))$");
QRegExpValidator *pReg = new QRegExpValidator(rx, this);
ui->lineedit_num->setValidator(pReg);
......@@ -243,11 +251,11 @@ FMPPayDialog::~FMPPayDialog()
delete ui;
if(_control != NULL)
{
delete _control;
_control = NULL;
}
// if(_control != NULL)
// {
// delete _control;
// _control = NULL;
// }
}
......@@ -291,7 +299,6 @@ void FMPPayDialog::mouseReleaseEvent(QMouseEvent *event)
void FMPPayDialog::setPaySuccessView(QJsonObject json)
{
ui->lb5->show();
ui->tlb5->show();
ui->lb6->show();
......@@ -358,6 +365,8 @@ void FMPPayDialog::setRefundView()
void FMPPayDialog::setCheckView()
{
ui->pushButton_2->setEnabled(false);
ui->btn_pay->setChecked(false);
ui->btn_refund->setChecked(false);
ui->btn_check->setChecked(true);
......@@ -423,7 +432,6 @@ bool FMPPayDialog::CheckLineEditCode(QString code)
void FMPPayDialog::PlayAnimation(QWidget *target0, QWidget *target1, Movemode movemode)
{
if(_is_amt)
{
return ;
......@@ -435,11 +443,6 @@ void FMPPayDialog::PlayAnimation(QWidget *target0, QWidget *target1, Movemode mo
ui->btn_refund->setEnabled(false);
ui->btn_check->setEnabled(false);
QPropertyAnimation animation0, animation1;
QEventLoop loop;
connect(&animation0, &QPropertyAnimation::finished, &loop, &QEventLoop::quit);
int tg0_begin_x = 0, tg0_begin_y = 0;
int tg0_end_x = 0, tg0_end_y = 0;
int tg1_begin_x = 0, tg1_begin_y = 0;
......@@ -483,6 +486,13 @@ void FMPPayDialog::PlayAnimation(QWidget *target0, QWidget *target1, Movemode mo
target0->move(tg0_end_x, tg0_end_y);
target1->move(tg1_end_x, tg1_end_y);
if(_needanimation)
{
QPropertyAnimation animation0, animation1;
QEventLoop loop;
connect(&animation0, &QPropertyAnimation::finished, &loop, &QEventLoop::quit);
animation0.setTargetObject(target0);
animation0.setPropertyName("pos");
animation0.setDuration(382);
......@@ -500,6 +510,8 @@ void FMPPayDialog::PlayAnimation(QWidget *target0, QWidget *target1, Movemode mo
animation1.start();
loop.exec();
}
_is_amt = false;
ui->btn_pay->setEnabled(true);
ui->btn_refund->setEnabled(true);
......@@ -564,6 +576,7 @@ void FMPPayDialog::on_btn_clear_clicked()
void FMPPayDialog::on_btn_close_clicked()
{
this->hide();
_control->StopService();
}
void FMPPayDialog::onLineeditCodeGetFocus()
......@@ -629,3 +642,8 @@ void FMPPayDialog::on_btn_backspace_refund_clicked()
{
_current_LineEdit->setText(_current_LineEdit->text().left(_current_LineEdit->text().length() - 1));
}
void FMPPayDialog::on_lineEdit_textChanged(const QString &arg1)
{
_control->GetCheckMode(arg1);
}
......@@ -78,6 +78,8 @@ private slots:
void on_btn_backspace_refund_clicked();
void on_lineEdit_textChanged(const QString &arg1);
private:
void setPayView();
......@@ -112,7 +114,7 @@ private:
bool _success_flag;
bool _is_amt;
bool _needanimation;
bool _b_mouse_pressed;
QPoint _mMovePosition;
};
......
......@@ -5,7 +5,7 @@
#define VER_MINOR 1
#define VER_REVISION 0
#define VER_BUILD 35
#define VER_BUILD 11
//! Convert version numbers to string
#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