Commit e2c9e349 by xiaoqing.gu

插件功能开发完毕:1、会员积分界面 2、积分订单界面 3、界面不可重复打开 4、优惠券显示券号

parent e3539e14
......@@ -51,3 +51,11 @@ void FMPVip::list()
d_func()->list();
}
}
bool FMPVip::isBusy()
{
if (_inited) {
return d_func()->isBusy();
}
return false;
}
......@@ -20,6 +20,8 @@ public:
void pay();
void list();
bool isBusy();
protected:
void InitService();
void UninitService();
......
......@@ -20,6 +20,7 @@ public:
}
virtual void pay() = 0;
virtual void list() = 0;
virtual bool isBusy() = 0;
signals:
void TriggerInit();
void TriggerUninit();
......
......@@ -28,6 +28,7 @@ int FMPVipPrivate::Init()
auto resend = new ReSend();
resend->start();
FMPVipServer::instance()->SetPluginContext(q->_ctx);
q->_inited = true;
......@@ -60,9 +61,13 @@ void FMPVipPrivate::pay()
void FMPVipPrivate::list()
{
Q_Q(FMPVip);
QByteArray rspData;
FMPVipServer::instance()->callVipPay("{\"fm_cmd\":10035}",rspData);
FMPVipServer::instance()->callVipPay("{\"fm_cmd\":10036}",rspData);
}
bool FMPVipPrivate::isBusy()
{
return FMPVipServer::instance()->IsBusy();
}
......
......@@ -19,6 +19,8 @@ public:
void pay();
void list();
bool isBusy();
public:
FMPVip *q_ptr;
private:
......
......@@ -13,7 +13,8 @@ FMPVipServer *FMPVipServer::instance()
FMPVipServer::FMPVipServer() :
QTcpServer(),
socket(nullptr),
dispatcher(new FMVipDispatcher(this))
dispatcher(new FMVipDispatcher(this)),
_isBusy(false)
{
Listen(23770);
connect(this, &QTcpServer::newConnection, this, &FMPVipServer::onNewConnection);
......@@ -48,6 +49,7 @@ void FMPVipServer::SetPluginContext(ctkPluginContext *ctx)
void FMPVipServer::onNewConnection()
{
_isBusy = true;
socket = nextPendingConnection();
connect(socket, &QTcpSocket::disconnected, this, &FMPVipServer::onDisconnected);
......@@ -57,6 +59,7 @@ void FMPVipServer::onNewConnection()
void FMPVipServer::onDisconnected()
{
FMP_DEBUG() << "Socket disconnected.";
_isBusy = false;
if(dispatcher!=nullptr) {
dispatcher->stopTask();
......@@ -67,6 +70,7 @@ void FMPVipServer::onDisconnected()
void FMPVipServer::onReadyRead()
{
_isBusy = true;
QByteArray recvData;
int needLen = -1, totalLen=0, dataLen = 0;
......@@ -127,5 +131,12 @@ void FMPVipServer::onReadyRead()
void FMPVipServer::callVipPay(const QByteArray &reqData, QByteArray &rspData)
{
_isBusy = true;
dispatcher->doTask(reqData,rspData);
_isBusy = false;
}
bool FMPVipServer::IsBusy()
{
return _isBusy;
}
......@@ -28,6 +28,8 @@ public:
void callVipPay(const QByteArray &reqData, QByteArray &rspData);
bool IsBusy();
signals:
void SocketDisconnected();
......@@ -43,6 +45,8 @@ private:
FMVipDispatcher *dispatcher;
bool isNeedSocketHeader;
bool _isBusy;
};
#endif // FMP_VIP_SERVER_H
......@@ -11,7 +11,7 @@ greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
CONFIG += c++11
DEFINES += TEST
DEFINES += TEST FASTPAY
SOURCES += \
$$PWD/backup/fmbackup.cpp \
......
......@@ -111,6 +111,31 @@ void FMVipDispatcher::doTask(const QByteArray &reqData, QByteArray &rspData)
}
#ifdef FASTPAY
case FM_List: {
if (_ctx) {
ctkServiceReference ref =_ctx->getServiceReference<FMPHomeInterface>();
FMPHomeInterface *home = _ctx->getService<FMPHomeInterface>(ref);
if(home) {
QString pn = home->partnerName();
QString pi = home->partnerId();
QString sn = home->storeName();
QString sl = home->storeId();
QString dl = home->deviceId();
QString dn = home->deviceName();
QString stationId = home->stationId();
QString operatorId = home->operatorId();
session.addData("PN", pn);
session.addData("PI", pi);
session.addData("SN", sn);
session.addData("SI", sl);
session.addData("DI", dl);
session.addData("DN", dn);
session.addData("STATIONID",stationId);
session.addData("OPERATORID",operatorId);
}
}
fmTask = new TaskList(jsonObj, &session);
rspData = fmTask->doTask();
session.clear();
......
......@@ -37,6 +37,7 @@
#define PUBLIC_KEY "Sign=MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAq+XlLmHtkvhb52GfOEXq 2oEU3eOQ2A8fEd1KX6C72aTvoY18SP5h7uMxXpbXpYPWiaLXo9x2hM89fyb4C0Sy 0kYL6Pl1J502PRyMD92TXC/4TCwpl7iwAiR+rYMbXFPNQBGk/KBKVT6XPYfyD1QG u4lmTVwhtcoJwBezh21S2vZWjvxiJ+lPCaXdb6qLBgl+4sJxzd7OZ+OavBm5tTCj ynrEV2w3KBbZ6vljAHowl2HQb0q5a6K6BktstolAfp2y/Hxx5BlUpRIRA61kLkJp nRl+eOF4n4fAv7hoczgDFPbEvgJ7MOc4IwOdzAy9whHF44i33nt4A43f+x2J+o+t 0QIDAQAB"
#define SUCCESS_CODE 100
// 请求类型的枚举值
enum FM_TYPE {
FM_Set_Store_Info = 1000,
......@@ -52,7 +53,9 @@ enum FM_TYPE {
FM_Coupon_Pay,
FM_Verify,
FM_Reverse,
FM_Point,
FM_List,
FM_Double,
FM_QR_Refund = 10041,
FM_Refund_Pay,
FM_Refund_Order
......@@ -81,7 +84,15 @@ const FMReqUrlMap::value_type FMReqUrlMapPairs[] =
FMReqUrlMap::value_type(FM_Final, "order"),
FMReqUrlMap::value_type(FM_Refund_Pay, "refund"),
FMReqUrlMap::value_type(FM_Refund_Order, "correct"),
#ifdef FASTPAY
FMReqUrlMap::value_type(FM_Coupon, "member/coupon/verify"),
FMReqUrlMap::value_type(FM_Verify,"coupon"),
FMReqUrlMap::value_type(FM_Point,"member/recharge/points"),
FMReqUrlMap::value_type(FM_List,"order/List?partner=sgdx"),
FMReqUrlMap::value_type(FM_Double,"order/Detail?partner=sgdx"),
#else
FMReqUrlMap::value_type(FM_Coupon, "ordercoupon"),
#endif
FMReqUrlMap::value_type(FM_Fund, "recharge")
};
const FMReqUrlMap ReqUrl(FMReqUrlMapPairs, FMReqUrlMapPairs + (sizeof FMReqUrlMapPairs / sizeof FMReqUrlMapPairs[0]));
......@@ -186,6 +197,12 @@ struct PP{
StationId = "station_id";
Ver = "ver";
Reqtype = "reqtype";
OpenId = "openid";
CouponApi = "couponApi";
OrderNo = "order_no";
CouponDiscount = "coupon_discount_amount";
PayTotalAmount = "pay_total_amount";
TotalAmount = "total_amount";
#endif
}
......@@ -283,6 +300,14 @@ struct PP{
QString StationId;
QString Ver;
QString Reqtype;
QString OpenId;
QString CouponApi;
QString OrderNo;
QString CouponDiscount;
QString PayTotalAmount;
QString TotalAmount;
#endif
};
......
......@@ -56,7 +56,7 @@ void Coupon::paint(QPainter *painter, const QRect &rect, const QPalette &palette
font.setWeight(1);
painter->setFont(font);
QRect limitRect(rect.x(), rect.y(), rect.width(), rect.height()-flagHeight);
QString limitStr = QString::fromLocal8Bit("满 %1 元可用").arg(this->limitAmount());
QString limitStr = QString::fromLocal8Bit("%1").arg(this->code());//在显示券的信息的时候将满额条件修改为couponCode
painter->drawText(limitRect, Qt::AlignCenter, limitStr);
// 优惠券名
......
#include "tasklist.h"
#include "fmviplist.h"
TaskList::TaskList(QJsonObject &jsonObj, Session *session, QObject *parent)
: FMTask(jsonObj, FM_List, session, parent)
{
......@@ -20,14 +21,46 @@ void TaskList::packagePOSReq()
void TaskList::setWindow()
{
_window = new FMVipList;
connect(qobject_cast<FMVipList*>(_window), SIGNAL(getList()), this, SLOT(onGetList()));
connect(qobject_cast<FMVipList*>(_window), SIGNAL(buttonClick()), this, SLOT(onButtonClick()));
// connect(qobject_cast<FMVipList*>(_window), SIGNAL(doubleClick(QString)), this, SLOT(onDoubleClick(QString)));
}
void TaskList::packageServerReq()
{
serverReqJsonObj[PosProps.StoreId] = session()->data("SI").toString();
serverReqJsonObj[PosProps.StationId] = session()->data("STATIONID").toString();
serverReqJsonObj[PosProps.PartnerId] = session()->data("PI").toString();
serverReqJsonObj[PosProps.OperatorId] = session()->data("OPERATORID").toString();
serverReqJsonObj["PageSize"] = "10";
serverReqJsonObj["PageCount"] = "1";
}
void TaskList::packagePOSRsp()
{
}
void TaskList::onGetList()
{
bool isOk = sendToServer();
QJsonArray orders = getServerJsonValue("orders").toArray();
qobject_cast<FMVipList*>(_window)->getListArray(orders);
}
void TaskList::onButtonClick()
{
bool isOk = sendToServer();
QJsonArray orders = getServerJsonValue("orders").toArray();
qobject_cast<FMVipList*>(_window)->clickListArray(orders);
}
//void TaskList::onDoubleClick(const QString &id)
//{
//}
......@@ -9,10 +9,15 @@ public:
explicit TaskList(QJsonObject &jsonObj, Session *session = 0, QObject *parent = 0);
~TaskList();
void packagePOSReq();
void setWindow();
void packageServerReq();
void packagePOSRsp();
void packagePOSReq() override;
void setWindow() override;
void packageServerReq() override;
void packagePOSRsp() override;
private slots:
void onGetList();
void onButtonClick();
// void onDoubleClick(const QString &id);
};
#endif // TASKLIST_H
......@@ -59,6 +59,8 @@ void TaskLogin::packageServerReq()
serverReqJsonObj[PosProps.StoreId] = session()->data("SI").toString();
serverReqJsonObj[PosProps.OperatorId] = session()->data("OPERATORID").toString();;
serverReqJsonObj[PosProps.Ver] = "2";
session()->addData(PosProps.TransId,transId);
#else
QJsonObject code;
......@@ -109,7 +111,7 @@ void TaskLogin::onLogin()
return;
}
#ifdef FASTPAY
if(getServerJsonValue("statusCode").toInt() != SUCCESS_CODE) {
if(getServerJsonValue("type").toInt() != 2 || getServerJsonValue("statusCode").toInt() != 100) {
QString info = QString::fromLocal8Bit("会员验证失败!");
FMP_WARN() << "Login failed: " << info;
FMMsgWnd::FailureWnd(info, _window);
......
......@@ -48,6 +48,17 @@ public:
};
/*积分接口*/
class TaskPoint : public FMTaskNoWnd
{
Q_OBJECT
public:
explicit TaskPoint(QJsonObject &jsonObj, Session *session = 0, QObject *parent = 0);
void packageServerReq();
void packagePOSRsp();
};
/*冲正接口*/
class TaskReverse : public FMTaskNoWnd
{
......
......@@ -54,6 +54,8 @@ void TaskPay::packagePOSReq()
#endif
QString fm_open_id_pos = getPosJsonValue(PosProps.Fm_open_id).toString();
QString fm_open_id_session = session()->data(PosProps.Fm_open_id).toString();
#ifndef FASTPAY
if(fm_open_id_session == "" || fm_open_id_pos!=fm_open_id_session || session()->data(PosProps.CanPay).toBool() == false) {
preTask = new TaskLogin(posReqJsonObj, _session, this);
preTask->session()->addData(PosProps.FM_Type, FM_Pay);
......@@ -63,6 +65,7 @@ void TaskPay::packagePOSReq()
}
this->_session = preTask->session();
}
#endif
session()->addData(PosProps.OrderAmount, getPosJsonValue(PosProps.OrderAmount).toInt());
session()->addData(PosProps.TransAmount, getPosJsonValue(PosProps.TransAmount).toInt());
......@@ -91,16 +94,17 @@ void TaskPay::onGetCoupons(Session* session)
void TaskPay::onCouponReq(const QString &code)
{
posReqJsonObj[PosProps.Coupon_code] = code;
session()->addData(PosProps.Coupon_code,code);
TaskCoupon couponTask(posReqJsonObj, this->session());
qDebug() << couponTask.doTask();
_session->addData(PosProps.CouponMap, this->session()->getCouponMap(PosProps.CouponMap));
if(_window != nullptr) {
qobject_cast<FMVipOrder*>(_window)->initCouponItems();
qobject_cast<FMVipOrder*>(_window)->insertVip();
_window->setIsBusy(false);
_window->setEnabled(true);
}
// qDebug() << couponTask->getServerJsonValue("");
}
#endif
......@@ -109,11 +113,12 @@ void TaskPay::setWindow()
{
_window = new FMVipOrder;
connect(qobject_cast<FMVipOrder*>(_window), SIGNAL(pay()), this, SLOT(onPay()));
#ifdef FASTPAY
connect(qobject_cast<FMVipOrder*>(_window),SIGNAL(couponReq(const QString &)),this,SLOT(onCouponReq(const QString &)));
#else
connect(qobject_cast<FMVipOrder*>(_window), SIGNAL(pay()), this, SLOT(onPay()));
#endif
}
......@@ -256,9 +261,9 @@ void TaskPay::packagePOSRsp()
// FMMsgWnd::FailureWnd(info, _window);
// }
QJsonObject json;
TaskCouponVerify verifyTask(json,_session);
verifyTask.doTask();
// QJsonObject json;
// TaskCouponVerify verifyTask(json,_session);
// verifyTask.doTask();
#else
int status = getServerJsonValue(PosProps.StatusCode).toInt();
QString orderId = getPosJsonValue(PosProps.OrderId).toString();
......
......@@ -20,9 +20,9 @@ FMMsgWnd::~FMMsgWnd()
delete ui;
}
int FMMsgWnd::_exec(InfoType type, const QString &info)
int FMMsgWnd::_exec(InfoType type, const QString &info, const QString &btn_ok_text)
{
ui->buttonBox->addButton(QString::fromLocal8Bit("确认"), QDialogButtonBox::AcceptRole);
ui->buttonBox->addButton(btn_ok_text, QDialogButtonBox::AcceptRole);
QString iconUrl;
switch (type) {
case T_Normal:
......@@ -43,6 +43,10 @@ int FMMsgWnd::_exec(InfoType type, const QString &info)
break;
case T_Question:
{
#ifdef FASTPAY
ui->label_logo->close();
ui->label_msg->setStyleSheet("QLabel{font:12 px;}");
#endif
ui->buttonBox->addButton(QString::fromLocal8Bit("取消"), QDialogButtonBox::RejectRole);
iconUrl = ":/img/tip_question.png";
break;
......@@ -65,35 +69,36 @@ int FMMsgWnd::_exec(InfoType type, const QString &info)
if(iconUrl != ""){
ui->label_logo->setStyleSheet(QString("border-image: url(%1);").arg(iconUrl));
}
ui->label_msg->setText(info);
return QDialog::exec();
}
void FMMsgWnd::FailureWnd(const QString &info, QDialog *parent)
void FMMsgWnd::FailureWnd(const QString &info, QDialog *parent, const QString &btn_ok_text)
{
FMMsgWnd window(parent);
if(parent != nullptr) {
window.setGeometry(parent->geometry());
}
window._exec(FMMsgWnd::T_Failure, info);
window._exec(FMMsgWnd::T_Failure, info, btn_ok_text);
}
void FMMsgWnd::WarningWnd(const QString &info, QDialog *parent)
void FMMsgWnd::WarningWnd(const QString &info, QDialog *parent, const QString &btn_ok_text)
{
FMMsgWnd window(parent);
if(parent != nullptr) {
window.setGeometry(parent->geometry());
}
window._exec(FMMsgWnd::T_Warning, info);
window._exec(FMMsgWnd::T_Warning, info, btn_ok_text);
}
void FMMsgWnd::SuccessWnd(const QString &info, QDialog *parent)
void FMMsgWnd::SuccessWnd(const QString &info, QDialog *parent, const QString &btn_ok_text)
{
FMMsgWnd window(parent);
if(parent != nullptr) {
window.setGeometry(parent->geometry());
}
window._exec(FMMsgWnd::T_Success, info);
window._exec(FMMsgWnd::T_Success, info, btn_ok_text);
}
void FMMsgWnd::LoginSuccess(const QString &account, const QString &name, const QString &birthday, QDialog *parent)
......@@ -103,14 +108,14 @@ void FMMsgWnd::LoginSuccess(const QString &account, const QString &name, const Q
window.setGeometry(parent->geometry());
}
QString info = QString::fromLocal8Bit("账号:%1\n姓名:%2\n生日:%3").arg(account).arg(name).arg(birthday);
window._exec(FMMsgWnd::T_LoginSuccess, info);
window._exec(FMMsgWnd::T_LoginSuccess, info, QString::fromLocal8Bit( "确认"));
}
int FMMsgWnd::Question(const QString &info, QDialog *parent)
int FMMsgWnd::Question(const QString &info, QDialog *parent, const QString &btn_ok_text)
{
FMMsgWnd window(parent);
if(parent != nullptr) {
window.setGeometry(parent->geometry());
}
return window._exec(FMMsgWnd::T_Question, info);
return window._exec(FMMsgWnd::T_Question, info, btn_ok_text);
}
......@@ -25,12 +25,12 @@ public:
T_Question
};
int _exec(InfoType type = T_Normal, const QString &info = "");
static void FailureWnd(const QString &info, QDialog *parent=0);
static void WarningWnd(const QString &info, QDialog *parent=0);
static void SuccessWnd(const QString &info, QDialog *parent=0);
int _exec(InfoType type = T_Normal, const QString &info = "", const QString &btn_ok_text="");
static void FailureWnd(const QString &info, QDialog *parent=0, const QString &btn_ok_text=QString::fromLocal8Bit("确认"));
static void WarningWnd(const QString &info, QDialog *parent=0, const QString &btn_ok_text=QString::fromLocal8Bit("确认"));
static void SuccessWnd(const QString &info, QDialog *parent=0, const QString &btn_ok_text=QString::fromLocal8Bit("确认"));
static void LoginSuccess(const QString &account, const QString &name, const QString &birthday, QDialog *parent=0);
static int Question(const QString &info, QDialog *parent=0);
static int Question(const QString &info, QDialog *parent=0, const QString &btn_ok_text=QString::fromLocal8Bit("确认"));
private:
Ui::FMMsgWnd *ui;
......
#include "fmviplist.h"
#include "fmviplist.h"
#include "ui_fmviplist.h"
#include <QJsonArray>
#include <QStandardItemModel>
FMVipList::FMVipList(QDialog *parent) :
FMVipWnd(parent),
ui(new Ui::FMVipList)
......@@ -15,3 +18,146 @@ FMVipList::~FMVipList()
{
delete ui;
}
int FMVipList::exec()
{
emit getList();
return FMVipWnd::exec();
}
bool FMVipList::initWnd(Session *session)
{
ui->store_label->setText(session->data("SI").toString());
ui->pos_label->setText(session->data("STATIONID").toString());
ui->operator_label->setText(session->data("OPERATORID").toString());
ui->bd_label->setText(QDateTime::currentDateTime().toString("yyyy-MM-dd"));
ui->tableWidget->horizontalHeader()->setStretchLastSection(true);
ui->tableWidget->setSelectionBehavior(QAbstractItemView::SelectRows); //单击选择一行
ui->tableWidget->setSelectionMode(QAbstractItemView::SingleSelection); //设置只能选择一行,不能多行选中
ui->tableWidget->setEditTriggers(QAbstractItemView::NoEditTriggers); //设置每行内容不可更改
ui->tableWidget->setAlternatingRowColors(true);
return true;
}
void FMVipList::getListArray(QJsonArray &jsonArray)
{
int row = jsonArray.size();
qDebug() << row;
ui->tableWidget->clear();
ui->tableWidget->setRowCount(row);
ui->tableWidget->setColumnCount(5);
QStringList header;
header << QString::fromLocal8Bit("订单编号") << QString::fromLocal8Bit("订单积分") << QString::fromLocal8Bit("积分状态") <<
QString::fromLocal8Bit("优惠券数") << QString::fromLocal8Bit("订单时间");
ui->tableWidget->setHorizontalHeaderLabels(header);
ui->tableWidget->setColumnWidth(0,300);
ui->tableWidget->setColumnWidth(4,300);
QString status;
for(int i=0; i<row; i++)
{
QJsonObject listObj = jsonArray[i].toObject();
ui->tableWidget->setItem(i, 0, new QTableWidgetItem(QString(listObj["fmOrderID"].toString())));
ui->tableWidget->setItem(i, 1, new QTableWidgetItem(QString(listObj["points"].toString())));
if(QString(listObj["pointsStatus"].toString()) == "F") {
status = QString::fromLocal8Bit("失败");
}else if(QString(listObj["pointsStatus"].toString()) == "S") {
status = QString::fromLocal8Bit("成功");
}else {
status = QString::fromLocal8Bit("未知");
}
ui->tableWidget->setItem(i, 2, new QTableWidgetItem(status));
ui->tableWidget->setItem(i, 3, new QTableWidgetItem(QString(listObj["couponCode"].toString())));
ui->tableWidget->setItem(i, 4, new QTableWidgetItem(QString(listObj["createDate"].toString())));
}
}
void FMVipList::on_order_pushButton_clicked()
{
QString date = ui->dateEdit->text();
emit buttonClick();
}
void FMVipList::clickListArray(QJsonArray &jsonArray)
{
int row = jsonArray.size();
ui->tableWidget->clear();
QStringList header;
header << QString::fromLocal8Bit("订单编号") << QString::fromLocal8Bit("订单积分") << QString::fromLocal8Bit("积分状态") <<
QString::fromLocal8Bit("优惠券数") << QString::fromLocal8Bit("订单时间");
ui->tableWidget->setHorizontalHeaderLabels(header);
ui->tableWidget->setColumnWidth(0,300);
ui->tableWidget->setColumnWidth(4,300);
QJsonArray array;
for(int i =0; i< row;i++)
{
QJsonObject listObj = jsonArray[i].toObject();
QString date = QString(listObj["createDate"].toString());
QString time = date.split(" ").at(0);
QString order = ui->order_lineEdit->text();
if(time == ui->dateEdit->text())
{
if(order == NULL)
{
array.append(listObj);
}else {
if(order == QString(listObj["fmOrderID"].toString())) {
array.append(listObj);
}
}
}
}
QString status;
int newRow = array.size();
ui->tableWidget->setRowCount(newRow);
ui->tableWidget->setColumnCount(5);
for(int j=0; j<newRow; j++)
{
QJsonObject obj = array[j].toObject();
ui->tableWidget->setItem(j, 0, new QTableWidgetItem(QString(obj["fmOrderID"].toString())));
ui->tableWidget->setItem(j, 1, new QTableWidgetItem(QString(obj["points"].toString())));
if(QString(obj["pointsStatus"].toString()) == "F") {
status = QString::fromLocal8Bit("失败");
}else if(QString(obj["pointsStatus"].toString()) == "S") {
status = QString::fromLocal8Bit("成功");
}else {
status = QString::fromLocal8Bit("未知");
}
ui->tableWidget->setItem(j, 2, new QTableWidgetItem(status));
ui->tableWidget->setItem(j, 3, new QTableWidgetItem(QString(obj["couponCode"].toString())));
ui->tableWidget->setItem(j, 4, new QTableWidgetItem(QString(obj["createDate"].toString())));
}
}
//void FMVipList::getDoubleArray(QJsonArray &jsonArray)
//{
// qDebug() << "____________________________13_________";
//}
//void FMVipList::on_tableWidget_doubleClicked(const QModelIndex &index)
//{
// int row = index.row();
// QString id = ui->tableWidget->item(row,0)->text();
// qDebug() << "____________________________11_________";
// emit doubleClick(id);
//}
......@@ -15,6 +15,22 @@ public:
explicit FMVipList(QDialog *parent = 0);
~FMVipList();
bool initWnd(Session *session);
void getListArray(QJsonArray &jsonArray);
void clickListArray(QJsonArray &jsonArray);
// void getDoubleArray(QJsonArray &jsonArray);
int exec();
signals:
void getList();
void buttonClick();
// void doubleClick(const QString &id);
private slots:
void on_order_pushButton_clicked();
// void on_tableWidget_doubleClicked(const QModelIndex &index);
private:
Ui::FMVipList *ui;
};
......
......@@ -44,12 +44,14 @@ bool FMVipLogin::initWnd(Session *session)
ui->logo_label->setText(QString::fromLocal8Bit("华润通小助手"));
ui->bd_label->setText(QDateTime::currentDateTime().toString("yyyy-MM-dd"));
ui->store_label->setText(session->data("SI").toString());
ui->pos_desc_label->close();
ui->pos_label->close();
ui->operator_desc_label->close();
ui->operator_label->close();
// ui->pos_desc_label->close();
// ui->pos_label->close();
// ui->operator_desc_label->close();
// ui->operator_label->close();
ui->pos_label->setText(session->data("STATIONID").toString());
ui->operator_label->setText(session->data("OPERATORID").toString());
ui->login_edit->setPlaceholderText(placeText);
ui->title->setStyleSheet("QWidget{background:rgb(255, 170, 0);border:1px}");
ui->title->setStyleSheet("QWidget{background:rgb(255, 170, 0);border:1px;color:black}");
ui->login_btn->setStyleSheet("QPushButton{background:rgb(255, 170, 0)}");
#else
ui->store_label->setText(session->data(PosProps.StoreId).toString());
......
#include "fmviporder.h"
#include "fmmsgwnd.h"
#include "taskothers.h"
#include "ui_fmviporder.h"
#include "itemdelegate.h"
#include "couponmodel.h"
......@@ -31,45 +32,66 @@ FMVipOrder::FMVipOrder(QDialog *parent) :
ui->undis_desc_label->close();
ui->undis_label->close();
scanfLabel = new QLabel(ui->price);
scanfLabel->setText(QString::fromLocal8Bit("优惠券扫一扫:"));
scanfLabel->adjustSize();
scanfLabel->move(150,20);
scanfLabel->show();
ui->balance_label->close();
ui->balance_desc_label->close();
ui->name_label->close();
ui->name_desc_label->close();
ui->id_label->close();
ui->id_desc_label->close();
ui->point_label->close();
ui->point_desc_label->close();
scanfLe = new QLineEdit(ui->price);
scanfLabel = new QLabel(ui->profile);
scanfLabel->move(0,0);
scanfLabel->setMinimumSize(182,61);
scanfLabel->setText(QString::fromLocal8Bit("扫一扫"));
scanfLabel->setAlignment(Qt::AlignCenter);
scanfLabel->setStyleSheet("QLabel{background:white;border:1px solid silver;border-bottom:0px}");
scanfLe = new QLineEdit(ui->profile);
scanfLe->setMinimumSize(350,30);
scanfLe->move(300,21);
scanfLe->show();
scanfLe->move(250,16);
scanfLe->setStyleSheet("QLineEdit{border:1px solid silver}");
storeLabel = new QLabel(ui->profile);
storeLabel->move(0,20);
storeLabel->setMinimumWidth(786);
storeLabel->setAlignment(Qt::AlignHCenter);
vipLabel_desc = new QLabel(ui->price);
vipLabel_desc->move(0,0);
vipLabel_desc->setMinimumSize(182,69);
vipLabel_desc->setText(QString::fromLocal8Bit("会员"));
vipLabel_desc->setAlignment(Qt::AlignCenter);
vipLabel_desc->setStyleSheet("QLabel{background:white;border:1px solid silver;border-top:0px}");
ui->profile->setStyleSheet("QWidget{border:1px solid silver}");
vipLe = new QLineEdit(ui->price);
vipLe->move(250,18);
vipLe->setMinimumSize(350,30);
vipLe->setEnabled(false);
ui->pay_edit->setFocus();
scanfLe->setFocus();
ui->pay_max->setText(QString::fromLocal8Bit("订单金额"));
ui->pay_max->setText(QString::fromLocal8Bit("订单金额"));
ui->pay_max->setAlignment(Qt::AlignLeft | Qt::AlignVCenter);
ui->pay_max->setStyleSheet("QLabel{color:black;font:normal 18px;}");
needPayLe = new QLineEdit(ui->pay_widget);
ui->horizontalLayout_3->addWidget(needPayLe);
needPayLe->setAlignment(Qt::AlignCenter);
needPayLe->setMinimumHeight(45);
needPayLe->setStyleSheet("QLineEdit{font: 500 30px blod \"Microsoft YaHei\";color: rgb(50,50,50);}");
needPayLe->setEnabled(false);
ui->standard_label->setText(QString::fromLocal8Bit("实收金额"));
ui->standard_label->setAlignment(Qt::AlignLeft | Qt::AlignVCenter);
ui->standard_label->setStyleSheet("QLabel{color:black;font:normal 18px;}");
ui->coupon_desc_label->setText(QString::fromLocal8Bit("优惠券"));
ui->pay_desc_label->setText(QString::fromLocal8Bit("金额"));
ui->logo_label->setText(QString::fromLocal8Bit("华润通小助手"));
ui->pay_desc_label->setText(QString::fromLocal8Bit("金额"));;
ui->pay_btn->setText(QString::fromLocal8Bit("提交"));
/*将profile界面中的label全部关闭,并插入新的门店信息*/
ui->balance_label->close();
ui->balance_desc_label->close();
ui->name_label->close();
ui->name_desc_label->close();
ui->id_label->close();
ui->id_desc_label->close();
ui->point_label->close();
ui->point_desc_label->close();
ui->title->setStyleSheet("QWidget{background:rgb(255, 170, 0);color:black}");
ui->pay_btn->setStyleSheet("QPushButton{background:rgb(255, 170, 0)}");
ui->coupon_page->setDisabled(true);
connect(scanfLe,SIGNAL(returnPressed()),this,SLOT(on_scanfLe_returnPressed()));
#endif
......@@ -87,13 +109,15 @@ FMVipOrder::~FMVipOrder()
#ifdef FASTPAY
delete scanfLabel;
delete scanfLe;
delete vipLabel_desc;
delete vipLe;
delete needPayLe;
#endif
}
bool FMVipOrder::initWnd(Session *session)
{
this->_session = session;
QString operator_id = session->data(PosProps.OperatorId).toString();
QString business_date = session->data(PosProps.BussinessDate).toString();
QString fm_id = session->data(PosProps.Fm_open_id).toString();
......@@ -129,8 +153,15 @@ bool FMVipOrder::initWnd(Session *session)
ui->name_label->setText(name);
#ifdef FASTPAY
storeLabel->setText(session->data("PN").toString());
storeLabel->adjustSize();
// storeLabel->setText(session->data("PN").toString());
// storeLabel->adjustSize();
QString storeName = session->data("PN").toString();
QString logo = QString::fromLocal8Bit("华润通小助手") + "(" +storeName + ")";
ui->logo_label->setText(logo);
ui->store_label->setText(session->data("SI").toString());
ui->pos_label->setText(session->data("STATIONID").toString());
ui->operator_label->setText(session->data("OPERATORID").toString());
ui->bd_label->setText(QDateTime::currentDateTime().toString("yyyy-MM-dd"));
#endif
......@@ -141,6 +172,7 @@ bool FMVipOrder::initWnd(Session *session)
selectionModel = ui->coupon_page->selectionModel();
connect(selectionModel, &QItemSelectionModel::selectionChanged, this, &FMVipOrder::onSelectionChanged);
insertVip();
initCouponItems();
oldPayText = DOUBLE_STR(orderInfo->getMaxWillPay());
......@@ -162,11 +194,43 @@ void FMVipOrder::on_pay_btn_clicked()
int payAmount = codeAmount + (orderInfo->getPayAmountScore() + orderInfo->getPayAmountCoupon()) * 100;
session()->addData(PosProps.Pay_amount, payAmount);
#ifdef FASTPAY
if(vipLe->text() == NULL)
{
FMMsgWnd::FailureWnd(QString::fromLocal8Bit("会员为空!"),this);
this->setEnabled(true);
return;
}
QString amount = needPayLe->text();
// QStringList strlist = str.split(":");
// QString amount = strlist.at(1);
// if(amount.toDouble() == 0.0)
// {
// FMMsgWnd::SuccessWnd(QString::fromLocal8Bit(" 提交成功!"),this);
// reject();
// return;
// }
session()->addData(PosProps.TotalAmount,QString::number(codeAmount));
session()->addData(PosProps.PayTotalAmount,amount.toDouble()*100);
session()->addData(PosProps.CouponDiscount,orderInfo->getPayAmountCoupon() * 100);
if(amount.toDouble() < 0)
{
FMMsgWnd::FailureWnd(QString::fromLocal8Bit("请确认金额!"),this);
this->setEnabled(true);
return;
}
QJsonObject json;
TaskPoint pointTask(json,_session);
pointTask.doTask();
reject();
#else
this->setEnabled(false);
setIsBusy(true);
emit pay();
#endif
}
//! 点击元素时选中/取消选中代金券
......@@ -204,6 +268,15 @@ void FMVipOrder::on_coupon_page_clicked(const QModelIndex &index)
}
}
void FMVipOrder::insertVip()
{
qDebug() << _session->data("VIP").toInt();
if(_session->data("VIP").toInt())
{
vipLe->setText(session()->data(PosProps.Coupon_code).toString());
}
}
void FMVipOrder::initCouponItems()
{
......@@ -325,8 +398,14 @@ void FMVipOrder::setRealPay()
QString orderPayStr = ui->pay_edit->text();
double orderPay = orderPayStr.toDouble();
double realPay = orderPay - orderInfo->getPayAmountCoupon();
ui->standard_label->setText(QString::fromLocal8Bit("实收金额:%1").arg(realPay));
}
qDebug() << realPay;
if(realPay <= 0)
{
needPayLe->setText(QString::fromLocal8Bit("0.00"));
}else{
needPayLe->setText(QString::fromLocal8Bit("%1").arg(realPay));
}
}
#endif
......@@ -3,6 +3,7 @@
#include <QListWidgetItem>
#include <QModelIndex>
#include <QLabel>
#include <QLineEdit>
#include <QVBoxLayout>
#include "fmvipwnd.h"
#include "global.h"
......@@ -29,6 +30,7 @@ public:
~FMVipOrder();
bool initWnd(Session *session);
void insertVip();
void initCouponItems();
void setWillPayText();
......@@ -216,9 +218,10 @@ private:
#ifdef FASTPAY
QLabel *scanfLabel;
QLabel *storeLabel;
QLabel *storeLabel_desc;
QLabel *vipLabel_desc;
QLineEdit *scanfLe;
QLineEdit *vipLe;
QLineEdit *needPayLe;
QJsonObject *_json;
#endif
......
......@@ -142,9 +142,12 @@
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<width>10</width>
<height>20</height>
</size>
</property>
......@@ -232,11 +235,11 @@
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Expanding</enum>
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>13</width>
<width>40</width>
<height>57</height>
</size>
</property>
......
......@@ -247,7 +247,7 @@
</layout>
</item>
<item>
<widget class="QListView" name="listView"/>
<widget class="QTableWidget" name="tableWidget"/>
</item>
</layout>
</widget>
......
......@@ -5,7 +5,7 @@
#define VER_MINOR 1
#define VER_REVISION 0
#define VER_BUILD 38
#define VER_BUILD 41
//! Convert version numbers to string
#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