Commit 15076e58 by NitefullWind

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

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