Commit ec386dbc by xiaoqing.gu

1、订单记录可配置 2、提交完成后回到支付界面,并清空界面,可继续下一笔交易

parent e2c9e349
...@@ -13,7 +13,7 @@ greaterThan(QT_MAJOR_VERSION, 4): QT += widgets ...@@ -13,7 +13,7 @@ greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
CONFIG += c++11 CONFIG += c++11
DEFINES += FM_DEBUG FASTPAY DEFINES += FASTPAY
SOURCES += \ SOURCES += \
fmp_vip.cpp \ fmp_vip.cpp \
......
...@@ -32,6 +32,11 @@ int FMPVipSettings::GetPayPartnerId() ...@@ -32,6 +32,11 @@ int FMPVipSettings::GetPayPartnerId()
return _GetValue("Home/PartnerId", 1371).toInt(); return _GetValue("Home/PartnerId", 1371).toInt();
} }
QString FMPVipSettings::getPageSize()
{
return _GetValue("List/PageSize").toString();
}
QVariant FMPVipSettings::_GetValue(const QString &key, QVariant defaultValue) QVariant FMPVipSettings::_GetValue(const QString &key, QVariant defaultValue)
{ {
if (_settings) { if (_settings) {
......
...@@ -18,6 +18,7 @@ public: ...@@ -18,6 +18,7 @@ public:
bool getIsNeedSocketHeader(); bool getIsNeedSocketHeader();
int GetPayPartnerId(); int GetPayPartnerId();
QString getPageSize();
private: private:
explicit FMPVipSettings(QObject *parent = 0); explicit FMPVipSettings(QObject *parent = 0);
......
#include "tasklist.h" #include "tasklist.h"
#include "fmviplist.h" #include "fmviplist.h"
#include "fmp_settings_i.h"
TaskList::TaskList(QJsonObject &jsonObj, Session *session, QObject *parent) TaskList::TaskList(QJsonObject &jsonObj, Session *session, QObject *parent)
...@@ -33,7 +34,7 @@ void TaskList::packageServerReq() ...@@ -33,7 +34,7 @@ void TaskList::packageServerReq()
serverReqJsonObj[PosProps.StationId] = session()->data("STATIONID").toString(); serverReqJsonObj[PosProps.StationId] = session()->data("STATIONID").toString();
serverReqJsonObj[PosProps.PartnerId] = session()->data("PI").toString(); serverReqJsonObj[PosProps.PartnerId] = session()->data("PI").toString();
serverReqJsonObj[PosProps.OperatorId] = session()->data("OPERATORID").toString(); serverReqJsonObj[PosProps.OperatorId] = session()->data("OPERATORID").toString();
serverReqJsonObj["PageSize"] = "10"; serverReqJsonObj["PageSize"] = FMPVipSettings::instance()->getPageSize();
serverReqJsonObj["PageCount"] = "1"; serverReqJsonObj["PageCount"] = "1";
} }
......
...@@ -24,7 +24,6 @@ void TaskCoupon::packageServerReq() ...@@ -24,7 +24,6 @@ void TaskCoupon::packageServerReq()
// request[ServerProps(PosProps.HrtAttrs)] = hrtObj; // request[ServerProps(PosProps.HrtAttrs)] = hrtObj;
// serverReqJsonObj["REQUEST"] = request; // serverReqJsonObj["REQUEST"] = request;
qDebug() << session()->data(PosProps.TransId).toString() << "^^^^^^^^^^^^^^^^^^^^^^^^^^";
if(session()->data(PosProps.TransId).toString() != NULL) if(session()->data(PosProps.TransId).toString() != NULL)
{ {
serverReqJsonObj[PosProps.TransId] = session()->data(PosProps.TransId).toString(); serverReqJsonObj[PosProps.TransId] = session()->data(PosProps.TransId).toString();
...@@ -283,9 +282,18 @@ TaskPoint::TaskPoint(QJsonObject &jsonObj, Session *session, QObject *parent) ...@@ -283,9 +282,18 @@ TaskPoint::TaskPoint(QJsonObject &jsonObj, Session *session, QObject *parent)
void TaskPoint::packageServerReq() void TaskPoint::packageServerReq()
{ {
if(session()->data(PosProps.OrderNo).toString() == NULL)
{
QString time = QDateTime::currentDateTime().toString("yyyyMMddhhmmsszzz");
QString stationId = session()->data("STATIONID").toString();
QString partnerId = session()->data("PI").toString();
QString orderNo = partnerId + stationId + time;
serverReqJsonObj[PosProps.OrderNo] = orderNo;
}else {
serverReqJsonObj[PosProps.OrderNo] = session()->data(PosProps.OrderNo).toString();
}
serverReqJsonObj[PosProps.CouponDiscount] = session()->data(PosProps.CouponDiscount).toString(); serverReqJsonObj[PosProps.CouponDiscount] = session()->data(PosProps.CouponDiscount).toString();
serverReqJsonObj[PosProps.OpenId] = session()->data(PosProps.OpenId).toString(); serverReqJsonObj[PosProps.OpenId] = session()->data(PosProps.OpenId).toString();
serverReqJsonObj[PosProps.OrderNo] = session()->data(PosProps.OrderNo).toString();
serverReqJsonObj[PosProps.Partner] = session()->data("PN").toString(); serverReqJsonObj[PosProps.Partner] = session()->data("PN").toString();
serverReqJsonObj[PosProps.PayTotalAmount] = session()->data(PosProps.PayTotalAmount).toString(); serverReqJsonObj[PosProps.PayTotalAmount] = session()->data(PosProps.PayTotalAmount).toString();
serverReqJsonObj[PosProps.TotalAmount] = session()->data(PosProps.TotalAmount).toString(); serverReqJsonObj[PosProps.TotalAmount] = session()->data(PosProps.TotalAmount).toString();
......
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
#include <QScrollBar> #include <QScrollBar>
#include <QItemSelectionModel> #include <QItemSelectionModel>
#include <QLabel> #include <QLabel>
#include "fmp_vip_server.h"
FMVipOrder::FMVipOrder(QDialog *parent) : FMVipOrder::FMVipOrder(QDialog *parent) :
FMVipWnd(parent), FMVipWnd(parent),
...@@ -177,7 +178,7 @@ bool FMVipOrder::initWnd(Session *session) ...@@ -177,7 +178,7 @@ bool FMVipOrder::initWnd(Session *session)
oldPayText = DOUBLE_STR(orderInfo->getMaxWillPay()); oldPayText = DOUBLE_STR(orderInfo->getMaxWillPay());
ui->pay_edit->setText(oldPayText); ui->pay_edit->setText(oldPayText);
QRegExp regexp("^[0-9]+(.[0-9]{2})?$"); QRegExp regexp("^(0\\.\\d{1,2})|([1-9]\\d*(\\.\\d{1,2})?)$");
ui->pay_edit->setValidator(new QRegExpValidator(regexp)); ui->pay_edit->setValidator(new QRegExpValidator(regexp));
ui->score_edit->setValidator(new QRegExpValidator(regexp)); ui->score_edit->setValidator(new QRegExpValidator(regexp));
setWillPayText(); setWillPayText();
...@@ -201,6 +202,12 @@ void FMVipOrder::on_pay_btn_clicked() ...@@ -201,6 +202,12 @@ void FMVipOrder::on_pay_btn_clicked()
this->setEnabled(true); this->setEnabled(true);
return; return;
} }
if(ui->pay_edit->text().toDouble() == 0.00)
{
FMMsgWnd::WarningWnd(QString::fromLocal8Bit("请确认订单金额!"),this);
return;
}
QString amount = needPayLe->text(); QString amount = needPayLe->text();
// QStringList strlist = str.split(":"); // QStringList strlist = str.split(":");
// QString amount = strlist.at(1); // QString amount = strlist.at(1);
...@@ -213,16 +220,31 @@ void FMVipOrder::on_pay_btn_clicked() ...@@ -213,16 +220,31 @@ void FMVipOrder::on_pay_btn_clicked()
session()->addData(PosProps.TotalAmount,QString::number(codeAmount)); session()->addData(PosProps.TotalAmount,QString::number(codeAmount));
session()->addData(PosProps.PayTotalAmount,amount.toDouble()*100); session()->addData(PosProps.PayTotalAmount,amount.toDouble()*100);
session()->addData(PosProps.CouponDiscount,orderInfo->getPayAmountCoupon() * 100); session()->addData(PosProps.CouponDiscount,orderInfo->getPayAmountCoupon() * 100);
if(amount.toDouble() < 0) // if(amount.toDouble() < 0)
{ // {
FMMsgWnd::FailureWnd(QString::fromLocal8Bit("请确认金额!"),this); // FMMsgWnd::FailureWnd(QString::fromLocal8Bit("请确认金额!"),this);
this->setEnabled(true); // this->setEnabled(true);
return; // return;
} // }
scanfLe->clear();
QJsonObject json; QJsonObject json;
TaskPoint pointTask(json,_session); TaskPoint pointTask(json,_session);
pointTask.doTask(); pointTask.doTask();
reject(); /*清空界面,让程序一直在支付界面*/
this->close();
vipLe->clear();
QMap<QString,Coupon> map;
session()->addData(PosProps.CouponMap,map);
session()->addData("VIP","0");
session()->addData(PosProps.TransId,"");
session()->addData(PosProps.OrderNo,"");
QByteArray rspData;
FMPVipServer::instance()->callVipPay("{\"fm_cmd\":1003}",rspData);
// scanfLe->clear();
// vipLe->clear();
// ui->pay_edit->setText("0.00");
#else #else
...@@ -270,7 +292,6 @@ void FMVipOrder::on_coupon_page_clicked(const QModelIndex &index) ...@@ -270,7 +292,6 @@ void FMVipOrder::on_coupon_page_clicked(const QModelIndex &index)
void FMVipOrder::insertVip() void FMVipOrder::insertVip()
{ {
qDebug() << _session->data("VIP").toInt();
if(_session->data("VIP").toInt()) if(_session->data("VIP").toInt())
{ {
vipLe->setText(session()->data(PosProps.Coupon_code).toString()); vipLe->setText(session()->data(PosProps.Coupon_code).toString());
...@@ -389,7 +410,13 @@ void FMVipOrder::on_pay_key_clicked() ...@@ -389,7 +410,13 @@ void FMVipOrder::on_pay_key_clicked()
#ifdef FASTPAY #ifdef FASTPAY
void FMVipOrder::on_scanfLe_returnPressed() void FMVipOrder::on_scanfLe_returnPressed()
{ {
emit couponReq(scanfLe->text());
if(orderInfo->selectCouponMap.contains(scanfLe->text())) {
FMMsgWnd::WarningWnd(QString::fromLocal8Bit("券已添加,请勿重复添加!"));
} else {
emit couponReq(scanfLe->text());
}
scanfLe->clear(); scanfLe->clear();
} }
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
#define VER_MINOR 1 #define VER_MINOR 1
#define VER_REVISION 0 #define VER_REVISION 0
#define VER_BUILD 41 #define VER_BUILD 42
//! Convert version numbers to string //! Convert version numbers to string
#define _STR(S) #S #define _STR(S) #S
......
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