Commit 54c06fce by gujin.wang

完善卡券核销插件,添加对券和商品不匹配情况的判断,并给出提示。

parent 3e7b797c
...@@ -15,8 +15,8 @@ Level=4 ...@@ -15,8 +15,8 @@ Level=4
[Home] [Home]
Server=http://115.159.226.87:20001/api/user/login Server=http://115.159.226.87:20001/api/user/login
PartnerId=1521 PartnerId=1371
StoreId=9999 StoreId=fm99999
PosId=01 PosId=01
Position=1479, 521 Position=1479, 521
CashierId=001 CashierId=001
......
No preview for this file type
...@@ -52,7 +52,9 @@ ...@@ -52,7 +52,9 @@
} }
/**/ /**/
#labActName{ #labActName{
font: 75 45pt "微软雅黑"; font-size:30px;
font-family:"微软雅黑";
font-weight:bold;
color: rgb(255, 255, 0); color: rgb(255, 255, 0);
} }
#labCodeName{ #labCodeName{
......
...@@ -52,7 +52,10 @@ ...@@ -52,7 +52,10 @@
} }
/**/ /**/
#labActName{ #labActName{
font: 75 45pt "微软雅黑"; /*font: 30 bold "微软雅黑";*/
font-size:30px;
font-family:"微软雅黑";
font-weight:bold;
color: rgb(255, 255, 0); color: rgb(255, 255, 0);
border:none; border:none;
} }
......
...@@ -71,4 +71,23 @@ void ErrCodeDialog::showForErr(const QString& coupon, const QString& mess, QWidg ...@@ -71,4 +71,23 @@ void ErrCodeDialog::showForErr(const QString& coupon, const QString& mess, QWidg
v.ui->labActName->setText( mess); v.ui->labActName->setText( mess);
v.exec(); v.exec();
} }
\ No newline at end of file
void ErrCodeDialog::showForMismatch(const QString &coupon, const QString &mess, QWidget *parent)
{
ErrCodeDialog v(parent);
// v.setGeometry( 0,0,350,470);
v.ui->topInvalidWidget->setObjectName("topExpirdWidget");
v.ui->topInvalidWidget->setStyleSheet( v.ui->topInvalidWidget->styleSheet());
v.ui->labTime->setVisible( false);
v.ui->labCodeName->setVisible( false);
v.ui->labFolat->setVisible( false);
v.ui->labActName->setVisible( true);
v.ui->labCode->setText(coupon );
v.ui->labActName->setText( mess);
v.exec();
}
...@@ -17,7 +17,8 @@ public: ...@@ -17,7 +17,8 @@ public:
static void showForInvalid(const QString& coupon, QWidget *parent = 0); static void showForInvalid(const QString& coupon, QWidget *parent = 0);
static void showForExpird(const QString& act_name, const QString& code_name, const QString& time_name, const QString& coupon, QWidget *parent = 0); static void showForExpird(const QString& act_name, const QString& code_name, const QString& time_name, const QString& coupon, QWidget *parent = 0);
static void showForErr( const QString& coupon, const QString& mess, QWidget *parent = 0); static void showForErr(const QString& coupon, const QString& mess, QWidget *parent = 0);
static void showForMismatch(const QString& coupon, const QString& mess, QWidget *parent = 0);
private: private:
Ui::ErrCodeDialog *ui; Ui::ErrCodeDialog *ui;
......
...@@ -65,7 +65,7 @@ ...@@ -65,7 +65,7 @@
} }
/*label*/ /*label*/
#labActName{ #labActName{
font: 75 45pt "微软雅黑"; font: 75 30pt "微软雅黑";
color: rgb(81, 81, 81); color: rgb(81, 81, 81);
} }
......
#include "fmp_redeem.h" #include "fmp_redeem.h"
#include "scanningdialog.h" #include "scanningdialog.h"
#include "consumptiondialog.h" #include "consumptiondialog.h"
#include "consumokdialog.h" #include "consumokdialog.h"
...@@ -6,6 +6,8 @@ ...@@ -6,6 +6,8 @@
#include "fmp_logger_i.h" #include "fmp_logger_i.h"
#include "fmp_pe_handlers.h" #include "fmp_pe_handlers.h"
#include "fmp_settings_i.h" #include "fmp_settings_i.h"
#include "fmp_epay_i.h"
#include "fmp_home_i.h"
#include <QJsonDocument> #include <QJsonDocument>
#include <QJsonObject> #include <QJsonObject>
#include <QJsonParseError> #include <QJsonParseError>
...@@ -17,6 +19,8 @@ ...@@ -17,6 +19,8 @@
#include <QJsonArray> #include <QJsonArray>
#include <QApplication> #include <QApplication>
#include <QResource> #include <QResource>
#include <QSettings>
#include <QMessageBox>
FMPRedeem::FMPRedeem(const FMPContext context) FMPRedeem::FMPRedeem(const FMPContext context)
:FMPRedeemInterface(), :FMPRedeemInterface(),
...@@ -25,7 +29,6 @@ FMPRedeem::FMPRedeem(const FMPContext context) ...@@ -25,7 +29,6 @@ FMPRedeem::FMPRedeem(const FMPContext context)
_clientReqCount(0), _clientReqCount(0),
_ste_handler(new FMPStartEventHandler(this)) _ste_handler(new FMPStartEventHandler(this))
{ {
//FMPLoggerInterface::InitContext(context);
//注册资源 //注册资源
QString strpath= QApplication::applicationDirPath(); QString strpath= QApplication::applicationDirPath();
QString rccPath = QString("%1/../rcc/%2.rcc").arg(strpath).arg("redeem"); QString rccPath = QString("%1/../rcc/%2.rcc").arg(strpath).arg("redeem");
...@@ -52,13 +55,64 @@ void FMPRedeem::UninitService() ...@@ -52,13 +55,64 @@ void FMPRedeem::UninitService()
{ {
} }
QJsonObject FMPRedeem::Redeem(const QJsonObject& storeInfo) QJsonValue FMPRedeem::SearchJsonObject(const QJsonObject& searchJson, const QString& searchKey)
{ {
FMP_DEBUG() << "Recv pos data: " << QJsonDocument(storeInfo).toJson(QJsonDocument::Compact); QJsonValue value;
if(searchJson.contains(searchKey))
_store_id = storeInfo["store_id"].toString(); {
_station_id = storeInfo["station_id"].toInt(); return searchJson[searchKey];
_operator_id = storeInfo["operator_id"].toString(); }
else
{
foreach(QString key, searchJson.keys())
{
if(searchJson[key].isObject())
{
QJsonObject ob = searchJson[key].toObject();
value = SearchJsonObject(ob, searchKey);
}
else if(searchJson[key].isArray())
{
QJsonArray arr = searchJson[key].toArray();
value = SearchJsonArray(arr, searchKey);
}
}
}
return value;
}
QJsonValue FMPRedeem::SearchJsonArray(const QJsonArray& searchJson, const QString& searchKey)
{
QJsonValue value;
for(int i = 0; i < searchJson.size(); i++)
{
if(searchJson[i].isObject())
{
QJsonObject ob = searchJson[i].toObject();
value = SearchJsonObject(ob, searchKey);
}
else if(searchJson[i].isArray())
{
QJsonArray arr = searchJson[i].toArray();
value = SearchJsonArray(arr, searchKey);
}
}
return value;
}
QJsonObject FMPRedeem::Redeem(const double needPay, const QJsonObject& requestInfo)
{
FMP_DEBUG() << "Recv redeem data: " << QJsonDocument(requestInfo).toJson(QJsonDocument::Compact);
_products_info = SearchJsonObject(requestInfo, "products").toArray();
_needPay = needPay;
//读取门店信息
QString apppath = QCoreApplication::applicationDirPath();
QSettings settings(QString("%1/FreemudPOS.ini").arg(apppath), QSettings::IniFormat);
_store_id = settings.value(FMP_INIKEY_LOGINSTOREID).toString();
_station_id = settings.value(FMP_INIKEY_LOGINPOSID).toString();
_operator_id = settings.value(FMP_INIKEY_LOGINCASHIER).toString();
_url = settings.value(FMP_INIKEY_EPAYURL).toString();
_partner_id = settings.value(FMP_INIKEY_LOGINPARTNERID).toInt();
//显示扫码界面获取券码 //显示扫码界面获取券码
ScanningDialog scanningDialog; ScanningDialog scanningDialog;
...@@ -70,16 +124,17 @@ QJsonObject FMPRedeem::Redeem(const QJsonObject& storeInfo) ...@@ -70,16 +124,17 @@ QJsonObject FMPRedeem::Redeem(const QJsonObject& storeInfo)
FMP_DEBUG() << QJsonDocument(ret).toJson(QJsonDocument::Compact); FMP_DEBUG() << QJsonDocument(ret).toJson(QJsonDocument::Compact);
return ret; return ret;
} }
_coupon = scanningDialog.code;
QJsonObject json; QJsonObject json;
json.insert("ver", 2); json.insert("ver", 2);
json.insert("clientReqCount", ++_clientReqCount%=10000000); json.insert("clientReqCount", ++_clientReqCount%=10000000);
json.insert("reqtype", 0); json.insert("reqtype", 0);
//json.insert("partnerId", _partnerId); json.insert("partnerId", _partner_id);
json.insert("store_id", _store_id); json.insert("store_id", _store_id);
json.insert("station_id", _station_id); json.insert("station_id", _station_id);
json.insert("operator_id", _operator_id); json.insert("operator_id", _operator_id);
json.insert("coupon", scanningDialog.code);//code json.insert("coupon", _coupon);
QByteArray reqData = QJsonDocument(json).toJson(QJsonDocument::Compact); QByteArray reqData = QJsonDocument(json).toJson(QJsonDocument::Compact);
reqData = CheckSendArray(reqData); reqData = CheckSendArray(reqData);
...@@ -109,8 +164,14 @@ QJsonObject FMPRedeem::SendRequest(const QByteArray &reqData) ...@@ -109,8 +164,14 @@ QJsonObject FMPRedeem::SendRequest(const QByteArray &reqData)
QNetworkRequest req; QNetworkRequest req;
QNetworkReply* reply = nullptr; QNetworkReply* reply = nullptr;
//req.setUrl(_url); QSslConfiguration config;
req.setUrl(QUrl("http://115.159.142.32/api?partner=mcd"));//Mcdonald's for test QList<QSslCertificate> certs = QSslCertificate::fromPath(qApp->applicationDirPath() + "/client01.pem");
config.setPeerVerifyMode(QSslSocket::VerifyNone);
config.setProtocol(QSsl::SslV3);
config.setCaCertificates(certs);
req.setSslConfiguration(config);
req.setUrl(_url);
req.setHeader(QNetworkRequest::ContentTypeHeader, "application/json"); req.setHeader(QNetworkRequest::ContentTypeHeader, "application/json");
req.setHeader(QNetworkRequest::ContentLengthHeader, reqData.length()); req.setHeader(QNetworkRequest::ContentLengthHeader, reqData.length());
...@@ -147,23 +208,22 @@ QJsonObject FMPRedeem::SendRequest(const QByteArray &reqData) ...@@ -147,23 +208,22 @@ QJsonObject FMPRedeem::SendRequest(const QByteArray &reqData)
disconnect(reply, &QNetworkReply::finished, &loop, &QEventLoop::quit); disconnect(reply, &QNetworkReply::finished, &loop, &QEventLoop::quit);
reply->abort(); reply->abort();
retJson["statusCode"] = FM_API_TIMEOUT; retJson["statusCode"] = FM_API_TIMEOUT;
retJson["msg"] = "请求超时"; retJson["msg"] = QString::fromLocal8Bit("请求超时");
} }
FMP_DEBUG() << "Server response: " << QJsonDocument(retJson).toJson(QJsonDocument::Compact); FMP_DEBUG() << "Server response: " << QJsonDocument(retJson).toJson(QJsonDocument::Compact);
return retJson; return retJson;
} }
QJsonObject FMPRedeem::ShowForUnConsum(const QJsonObject &json) QJsonObject FMPRedeem::ShowForUnConsum(QJsonObject json)
{ {
QJsonObject codeInfo = json["codeInfo"].toObject(); QJsonObject codeInfo = json["codeInfo"].toObject();
QString act_name = codeInfo["act_name"].toString(); QString act_name = codeInfo["act_name"].toString();
//QString code_name = codeInfo["promotion_type"].toString();
QString code_name = codeInfo["act_id"].toString(); QString code_name = codeInfo["act_id"].toString();
QString vdata = codeInfo["vdata"].toString(); QString vdata = codeInfo["vdata"].toString();
QString coupon = codeInfo["code"].toString(); QString coupon = codeInfo["code"].toString();
QString ebcode = codeInfo["ebcode"].toString(); QString ebcode = codeInfo["ebcode"].toString();
QString time_name = QString("有效期至: ").append(vdata); QString time_name = QString::fromLocal8Bit("有效期至: ").append(vdata);
int couponType = json["couponType"].toInt(); int couponType = json["couponType"].toInt();
if( ConsumptionDialog::ShowForUnConsum(act_name, code_name,time_name,coupon)) if( ConsumptionDialog::ShowForUnConsum(act_name, code_name,time_name,coupon))
...@@ -172,7 +232,7 @@ QJsonObject FMPRedeem::ShowForUnConsum(const QJsonObject &json) ...@@ -172,7 +232,7 @@ QJsonObject FMPRedeem::ShowForUnConsum(const QJsonObject &json)
redeemJson["ver"] = 2; redeemJson["ver"] = 2;
redeemJson["clientReqCount"] = (++_clientReqCount%=10000000); redeemJson["clientReqCount"] = (++_clientReqCount%=10000000);
redeemJson["reqtype"] = 71; redeemJson["reqtype"] = 71;
//redeemJson["partnerId"] = _partnerId; redeemJson["partnerId"] = _partner_id;
redeemJson["store_id"] = _store_id; redeemJson["store_id"] = _store_id;
redeemJson["station_id"] = _station_id; redeemJson["station_id"] = _station_id;
redeemJson["trans_id"] = QString::number(QDateTime::currentDateTimeUtc().toTime_t()); redeemJson["trans_id"] = QString::number(QDateTime::currentDateTimeUtc().toTime_t());
...@@ -180,33 +240,59 @@ QJsonObject FMPRedeem::ShowForUnConsum(const QJsonObject &json) ...@@ -180,33 +240,59 @@ QJsonObject FMPRedeem::ShowForUnConsum(const QJsonObject &json)
redeemJson["business_date"] = QDate::currentDate().toString("yyyyMMdd"); redeemJson["business_date"] = QDate::currentDate().toString("yyyyMMdd");
if( couponType == 0){ //商品券 if( couponType == 0){ //商品券
if(!IsContinue(SearchJsonObject(json, "paid").toInt()))
{
QJsonObject result;
result["statusCode"] = FM_API_WINDOWCLOSE;
result["msg"] = QString::fromLocal8Bit("窗口关闭");
return result;
}
QJsonObject transaction; QJsonObject transaction;
QJsonArray transactions; QJsonArray transactions;
transaction["code"] = coupon; transaction["code"] = coupon;
transaction["ebcode"] = ebcode; transaction["ebcode"] = ebcode;
//transaction["vdata"] = codeInfo["vdata"];
//得到该券所对应商品id,目前一张券只对应一种商品
QJsonArray jsonPro = codeInfo["products"].toArray(); QString canUsedProduct = SearchJsonObject(json, "pid").toString();
QJsonArray products; //遍历传入的商品信息,查找是否有相同的商品id,
int seq = 1; //核销顺序 //若有则进行核销,否则,直接返回失败
for( int i = 0; i < jsonPro.size(); i++){ int i;
QJsonObject obj = jsonPro[i].toObject(); for(i = 0; i < _products_info.size(); i++){
QJsonObject product; QJsonObject obj = _products_info[i].toObject();
product.insert("seq", seq++); if(obj["pid"].toString() == canUsedProduct)
product.insert("pid", obj["pid"]); break;
product.insert("consume_num", obj["number"]);
products.append(product);
} }
if(i >= _products_info.size())
{
//不存在对应商品
return ShowForMismatch(json);
}
QJsonArray products;
QJsonObject product;
product.insert("seq", 1);
product.insert("pid", _products_info[i].toObject()["pid"]);
product.insert("consume_num", _products_info[i].toObject()["consume_num"]);
products.append(product);
transaction["products"] = products; transaction["products"] = products;
transactions.append(transaction); transactions.append(transaction);
redeemJson["transactions"] = transactions; redeemJson["transactions"] = transactions;
} }
if( couponType == 1){ //代金券 if( couponType == 1){ //代金券
if(!IsContinue(SearchJsonObject(json, "amount").toInt()))
{
QJsonObject result;
result["statusCode"] = FM_API_WINDOWCLOSE;
result["msg"] = QString::fromLocal8Bit("窗口关闭");
return result;
}
QJsonObject transaction; QJsonObject transaction;
transaction["code"] = coupon; transaction["code"] = coupon;
transaction["ebcode"] = ebcode; transaction["ebcode"] = ebcode;
//transaction["vdata"] = codeInfo["vdata"];
QJsonArray transactions; QJsonArray transactions;
transactions.append(transaction); transactions.append(transaction);
...@@ -216,79 +302,102 @@ QJsonObject FMPRedeem::ShowForUnConsum(const QJsonObject &json) ...@@ -216,79 +302,102 @@ QJsonObject FMPRedeem::ShowForUnConsum(const QJsonObject &json)
QByteArray reqData = QJsonDocument(redeemJson).toJson(); QByteArray reqData = QJsonDocument(redeemJson).toJson();
reqData = CheckSendArray(reqData); reqData = CheckSendArray(reqData);
QJsonObject redeemResult;
QJsonObject retJson = SendRequest(reqData); QJsonObject retJson = SendRequest(reqData);
int statusCode = retJson["statusCode"].toInt(); int statusCode = retJson["statusCode"].toInt();
switch(statusCode) switch(statusCode)
{ {
case 100: case 100:
{ {
QString _time = QDateTime::currentDateTime().toString("yyyy-MM-dd HH:mm"); QString _time = QDateTime::currentDateTime().toString("yyyy-MM-dd");
QString _time_name; QString _time_name;
_time_name.append(_store_id).append("(").append(QString::number(_station_id)).append( ")").append(" ").append(_time); _time_name.append(_store_id).append("(").append(_station_id).append( ")").append(" ").append(_time);
ConsumOkDialog::showConsumOk( act_name, code_name, _time_name, coupon); ConsumOkDialog::showConsumOk( act_name, code_name, _time_name, coupon);
if(couponType == 0) //商品券
{
redeemResult["discount"] = SearchJsonObject(json, "paid").toInt()/100;
}
else if(couponType == 1) //代金券
{
redeemResult["discount"] = SearchJsonObject(json, "amount").toInt()/100;
}
} }
break; break;
default: default:
ErrCodeDialog::showForErr(coupon, QString("error:").append(QString::number(statusCode))); ErrCodeDialog::showForErr(coupon, QString("error:").append(QString::number(statusCode)));
break; break;
} }
//return retJson; redeemResult["statusCode"] = retJson["statusCode"];
return json; redeemResult["msg"] = retJson["msg"].toString();
return redeemResult;
} }
else else
{ {
QJsonObject retJson; QJsonObject retJson;
retJson["statusCode"] = FM_API_WINDOWCLOSE; retJson["statusCode"] = FM_API_WINDOWCLOSE;
retJson["msg"] = "窗口关闭"; retJson["msg"] = QString::fromLocal8Bit("窗口关闭");
return retJson; return retJson;
} }
} }
QJsonObject FMPRedeem::ShowForHasConsum(const QJsonObject &json) QJsonObject FMPRedeem::ShowForHasConsum(QJsonObject json)
{ {
qDebug() << json; QString storeInfo = QString("%1(%2)").arg(_store_id).arg(_station_id);
QJsonObject redeemInfoJson = json["redeemInfo"].toObject(); ConsumptionDialog::ShowForHasConsum(json["msg"].toString(), "", storeInfo, _coupon);
QString time = redeemInfoJson["redeem_date"].toString();
QString time_name;
time_name.append(_store_id).append("(").append(QString::number(_station_id)).append( ")").append(" ").append(time);
QJsonObject codeInfo = json["codeInfo"].toObject();
QString act_name = codeInfo["act_name"].toString();
//QString code_name = codeInfo["promotion_type"].toString();
QString code_name = codeInfo["act_id"].toString();
QString coupon = codeInfo["code"].toString();
ConsumptionDialog::ShowForHasConsum( act_name, code_name, time_name, coupon);
return json; return json;
} }
QJsonObject FMPRedeem::ShowForInvalid(const QJsonObject &json) QJsonObject FMPRedeem::ShowForInvalid(QJsonObject json)
{ {
QString coupon = json["codeInfo"].toObject()["code"].toString(); ErrCodeDialog::showForInvalid(_coupon);
ErrCodeDialog::showForInvalid(coupon);
return json; return json;
} }
QJsonObject FMPRedeem::ShowForExpird(const QJsonObject &json) QJsonObject FMPRedeem::ShowForExpird(QJsonObject json)
{ {
QJsonObject codeInfo = json["codeInfo"].toObject(); ErrCodeDialog::showForExpird("", "", "", _coupon);
QString act_name = codeInfo["act_name"].toString();
//QString code_name = codeInfo["promotion_type"].toString();
QString code_name = codeInfo["act_id"].toString();
QString vdata = codeInfo["vdata"].toString();
QString coupon = codeInfo["code"].toString();
ErrCodeDialog::showForExpird(act_name, code_name, QString("有效期至: ").append( vdata), coupon);
return json; return json;
} }
QJsonObject FMPRedeem::ShowForErr(const QJsonObject &json) QJsonObject FMPRedeem::ShowForErr(QJsonObject json)
{ {
int statusCode = json["statusCode"].toInt(); int statusCode = json["statusCode"].toInt();
QString coupon = json["codeInfo"].toObject()["code"].toString(); ErrCodeDialog::showForErr(_coupon, QString("error: ").append(QString::number(statusCode)));
ErrCodeDialog::showForErr(coupon, QString("error: ").append(QString::number(statusCode)));
return json; return json;
} }
QJsonObject FMPRedeem::ShowForMismatch(QJsonObject json)
{
ErrCodeDialog::showForMismatch(_coupon, QString::fromLocal8Bit("券和商品不匹配"));
QJsonObject mismatch;
mismatch["statusCode"] = 31;
mismatch["msg"] = QString::fromLocal8Bit("券和商品不匹配");
return mismatch;
}
bool FMPRedeem::IsContinue(int couponAmount)
{
if(_needPay < couponAmount/100.0)
{
//如果卡券抵扣额已大于待付金额,则给出警告提示
QMessageBox msg;
msg.setWindowTitle(QString::fromLocal8Bit("警告"));
msg.setText(QString::fromLocal8Bit("卡券总额已超出应付金额!是否继续?"));
msg.setStandardButtons(QMessageBox::Yes|QMessageBox::Cancel);
msg.setIcon(QMessageBox::Warning);
//msg.setWindowModality(Qt::ApplicationModal);
msg.setWindowFlags(msg.windowFlags() | Qt::WindowStaysOnTopHint);
msg.setAttribute(Qt::WA_QuitOnClose, false);
int choice = msg.exec();
if(choice != QMessageBox::Yes)
{
return false;
}
}
return true;
}
int FMPRedeem::ZH_caclChkValue(char *pJsonData, int startPos, int endPos) int FMPRedeem::ZH_caclChkValue(char *pJsonData, int startPos, int endPos)
{ {
/* startPos <= && < endPos */ /* startPos <= && < endPos */
......
#ifndef FMP_REDEEM_H #ifndef FMP_REDEEM_H
#define FMP_REDEEM_H #define FMP_REDEEM_H
#include "fmp_redeem_i.h" #include "fmp_redeem_i.h"
#include "fmp_settings_i.h" #include "fmp_settings_i.h"
#include <QJsonObject> #include <QJsonObject>
#include <QJsonArray>
#include <QPointer> #include <QPointer>
class FMPStartEventHandler; class FMPStartEventHandler;
class FMPRedeem : public FMPRedeemInterface class FMPRedeem : public FMPRedeemInterface
...@@ -28,7 +29,7 @@ public: ...@@ -28,7 +29,7 @@ public:
explicit FMPRedeem(const FMPContext context); explicit FMPRedeem(const FMPContext context);
virtual ~FMPRedeem(); virtual ~FMPRedeem();
QJsonObject Redeem(const QJsonObject& storeInfo); //券码核销 QJsonObject Redeem(const double needPay, const QJsonObject& requestInfo); //券码核销
protected: protected:
const FMPContext GetContext() const { return _context; } const FMPContext GetContext() const { return _context; }
...@@ -39,20 +40,28 @@ protected slots: ...@@ -39,20 +40,28 @@ protected slots:
private: private:
QJsonObject SendRequest(const QByteArray &reqData); QJsonObject SendRequest(const QByteArray &reqData);
QJsonObject ShowForUnConsum(const QJsonObject &json); QJsonObject ShowForUnConsum(QJsonObject json);
QJsonObject ShowForHasConsum(const QJsonObject &json); QJsonObject ShowForHasConsum(QJsonObject json);
QJsonObject ShowForInvalid(const QJsonObject &json); QJsonObject ShowForInvalid(QJsonObject json);
QJsonObject ShowForExpird(const QJsonObject &json); QJsonObject ShowForExpird(QJsonObject json);
QJsonObject ShowForErr(const QJsonObject &json); QJsonObject ShowForErr(QJsonObject json);
QJsonObject ShowForMismatch(QJsonObject json);
int ZH_caclChkValue(char * pJsonData, int startPos, int endPos); int ZH_caclChkValue(char * pJsonData, int startPos, int endPos);
QByteArray CheckSendArray( QByteArray & jsonArray); QByteArray CheckSendArray( QByteArray & jsonArray);
QJsonValue SearchJsonObject(const QJsonObject& searchJson, const QString& searchKey);
QJsonValue SearchJsonArray(const QJsonArray& searchJson, const QString& searchKey);
bool IsContinue(int couponAmount);
private: private:
bool _inited; bool _inited;
double _needPay;
QString _store_id; QString _store_id;
int _station_id; QString _station_id;
QString _operator_id; QString _operator_id;
int _clientReqCount; QString _coupon;
int _partner_id;
QString _url;
QJsonArray _products_info;
int _clientReqCount;
const FMPContext _context; const FMPContext _context;
QPointer<FMPStartEventHandler> _ste_handler; QPointer<FMPStartEventHandler> _ste_handler;
}; };
......
#ifndef FMP_REDEEM_I_H #ifndef FMP_REDEEM_I_H
#define FMP_REDEEM_I_H #define FMP_REDEEM_I_H
#include <fmp_plugin_i.h> #include <fmp_plugin_i.h>
...@@ -20,7 +20,7 @@ public: ...@@ -20,7 +20,7 @@ public:
connect(this, &FMPRedeemInterface::TriggerUninit, this, &FMPRedeemInterface::OnTriggerUninit); connect(this, &FMPRedeemInterface::TriggerUninit, this, &FMPRedeemInterface::OnTriggerUninit);
} }
virtual QJsonObject Redeem(const QJsonObject& storeInfo) = 0; //券码核销 virtual QJsonObject Redeem(const double needPay, const QJsonObject& requestInfo) = 0; //券码核销
signals: signals:
void TriggerInit(); void TriggerInit();
void TriggerUninit(); void TriggerUninit();
......
...@@ -10,11 +10,11 @@ ...@@ -10,11 +10,11 @@
<file>img/btn_canel.png</file> <file>img/btn_canel.png</file>
<file>img/btn_consumption.png</file> <file>img/btn_consumption.png</file>
<file>img/btn_consumption_invalid.png</file> <file>img/btn_consumption_invalid.png</file>
<file>img/btn_manual.png</file>
<file>img/close.png</file> <file>img/close.png</file>
<file>img/consumption_ok.png</file> <file>img/consumption_ok.png</file>
<file>img/folat_be_invalid.png</file> <file>img/folat_be_invalid.png</file>
<file>img/ma_bg.png</file> <file>img/ma_bg.png</file>
<file>img/scanning_bar.png</file> <file>img/scanning_bar.png</file>
<file>img/tray.png</file>
</qresource> </qresource>
</RCC> </RCC>
fmp_redeem/res/img/bg_be_invalid.png

