Commit 35851cc6 by NitefllWind

1.新增支付时必须使用支付码认证。2.修复按ECS键程序无返回而卡死。3.美化代金券元素显示界面。

parent cfea96e1
...@@ -69,6 +69,7 @@ INT FMVipDispatcher::_ParseRequest(LPSTR data) ...@@ -69,6 +69,7 @@ INT FMVipDispatcher::_ParseRequest(LPSTR data)
isLastOne = true; isLastOne = true;
_serverRspData.clear(); _serverRspData.clear();
isPayLogin = false;
// 唤起客户端界面 // 唤起客户端界面
emit requested(_posReqObj); emit requested(_posReqObj);
...@@ -130,9 +131,17 @@ void FMVipDispatcher::onRequest(const QJsonObject &jsonObj) ...@@ -130,9 +131,17 @@ void FMVipDispatcher::onRequest(const QJsonObject &jsonObj)
requestSuccess = true; requestSuccess = true;
// 支付、充值、结算先检查登陆状态。 // 支付、充值、结算先检查登陆状态。
QJsonObject copyJsonObj(jsonObj); QJsonObject copyJsonObj(jsonObj);
if (!isLogined()) { if(type == Type_Fund && !isLogined())
{
_posReqObj["fm_cmd"] = Type_Login;
isLastOne = false;
login();
}
if(type == Type_Pay)
{
_posReqObj["fm_cmd"] = Type_Login; _posReqObj["fm_cmd"] = Type_Login;
isLastOne = false; isLastOne = false;
isPayLogin = true;
login(); login();
} }
if (requestSuccess == true && _windowReturn != -1) { if (requestSuccess == true && _windowReturn != -1) {
...@@ -173,8 +182,29 @@ void FMVipDispatcher::onFinished() ...@@ -173,8 +182,29 @@ void FMVipDispatcher::onFinished()
void FMVipDispatcher::onServerResponsed(const QJsonObject &rspObj) void FMVipDispatcher::onServerResponsed(const QJsonObject &rspObj)
{ {
int status = rspObj["statusCode"].toInt();
int prompt = rspObj["prompt"].toInt();
if(_vindow != 0) { if(_vindow != 0) {
_vindow->setIsBusy(false); _vindow->setIsBusy(false);
// 支付时, 会员认证的返回,如果不可付款
int canPan = FMVipForward::instance()->sessionDataInt("canPay");
// 如果是支付认证则不关闭窗口
if(isPayLogin)
{
if(status != 100)
{
_vindow->resetWnd();
FMMsgWnd::FailureWnd(rspObj["msg"].toString());
return;
}else if(canPan != 1)
{
_vindow->resetWnd();
FMMsgWnd::FailureWnd("请使用支付码付款");
return;
}
}
_vindow->deleteLater(); _vindow->deleteLater();
} }
...@@ -182,8 +212,6 @@ void FMVipDispatcher::onServerResponsed(const QJsonObject &rspObj) ...@@ -182,8 +212,6 @@ void FMVipDispatcher::onServerResponsed(const QJsonObject &rspObj)
QByteArray rspData = rspDoc.toJson(); QByteArray rspData = rspDoc.toJson();
_serverRspData = rspData; _serverRspData = rspData;
int status = rspObj["statusCode"].toInt();
int prompt = rspObj["prompt"].toInt();
if(status != 100) { if(status != 100) {
if(prompt == 0) if(prompt == 0)
...@@ -210,7 +238,7 @@ void FMVipDispatcher::onDoPost() ...@@ -210,7 +238,7 @@ void FMVipDispatcher::onDoPost()
void FMVipDispatcher::login() void FMVipDispatcher::login()
{ {
if (!_vindow) { if (!_vindow) {
FMVipLogin *login = new FMVipLogin; FMVipLogin *login = new FMVipLogin(isPayLogin);
connect(login, SIGNAL(destroyed(QObject*)), SLOT(onFinished())); connect(login, SIGNAL(destroyed(QObject*)), SLOT(onFinished()));
connect(login, SIGNAL(doPost()), SLOT(onDoPost())); connect(login, SIGNAL(doPost()), SLOT(onDoPost()));
_vindow = login; _vindow = login;
......
...@@ -63,6 +63,7 @@ private: ...@@ -63,6 +63,7 @@ private:
QMutex mutex; QMutex mutex;
QWaitCondition serverIsBusy; QWaitCondition serverIsBusy;
BOOL requestSuccess; BOOL requestSuccess;
BOOL isPayLogin;
}; };
#endif // FMVIPDISPATCHER_H #endif // FMVIPDISPATCHER_H
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
#include "fmvipforward.h" #include "fmvipforward.h"
#include "fmloading.h" #include "fmloading.h"
FMVipLogin::FMVipLogin(QDialog *parent) : FMVipLogin::FMVipLogin(bool isMustPayCode, QDialog *parent) :
FMVipWnd(parent), FMVipWnd(parent),
ui(new Ui::FMVipLogin) ui(new Ui::FMVipLogin)
{ {
...@@ -18,9 +18,17 @@ FMVipLogin::FMVipLogin(QDialog *parent) : ...@@ -18,9 +18,17 @@ FMVipLogin::FMVipLogin(QDialog *parent) :
QString operator_id = FMVipForward::instance()->sessionData("operator_id"); QString operator_id = FMVipForward::instance()->sessionData("operator_id");
QString business_date = FMVipForward::instance()->sessionData("business_date"); QString business_date = FMVipForward::instance()->sessionData("business_date");
ui->login_edit->setFocus(); ui->login_edit->setFocus();
ui->operator_label->setText(operator_id); ui->operator_label->setText(operator_id);
ui->bd_label->setText(business_date); ui->bd_label->setText(business_date);
if(isMustPayCode)
{
ui->login_edit->setPlaceholderText("支付码");
}else{
ui->login_edit->setPlaceholderText("手机号/账号/支付码");
}
} }
FMVipLogin::~FMVipLogin() FMVipLogin::~FMVipLogin()
...@@ -43,32 +51,10 @@ void FMVipLogin::on_login_btn_clicked() ...@@ -43,32 +51,10 @@ void FMVipLogin::on_login_btn_clicked()
setIsBusy(true); setIsBusy(true);
} }
void FMVipLogin::on_login_result(QNetworkReply *reply) void FMVipLogin::resetWnd()
{ {
qDebug() << __FUNCTION__; ui->login_btn->setEnabled(true);
QJsonDocument json = QJsonDocument::fromJson(reply->readAll()); ui->login_edit->setEnabled(true);
ui->login_edit->clear();
QFile user(":/data/user"); ui->login_edit->setFocus();
if (user.open(QFile::ReadOnly)) {
if (ui->login_edit->text() == user.readAll()) {
FMVipPanel *panel = new FMVipPanel;
QFile file(":/data/profile");
if (file.open(QFile::ReadOnly)) {
panel->setProfile(file.readAll());
panel->show();
close();
emit loginSuccess();
}
else {
qDebug() << "Failed opening file: " << file.fileName();
}
}
else {
qDebug() << "User not authorized.";
}
}
else {
qDebug() << "Failed opening file: " << user.fileName();
}
} }
...@@ -14,15 +14,14 @@ class FMVipLogin : public FMVipWnd ...@@ -14,15 +14,14 @@ class FMVipLogin : public FMVipWnd
Q_OBJECT Q_OBJECT
public: public:
explicit FMVipLogin(QDialog *parent = 0); explicit FMVipLogin(bool isMustPayCode = false, QDialog *parent = 0);
~FMVipLogin(); ~FMVipLogin();
protected:
void resetWnd();
signals: signals:
void loginSuccess(); void loginSuccess();
public slots: public slots:
void on_login_btn_clicked(); void on_login_btn_clicked();
protected slots:
void on_login_result(QNetworkReply *);
private: private:
Ui::FMVipLogin *ui; Ui::FMVipLogin *ui;
}; };
......
...@@ -48,13 +48,18 @@ bool FMVipWnd::setProfile(const QByteArray &d) ...@@ -48,13 +48,18 @@ bool FMVipWnd::setProfile(const QByteArray &d)
return true; return true;
} }
void FMVipWnd::on_close_btn_clicked() void FMVipWnd::reject()
{ {
close(); QDialog::reject();
setResult(-1); // 关闭时返回-1 setResult(-1); // 关闭时返回-1
deleteLater(); deleteLater();
} }
void FMVipWnd::on_close_btn_clicked()
{
reject();
}
void FMVipWnd::setIsBusy(const bool isBusy) void FMVipWnd::setIsBusy(const bool isBusy)
{ {
if(isBusy) if(isBusy)
...@@ -80,6 +85,8 @@ int FMVipWnd::exec() ...@@ -80,6 +85,8 @@ int FMVipWnd::exec()
QRect rc = w.availableGeometry(); QRect rc = w.availableGeometry();
setGeometry((rc.width() - width()) / 2, (rc.height() - height()) / 2, width(), height()); setGeometry((rc.width() - width()) / 2, (rc.height() - height()) / 2, width(), height());
qDebug() << QString("rc(%1, %2), w(%3, %4)").arg(rc.width()).arg(rc.height()).arg(w.width()).arg(w.height());
return QDialog::exec(); return QDialog::exec();
} }
......
...@@ -17,6 +17,7 @@ public: ...@@ -17,6 +17,7 @@ public:
//! Set current user profile (Json data) //! Set current user profile (Json data)
bool setProfile(const QByteArray&); bool setProfile(const QByteArray&);
void setIsBusy(const bool isBusy = true); void setIsBusy(const bool isBusy = true);
virtual void resetWnd(){}
int exec(); int exec();
signals: signals:
...@@ -25,6 +26,10 @@ public slots: ...@@ -25,6 +26,10 @@ public slots:
void on_close_btn_clicked(); void on_close_btn_clicked();
private: private:
FMLoading* loadingWindow; FMLoading* loadingWindow;
protected:
QJsonObject _profile_obj;
bool _isBusy;
void reject();
#ifdef Q_OS_WIN #ifdef Q_OS_WIN
protected: protected:
bool nativeEvent(const QByteArray &eventType, void *message, long *result); bool nativeEvent(const QByteArray &eventType, void *message, long *result);
...@@ -32,10 +37,6 @@ protected: ...@@ -32,10 +37,6 @@ protected:
protected: protected:
long winNCHitTest(MSG *msg); long winNCHitTest(MSG *msg);
protected:
QJsonObject _profile_obj;
bool _isBusy;
#endif #endif
}; };
......
...@@ -6,8 +6,8 @@ ...@@ -6,8 +6,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>327</width> <width>300</width>
<height>165</height> <height>150</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
...@@ -15,71 +15,123 @@ ...@@ -15,71 +15,123 @@
</property> </property>
<property name="styleSheet"> <property name="styleSheet">
<string notr="true"> <string notr="true">
#FMCouponWidget
{
background-color: rgb(255, 255, 255);
border-image: url(:/coupon_select.png);
}
#code_lab #code_lab
{ {
color: rgb(50,50,50); max-height: 15%;
font: 18px &quot;Microsoft YaHei&quot;; color: rgb(127,127,127);
font: 15px &quot;Microsoft YaHei&quot;;
} }
#amount_lab #amount_lab
{ {
color: rgb(50,50,50); min-height: 65%;
max-height: 65%;
color: rgb(229, 11, 72);
font: bold 36px &quot;Microsoft YaHei&quot;; font: bold 36px &quot;Microsoft YaHei&quot;;
} }
#desc_lab #desc_lab
{ {
color: rgb(50,50,50); max-height: 30%;
font: 18px &quot;Microsoft YaHei&quot;; color: rgb(252,255,255);
background-color: rgb(229, 11, 72);
font: bold 18px &quot;Microsoft YaHei&quot;;
}
#coupon_left
{
max-width: 5px;
background-color: rgb(255, 170, 37);
}
#coupon_separator
{
max-height: 1px;
background-image: url(:/coupon_separator.png);
margin-bottom: 5px;
} }
</string> </string>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout"> <layout class="QHBoxLayout" name="horizontalLayout">
<property name="spacing"> <property name="spacing">
<number>0</number> <number>0</number>
</property> </property>
<property name="leftMargin"> <property name="leftMargin">
<number>5</number> <number>0</number>
</property> </property>
<property name="topMargin"> <property name="topMargin">
<number>5</number> <number>0</number>
</property> </property>
<property name="rightMargin"> <property name="rightMargin">
<number>5</number> <number>0</number>
</property> </property>
<property name="bottomMargin"> <property name="bottomMargin">
<number>5</number> <number>0</number>
</property> </property>
<item> <item>
<widget class="QLabel" name="code_lab"> <widget class="QLabel" name="coupon_left"/>
<property name="text">
<string>123456789</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item> </item>
<item> <item>
<widget class="QLabel" name="amount_lab"> <layout class="QVBoxLayout" name="verticalLayout">
<property name="text"> <property name="spacing">
<string>40</string> <number>0</number>
</property> </property>
<property name="alignment"> <property name="leftMargin">
<set>Qt::AlignCenter</set> <number>5</number>
</property> </property>
</widget> <property name="topMargin">
</item> <number>5</number>
<item>
<widget class="QLabel" name="desc_lab">
<property name="text">
<string>测试代金券</string>
</property> </property>
<property name="alignment"> <property name="rightMargin">
<set>Qt::AlignCenter</set> <number>5</number>
</property> </property>
<property name="wordWrap"> <property name="bottomMargin">
<bool>true</bool> <number>5</number>
</property> </property>
</widget> <item>
<widget class="QLabel" name="amount_lab">
<property name="text">
<string>¥40.00</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="coupon_separator"/>
</item>
<item>
<widget class="QLabel" name="desc_lab">
<property name="maximumSize">
<size>
<width>16777215</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>测试代金券</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="code_lab">
<property name="text">
<string>123456789</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
</layout>
</item> </item>
</layout> </layout>
</widget> </widget>
......
...@@ -41,14 +41,16 @@ ...@@ -41,14 +41,16 @@
} }
#close_btn { #close_btn {
min-width: 53px; min-height: 53px; min-width: 30px; min-height: 30px;
border-image: url(&quot;:/btn_close.png&quot;); max-width: 30px; max-height: 30px;
margin-left: 260;
border-image: url(&quot;:/btn_alert_close.png&quot;);
} }
#close_btn:hover{ <!-- #close_btn:hover{
min-width: 51px; min-height: 51px; min-width: 51px; min-height: 51px;
border-image: url(&quot;:/btn_alert_close.png&quot;); border-image: url(&quot;:/btn_alert_close.png&quot;);
} } -->
#alertLabMsg #alertLabMsg
{ {
color: rgb(129, 129, 129); color: rgb(129, 129, 129);
...@@ -84,6 +86,10 @@ ...@@ -84,6 +86,10 @@
<number>0</number> <number>0</number>
</property> </property>
<item> <item>
<widget class="QPushButton" name="close_btn">
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_3"> <layout class="QHBoxLayout" name="horizontalLayout_3">
<property name="spacing"> <property name="spacing">
<number>0</number> <number>0</number>
......
...@@ -74,13 +74,12 @@ ...@@ -74,13 +74,12 @@
#login_edit { #login_edit {
min-height: 60px; min-height: 60px;
border: 1 solid silver; border: 1 solid silver;
text-align: center;
font: 100 30px &quot;Microsoft YaHei&quot;; font: 100 30px &quot;Microsoft YaHei&quot;;
color: rgb(50,50,50); color: rgb(50,50,50);
background: white; background: white;
border: 1 solid silver; border: 1 solid silver;
border-left: 0; border-left: 0;
margin-left: -82; <!-- margin-left: -82; -->
} }
#login_btn { #login_btn {
...@@ -244,9 +243,6 @@ ...@@ -244,9 +243,6 @@
<property name="frame"> <property name="frame">
<bool>true</bool> <bool>true</bool>
</property> </property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
<property name="placeholderText"> <property name="placeholderText">
<string/> <string/>
</property> </property>
......
...@@ -87,7 +87,7 @@ ...@@ -87,7 +87,7 @@
border-top: 0 solid silver; border-top: 0 solid silver;
} }
#price_label { #price_label {
font: bold 36px &quot;Microsoft YaHei&quot;; font: bold 42px &quot;Microsoft YaHei&quot;;
padding-left: 70px; padding-left: 70px;
color: rgb(50,50,50); color: rgb(50,50,50);
border: 0 solid silver; border: 0 solid silver;
......
...@@ -14,5 +14,7 @@ ...@@ -14,5 +14,7 @@
<file>loading.gif</file> <file>loading.gif</file>
<file>alert_bg.png</file> <file>alert_bg.png</file>
<file>tip_warning.png</file> <file>tip_warning.png</file>
<file>coupon_select.png</file>
<file>coupon_separator.png</file>
</qresource> </qresource>
</RCC> </RCC>
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