Commit 35851cc6 by NitefllWind

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

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