7.59 KB | W: | H:

fmp_redeem/res/img/bg_be_invalid.png

3.87 KB | W: | H:

fmp_redeem/res/img/bg_be_invalid.png
fmp_redeem/res/img/bg_be_invalid.png
fmp_redeem/res/img/bg_be_invalid.png
fmp_redeem/res/img/bg_be_invalid.png
  • 2-up
  • Swipe
  • Onion skin
fmp_redeem/res/img/bg_exchange.png

47 KB | W: | H:

fmp_redeem/res/img/bg_exchange.png

8.44 KB | W: | H:

fmp_redeem/res/img/bg_exchange.png
fmp_redeem/res/img/bg_exchange.png
fmp_redeem/res/img/bg_exchange.png
fmp_redeem/res/img/bg_exchange.png
  • 2-up
  • Swipe
  • Onion skin
fmp_redeem/res/img/bg_invalid_code.png

12.7 KB | W: | H:

fmp_redeem/res/img/bg_invalid_code.png

10.8 KB | W: | H:

fmp_redeem/res/img/bg_invalid_code.png
fmp_redeem/res/img/bg_invalid_code.png
fmp_redeem/res/img/bg_invalid_code.png
fmp_redeem/res/img/bg_invalid_code.png
  • 2-up
  • Swipe
  • Onion skin
