Commit 75a22813 by gujin.wang

修改查询核销记录为请求服务端接口

parent 62d46658
...@@ -18,16 +18,16 @@ Level=4 ...@@ -18,16 +18,16 @@ Level=4
[Home] [Home]
Server=http://115.159.226.87:20001/api/user/login Server=http://115.159.226.87:20001/api/user/login
PartnerId=1371 PartnerId=1739
StoreId=aaa StoreId=SH058
PosId=bbb PosId=01
Position=2561, 423 Position=2592, 158
CashierId=001 CashierId=001
OperatorId=01 OperatorId=01
ShowStoreInfo=0 ShowStoreInfo=0
[Pay] [Pay]
Server=https://115.159.18.100/api Server="http://115.159.119.32:27935/api?partner=yhdw"
Timeout=60 Timeout=60
[Vip] [Vip]
...@@ -35,6 +35,7 @@ Server=http://member.freemudorder.com/member_today/service/restful/pos ...@@ -35,6 +35,7 @@ Server=http://member.freemudorder.com/member_today/service/restful/pos
[Coupon] [Coupon]
Server=http://115.159.142.32/api Server=http://115.159.142.32/api
RedeemLog=http://115.159.119.32:27935/getRedeemLog
[Syncer] [Syncer]
Interval=3 Interval=3
......
...@@ -27,6 +27,6 @@ void ConsumOkDialog::showConsumOk(const QString& act_name, const QString& code_n ...@@ -27,6 +27,6 @@ void ConsumOkDialog::showConsumOk(const QString& act_name, const QString& code_n
v.ui->labCode->setText( coupon); v.ui->labCode->setText( coupon);
v.ui->labActName->setText( act_name); v.ui->labActName->setText( act_name);
v.ui->labTime->setText( time_name); v.ui->labTime->setText( time_name);
v.ui->labCodeName->setText( code_name); v.ui->labChannel->setText(QString::fromLocal8Bit("渠道:") + code_name);
v.exec(); v.exec();
} }
\ No newline at end of file
...@@ -57,9 +57,9 @@ ...@@ -57,9 +57,9 @@
font-weight:bold; font-weight:bold;
color: rgb(255, 255, 0); color: rgb(255, 255, 0);
} }
#labCodeName{ #labChannel{
font: 72 23pt "微软雅黑"; font: 72 23pt "微软雅黑";
color: rgb(146, 53, 50); color: rgb(255, 255, 255);
} }
#labTime{ #labTime{
...@@ -179,7 +179,7 @@ ...@@ -179,7 +179,7 @@
<set>Qt::AlignCenter</set> <set>Qt::AlignCenter</set>
</property> </property>
</widget> </widget>
<widget class="QLabel" name="labCodeName"> <widget class="QLabel" name="labChannel">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>0</x> <x>0</x>
...@@ -201,10 +201,10 @@ ...@@ -201,10 +201,10 @@
</size> </size>
</property> </property>
<property name="text"> <property name="text">
<string>键位促销</string> <string>渠道:浦发银行</string>
</property> </property>
<property name="alignment"> <property name="alignment">
<set>Qt::AlignCenter</set> <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property> </property>
</widget> </widget>
<widget class="QLabel" name="labTime"> <widget class="QLabel" name="labTime">
......
#include "consumptiondialog.h" #include "consumptiondialog.h"
#include "ui_consumptiondialog.h" #include "ui_consumptiondialog.h"
#include <QDebug>
ConsumptionDialog::ConsumptionDialog(QWidget * parent, Qt::WindowFlags f) : ConsumptionDialog::ConsumptionDialog(QWidget * parent, Qt::WindowFlags f) :
QDialog(parent, f), QDialog(parent, f),
...@@ -21,7 +21,7 @@ ConsumptionDialog::~ConsumptionDialog() ...@@ -21,7 +21,7 @@ ConsumptionDialog::~ConsumptionDialog()
delete ui; delete ui;
} }
bool ConsumptionDialog::ShowForUnConsum(const QString& act_name, const QString& code_name, const QString& time_name, const QString& coupon, QWidget *parent) bool ConsumptionDialog::ShowForUnConsum(const QString& act_name, double face_amount, double actual_amount, const QString& eb_name, const QString& time_name, const QString& coupon, QWidget *parent)
{ {
ConsumptionDialog v(parent); ConsumptionDialog v(parent);
// v.setGeometry( 0,0,350,470); // v.setGeometry( 0,0,350,470);
...@@ -32,7 +32,7 @@ bool ConsumptionDialog::ShowForUnConsum(const QString& act_name, const QString& ...@@ -32,7 +32,7 @@ bool ConsumptionDialog::ShowForUnConsum(const QString& act_name, const QString&
v.ui->btnConsumption->setStyleSheet( v.ui->btnConsumption->styleSheet()); v.ui->btnConsumption->setStyleSheet( v.ui->btnConsumption->styleSheet());
v.ui->btnConsumption->setEnabled( true); v.ui->btnConsumption->setEnabled( true);
v.setData( act_name,code_name ,time_name,coupon ); v.setData(act_name, face_amount, actual_amount, eb_name, time_name, coupon);
if( v.exec() == QDialog::Accepted){ if( v.exec() == QDialog::Accepted){
return true; return true;
...@@ -52,8 +52,9 @@ bool ConsumptionDialog::ShowForHasConsum(const QString& act_name, const QString& ...@@ -52,8 +52,9 @@ bool ConsumptionDialog::ShowForHasConsum(const QString& act_name, const QString&
v.ui->btnConsumption->setObjectName( "btnConsumNull"); v.ui->btnConsumption->setObjectName( "btnConsumNull");
v.ui->btnConsumption->setStyleSheet( v.ui->btnConsumption->styleSheet()); v.ui->btnConsumption->setStyleSheet( v.ui->btnConsumption->styleSheet());
v.ui->btnConsumption->setEnabled( false); v.ui->btnConsumption->setEnabled( false);
v.setData( act_name,code_name ,time_name,coupon );
v.setData( act_name,code_name ,time_name,coupon );
v.ui->labActName->setStyleSheet("color:white;");
if( v.exec() == QDialog::Accepted){ if( v.exec() == QDialog::Accepted){
return true; return true;
} }
...@@ -61,10 +62,66 @@ bool ConsumptionDialog::ShowForHasConsum(const QString& act_name, const QString& ...@@ -61,10 +62,66 @@ bool ConsumptionDialog::ShowForHasConsum(const QString& act_name, const QString&
return false; return false;
} }
int timerId = 0;
void ConsumptionDialog::ShowForWaiting(QString context, QString coupon, QWidget *parent)
{
ui->labTime->hide();
ui->labCodeName->hide();
ui->actualAmount->hide();
ui->ebname->hide();
ui->topNoConsumeWidget->setObjectName( "topWaitingWidget");
ui->topNoConsumeWidget->setStyleSheet( ui->topNoConsumeWidget->styleSheet());
ui->btnConsumption->setEnabled(false);
ui->btnConsumption->setStyleSheet("border-image: url(:/img/btn_consumption_invalid.png);");
ui->labActName->setText(context);
ui->labCode->setText(coupon);
timerId = startTimer(500);
show();
}
void ConsumptionDialog::timerEvent(QTimerEvent *)
{
static int i = 0;
QString str = ui->labActName->text();
if(i == 0)
{
str.remove(QRegularExpression("\\."));
ui->labActName->setText(str);
}
else
{
str.append(".");
ui->labActName->setText(str);
}
i++;
i = i % 4;
}
void ConsumptionDialog::HideForWaiting()
{
killTimer(timerId);
reject();
}
void ConsumptionDialog::setData(const QString& act_name, const QString& code_name, const QString& time_name, const QString& coupon) void ConsumptionDialog::setData(const QString& act_name, const QString& code_name, const QString& time_name, const QString& coupon)
{ {
ui->labCode->setText( coupon); ui->labCode->setText( coupon);
ui->labCodeName->setAlignment(Qt::AlignCenter);
ui->actualAmount->hide();
ui->ebname->hide();
ui->labCodeName->setText( code_name); ui->labCodeName->setText( code_name);
ui->labActName->setText( act_name); ui->labActName->setText( act_name);
ui->labTime->setText( time_name); ui->labTime->setText( time_name);
} }
void ConsumptionDialog::setData(const QString &act_name, double face_amount, double actual_amount, const QString& eb_name, const QString& time_name, const QString& coupon)
{
ui->labCode->setText(coupon);
ui->labCodeName->setText(QString::fromLocal8Bit("面值: %1 元").arg(face_amount));
ui->actualAmount->setText(QString::fromLocal8Bit("实收: %1 元").arg(actual_amount));
ui->ebname->setText(QString::fromLocal8Bit("渠道: ") + eb_name);
ui->labActName->setText(act_name);
ui->labTime->setText(time_name);
}
#ifndef CONSUMPTIONDIALOG_H #ifndef CONSUMPTIONDIALOG_H
#define CONSUMPTIONDIALOG_H #define CONSUMPTIONDIALOG_H
#include <QDialog> #include <QDialog>
...@@ -19,8 +19,14 @@ public: ...@@ -19,8 +19,14 @@ public:
~ConsumptionDialog(); ~ConsumptionDialog();
void setData(const QString& act_name, const QString& code_name, const QString& time_name, const QString& coupon); void setData(const QString& act_name, const QString& code_name, const QString& time_name, const QString& coupon);
static bool ShowForUnConsum(const QString &act_name, const QString& code_name, const QString& time_name, const QString& coupon, QWidget *parent = 0); void setData(const QString &act_name, double face_amount, double actual_amount, const QString& eb_name, const QString& time_name, const QString& coupon);
static bool ShowForUnConsum(const QString &act_name, double face_amount, double actual_amount, const QString& eb_name, const QString& time_name, const QString& coupon, QWidget *parent = 0);
static bool ShowForHasConsum(const QString& act_name, const QString& code_name, const QString& time_name, const QString& coupon, QWidget *parent = 0); static bool ShowForHasConsum(const QString& act_name, const QString& code_name, const QString& time_name, const QString& coupon, QWidget *parent = 0);
void ShowForWaiting(QString context, QString coupon, QWidget *parent = 0);
void HideForWaiting();
protected:
void timerEvent(QTimerEvent *);
signals: signals:
void sgBtnOk(); void sgBtnOk();
......
...@@ -50,17 +50,29 @@ ...@@ -50,17 +50,29 @@
border-top-left-radius:12px; border-top-left-radius:12px;
border-top-right-radius:12px; border-top-right-radius:12px;
} }
#topWaitingWidget{
background-image: url(:/img/bg_waiting.png);
border:none;
border-top-left-radius:12px;
border-top-right-radius:12px;
}
/**/ /**/
#labActName{ #labActName{
/*font: 30 bold &quot;微软雅黑&quot;;*/ /*font: 30 bold &quot;微软雅黑&quot;;*/
font-size:30px; font-size:25px;
font-family:&quot;微软雅黑&quot;; font-family:&quot;微软雅黑&quot;;
font-weight:bold; font-weight:bold;
color: rgb(255, 255, 0); color: rgb(255, 255, 0);
border:none; border:none;
} }
#labCodeName{ #ebname{
font: 65 20pt &quot;微软雅黑&quot;;
color: rgb(255,255,255);
border:none;
}
#labCodeName, #actualAmount{
font: 65 15pt &quot;微软雅黑&quot;; font: 65 15pt &quot;微软雅黑&quot;;
color: rgb(255, 255, 0); color: rgb(255, 255, 0);
border:none; border:none;
...@@ -162,25 +174,25 @@ ...@@ -162,25 +174,25 @@
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>0</x> <x>0</x>
<y>105</y> <y>90</y>
<width>330</width> <width>330</width>
<height>80</height> <height>50</height>
</rect> </rect>
</property> </property>
<property name="minimumSize"> <property name="minimumSize">
<size> <size>
<width>330</width> <width>330</width>
<height>80</height> <height>50</height>
</size> </size>
</property> </property>
<property name="maximumSize"> <property name="maximumSize">
<size> <size>
<width>330</width> <width>330</width>
<height>80</height> <height>50</height>
</size> </size>
</property> </property>
<property name="text"> <property name="text">
<string>查询中...</string> <string>查询中</string>
</property> </property>
<property name="alignment"> <property name="alignment">
<set>Qt::AlignCenter</set> <set>Qt::AlignCenter</set>
...@@ -218,7 +230,7 @@ ...@@ -218,7 +230,7 @@
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>0</x> <x>0</x>
<y>205</y> <y>186</y>
<width>330</width> <width>330</width>
<height>37</height> <height>37</height>
</rect> </rect>
...@@ -239,10 +251,81 @@ ...@@ -239,10 +251,81 @@
<string notr="true"/> <string notr="true"/>
</property> </property>
<property name="text"> <property name="text">
<string>键位促销</string> <string>面值: </string>
</property> </property>
<property name="alignment"> <property name="alignment">
<set>Qt::AlignCenter</set> <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
<property name="indent">
<number>10</number>
</property>
</widget>
<widget class="QLabel" name="actualAmount">
<property name="geometry">
<rect>
<x>0</x>
<y>220</y>
<width>330</width>
<height>37</height>
</rect>
</property>
<property name="minimumSize">
<size>
<width>330</width>
<height>37</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>330</width>
<height>37</height>
</size>
</property>
<property name="styleSheet">
<string notr="true"/>
</property>
<property name="text">
<string>实收: </string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
<property name="indent">
<number>10</number>
</property>
</widget>
<widget class="QLabel" name="ebname">
<property name="geometry">
<rect>
<x>0</x>
<y>150</y>
<width>330</width>
<height>37</height>
</rect>
</property>
<property name="minimumSize">
<size>
<width>330</width>
<height>37</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>330</width>
<height>37</height>
</size>
</property>
<property name="styleSheet">
<string notr="true"/>
</property>
<property name="text">
<string>渠道: </string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
<property name="indent">
<number>10</number>
</property> </property>
</widget> </widget>
</widget> </widget>
......
#include "couponkeypad.h" #include "couponkeypad.h"
#include "ui_couponkeypad.h" #include "ui_couponkeypad.h"
CouponKeypad::CouponKeypad(QWidget *parent, Qt::WindowFlags f) : CouponKeypad::CouponKeypad(QWidget *parent, Qt::WindowFlags f) :
...@@ -53,3 +53,11 @@ void CouponKeypad::onDigitClicked() ...@@ -53,3 +53,11 @@ void CouponKeypad::onDigitClicked()
QPushButton *btn = qobject_cast<QPushButton*>(sender()); QPushButton *btn = qobject_cast<QPushButton*>(sender());
ui->text->setText(ui->text->text() + btn->text()); ui->text->setText(ui->text->text() + btn->text());
} }
void CouponKeypad::keyPressEvent(QKeyEvent *e)
{
if( e->key() == Qt::Key_Enter || e->key() == Qt::Key_End || e->key() == 16777220 )
{
on_btnOK_clicked();
}
}
\ No newline at end of file
#ifndef COUPONKEYPAD_H #ifndef COUPONKEYPAD_H
#define COUPONKEYPAD_H #define COUPONKEYPAD_H
#include <QDialog> #include <QDialog>
#include <QKeyEvent>
namespace Ui { namespace Ui {
class CouponKeypad; class CouponKeypad;
...@@ -22,6 +23,9 @@ public slots: ...@@ -22,6 +23,9 @@ public slots:
void on_btnClear_clicked(); void on_btnClear_clicked();
void onDigitClicked(); void onDigitClicked();
protected:
void keyPressEvent(QKeyEvent *e);
public: public:
QString code; QString code;
......
#include "datedialog.h"
#include "ui_datedialog.h"
DateDialog::DateDialog(QWidget *parent) :
QDialog(parent),
ui(new Ui::DateDialog)
{
ui->setupUi(this);
setAttribute(Qt::WA_QuitOnClose, false);
setWindowFlags(windowFlags() | Qt::FramelessWindowHint | Qt::WindowStaysOnTopHint);
connect(ui->calendarWidget, SIGNAL(selectionChanged()), this, SLOT(OnSelectedChanged()));
connect(ui->closeBtn, SIGNAL(clicked(bool)), this, SLOT(close()));
}
DateDialog::~DateDialog()
{
delete ui;
}
void DateDialog::mousePressEvent(QMouseEvent *e)
{
mouse_pressed = true;
movePosition = e->globalPos() - pos();
return QDialog::mousePressEvent(e);
}
void DateDialog::mouseMoveEvent(QMouseEvent *e)
{
if(mouse_pressed && (e->buttons() & Qt::LeftButton) && (e->globalPos()-movePosition).manhattanLength() > QApplication::startDragDistance())
{
move(e->globalPos() - movePosition);
movePosition = e->globalPos() - pos();
}
return QDialog::mouseMoveEvent(e);
}
void DateDialog::mouseReleaseEvent(QMouseEvent *e)
{
mouse_pressed = false;
return QDialog::mouseReleaseEvent(e);
}
void DateDialog::keyPressEvent(QKeyEvent *e)
{
switch(e->key())
{
case Qt::Key_Return:
case Qt::Key_Enter:
return;
default:
break;
}
QDialog::keyPressEvent(e);
}
void DateDialog::OnSelectedChanged()
{
QDate cur = ui->calendarWidget->selectedDate();
emit DateChanged(cur);
}
#ifndef DATEDIALOG_H
#define DATEDIALOG_H
#include <QDialog>
#include <QMouseEvent>
#include <QDate>
namespace Ui {
class DateDialog;
}
class DateDialog : public QDialog
{
Q_OBJECT
public:
explicit DateDialog(QWidget *parent = 0);
~DateDialog();
protected:
void mousePressEvent(QMouseEvent *e);
void mouseMoveEvent(QMouseEvent *e);
void mouseReleaseEvent(QMouseEvent *e);
void keyPressEvent(QKeyEvent *e);
private slots:
void OnSelectedChanged();
signals:
void DateChanged(QDate curDate);
private:
Ui::DateDialog *ui;
bool mouse_pressed;
QPoint movePosition;
};
#endif // DATEDIALOG_H
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>DateDialog</class>
<widget class="QDialog" name="DateDialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>464</width>
<height>346</height>
</rect>
</property>
<property name="windowTitle">
<string>Dialog</string>
</property>
<property name="styleSheet">
<string notr="true">#titleLabel{
background: rgb(56, 56, 64);
color:rgb(255, 255, 255);
font: normal 16px &quot;Microsoft YaHei&quot;;
}
#closeBtn{
border:none;
background-color:rgb(56,56,64);
background-image:url(:/img/close_02.png);
background-repeat:no-repeat;
background-position:center;
}
#closeBtn{
padding:1 0 0 2;
}
QCalendarWidget QWidget#qt_calendar_navigationbar{
min-height:30px;
background: lightgrey;
}
QCalendarWidget QTableView{
font-size:25px;
}
#qt_calendar_monthbutton,#qt_calendar_yearbutton,#qt_calendar_monthbutton:focus,#qt_calendar_yearbutton:focus{
color:black;
font-size:25px;
}
#qt_calendar_yearedit{
min-width:50px;
}</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<property name="spacing">
<number>0</number>
</property>
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<property name="spacing">
<number>0</number>
</property>
<item>
<widget class="QLabel" name="titleLabel">
<property name="minimumSize">
<size>
<width>0</width>
<height>40</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>40</height>
</size>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="closeBtn">
<property name="minimumSize">
<size>
<width>40</width>
<height>40</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>40</width>
<height>40</height>
</size>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QCalendarWidget" name="calendarWidget">
<property name="verticalHeaderFormat">
<enum>QCalendarWidget::NoVerticalHeader</enum>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>
...@@ -28,8 +28,7 @@ void ErrCodeDialog::showForInvalid(const QString& coupon, QWidget *parent) ...@@ -28,8 +28,7 @@ void ErrCodeDialog::showForInvalid(const QString& coupon, QWidget *parent)
v.ui->labTime->setVisible( false); v.ui->labTime->setVisible( false);
v.ui->labActName->setVisible( false); v.ui->labActName->setVisible( false);
v.ui->labCodeName->setVisible( false); v.ui->labChannel->setVisible( false);
v.ui->labFolat->setVisible( false);
v.ui->labCode->setText(coupon ); v.ui->labCode->setText(coupon );
...@@ -45,12 +44,13 @@ void ErrCodeDialog::showForExpird(const QString& act_name, const QString& code_n ...@@ -45,12 +44,13 @@ void ErrCodeDialog::showForExpird(const QString& act_name, const QString& code_n
v.ui->labTime->setVisible( true); v.ui->labTime->setVisible( true);
v.ui->labActName->setVisible( true); v.ui->labActName->setVisible( true);
v.ui->labCodeName->setVisible( true); v.ui->labChannel->setVisible( true);
v.ui->labCode->setText(coupon ); v.ui->labCode->setText(coupon );
v.ui->labTime->setText( time_name); v.ui->labTime->setText( time_name);
v.ui->labActName->setText( act_name); v.ui->labActName->setText( act_name);
v.ui->labCodeName->setText( code_name); v.ui->labActName->setStyleSheet("color:white;");
v.ui->labChannel->setText( code_name);
v.exec(); v.exec();
} }
...@@ -64,31 +64,42 @@ void ErrCodeDialog::showForErr(const QString& coupon, const QString& mess, QWidg ...@@ -64,31 +64,42 @@ void ErrCodeDialog::showForErr(const QString& coupon, const QString& mess, QWidg
v.ui->labTime->setVisible( false); v.ui->labTime->setVisible( false);
v.ui->labCodeName->setVisible( false); v.ui->labChannel->setVisible( true);
v.ui->labFolat->setVisible( false); //100 -> 浦发银行
//88 -> 交通银行
QString channel;
if(coupon.left(3) == "100" && coupon.length()==12)
channel = QString::fromLocal8Bit("浦发银行");
else if(coupon.left(2) == "88" && coupon.length()==12)
channel = QString::fromLocal8Bit("交通银行");
else
channel = QString::fromLocal8Bit("未知");
v.ui->labActName->setVisible( true); v.ui->labChannel->setText(QString::fromLocal8Bit("渠道: ") + channel);
v.ui->labCode->setText(coupon );
v.ui->labActName->setText( mess);
v.exec();
}
void ErrCodeDialog::showForMismatch(const QString &coupon, const QString &mess, QWidget *parent)
{
ErrCodeDialog v(parent);
// v.setGeometry( 0,0,350,470);
v.ui->topInvalidWidget->setObjectName("topExpirdWidget");
v.ui->topInvalidWidget->setStyleSheet( v.ui->topInvalidWidget->styleSheet());
v.ui->labTime->setVisible( false);
v.ui->labCodeName->setVisible( false);
v.ui->labFolat->setVisible( false);
v.ui->labActName->setVisible( true); v.ui->labActName->setVisible( true);
v.ui->labCode->setText(coupon ); v.ui->labCode->setText(coupon );
v.ui->labActName->setText( mess);
//换行显示
int w = v.ui->labActName->width();
QFontMetrics fm = v.ui->labActName->fontMetrics();
QString tmp, newStr;
for(int i = 0; i < mess.length(); i++)
{
tmp.append(mess.at(i));
int nw = fm.width(tmp);
if(nw >= w - 20)
{
tmp.append(QChar::LineFeed);
newStr.append(tmp);
tmp.clear();
}
}
if(!tmp.isEmpty())
newStr.append(tmp);
v.ui->labActName->setText(newStr);
v.ui->labActName->setStyleSheet("color:white;");
v.exec(); v.exec();
} }
\ No newline at end of file
#ifndef ERRCODEDIALOG_H #ifndef ERRCODEDIALOG_H
#define ERRCODEDIALOG_H #define ERRCODEDIALOG_H
#include <QDialog> #include <QDialog>
...@@ -18,7 +18,6 @@ public: ...@@ -18,7 +18,6 @@ public:
static void showForInvalid(const QString& coupon, QWidget *parent = 0); static void showForInvalid(const QString& coupon, QWidget *parent = 0);
static void showForExpird(const QString& act_name, const QString& code_name, const QString& time_name, const QString& coupon, QWidget *parent = 0); static void showForExpird(const QString& act_name, const QString& code_name, const QString& time_name, const QString& coupon, QWidget *parent = 0);
static void showForErr(const QString& coupon, const QString& mess, QWidget *parent = 0); static void showForErr(const QString& coupon, const QString& mess, QWidget *parent = 0);
static void showForMismatch(const QString& coupon, const QString& mess, QWidget *parent = 0);
private: private:
Ui::ErrCodeDialog *ui; Ui::ErrCodeDialog *ui;
......
...@@ -38,7 +38,8 @@ ...@@ -38,7 +38,8 @@
} }
/**/ /**/
#topInvalidWidget{ #topInvalidWidget{
background-image: url(:/img/bg_invalid_code.png); /*background-image: url(:/img/bg_invalid_code.png);*/
background-image: url(:/img/bg_be_invalid.png);
border:none; border:none;
border-top-left-radius:12px; border-top-left-radius:12px;
border-top-right-radius:12px; border-top-right-radius:12px;
...@@ -53,7 +54,6 @@ ...@@ -53,7 +54,6 @@
#labFolat{ #labFolat{
border:none; border:none;
background-image: url(:/img/folat_be_invalid.png); background-image: url(:/img/folat_be_invalid.png);
} }
/**/ /**/
...@@ -65,13 +65,13 @@ ...@@ -65,13 +65,13 @@
} }
/*label*/ /*label*/
#labActName{ #labActName{
font: 75 30pt &quot;微软雅黑&quot;; font: 60 20pt &quot;微软雅黑&quot;;
color: rgb(81, 81, 81); color: rgb(81, 81, 81);
} }
#labCodeName{ #labChannel{
font: 72 25pt &quot;微软雅黑&quot;; font: 65 15pt &quot;微软雅黑&quot;;
color: rgb(81, 81, 81); color: rgb(255, 255, 255);
} }
#labTime{ #labTime{
...@@ -197,9 +197,9 @@ ...@@ -197,9 +197,9 @@
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>0</x> <x>0</x>
<y>90</y> <y>60</y>
<width>330</width> <width>330</width>
<height>80</height> <height>100</height>
</rect> </rect>
</property> </property>
<property name="minimumSize"> <property name="minimumSize">
...@@ -211,17 +211,17 @@ ...@@ -211,17 +211,17 @@
<property name="maximumSize"> <property name="maximumSize">
<size> <size>
<width>330</width> <width>330</width>
<height>80</height> <height>100</height>
</size> </size>
</property> </property>
<property name="text"> <property name="text">
<string>5元脆骨鸡</string> <string>5元脆骨鸡</string>
</property> </property>
<property name="alignment"> <property name="alignment">
<set>Qt::AlignCenter</set> <set>Qt::AlignHCenter|Qt::AlignTop</set>
</property> </property>
</widget> </widget>
<widget class="QLabel" name="labCodeName"> <widget class="QLabel" name="labChannel">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>0</x> <x>0</x>
...@@ -246,35 +246,13 @@ ...@@ -246,35 +246,13 @@
<string notr="true"/> <string notr="true"/>
</property> </property>
<property name="text"> <property name="text">
<string>键位促销</string> <string>渠道:浦发银行</string>
</property> </property>
<property name="alignment"> <property name="alignment">
<set>Qt::AlignCenter</set> <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
</widget>
<widget class="QLabel" name="labFolat">
<property name="geometry">
<rect>
<x>68</x>
<y>0</y>
<width>262</width>
<height>167</height>
</rect>
</property>
<property name="minimumSize">
<size>
<width>262</width>
<height>167</height>
</size>
</property> </property>
<property name="maximumSize"> <property name="indent">
<size> <number>15</number>
<width>262</width>
<height>167</height>
</size>
</property>
<property name="text">
<string/>
</property> </property>
</widget> </widget>
</widget> </widget>
......
#include "fmloading.h"
#include "ui_fmloading.h"
FMLoading::FMLoading(QWidget *parent) :
QDialog(parent),
movie(Q_NULLPTR),
ui(new Ui::FMLoading)
{
ui->setupUi(this);
setWindowFlags(windowFlags() | Qt::FramelessWindowHint | Qt::Tool | Qt::WindowStaysOnTopHint);
setAttribute(Qt::WA_TranslucentBackground, true);
movie = new QMovie(":/img/loading.gif");
if(movie->isValid())
{
connect(movie, SIGNAL(finished()), movie, SLOT(start()));
movie->start();
ui->label->setMovie(movie);
}
else
{
ui->label->setText(QString::fromLocal8Bit("无效动画"));
}
}
FMLoading::~FMLoading()
{
if(movie != Q_NULLPTR)
{
delete movie;
movie = Q_NULLPTR;
}
delete ui;
}
#ifndef FMLOADING_H
#define FMLOADING_H
#include <QDialog>
#include <QMovie>
namespace Ui {
class FMLoading;
}
class FMLoading : public QDialog
{
Q_OBJECT
public:
explicit FMLoading(QWidget *parent = 0);
~FMLoading();
private:
Ui::FMLoading *ui;
QMovie* movie;
};
#endif // FMLOADING_H
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>FMLoading</class>
<widget class="QDialog" name="FMLoading">
<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 class="QLabel" name="label">
<property name="geometry">
<rect>
<x>90</x>
<y>50</y>
<width>241</width>
<height>191</height>
</rect>
</property>
<property name="text">
<string>TextLabel</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</widget>
<resources/>
<connections/>
</ui>
...@@ -6,6 +6,9 @@ ...@@ -6,6 +6,9 @@
#include <QJsonObject> #include <QJsonObject>
#include <QJsonArray> #include <QJsonArray>
#include <QPointer> #include <QPointer>
#include <QNetworkReply>
#include <QSqlDatabase>
class FMPStartEventHandler; class FMPStartEventHandler;
class FMPRedeem : public FMPRedeemInterface class FMPRedeem : public FMPRedeemInterface
{ {
...@@ -34,6 +37,7 @@ public: ...@@ -34,6 +37,7 @@ public:
QJsonObject GetRedeemJson()const; QJsonObject GetRedeemJson()const;
virtual bool IsRedeeming() const; virtual bool IsRedeeming() const;
virtual void ShowRedeemDetail(); virtual void ShowRedeemDetail();
virtual ctkPlugin::State GetPluginState();
protected: protected:
const FMPContext GetContext() const { return _context; } const FMPContext GetContext() const { return _context; }
...@@ -49,12 +53,11 @@ private: ...@@ -49,12 +53,11 @@ private:
QJsonObject ShowForInvalid(QJsonObject json); QJsonObject ShowForInvalid(QJsonObject json);
QJsonObject ShowForExpird(QJsonObject json); QJsonObject ShowForExpird(QJsonObject json);
QJsonObject ShowForErr(QJsonObject json); QJsonObject ShowForErr(QJsonObject json);
QJsonObject ShowForMismatch(QJsonObject json);
int ZH_caclChkValue(char * pJsonData, int startPos, int endPos); int ZH_caclChkValue(char * pJsonData, int startPos, int endPos);
QByteArray CheckSendArray( QByteArray & jsonArray); QByteArray CheckSendArray( QByteArray & jsonArray);
QJsonValue SearchJsonObject(QJsonObject& searchJson, QString searchKey); QJsonValue SearchJsonObject(QJsonObject& searchJson, QString searchKey);
QJsonValue SearchJsonArray(QJsonArray& searchJson, QString searchKey); QJsonValue SearchJsonArray(QJsonArray& searchJson, QString searchKey);
void SaveRedeemResult(QString code, QString code_name, QString ebname, double amount); void LoadStoreInfo();
private: private:
bool _inited; bool _inited;
...@@ -63,12 +66,14 @@ private: ...@@ -63,12 +66,14 @@ private:
QString _operator_id; QString _operator_id;
QString _coupon; QString _coupon;
int _partner_id; int _partner_id;
QString _url; QString _redeem_url;
QString _redeem_log_url;
QJsonArray _products_info; QJsonArray _products_info;
QJsonObject _redeem_json; //存放核销请求字符串 QJsonObject _redeem_json; //存放核销请求字符串
int _clientReqCount; int _clientReqCount;
const FMPContext _context; const FMPContext _context;
QPointer<FMPStartEventHandler> _ste_handler; QPointer<FMPStartEventHandler> _ste_handler;
QNetworkReply* _reply;
}; };
#endif // FMP_REDEEM_H #endif // FMP_REDEEM_H
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
#------------------------------------------------- #-------------------------------------------------
TEMPLATE = lib TEMPLATE = lib
QT += core gui network winextras sql QT += core gui network winextras sql concurrent
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
CONFIG += c++11 CONFIG += c++11
...@@ -65,8 +65,10 @@ HEADERS += \ ...@@ -65,8 +65,10 @@ HEADERS += \
scanningdialog.h \ scanningdialog.h \
fmp_pe_handlers.h \ fmp_pe_handlers.h \
storedialog.h \ storedialog.h \
mysqltablemodel.h \ redeemdetail.h \
redeemdetail.h datedialog.h \
fmp_redeem_def.h \
fmloading.h
SOURCES += \ SOURCES += \
fmp_redeem.cpp \ fmp_redeem.cpp \
...@@ -78,8 +80,9 @@ SOURCES += \ ...@@ -78,8 +80,9 @@ SOURCES += \
scanningdialog.cpp \ scanningdialog.cpp \
fmp_pe_handlers.cpp \ fmp_pe_handlers.cpp \
storedialog.cpp \ storedialog.cpp \
mysqltablemodel.cpp \ redeemdetail.cpp \
redeemdetail.cpp datedialog.cpp \
fmloading.cpp
FORMS += \ FORMS += \
consumokdialog.ui \ consumokdialog.ui \
...@@ -88,4 +91,6 @@ FORMS += \ ...@@ -88,4 +91,6 @@ FORMS += \
errcodedialog.ui \ errcodedialog.ui \
scanningdialog.ui \ scanningdialog.ui \
storedialog.ui \ storedialog.ui \
redeemdetail.ui redeemdetail.ui \
\ No newline at end of file datedialog.ui \
fmloading.ui
\ No newline at end of file
#ifndef FMP_REDEEM_DEF_H
#define FMP_REDEEM_DEF_H
#define FMP_INIKEY_REDEEM_LOG "Coupon/RedeemLog"
#endif // FMP_REDEEM_DEF_H
...@@ -25,6 +25,7 @@ public: ...@@ -25,6 +25,7 @@ public:
virtual QJsonObject GetRedeemJson()const = 0; virtual QJsonObject GetRedeemJson()const = 0;
virtual bool IsRedeeming()const = 0; virtual bool IsRedeeming()const = 0;
virtual void ShowRedeemDetail() = 0; virtual void ShowRedeemDetail() = 0;
virtual ctkPlugin::State GetPluginState() = 0;
signals: signals:
void TriggerInit(); void TriggerInit();
......
...@@ -14,7 +14,6 @@ class FMPRedeemPlugin : public QObject, public ctkPluginActivator ...@@ -14,7 +14,6 @@ class FMPRedeemPlugin : public QObject, public ctkPluginActivator
public: public:
explicit FMPRedeemPlugin(); explicit FMPRedeemPlugin();
void start(ctkPluginContext* context); void start(ctkPluginContext* context);
void stop(ctkPluginContext* context); void stop(ctkPluginContext* context);
......
#include "mysqltablemodel.h"
MySqlTableModel::MySqlTableModel(QObject *parent, QSqlDatabase db)
:QSqlTableModel(parent, db)
{
}
QVariant MySqlTableModel::data(const QModelIndex &idx, int role) const
{
QVariant value = QSqlTableModel::data(idx, role);
if(role == Qt::TextAlignmentRole)
return Qt::AlignCenter;
return value;
}
\ No newline at end of file
#ifndef MYSQLTABLEMODEL_H
#define MYSQLTABLEMODEL_H
#include <QSqlTableModel>
class MySqlTableModel : public QSqlTableModel
{
public:
MySqlTableModel(QObject * parent = 0, QSqlDatabase db = QSqlDatabase());
QVariant data(const QModelIndex &idx, int role) const;
};
#endif // MYSQLTABLEMODEL_H
...@@ -6,7 +6,12 @@ ...@@ -6,7 +6,12 @@
#include <QSqlQuery> #include <QSqlQuery>
#include <QSqlError> #include <QSqlError>
#include <QDate> #include <QDate>
#include "mysqltablemodel.h" #include <QFuture>
#include <QStandardItemModel>
#include <QNetworkReply>
#include <QJsonObject>
#include "datedialog.h"
#include "fmloading.h"
namespace Ui { namespace Ui {
class RedeemDetail; class RedeemDetail;
...@@ -15,9 +20,19 @@ class RedeemDetail; ...@@ -15,9 +20,19 @@ class RedeemDetail;
class RedeemDetail : public QDialog class RedeemDetail : public QDialog
{ {
Q_OBJECT Q_OBJECT
enum {
FM_API_SUCCESS = 100,
FM_API_ERROR,
FM_API_TIMEOUT,
FM_API_BADJSON,
FM_API_NETWORKERROR,
FM_API_SERVERERROR,
FM_API_WINDOWCLOSE,
FM_API_TYPEERROR
};
public: public:
explicit RedeemDetail(QWidget *parent = 0); explicit RedeemDetail(int partnerId, QString storeId, QString url, QWidget *parent = 0);
~RedeemDetail(); ~RedeemDetail();
protected: protected:
...@@ -29,23 +44,33 @@ protected: ...@@ -29,23 +44,33 @@ protected:
private slots: private slots:
void FindByCode(); void FindByCode();
void FindByCode(QString str); void FindByCode(QString str);
void RefundByCode();
void ShowKeyboard(bool checked); void ShowKeyboard(bool checked);
bool InitSqlite();
void ComputeCurrentData();
void LoadRedeemRecord(); void LoadRedeemRecord();
void PrevDay(); void OnStartDateClicked();
void NextDay(); void OnEndDateClicked();
void keyboardPressed(); void keyboardPressed(bool);
void OnStartDateChanged(QDate cur);
void OnEndDateChanged(QDate cur);
void InitModel();
void ShowRedeemRecord(QJsonObject obj);
void FirstLoadRecord();
void SetBusy(bool busy);
signals:
void Loaded(QJsonObject);
private: private:
Ui::RedeemDetail *ui; Ui::RedeemDetail *ui;
bool mouse_pressed; bool mouse_pressed;
QPoint movePosition; QPoint movePosition;
QSqlDatabase db; QStandardItemModel model;
MySqlTableModel* model; DateDialog dateDlg;
QDate curDate; FMLoading loadingDlg;
QDate minDate; int partnerId;
QString storeId, url;
QDate startDate, endDate;
QFuture<void> future;
QNetworkReply* reply;
}; };
#endif // DIALOG_H #endif // DIALOG_H
...@@ -19,5 +19,7 @@ ...@@ -19,5 +19,7 @@
<file>img/close_02.png</file> <file>img/close_02.png</file>
<file>img/dlt.png</file> <file>img/dlt.png</file>
<file>img/dlt_onclick.png</file> <file>img/dlt_onclick.png</file>
<file>img/bg_waiting.png</file>
<file>img/loading.gif</file>
</qresource> </qresource>
</RCC> </RCC>
...@@ -16,16 +16,20 @@ Level=0 ...@@ -16,16 +16,20 @@ Level=0
[Home] [Home]
Server=http://115.159.226.87:20001/api/user/login Server=http://115.159.226.87:20001/api/user/login
PartnerId=1739 PartnerId=1739
StoreId=WH026 StoreId=SH058
PosId=01 PosId=01
Position=1591, 268 Position=2586, 177
CashierId=001 CashierId=001
ShowStoreInfo=1 ShowStoreInfo=0
[Pay] [Pay]
Server=https://115.159.18.100/api Server="http://115.159.119.32:27935/api?partner=yhdw"
Timeout=60 Timeout=60
[Coupon]
Server=http://115.159.142.32/api
RedeemLog=http://115.159.119.32:27935/getRedeemLog
[Vip] [Vip]
Server=http://member.freemudorder.com/member_today/service/restful/pos Server=http://member.freemudorder.com/member_today/service/restful/pos
......
No preview for this file type
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