Commit 15076e58 by NitefullWind

1. 修复支付界面金额变化问题。 2. 限制使用支付码支付。 3. 修复在认证界面按Esc会进入支付界面的Bug。 4. 修改一些界面。

parent 6e5a131f
...@@ -75,7 +75,7 @@ struct PP{ ...@@ -75,7 +75,7 @@ struct PP{
Mobile = "mobile"; Mobile = "mobile";
Fm_open_id = "fm_open_id"; Fm_open_id = "fm_open_id";
Account = "account"; Account = "account";
CanPay = "CanPay"; CanPay = "can_pay";
Score = "score"; Score = "score";
......
...@@ -61,7 +61,7 @@ void FMTask::stopTask() ...@@ -61,7 +61,7 @@ void FMTask::stopTask()
preTask->stopTask(); preTask->stopTask();
} }
if(_window != nullptr) { if(_window != nullptr) {
_window->close(); _window->accept();
_window = nullptr; _window = nullptr;
} }
...@@ -81,6 +81,8 @@ void FMTask::showWindow() ...@@ -81,6 +81,8 @@ void FMTask::showWindow()
{ {
FMP_DEBUG() << __FUNCTION__; FMP_DEBUG() << __FUNCTION__;
QString sL[] = { QString sL[] = {
PosProps.StoreId,
PosProps.PosId,
PosProps.OperatorId, PosProps.OperatorId,
PosProps.BussinessDate, PosProps.BussinessDate,
}; };
...@@ -93,7 +95,7 @@ void FMTask::showWindow() ...@@ -93,7 +95,7 @@ void FMTask::showWindow()
if(_window != nullptr) { if(_window != nullptr) {
_window->initWnd(this->session()); _window->initWnd(this->session());
int ret = _window->exec(); int ret = _window->exec();
if(ret == -1) { if(ret != 1) {
setError(FM_API_WINDOWCLOSE); setError(FM_API_WINDOWCLOSE);
} }
} }
......
...@@ -55,5 +55,5 @@ void TaskFund::packagePOSRsp() ...@@ -55,5 +55,5 @@ void TaskFund::packagePOSRsp()
void TaskFund::onFund() void TaskFund::onFund()
{ {
sendToServer(); sendToServer();
_window->close(); _window->reject();
} }
...@@ -37,7 +37,7 @@ void TaskLogin::onLogin() ...@@ -37,7 +37,7 @@ void TaskLogin::onLogin()
bool isOk = sendToServer(); bool isOk = sendToServer();
if(!isOk) { if(!isOk) {
if(_window != nullptr) { if(_window != nullptr) {
_window->close(); _window->accept();
} }
return; return;
} }
...@@ -49,11 +49,11 @@ void TaskLogin::onLogin() ...@@ -49,11 +49,11 @@ void TaskLogin::onLogin()
FMMsgWnd::FailureWnd(info, _window); FMMsgWnd::FailureWnd(info, _window);
} }
// 认证成功但限制用支付码 // 认证成功但限制用支付码
// else if((session()->data(PosProps.FM_Type).toInt() == FM_Pay) && else if((session()->data(PosProps.FM_Type).toInt() == FM_Pay) &&
// (getServerJsonValue(PosProps.CanPay).toInt() != 1)) { (getServerJsonValue(PosProps.CanPay).toInt() != 1)) {
// FMP_WARN() << ErrorNeedPayCode; FMP_WARN() << ErrorNeedPayCode;
// FMMsgWnd::FailureWnd(ErrorNeedPayCode); FMMsgWnd::FailureWnd(QString::fromLocal8Bit(ErrorNeedPayCode), _window);
// } }
// 认证成功 // 认证成功
else { else {
QString fm_open_id = getServerJsonValue(PosProps.Fm_open_id).toString(); QString fm_open_id = getServerJsonValue(PosProps.Fm_open_id).toString();
...@@ -87,7 +87,7 @@ void TaskLogin::onLogin() ...@@ -87,7 +87,7 @@ void TaskLogin::onLogin()
} }
session()->addData(PosProps.CouponMap, couponMap); session()->addData(PosProps.CouponMap, couponMap);
} }
_window->close(); _window->accept();
} }
if(_window!=nullptr) { if(_window!=nullptr) {
_window->resetWnd(); _window->resetWnd();
......
#include "taskpay.h" #include "taskpay.h"
#include "fmviporder.h" #include "fmviporder.h"
#include "tasklogin.h" #include "tasklogin.h"
#include "fmp_vip_settings.h"
TaskPay::TaskPay(QJsonObject &jsonObj, QObject *parent) TaskPay::TaskPay(QJsonObject &jsonObj, QObject *parent)
:FMTask(jsonObj, FM_Pay, 0, parent) :FMTask(jsonObj, FM_Pay, 0, parent)
...@@ -121,5 +122,12 @@ void TaskPay::packagePOSRsp() ...@@ -121,5 +122,12 @@ void TaskPay::packagePOSRsp()
void TaskPay::onPay() void TaskPay::onPay()
{ {
sendToServer(); sendToServer();
_window->close();
if(error() == FM_API_TIMEOUT) {
FMP_INFO() << "Pay failed: timeout. To reversal.";
TaskRefundPay taskRefundPay(posReqJsonObj);
taskRefundPay.doTask();
}
_window->accept();
} }
...@@ -25,17 +25,17 @@ void FMMsgWnd::show(InfoType type, const QString &info) ...@@ -25,17 +25,17 @@ void FMMsgWnd::show(InfoType type, const QString &info)
iconUrl = ""; iconUrl = "";
break; break;
case T_Success: case T_Success:
iconUrl = ":/tip_ok.png"; iconUrl = ":/img/tip_ok.png";
break; break;
case T_Failure: case T_Failure:
iconUrl = ":/tip_error.png"; iconUrl = ":/img/tip_error.png";
break; break;
case T_Warning: case T_Warning:
iconUrl = ":/tip_warning.png"; iconUrl = ":/img/tip_warning.png";
break; break;
case T_LoginSuccess: case T_LoginSuccess:
ui->label_msg->setText(QString::fromLocal8Bit("会员认证成功")); ui->label_msg->setText(QString::fromLocal8Bit("会员认证成功"));
iconUrl = ":/tip_ok.png"; iconUrl = ":/img/tip_ok.png";
break; break;
default: default:
iconUrl = ""; iconUrl = "";
......
...@@ -31,8 +31,14 @@ bool FMVipOrder::initWnd(Session *session) ...@@ -31,8 +31,14 @@ bool FMVipOrder::initWnd(Session *session)
QString operator_id = session->data(PosProps.OperatorId).toString(); QString operator_id = session->data(PosProps.OperatorId).toString();
QString business_date = session->data(PosProps.BussinessDate).toString(); QString business_date = session->data(PosProps.BussinessDate).toString();
QString fm_id = session->data(PosProps.Account).toString(); QString fm_id = session->data(PosProps.Mobile).toString();
if(fm_id.isEmpty()) {
fm_id = "--";
}
QString name = session->data(PosProps.Name).toString(); QString name = session->data(PosProps.Name).toString();
if(name.isEmpty()) {
name = "--";
}
QString birthday = session->data(PosProps.Birthday).toString(); QString birthday = session->data(PosProps.Birthday).toString();
QString amount_str = QString::number(session->data(PosProps.Amount).toInt()); QString amount_str = QString::number(session->data(PosProps.Amount).toInt());
...@@ -48,6 +54,8 @@ bool FMVipOrder::initWnd(Session *session) ...@@ -48,6 +54,8 @@ bool FMVipOrder::initWnd(Session *session)
double maxDisAmount = (orderAmount - session->data(PosProps.UndisAmount).toInt()) / 100.0; double maxDisAmount = (orderAmount - session->data(PosProps.UndisAmount).toInt()) / 100.0;
orderInfo->setMaxDisAmount(maxDisAmount); orderInfo->setMaxDisAmount(maxDisAmount);
ui->store_label->setText(session->data(PosProps.StoreId).toString());
ui->pos_label->setText(session->data(PosProps.PosId).toString());
ui->operator_label->setText(operator_id); ui->operator_label->setText(operator_id);
ui->bd_label->setText(business_date); ui->bd_label->setText(business_date);
ui->id_label->setText(fm_id); ui->id_label->setText(fm_id);
...@@ -93,6 +101,7 @@ void FMVipOrder::on_pay_chk_clicked(bool checked) ...@@ -93,6 +101,7 @@ void FMVipOrder::on_pay_chk_clicked(bool checked)
int is = checked ? 1 : 0; int is = checked ? 1 : 0;
session()->addData(ServerProps(PosProps.IsUseScore), is); session()->addData(ServerProps(PosProps.IsUseScore), is);
orderInfo->setUseScore(checked); orderInfo->setUseScore(checked);
oldPayText = DOUBLE_STR(orderInfo->getMaxWillPay());
setWillPayText(); setWillPayText();
} }
...@@ -158,6 +167,7 @@ void FMVipOrder::onSelectionChanged(const QItemSelection &selected, const QItemS ...@@ -158,6 +167,7 @@ void FMVipOrder::onSelectionChanged(const QItemSelection &selected, const QItemS
orderInfo->setMaxDisAmount(orderInfo->getMaxDisAmount() + coupon.limitAmount()); orderInfo->setMaxDisAmount(orderInfo->getMaxDisAmount() + coupon.limitAmount());
} }
orderInfo->enoughCoupon(); orderInfo->enoughCoupon();
oldPayText = DOUBLE_STR(orderInfo->getMaxWillPay());
setWillPayText(); setWillPayText();
} }
...@@ -165,8 +175,8 @@ void FMVipOrder::setWillPayText() ...@@ -165,8 +175,8 @@ void FMVipOrder::setWillPayText()
{ {
on_pay_edit_textChanged(oldPayText); on_pay_edit_textChanged(oldPayText);
ui->pay_edit->setFocus(); // ui->pay_edit->setFocus();
ui->pay_edit->selectAll(); // ui->pay_edit->selectAll();
} }
void FMVipOrder::on_coupon_prev_btn_clicked() void FMVipOrder::on_coupon_prev_btn_clicked()
...@@ -185,19 +195,18 @@ void FMVipOrder::on_pay_edit_textChanged(const QString &text) ...@@ -185,19 +195,18 @@ void FMVipOrder::on_pay_edit_textChanged(const QString &text)
{ {
double num = text.toDouble(); double num = text.toDouble();
double maxPay = orderInfo->getMaxWillPay(); double maxPay = orderInfo->getMaxWillPay();
if (num > maxPay) {
ui->pay_edit->setText(DOUBLE_STR(maxPay));
if (num > maxPay) {
QString maxPay_info = QString::fromLocal8Bit("余额只需支付 %1 元"); QString maxPay_info = QString::fromLocal8Bit("余额只需支付 %1 元");
if (maxPay >= orderInfo->getAmountStr().toDouble()) { if (maxPay >= orderInfo->getAmountStr().toDouble()) {
maxPay_info = QString::fromLocal8Bit("余额最多支付 %1 元"); maxPay_info = QString::fromLocal8Bit("余额最多支付 %1 元");
} }
ui->pay_max->setText(maxPay_info.arg(maxPay)); ui->pay_max->setText(maxPay_info.arg(maxPay));
ui->pay_edit->setText(DOUBLE_STR(maxPay));
ui->pay_edit->setFocus();
ui->pay_edit->selectAll();
} else { } else {
oldPayText = text; oldPayText = text;
ui->pay_max->setText(""); ui->pay_max->setText("");
ui->pay_edit->setText(text);
} }
} }
...@@ -26,7 +26,7 @@ FMVipWnd::~FMVipWnd() ...@@ -26,7 +26,7 @@ FMVipWnd::~FMVipWnd()
void FMVipWnd::on_close_btn_clicked() void FMVipWnd::on_close_btn_clicked()
{ {
this->done(-1); this->reject();
} }
bool FMVipWnd::close() bool FMVipWnd::close()
......
...@@ -149,7 +149,7 @@ ...@@ -149,7 +149,7 @@
</size> </size>
</property> </property>
<property name="text"> <property name="text">
<string/> <string>非码会员</string>
</property> </property>
</widget> </widget>
</item> </item>
......
...@@ -329,7 +329,7 @@ ...@@ -329,7 +329,7 @@
</size> </size>
</property> </property>
<property name="text"> <property name="text">
<string/> <string>非码会员</string>
</property> </property>
</widget> </widget>
</item> </item>
......
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