fmp_redeem/res/img/bg_no_exchange.png

47.2 KB | W: | H:

fmp_redeem/res/img/bg_no_exchange.png

8.37 KB | W: | H:

fmp_redeem/res/img/bg_no_exchange.png
fmp_redeem/res/img/bg_no_exchange.png
fmp_redeem/res/img/bg_no_exchange.png
fmp_redeem/res/img/bg_no_exchange.png
  • 2-up
  • Swipe
  • Onion skin
fmp_redeem/res/img/bg_sanning.png

62.9 KB | W: | H:

fmp_redeem/res/img/bg_sanning.png

51 KB | W: | H:

fmp_redeem/res/img/bg_sanning.png
fmp_redeem/res/img/bg_sanning.png
fmp_redeem/res/img/bg_sanning.png
fmp_redeem/res/img/bg_sanning.png
  • 2-up
  • Swipe
  • Onion skin
fmp_redeem/res/img/bg_working.png

50 KB | W: | H:

fmp_redeem/res/img/bg_working.png

26.3 KB | W: | H:

fmp_redeem/res/img/bg_working.png
fmp_redeem/res/img/bg_working.png
fmp_redeem/res/img/bg_working.png
fmp_redeem/res/img/bg_working.png
  • 2-up
  • Swipe
  • Onion skin
