Commit b92c4e0b by NitefullWind

1. 管理界面新增两个查询按钮。 2. 实现流水查询界面可配置查询支付方式。 3. 修复查询界面多次查询倒计时Label不重置Bug。

parent 6b9fa9aa
......@@ -77,5 +77,6 @@ typedef enum
#define CONFIG_LOG_LEVEL "LOG/LEVEL"
#define CONFIG_LOG_SIZE "LOG/SIZE"
#define CONFIG_LOG_COUNT "LOG/COUNT"
#define CONFIG_PAYMENT_METHODS "PaymentMethods"
#endif
......@@ -117,7 +117,7 @@ void Control::Start(const char *indata, char *outdata)
// _widget->ShowWithRequest(_request);
_widget->ShowWithRequest(_posType, _posReqJsonObj);
_widget->ShowWithRequest(_posReqJsonObj);
if(reqType != refund && reqType != pay)
{
......
......@@ -3,6 +3,7 @@
#include "tools.h"
#include "fmglobal.h"
#include <QSettings>
#include <QTextCodec>
#include <QDebug>
/**
......@@ -36,6 +37,13 @@ bool FMPSettings::SetValue(const QString &k, QVariant v)
return d->SetValue(k, v);
}
QStringList FMPSettings::GetAllKeys(const QString &g)
{
Q_D(FMPSettings);
return d->GetAllKeys(g);
}
/**
***************************************************************
*/
......@@ -45,6 +53,7 @@ FMPSettingsPrivate::FMPSettingsPrivate(QObject *parent)
char path[MAX_PATH] = {0};
ToolS::GetProcPath(path);
_sets = new QSettings(QString::fromLocal8Bit("%1/%2").arg(path).arg(USERCONFIG_NAME), QSettings::IniFormat);
_sets->setIniCodec(QTextCodec::codecForName("GB2312"));
}
QVariant FMPSettingsPrivate::GetValue(const QString &k, QVariant default_val)
......@@ -57,3 +66,15 @@ bool FMPSettingsPrivate::SetValue(const QString &k, QVariant v)
_sets->setValue(k, v);
return (_sets->value(k) == v);
}
QStringList FMPSettingsPrivate::GetAllKeys(const QString &g)
{
if(g.isEmpty()) {
return _sets->allKeys();
} else {
_sets->beginGroup(g);
QStringList keys = _sets->allKeys();
_sets->endGroup();
return keys;
}
}
......@@ -20,6 +20,14 @@ public:
QVariant GetValue(const QString &k, QVariant default_val);
bool SetValue(const QString&k, QVariant v);
/**
* @brief GetAllKeys
* 获取所有key,如果参数g不为空,则获取该group下的所有Key
* @param g
* @return
*/
QStringList GetAllKeys(const QString &g="");
private:
FMPSettingsPrivate *d_ptr;
};
......@@ -39,6 +47,8 @@ public:
QVariant GetValue(const QString &k, QVariant default_val);
bool SetValue(const QString&k, QVariant v);
QStringList GetAllKeys(const QString &g="");
public:
FMPSettings *q_ptr;
QSettings *_sets;
......
......@@ -63,11 +63,7 @@ HostWidget::HostWidget(QWidget *parent) :
//ui->tableWidget->horizontalHeader()->setSectionResizeMode(QHeaderView::Stretch);
ui->tableWidget->verticalHeader()->setDefaultSectionSize(45);
ui->btn_mananger_print_shift->setVisible(false);
_paymentMethodBtns->setExclusive(true);
_paymentMethodBtns->addButton(ui->btn_payment_method_ali, 0);
_paymentMethodBtns->addButton(ui->btn_payment_method_wx, 1);
connect(_paymentMethodBtns, SIGNAL(buttonToggled(QAbstractButton*,bool)), this, SLOT(onPaymentMethodBtnsToggled(QAbstractButton*,bool)));
}
......@@ -109,6 +105,44 @@ void HostWidget::InitWidget()
{
_widgetlist.at(i)->hide();
}
// Init manage page.
_posType = (POSType)setting.GetValue(CONFIG_ALL_PARTNER, SIMPHONY).toInt();
int btnNums = 3;
// SPCC显示交班单,其他不显示
if(_posType==SPCC) {
ui->btn_mananger_print_shift->setVisible(true);
btnNums = 4;
} else {
ui->btn_mananger_print_shift->setVisible(false);
ui->btn_mananger_print_shift->setMaximumSize(0,0);
ui->btn_mananger_print_shift->setMinimumSize(0,0);
}
// Simphony不显示流水查询,但显示卡券流水查询和第三方流水查询
ui->btn_mananger_check_coupon->setVisible(false);
ui->btn_mananger_check_coupon->setMaximumSize(0,0);
ui->btn_mananger_check_coupon->setMinimumSize(0,0);
ui->btn_mananger_check_third->setVisible(false);
ui->btn_mananger_check_third->setMaximumSize(0,0);
ui->btn_mananger_check_third->setMinimumSize(0,0);
if(_posType==SIMPHONY) {
ui->btn_mananger_print->setVisible(false);
ui->btn_mananger_print->setMaximumSize(0,0);
ui->btn_mananger_print->setMinimumSize(0,0);
}
int spacing = (qApp->desktop()->availableGeometry().width()-ui->btn_mananger_register->width()*btnNums)/(btnNums+2);
ui->horizontalLayout_manager->setSpacing(spacing);
QStringList payCodes = setting.GetAllKeys(CONFIG_PAYMENT_METHODS);
foreach (QString payCode, payCodes) {
QString payStr = setting.GetValue(QString("%1/%2").arg(CONFIG_PAYMENT_METHODS).arg(payCode), "").toString();
_paymentMethodsMap.insert(payStr, payCode);
ui->comBox_payment_method->addItem(payStr);
}
}
void HostWidget::setRuning(bool runing)
......@@ -336,10 +370,8 @@ void HostWidget::ShowWiteJson(bool flag, QJsonObject object, QString error)
}
}
void HostWidget::ShowWithRequest(POSType posType, QJsonObject requestObj)
void HostWidget::ShowWithRequest(QJsonObject requestObj)
{
_posType = posType;
_type = (ReqType)FMTool::GetJsonValue(requestObj, JSON_KEY_REQTYPE).toInt();
_posReqJsonObj = requestObj;
......@@ -347,26 +379,6 @@ void HostWidget::ShowWithRequest(POSType posType, QJsonObject requestObj)
switch (_type) {
case manage:
{
int btnNums = 3;
if(_posType==SPCC) {
ui->btn_mananger_print_shift->setVisible(true);
btnNums = 4;
} else {
ui->btn_mananger_print_shift->setMaximumSize(0,0);
ui->btn_mananger_print_shift->setMinimumSize(0,0);
}
if(_posType==SIMPHONY) {
btnNums = 2;
ui->btn_mananger_print->setVisible(false);
ui->btn_mananger_print->setMaximumSize(0,0);
ui->btn_mananger_print->setMinimumSize(0,0);
}
int spacing = (qApp->desktop()->availableGeometry().width()-ui->btn_mananger_register->width()*btnNums)/(btnNums+2);
ui->horizontalLayout_manager->setSpacing(spacing);
ShowWidget(ui->Manager);
_curr_show_widget = ui->Manager;
break;
......@@ -766,7 +778,11 @@ void HostWidget::on_btn_find_check_clicked()
list.append(ui->dateEdit_find_begin->text().replace("/","-"));
list.append(ui->dateEdit_find_end->text().replace("/","-"));
list.append(ui->label_find_page->text());
list.append(_paymentMethodBtns->checkedButton()->text());
// 支付方式code
QString currPaymentMethod = ui->comBox_payment_method->currentText();
list.append(_paymentMethodsMap[currPaymentMethod]);
qDebug() << "Find list: " << list;
_label_find_timer->start();
emit RequestWithType(finds, list);
......
......@@ -3,6 +3,7 @@
#include "fmp_window.h"
#include "requestmodel.h"
#include "fmp_settings.h"
#include <QWidget>
#include <QList>
#include <QTimer>
......@@ -29,7 +30,7 @@ public:
~HostWidget();
void ShowWithRequest(AlipayRequest request);
void ShowWithRequest(POSType posType, QJsonObject requestObj);
void ShowWithRequest(QJsonObject requestObj);
void ShowWiteMGS(ReqType type, bool flag, QString message = QString());
......@@ -49,7 +50,7 @@ signals:
void Exits();
//ж
//���������
void Interrupt();
protected:
......@@ -100,6 +101,8 @@ private:
private:
Ui::HostWidget *ui;
FMPSettings setting;
QList<QWidget *> _widgetlist;
QWidget *_curr_show_widget;
......@@ -127,6 +130,8 @@ private:
POSType _posType;
ReqType _type;
QMap<QString, QString> _paymentMethodsMap;
};
#endif // HOSTWIDGET_H
......@@ -6,7 +6,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>2977</width>
<width>3337</width>
<height>839</height>
</rect>
</property>
......@@ -552,64 +552,14 @@
</spacer>
</item>
<item>
<widget class="QPushButton" name="btn_payment_method_ali">
<widget class="QComboBox" name="comBox_payment_method">
<property name="styleSheet">
<string notr="true">#btn_payment_method_ali
<string notr="true">#comBox_payment_method
{
border:0px;
border-radius:2px;
background-color: rgb(0, 179, 238);
font: 75 20px &quot;Microsoft YaHei UI Light&quot;;
max-height: 35px; max-width: 100px;
min-height: 35px; min-width: 100px;
}</string>
</property>
<property name="text">
<string>支付宝</string>
</property>
<property name="checkable">
<bool>true</bool>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Maximum</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="btn_payment_method_wx">
<property name="styleSheet">
<string notr="true">#btn_payment_method_wx
{
border:0px;
border-radius:2px;
background-color: rgb(150, 150, 150);
font: 75 20px &quot;Microsoft YaHei UI Light&quot;;
max-height: 35px; max-width: 100px;
min-height: 35px; min-width: 100px;
background-color: rgb(208, 208, 208);
}</string>
</property>
<property name="text">
<string>微信支付</string>
</property>
<property name="checkable">
<bool>true</bool>
</property>
</widget>
</item>
<item>
......@@ -1802,7 +1752,7 @@ QHeaderView::section{
border:0px;
border-radius:6px;
background-color: rgb(0, 179, 238);
font: 75 35px &quot;Microsoft YaHei UI Light&quot;;
font: 75 30px &quot;Microsoft YaHei UI Light&quot;;
color: rgb(255, 255, 255);
}</string>
</property>
......@@ -1812,6 +1762,66 @@ QHeaderView::section{
</widget>
</item>
<item>
<widget class="QPushButton" name="btn_mananger_check_coupon">
<property name="minimumSize">
<size>
<width>180</width>
<height>180</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>180</width>
<height>180</height>
</size>
</property>
<property name="styleSheet">
<string notr="true">#btn_mananger_check_coupon
{
border:0px;
border-radius:6px;
background-color: rgb(0, 179, 238);
font: 75 30px &quot;Microsoft YaHei UI Light&quot;;
color: rgb(255, 255, 255);
}</string>
</property>
<property name="text">
<string>卡券
交易流水查询</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="btn_mananger_check_third">
<property name="minimumSize">
<size>
<width>180</width>
<height>180</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>180</width>
<height>180</height>
</size>
</property>
<property name="styleSheet">
<string notr="true">#btn_mananger_check_third
{
border:0px;
border-radius:6px;
background-color: rgb(0, 179, 238);
font: 75 30px &quot;Microsoft YaHei UI Light&quot;;
color: rgb(255, 255, 255);
}</string>
</property>
<property name="text">
<string>第三方
交易流水查询</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="btn_mananger_check">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
......@@ -1837,7 +1847,7 @@ QHeaderView::section{
border:0px;
border-radius:6px;
background-color: rgb(0, 179, 238);
font: 75 35px &quot;Microsoft YaHei UI Light&quot;;
font: 75 30px &quot;Microsoft YaHei UI Light&quot;;
color: rgb(255, 255, 255);
}</string>
</property>
......@@ -1872,7 +1882,7 @@ QHeaderView::section{
border:0px;
border-radius:6px;
background-color: rgb(0, 179, 238);
font: 75 35px &quot;Microsoft YaHei UI Light&quot;;
font: 75 30px &quot;Microsoft YaHei UI Light&quot;;
color: rgb(255, 255, 255);
}</string>
</property>
......@@ -1901,7 +1911,7 @@ QHeaderView::section{
border:0px;
border-radius:6px;
background-color: rgb(0, 179, 238);
font: 75 35px &quot;Microsoft YaHei UI Light&quot;;
font: 75 30px &quot;Microsoft YaHei UI Light&quot;;
color: rgb(255, 255, 255);
}</string>
</property>
......
......@@ -296,7 +296,7 @@ private:
QString tmp0 = list[0];
QString tmp1 = list[1];
QString tmp2 = list[2];
QString tmpPayMethod = list[3];
int paymentMethod = list[3].toInt();
QString cur = QDateTime::currentDateTime().toString("hh:mm:ss");
......@@ -314,12 +314,6 @@ private:
json.insert(JSON_KEY_PAGESIZE, 10);
json.insert(JSON_KEY_PAGENUM, tmp2.toInt());
int paymentMethod = 10001;
if(tmpPayMethod == QString::fromLocal8Bit("支付宝")) {
paymentMethod = 10001;
} else if(tmpPayMethod == QString::fromLocal8Bit("微信支付")) {
paymentMethod = 10004;
}
json[JSON_KEY_METHCODE] = paymentMethod;
return true;
......
......@@ -8,6 +8,7 @@ LabelsTimer::LabelsTimer(QLabel *label, int time, QString format) :
_label(label),
_timer(new QTimer(label)),
_time(time),
_tempTime(time),
_format(format)
{
connect(_timer, &QTimer::timeout, this, &LabelsTimer::onTimeout);
......@@ -28,9 +29,10 @@ void LabelsTimer::setLabel(QLabel *label)
void LabelsTimer::start()
{
_label->setText(_format.arg(_time));
_tempTime = _time;
_timer->setInterval(1000);
_timer->start();
onTimeout();
}
void LabelsTimer::start(int time, QString format)
......@@ -42,6 +44,7 @@ void LabelsTimer::start(int time, QString format)
void LabelsTimer::stop()
{
_tempTime = 0;
_timer->stop();
}
......@@ -52,8 +55,8 @@ void LabelsTimer::onTimeout()
emit timeout();
// this->deleteLater();
} else {
_time = _time - 1;
_label->setText(_format.arg(_time));
_label->setText(_format.arg(_tempTime));
emit timeChanged(_time);
_tempTime = _tempTime - 1;
}
}
......@@ -31,7 +31,7 @@ private slots:
private:
QLabel *_label;
QTimer *_timer;
int _time;
int _time, _tempTime;
QString _format;
};
......
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