fmp_redeem/res/img/btn_canel.png

2.93 KB | W: | H:

fmp_redeem/res/img/btn_canel.png

2.63 KB | W: | H:

fmp_redeem/res/img/btn_canel.png
fmp_redeem/res/img/btn_canel.png
fmp_redeem/res/img/btn_canel.png
fmp_redeem/res/img/btn_canel.png
  • 2-up
  • Swipe
  • Onion skin
fmp_redeem/res/img/btn_consumption.png

4.83 KB | W: | H:

fmp_redeem/res/img/btn_consumption.png

4.98 KB | W: | H:

fmp_redeem/res/img/btn_consumption.png
fmp_redeem/res/img/btn_consumption.png
fmp_redeem/res/img/btn_consumption.png
fmp_redeem/res/img/btn_consumption.png
  • 2-up
  • Swipe
  • Onion skin
fmp_redeem/res/img/close.png

1.62 KB | W: | H:

fmp_redeem/res/img/close.png

2.17 KB | W: | H:

fmp_redeem/res/img/close.png
fmp_redeem/res/img/close.png
fmp_redeem/res/img/close.png
fmp_redeem/res/img/close.png
  • 2-up
  • Swipe
  • Onion skin
fmp_redeem/res/img/consumption_ok.png

5.95 KB | W: | H:

fmp_redeem/res/img/consumption_ok.png

5.79 KB | W: | H:

fmp_redeem/res/img/consumption_ok.png
fmp_redeem/res/img/consumption_ok.png
fmp_redeem/res/img/consumption_ok.png
fmp_redeem/res/img/consumption_ok.png
  • 2-up
  • Swipe
  • Onion skin
fmp_redeem/res/img/ma_bg.png

7.27 KB | W: | H:

fmp_redeem/res/img/ma_bg.png

8.07 KB | W: | H:

fmp_redeem/res/img/ma_bg.png
fmp_redeem/res/img/ma_bg.png
fmp_redeem/res/img/ma_bg.png
fmp_redeem/res/img/ma_bg.png
  • 2-up
  • Swipe
  • Onion skin
...@@ -40,7 +40,8 @@ ...@@ -40,7 +40,8 @@
#btnManual{ #btnManual{
border: 0 solid red; border: 0 solid red;
background: rgb(231,68,59); /*background: rgb(231,68,59);*/
background-image: url(:/img/btn_manual.png);
color: rgb(253,197,24); color: rgb(253,197,24);
font: normal 18px &quot;微软雅黑&quot;; font: normal 18px &quot;微软雅黑&quot;;
}</string> }</string>
...@@ -83,14 +84,14 @@ ...@@ -83,14 +84,14 @@
<widget class="QPushButton" name="btnManual"> <widget class="QPushButton" name="btnManual">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>100</x> <x>30</x>
<y>220</y> <y>220</y>
<width>141</width> <width>273</width>
<height>41</height> <height>77</height>
</rect> </rect>
</property> </property>
<property name="text"> <property name="text">
<string>手动输入券码</string> <string/>
</property> </property>
</widget> </widget>
</widget> </widget>
......
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