Commit 26345010 by guanghui.cui

账单功能

parent 0e7142d5
...@@ -154,12 +154,7 @@ bool FMPDataBase::isRecordExist(QString table, QString condition) ...@@ -154,12 +154,7 @@ bool FMPDataBase::isRecordExist(QString table, QString condition)
if(!flag) if(!flag)
FMP_WARN() << tmpquery.lastError(); FMP_WARN() << tmpquery.lastError();
tmpquery.last(); return tmpquery.next();
int total=tmpquery.at()+1;
if(total>0)
return true;
return false;
} }
bool FMPDataBase::getSql(QString table, QVariantHash data, QStringList& columnnamelist, QStringList& columnvaluelist) bool FMPDataBase::getSql(QString table, QVariantHash data, QStringList& columnnamelist, QStringList& columnvaluelist)
......
...@@ -30,6 +30,7 @@ ...@@ -30,6 +30,7 @@
unsigned int FMPePayPrivate::s_ClientReqCount = 10000; unsigned int FMPePayPrivate::s_ClientReqCount = 10000;
#define ERROR_ORDER_STATUS 102 //异常订单状态码
FMPePayPrivate::FMPePayPrivate(FMPePay *parent) FMPePayPrivate::FMPePayPrivate(FMPePay *parent)
: QObject(parent), : QObject(parent),
...@@ -44,9 +45,59 @@ FMPePayPrivate::FMPePayPrivate(FMPePay *parent) ...@@ -44,9 +45,59 @@ FMPePayPrivate::FMPePayPrivate(FMPePay *parent)
_is_api(false), _is_api(false),
_queryThread(nullptr) _queryThread(nullptr)
{ {
Q_Q(FMPePay);
FMPLoggerInterface::InitContext(q_ptr->_ctx); FMPLoggerInterface::InitContext(q_ptr->_ctx);
_watcher = new QFutureWatcher<QByteArray>(); _watcher = new QFutureWatcher<QByteArray>();
connect( _watcher, SIGNAL( finished() ), this, SLOT( witedata() ) ); connect( _watcher, SIGNAL( finished() ), this, SLOT( witedata() ) );
if(_db == nullptr)
{
_db = new FMPDataBase(q->_databasename);
QString sql = "create table " + q->_table + " ("
"fmId varchar(40), "
"code varchar(40), "
"pay_transId varchar(40), "
"trans_id varchar(40),"
"pay_id varchar(40), "
"pay_ebcode varchar(20), "
"total_amount integer, "
"pcoupon_amount integer, "
"mcoupon_amount integer, "
"alipay_amount integer, "
"invoice_amount integer, "
"business_date date, "
"isrefund boolean, "
"refund_date date,"
"statusCode integer,"
"operator_id varchar(40),"
"addtime TIMESTAMP default (datetime('now', 'localtime')),"
"PRIMARY KEY (trans_id)"
")";
FMP_INFO() << " creat table sql:" << sql;
if(_db->creat(sql))
{
FMP_WARN() << "creat table fmp_pay failed";
}
}
if(_queryThread==nullptr)
_queryThread=new CQueryThread(this);
//读取配置文件信息
_setting = q->GetService<FMPSettingsInterface>(q->_ctx);
q->_url = _setting->GetString(FMP_INIKEY_EPAYURL);
q->_partner_id = _setting->GetString(FMP_INIKEY_LOGINPARTNERID);
q->_time_out = _setting->GetInt(FMP_INIKEY_EPAYTIMEOUT);
q->_time_out = (q->_time_out > 60 ? q->_time_out : 60);
q->_store_id = _setting->GetString(FMP_INIKEY_LOGINSTOREID);
q->_station_id = _setting->GetString(FMP_INIKEY_LOGINPOSID);
q->_operator_id = _setting->GetString(FMP_INIKEY_LOGINCASHIER);
//检查异常订单
CheckErrorOrder();
} }
FMPePayPrivate::~FMPePayPrivate() FMPePayPrivate::~FMPePayPrivate()
...@@ -66,6 +117,11 @@ FMPePayPrivate::~FMPePayPrivate() ...@@ -66,6 +117,11 @@ FMPePayPrivate::~FMPePayPrivate()
if(_db != nullptr){ if(_db != nullptr){
delete _db; delete _db;
_db = nullptr;
}
if(_queryThread != nullptr){
delete _queryThread;
_queryThread = nullptr;
} }
} }
...@@ -105,17 +161,6 @@ void FMPePayPrivate::Uninit() ...@@ -105,17 +161,6 @@ void FMPePayPrivate::Uninit()
delete _model; delete _model;
_model = nullptr; _model = nullptr;
} }
if(_db != nullptr){
delete _db;
_db = nullptr;
}
if(_queryThread != nullptr){
delete _queryThread;
_queryThread = nullptr;
}
} }
void FMPePayPrivate::Init() void FMPePayPrivate::Init()
...@@ -130,66 +175,23 @@ void FMPePayPrivate::Init() ...@@ -130,66 +175,23 @@ void FMPePayPrivate::Init()
_network = q->GetService<FMPNetworkInterface>(q->_ctx); _network = q->GetService<FMPNetworkInterface>(q->_ctx);
} }
if(_db == nullptr)
{
_db = new FMPDataBase(q->_databasename);
QString sql = "create table " + q->_table + " ("
"fmId varchar(40), "
"code varchar(40), "
"pay_transId varchar(40), "
"trans_id varchar(40),"
"pay_id varchar(40), "
"pay_ebcode varchar(20), "
"total_amount integer, "
"pcoupon_amount integer, "
"mcoupon_amount integer, "
"alipay_amount integer, "
"invoice_amount integer, "
"business_date date, "
"isrefund boolean, "
"refund_date date,"
"statusCode integer,"
"operator_id varchar(40),"
"addtime TIMESTAMP default (datetime('now', 'localtime')),"
"PRIMARY KEY (trans_id)"
")";
FMP_INFO() << " creat table sql:" << sql;
if(_db->creat(sql))
{
FMP_WARN() << "creat table fmp_pay failed";
}
}
if(_model == nullptr) if(_model == nullptr)
{ {
_model = new FMPPayCheckModel(NULL, _db->getDb()); _model = new FMPPayCheckModel(NULL, _db->getDb());
_model->setTable(q->_table); _model->setTable(q->_table);
_model->setEditStrategy(QSqlTableModel::OnManualSubmit); _model->setEditStrategy(QSqlTableModel::OnManualSubmit);
} }
if(_queryThread==nullptr)
_queryThread=new CQueryThread(this);
if(_payDialog == nullptr) { if(_payDialog == nullptr) {
QVariantHash hash; QVariantHash hash;
_setting = q->GetService<FMPSettingsInterface>(q->_ctx);
q->_url = _setting->GetString(FMP_INIKEY_EPAYURL);
q->_partner_id = _setting->GetString(FMP_INIKEY_LOGINPARTNERID);
q->_time_out = _setting->GetInt(FMP_INIKEY_EPAYTIMEOUT);
q->_time_out = (q->_time_out > 60 ? q->_time_out : 60);
hash[FMP_EPAY_PARTNERID] = q->_partner_id; hash[FMP_EPAY_PARTNERID] = q->_partner_id;
hash[FMP_EPAY_TIMEOUT] = q->_time_out; hash[FMP_EPAY_TIMEOUT] = q->_time_out;
if (!_is_api) { if (!_is_api) {
q->_store_id = _setting->GetString(FMP_INIKEY_LOGINSTOREID);
q->_station_id = _setting->GetString(FMP_INIKEY_LOGINPOSID);
q->_operator_id = _setting->GetString(FMP_INIKEY_LOGINCASHIER);
hash[FMP_EPAY_ANIMATION] = _setting->GetBool(FMP_INIKEY_ANIMATION); hash[FMP_EPAY_ANIMATION] = _setting->GetBool(FMP_INIKEY_ANIMATION);
hash[FMP_EPAY_BUSINESSDATE] = q->_businessdate; hash[FMP_EPAY_BUSINESSDATE] = q->_businessdate;
hash[FMP_EPAY_STOREID] = q->_store_id; hash[FMP_EPAY_STOREID] = q->_store_id;
...@@ -262,6 +264,8 @@ void FMPePayPrivate::DockPayRequest(const QByteArray &json) ...@@ -262,6 +264,8 @@ void FMPePayPrivate::DockPayRequest(const QByteArray &json)
{ {
_is_api = true; _is_api = true;
_origin_request = QJsonDocument::fromJson(json).object(); _origin_request = QJsonDocument::fromJson(json).object();
_pos_trans_id=_origin_request[FMP_EPAY_TRANSID].toString();
FMP_INFO() << "pay request json:" <<json;
} }
#define FMP_EPAY_STATUSCODE "statusCode" #define FMP_EPAY_STATUSCODE "statusCode"
...@@ -382,7 +386,7 @@ void FMPePayPrivate::ControlPayJson(QString sum, QString code) ...@@ -382,7 +386,7 @@ void FMPePayPrivate::ControlPayJson(QString sum, QString code)
emit error(errors); emit error(errors);
_origin_response = outjson; _origin_response = outjson;
writeOrderToSqlite(); writeOrderToSqlite();
if(outjson[FMP_RPAY_PAY_RETURN_STATUSCODE].toInt() == 102){ if(outjson[FMP_RPAY_PAY_RETURN_STATUSCODE].toInt() == ERROR_ORDER_STATUS){
_queryThread->setReqJson(_docked_request); _queryThread->setReqJson(_docked_request);
_queryThread->start(); _queryThread->start();
} }
...@@ -489,7 +493,7 @@ bool FMPePayPrivate::HttpPost(QJsonObject& outjson, QJsonObject json, QString &e ...@@ -489,7 +493,7 @@ bool FMPePayPrivate::HttpPost(QJsonObject& outjson, QJsonObject json, QString &e
if(reply->error() != QNetworkReply::NoError) if(reply->error() != QNetworkReply::NoError)
{ {
error = QString::fromLocal8Bit("网络异常,支付失败!"); error = QString::fromLocal8Bit("网络异常,支付失败!");
outjson[FMP_RPAY_PAY_RETURN_STATUSCODE]=102; outjson[FMP_RPAY_PAY_RETURN_STATUSCODE]=ERROR_ORDER_STATUS;
outjson[FMP_RPAY_PAY_RETURN_MSG]=error; outjson[FMP_RPAY_PAY_RETURN_MSG]=error;
return false; return false;
} }
...@@ -497,7 +501,7 @@ bool FMPePayPrivate::HttpPost(QJsonObject& outjson, QJsonObject json, QString &e ...@@ -497,7 +501,7 @@ bool FMPePayPrivate::HttpPost(QJsonObject& outjson, QJsonObject json, QString &e
if(!CheckReturnJson(reply->readAll(), outjson)) if(!CheckReturnJson(reply->readAll(), outjson))
{ {
error = QString::fromLocal8Bit("网络异常,支付失败!"); error = QString::fromLocal8Bit("网络异常,支付失败!");
outjson[FMP_RPAY_PAY_RETURN_STATUSCODE]=102; outjson[FMP_RPAY_PAY_RETURN_STATUSCODE]=ERROR_ORDER_STATUS;
outjson[FMP_RPAY_PAY_RETURN_MSG]=error; outjson[FMP_RPAY_PAY_RETURN_MSG]=error;
return false; return false;
} }
...@@ -512,7 +516,7 @@ bool FMPePayPrivate::HttpPost(QJsonObject& outjson, QJsonObject json, QString &e ...@@ -512,7 +516,7 @@ bool FMPePayPrivate::HttpPost(QJsonObject& outjson, QJsonObject json, QString &e
else else
error = QString::fromLocal8Bit("未定义错误") + QString("[%1]").arg(outjson[FMP_RPAY_PAY_RETURN_STATUSCODE].toInt()); error = QString::fromLocal8Bit("未定义错误") + QString("[%1]").arg(outjson[FMP_RPAY_PAY_RETURN_STATUSCODE].toInt());
if(outjson[FMP_RPAY_PAY_RETURN_STATUSCODE].toInt() == 204) //超时 if(outjson[FMP_RPAY_PAY_RETURN_STATUSCODE].toInt() == 204) //超时
outjson[FMP_RPAY_PAY_RETURN_STATUSCODE]=102; outjson[FMP_RPAY_PAY_RETURN_STATUSCODE]=ERROR_ORDER_STATUS;
else else
outjson[FMP_RPAY_PAY_RETURN_STATUSCODE]=105; outjson[FMP_RPAY_PAY_RETURN_STATUSCODE]=105;
return false; return false;
...@@ -561,7 +565,7 @@ void FMPePayPrivate::GetApiReqMode(int type) ...@@ -561,7 +565,7 @@ void FMPePayPrivate::GetApiReqMode(int type)
//QString date=q->_businessdate; //QString date=q->_businessdate;
switch (type) { switch (type) {
case ORDER_NEED_PAY: case ORDER_NEED_PAY:
sql=QString("addtime like '%1%%' and statusCode=106 or statusCode=105").arg(q->_businessdate); sql=QString("addtime like '%1%%' and (statusCode=105 or statusCode=106)").arg(q->_businessdate);
break; break;
case ORDER_HAS_ERROR: case ORDER_HAS_ERROR:
sql=QString("statusCode=102 and addtime like '%1%%'").arg(q->_businessdate); sql=QString("statusCode=102 and addtime like '%1%%'").arg(q->_businessdate);
...@@ -807,7 +811,7 @@ void FMPePayPrivate::GetReverseJson() ...@@ -807,7 +811,7 @@ void FMPePayPrivate::GetReverseJson()
} }
void FMPePayPrivate::ClosePayWindow(int type) void FMPePayPrivate::ClosePayWindow(int type)
{ {
Q_Q(FMPePay); // Q_Q(FMPePay);
//返回支付结果json;发送给socket //返回支付结果json;发送给socket
//状态码:107 现金支付 //状态码:107 现金支付
...@@ -863,25 +867,25 @@ void FMPePayPrivate::writeOrderToSqlite() ...@@ -863,25 +867,25 @@ void FMPePayPrivate::writeOrderToSqlite()
FMP_ERROR() << "数据发送监控程序失败:" << json; FMP_ERROR() << "数据发送监控程序失败:" << json;
} }
} }
_dbWrite[FMP_EPAY_TRANSID]=_pos_trans_id;
if(_dbWrite[FMP_RPAY_PAY_RETURN_STATUSCODE].toInt() == 100){ if(_dbWrite[FMP_RPAY_PAY_RETURN_STATUSCODE].toInt() == 100){
if (_is_api) if (!_db->isRecordExist(q->_table,_pos_trans_id)){
_dbWrite[FMP_EPAY_OPERATORID] = _origin_request[FMP_EPAY_OPERATORID];
_db->insert(q->_table, _dbWrite.toVariantHash()); _db->insert(q->_table, _dbWrite.toVariantHash());
}
else else
_db->update(q->_table, _dbWrite.toVariantHash(),QString("trans_id = '%1'").arg(_dbWrite[SQL_KEY_TRANSID].toString())); _db->update(q->_table, _dbWrite.toVariantHash(),QString("trans_id = '%1'").arg(_dbWrite[SQL_KEY_TRANSID].toString()));
} }
else{ else{
if(!_db->isRecordExist(q->_table,_pos_trans_id)){
QJsonObject origin_trans = _origin_request["transactions"].toObject(); QJsonObject origin_trans = _origin_request["transactions"].toObject();
if(_is_api){
_dbWrite["total_amount"]=origin_trans["order_amount"]; _dbWrite["total_amount"]=origin_trans["order_amount"];
_dbWrite["business_date"]=_origin_request["business_date"]; _dbWrite["business_date"]=_origin_request["business_date"];
_dbWrite[FMP_EPAY_TRANSID] = _origin_request[FMP_EPAY_TRANSID]; //_dbWrite[FMP_EPAY_TRANSID] = _origin_request[FMP_EPAY_TRANSID];
_dbWrite[FMP_EPAY_OPERATORID] = _origin_request[FMP_EPAY_OPERATORID];
_db->insert(q->_table, _dbWrite.toVariantHash()); _db->insert(q->_table, _dbWrite.toVariantHash());
} }
else{ else{
_dbWrite[FMP_EPAY_TRANSID]=_pos_trans_id;
_db->update(q->_table, _dbWrite.toVariantHash(),QString("trans_id = '%1'").arg(_dbWrite[FMP_EPAY_TRANSID].toString())); _db->update(q->_table, _dbWrite.toVariantHash(),QString("trans_id = '%1'").arg(_dbWrite[FMP_EPAY_TRANSID].toString()));
} }
} }
...@@ -957,7 +961,7 @@ void FMPePayPrivate::CheckErrorOrder() ...@@ -957,7 +961,7 @@ void FMPePayPrivate::CheckErrorOrder()
QStringList keylist; QStringList keylist;
QSqlQuery query; QSqlQuery query;
keylist <<FMP_EPAY_TRANSID << FMP_EPAY_OPERATORID; keylist <<FMP_EPAY_TRANSID << FMP_EPAY_OPERATORID;
if(!_db->find(q->_table, query, keylist, QString("statusCode = %1 and business_date= '%2'").arg(102).arg(q->_businessdate)) || !query.next()) { if(!_db->find(q->_table, query, keylist, QString("statusCode = %1 and business_date= '%2'").arg(ERROR_ORDER_STATUS).arg(q->_businessdate)) || !query.next()) {
return; return;
} }
else { else {
...@@ -973,3 +977,57 @@ void FMPePayPrivate::CheckErrorOrder() ...@@ -973,3 +977,57 @@ void FMPePayPrivate::CheckErrorOrder()
_queryThread->start(); _queryThread->start();
} }
} }
void FMPePayPrivate::GetDailyBillData(QVector<PayDetail> &vecPay)
{
Q_Q(FMPePay);
QStringList keylist;
keylist<<"count(*) as num"<<"sum(total_amount) as total";
QSqlQuery query;
PayDetail pay;
//支付宝查询
if(!_db->find(q->_table, query, keylist, QString("statusCode = %1 and business_date= '%2' and pay_ebcode='%3'").arg(100).arg(q->_businessdate).arg("10001")) || !query.next()) {
FMP_ERROR() << "查询支付数据错误!";
}
else {
pay.name=QString::fromLocal8Bit("支付宝");
pay.num = query.value(0).toString();
pay.total = QString::number(query.value(1).toDouble()/100);
pay.status=1;
vecPay.push_back(pay);
}
//微信查询
if(!_db->find(q->_table, query, keylist, QString("statusCode = %1 and business_date= '%2' and pay_ebcode='%3'").arg(100).arg(q->_businessdate).arg("10004")) || !query.next()) {
FMP_ERROR() << "查询支付数据错误!";
}
else {
pay.name=QString::fromLocal8Bit("微信");
pay.num = query.value(0).toString();
pay.total = QString::number(query.value(1).toDouble()/100);
pay.status=1;
vecPay.push_back(pay);
}
//全部查询
if(!_db->find(q->_table, query, keylist, QString("statusCode = %1 and business_date= '%2'").arg(100).arg(q->_businessdate)) || !query.next()) {
FMP_ERROR() << "查询支付数据错误!";
}
else {
pay.name=QString::fromLocal8Bit("全部");
pay.num = query.value(0).toString();
pay.total = QString::number(query.value(1).toDouble()/100);
pay.status=1;
vecPay.push_back(pay);
}
//QString::number(json[FMP_RPAY_PAY_RETURN_TOTAL].toDouble()/100)
//未成功支付
if(!_db->find(q->_table, query, keylist, QString("statusCode != %1 and business_date= '%2'").arg(100).arg(q->_businessdate)) || !query.next()) {
FMP_ERROR() << "查询支付数据错误!";
}
else {
pay.name=QString::fromLocal8Bit("");
pay.num = query.value(0).toString();
pay.total = QString::number(query.value(1).toDouble()/100);
pay.status=0;
vecPay.push_back(pay);
}
}
...@@ -21,6 +21,14 @@ typedef struct { ...@@ -21,6 +21,14 @@ typedef struct {
int len; int len;
}FMSOCKEHEADER; }FMSOCKEHEADER;
struct PayDetail
{
QString name;
QString num;
QString total;
int status; //状态 支付失败:0 支付成功:1
};
class FMPePayPrivate : public QObject class FMPePayPrivate : public QObject
{ {
Q_OBJECT Q_OBJECT
...@@ -60,6 +68,8 @@ public: ...@@ -60,6 +68,8 @@ public:
bool HttpPost(QJsonObject& outjson, QJsonObject json, QString &error, int timeout = 60); bool HttpPost(QJsonObject& outjson, QJsonObject json, QString &error, int timeout = 60);
void GetDailyBillData(QVector<PayDetail> &vecPay);
private: private:
void ControlReverseJson(); void ControlReverseJson();
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
#include <QMouseEvent> #include <QMouseEvent>
#include <Windows.h> #include <Windows.h>
#include <QDesktopWidget> #include <QDesktopWidget>
#include <QStandardItemModel>
#include <QPropertyAnimation> #include <QPropertyAnimation>
...@@ -93,6 +93,7 @@ FMPPayDialog::FMPPayDialog(FMPePayPrivate *control, QVariantHash basicinfo, QWid ...@@ -93,6 +93,7 @@ FMPPayDialog::FMPPayDialog(FMPePayPrivate *control, QVariantHash basicinfo, QWid
connect(ui->btn_errorOrder, &QPushButton::clicked, this, &FMPPayDialog::onWidgetChange); connect(ui->btn_errorOrder, &QPushButton::clicked, this, &FMPPayDialog::onWidgetChange);
connect(ui->btn_success, &QPushButton::clicked, this, &FMPPayDialog::onWidgetChange); connect(ui->btn_success, &QPushButton::clicked, this, &FMPPayDialog::onWidgetChange);
connect(ui->btn_done, &QPushButton::clicked, this, &FMPPayDialog::onWidgetChange); connect(ui->btn_done, &QPushButton::clicked, this, &FMPPayDialog::onWidgetChange);
connect(ui->btn_dailyBill, &QPushButton::clicked, this, &FMPPayDialog::onWidgetChange);
connect(_control, &FMPePayPrivate::error, this, &FMPPayDialog::showErrorMsg); connect(_control, &FMPePayPrivate::error, this, &FMPPayDialog::showErrorMsg);
connect(_control, &FMPePayPrivate::finished, this, &FMPPayDialog::showSuccessMsg); connect(_control, &FMPePayPrivate::finished, this, &FMPPayDialog::showSuccessMsg);
...@@ -158,6 +159,7 @@ FMPPayDialog::FMPPayDialog(FMPePayPrivate *control, QVariantHash basicinfo, QWid ...@@ -158,6 +159,7 @@ FMPPayDialog::FMPPayDialog(FMPePayPrivate *control, QVariantHash basicinfo, QWid
ui->wdg_query_main->move(0, ui->wdg_query_main->height()); ui->wdg_query_main->move(0, ui->wdg_query_main->height());
ui->wdg_refund_main->move(0, ui->wdg_refund_main->height()); ui->wdg_refund_main->move(0, ui->wdg_refund_main->height());
ui->wdg_success_main->move(0, ui->wdg_success_main->height()); ui->wdg_success_main->move(0, ui->wdg_success_main->height());
ui->wdg_dailyBill_main->move(0, ui->wdg_dailyBill_main->height());
if (basicinfo["fm_cmd"].toInt() == 10031) { if (basicinfo["fm_cmd"].toInt() == 10031) {
ui->btn_pay->click(); ui->btn_pay->click();
...@@ -310,6 +312,9 @@ void FMPPayDialog::onWidgetChange() ...@@ -310,6 +312,9 @@ void FMPPayDialog::onWidgetChange()
if(_curt_btn->property("index").toInt() == 6) if(_curt_btn->property("index").toInt() == 6)
setDoneView(); setDoneView();
if(_curt_btn->property("index").toInt() == 7)
setDailyBillView();
Movemode move = BtmToTop; Movemode move = BtmToTop;
QWidget *nextwdg = findChild<QWidget *>(_curt_btn->property("pageName").toString()); QWidget *nextwdg = findChild<QWidget *>(_curt_btn->property("pageName").toString());
...@@ -509,6 +514,7 @@ void FMPPayDialog::setPayView() ...@@ -509,6 +514,7 @@ void FMPPayDialog::setPayView()
ui->btn_waitPay->setChecked(false); ui->btn_waitPay->setChecked(false);
ui->btn_errorOrder->setChecked(false); ui->btn_errorOrder->setChecked(false);
ui->btn_success->setChecked(false); ui->btn_success->setChecked(false);
ui->btn_dailyBill->setChecked(false);
_current_LineEdit = ui->lineedit_num; _current_LineEdit = ui->lineedit_num;
} }
...@@ -522,6 +528,7 @@ void FMPPayDialog::setRefundView() ...@@ -522,6 +528,7 @@ void FMPPayDialog::setRefundView()
ui->btn_waitPay->setChecked(false); ui->btn_waitPay->setChecked(false);
ui->btn_errorOrder->setChecked(false); ui->btn_errorOrder->setChecked(false);
ui->btn_success->setChecked(false); ui->btn_success->setChecked(false);
ui->btn_dailyBill->setChecked(false);
ui->lineedit_num_refund->setFocus(); ui->lineedit_num_refund->setFocus();
_current_LineEdit = ui->lineedit_num_refund; _current_LineEdit = ui->lineedit_num_refund;
} }
...@@ -538,6 +545,7 @@ void FMPPayDialog::setCheckView() ...@@ -538,6 +545,7 @@ void FMPPayDialog::setCheckView()
ui->btn_waitPay->setChecked(false); ui->btn_waitPay->setChecked(false);
ui->btn_errorOrder->setChecked(false); ui->btn_errorOrder->setChecked(false);
ui->btn_success->setChecked(false); ui->btn_success->setChecked(false);
ui->btn_dailyBill->setChecked(false);
ui->lineEdit->clear(); ui->lineEdit->clear();
_control->GetMode(); _control->GetMode();
...@@ -554,6 +562,7 @@ void FMPPayDialog::setDoneView() ...@@ -554,6 +562,7 @@ void FMPPayDialog::setDoneView()
ui->btn_waitPay->setChecked(false); ui->btn_waitPay->setChecked(false);
ui->btn_errorOrder->setChecked(false); ui->btn_errorOrder->setChecked(false);
ui->btn_success->setChecked(false); ui->btn_success->setChecked(false);
ui->btn_dailyBill->setChecked(false);
_control->GetApiReqMode(ORDER_DONE); _control->GetApiReqMode(ORDER_DONE);
} }
...@@ -569,6 +578,7 @@ void FMPPayDialog::setSuccessView() ...@@ -569,6 +578,7 @@ void FMPPayDialog::setSuccessView()
ui->btn_waitPay->setChecked(false); ui->btn_waitPay->setChecked(false);
ui->btn_errorOrder->setChecked(false); ui->btn_errorOrder->setChecked(false);
ui->btn_success->setChecked(true); ui->btn_success->setChecked(true);
ui->btn_dailyBill->setChecked(false);
_control->GetApiReqMode(ORDER_PAY_SUCCESS); _control->GetApiReqMode(ORDER_PAY_SUCCESS);
} }
...@@ -584,6 +594,7 @@ void FMPPayDialog::setErrorOrderView() ...@@ -584,6 +594,7 @@ void FMPPayDialog::setErrorOrderView()
ui->btn_waitPay->setChecked(false); ui->btn_waitPay->setChecked(false);
ui->btn_errorOrder->setChecked(true); ui->btn_errorOrder->setChecked(true);
ui->btn_success->setChecked(false); ui->btn_success->setChecked(false);
ui->btn_dailyBill->setChecked(false);
_control->GetApiReqMode(ORDER_HAS_ERROR); _control->GetApiReqMode(ORDER_HAS_ERROR);
} }
...@@ -601,10 +612,75 @@ void FMPPayDialog::setWaitPayView() ...@@ -601,10 +612,75 @@ void FMPPayDialog::setWaitPayView()
ui->btn_waitPay->setChecked(true); ui->btn_waitPay->setChecked(true);
ui->btn_errorOrder->setChecked(false); ui->btn_errorOrder->setChecked(false);
ui->btn_success->setChecked(false); ui->btn_success->setChecked(false);
ui->btn_dailyBill->setChecked(false);
_control->GetApiReqMode(ORDER_NEED_PAY); _control->GetApiReqMode(ORDER_NEED_PAY);
} }
void FMPPayDialog::setDailyBillView()
{
ui->label_tip->setVisible(false);
ui->btn_waitPay_close->setEnabled(false);
ui->btn_waitPay_pay->setEnabled(false);
ui->btn_pay->setChecked(false);
ui->btn_refund->setChecked(false);
ui->btn_check->setChecked(false);
ui->btn_done->setChecked(false);
ui->btn_waitPay->setChecked(false);
ui->btn_errorOrder->setChecked(false);
ui->btn_success->setChecked(false);
ui->btn_dailyBill->setChecked(true);
QVector<PayDetail> vecPay;
_control->GetDailyBillData(vecPay);
QStandardItemModel *modelBill = new QStandardItemModel();
modelBill->setColumnCount(3);
modelBill->setHeaderData(0,Qt::Horizontal,QString::fromLocal8Bit("成功收款"));
modelBill->setHeaderData(1,Qt::Horizontal,QString::fromLocal8Bit("笔数"));
modelBill->setHeaderData(2,Qt::Horizontal,QString::fromLocal8Bit("金额(元)"));
ui->tableView_dailyBill->setModel(modelBill);
ui->tableView_dailyBill->setColumnWidth(0, 200);
ui->tableView_dailyBill->setColumnWidth(1, 200);
ui->tableView_dailyBill->setColumnWidth(2, 200);
ui->tableView_dailyBill->setSelectionMode(QTableView::SingleSelection);
ui->tableView_dailyBill->setSelectionBehavior(QTableView::SelectRows);
ui->tableView_dailyBill->setEditTriggers(QTableView::NoEditTriggers);
QStandardItemModel *modelBillFailed = new QStandardItemModel();
modelBillFailed->setColumnCount(3);
modelBillFailed->setHeaderData(0,Qt::Horizontal,QString::fromLocal8Bit("支付失败"));
modelBillFailed->setHeaderData(1,Qt::Horizontal,QString::fromLocal8Bit("笔数"));
modelBillFailed->setHeaderData(2,Qt::Horizontal,QString::fromLocal8Bit("金额(元)"));
ui->tableView_failedBill->setModel(modelBillFailed);
ui->tableView_failedBill->setColumnWidth(0, 200);
ui->tableView_failedBill->setColumnWidth(1, 200);
ui->tableView_failedBill->setColumnWidth(2, 200);
ui->tableView_failedBill->setSelectionMode(QTableView::SingleSelection);
ui->tableView_failedBill->setSelectionBehavior(QTableView::SelectRows);
ui->tableView_failedBill->setEditTriggers(QTableView::NoEditTriggers);
for(int i=0;i<vecPay.size();i++){
if(vecPay[i].status==1){
modelBill->setItem(i,0,new QStandardItem(vecPay[i].name));
modelBill->setItem(i,1,new QStandardItem(vecPay[i].num));
modelBill->setItem(i,2,new QStandardItem(vecPay[i].total));
modelBill->item(i,0)->setTextAlignment(Qt::AlignCenter);
modelBill->item(i,1)->setTextAlignment(Qt::AlignCenter);
modelBill->item(i,2)->setTextAlignment(Qt::AlignCenter);
}
else{
modelBillFailed->setItem(0,0,new QStandardItem(vecPay[i].name));
modelBillFailed->setItem(0,1,new QStandardItem(vecPay[i].num));
modelBillFailed->setItem(0,2,new QStandardItem(vecPay[i].total));
modelBillFailed->item(0,0)->setTextAlignment(Qt::AlignCenter);
modelBillFailed->item(0,1)->setTextAlignment(Qt::AlignCenter);
modelBillFailed->item(0,2)->setTextAlignment(Qt::AlignCenter);
}
}
}
void FMPPayDialog::onBtnNumClicked() void FMPPayDialog::onBtnNumClicked()
{ {
...@@ -982,6 +1058,7 @@ void FMPPayDialog::setShowFunc() ...@@ -982,6 +1058,7 @@ void FMPPayDialog::setShowFunc()
ui->btn_errorOrder->setVisible(false); ui->btn_errorOrder->setVisible(false);
ui->btn_success->setVisible(false); ui->btn_success->setVisible(false);
ui->btn_done->setVisible(false); ui->btn_done->setVisible(false);
ui->btn_dailyBill->setVisible(false);
ui->wdg_waitPay_main->move(0, ui->wdg_waitPay_main->height()); ui->wdg_waitPay_main->move(0, ui->wdg_waitPay_main->height());
ui->wdg_pay_main->move(0, 0); ui->wdg_pay_main->move(0, 0);
} }
...@@ -993,6 +1070,7 @@ void FMPPayDialog::setShowFunc() ...@@ -993,6 +1070,7 @@ void FMPPayDialog::setShowFunc()
ui->btn_errorOrder->setVisible(true); ui->btn_errorOrder->setVisible(true);
ui->btn_success->setVisible(true); ui->btn_success->setVisible(true);
ui->btn_done->setVisible(true); ui->btn_done->setVisible(true);
ui->btn_dailyBill->setVisible(true);
ui->wdg_pay_main->move(0, ui->wdg_pay_main->height()); ui->wdg_pay_main->move(0, ui->wdg_pay_main->height());
ui->wdg_waitPay_main->move(0, 0); ui->wdg_waitPay_main->move(0, 0);
ui->label_tip->setVisible(false); ui->label_tip->setVisible(false);
......
...@@ -129,6 +129,7 @@ private: ...@@ -129,6 +129,7 @@ private:
void setErrorOrderView(); void setErrorOrderView();
void setWaitPayView(); void setWaitPayView();
void setDoneView(); void setDoneView();
void setDailyBillView();
private: private:
Ui::FMPPayDialog *ui; Ui::FMPPayDialog *ui;
......
...@@ -453,14 +453,32 @@ QScrollBar::add-page:vertical,QScrollBar::sub-page:vertical ...@@ -453,14 +453,32 @@ QScrollBar::add-page:vertical,QScrollBar::sub-page:vertical
<property name="minimumSize"> <property name="minimumSize">
<size> <size>
<width>0</width> <width>0</width>
<height>40</height> <height>80</height>
</size> </size>
</property> </property>
<property name="cursor"> <property name="cursor">
<cursorShape>PointingHandCursor</cursorShape> <cursorShape>PointingHandCursor</cursorShape>
</property> </property>
<property name="styleSheet">
<string notr="true">#btn_waitPay
{
border-radius: 0px;
background-color: rgb(249, 249, 249);
image: url(:/img/wait_pay1.png);
}
#btn_waitPay:checked
{
border-radius: 0px;
background-color: rgb(233, 239, 251);
image: url(:/img/wait_pay0.png);
border-right: 2 solid rgb(93,144,237);
}</string>
</property>
<property name="text"> <property name="text">
<string>待支付</string> <string/>
</property> </property>
<property name="checkable"> <property name="checkable">
<bool>true</bool> <bool>true</bool>
...@@ -484,14 +502,32 @@ QScrollBar::add-page:vertical,QScrollBar::sub-page:vertical ...@@ -484,14 +502,32 @@ QScrollBar::add-page:vertical,QScrollBar::sub-page:vertical
<property name="minimumSize"> <property name="minimumSize">
<size> <size>
<width>0</width> <width>0</width>
<height>40</height> <height>80</height>
</size> </size>
</property> </property>
<property name="cursor"> <property name="cursor">
<cursorShape>PointingHandCursor</cursorShape> <cursorShape>PointingHandCursor</cursorShape>
</property> </property>
<property name="styleSheet">
<string notr="true">#btn_errorOrder
{
border-radius: 0px;
background-color: rgb(249, 249, 249);
image: url(:/img/error_order1.png);
}
#btn_errorOrder:checked
{
border-radius: 0px;
background-color: rgb(233, 239, 251);
image: url(:/img/error_order0.png);
border-right: 2 solid rgb(93,144,237);
}</string>
</property>
<property name="text"> <property name="text">
<string>异常</string> <string/>
</property> </property>
<property name="checkable"> <property name="checkable">
<bool>true</bool> <bool>true</bool>
...@@ -512,14 +548,32 @@ QScrollBar::add-page:vertical,QScrollBar::sub-page:vertical ...@@ -512,14 +548,32 @@ QScrollBar::add-page:vertical,QScrollBar::sub-page:vertical
<property name="minimumSize"> <property name="minimumSize">
<size> <size>
<width>0</width> <width>0</width>
<height>40</height> <height>80</height>
</size> </size>
</property> </property>
<property name="cursor"> <property name="cursor">
<cursorShape>PointingHandCursor</cursorShape> <cursorShape>PointingHandCursor</cursorShape>
</property> </property>
<property name="styleSheet">
<string notr="true">#btn_success
{
border-radius: 0px;
background-color: rgb(249, 249, 249);
image: url(:/img/success_order1.png);
}
#btn_success:checked
{
border-radius: 0px;
background-color: rgb(233, 239, 251);
image: url(:/img/success_order0.png);
border-right: 2 solid rgb(93,144,237);
}</string>
</property>
<property name="text"> <property name="text">
<string>已支付</string> <string/>
</property> </property>
<property name="checkable"> <property name="checkable">
<bool>true</bool> <bool>true</bool>
...@@ -540,14 +594,32 @@ QScrollBar::add-page:vertical,QScrollBar::sub-page:vertical ...@@ -540,14 +594,32 @@ QScrollBar::add-page:vertical,QScrollBar::sub-page:vertical
<property name="minimumSize"> <property name="minimumSize">
<size> <size>
<width>0</width> <width>0</width>
<height>40</height> <height>80</height>
</size> </size>
</property> </property>
<property name="cursor"> <property name="cursor">
<cursorShape>PointingHandCursor</cursorShape> <cursorShape>PointingHandCursor</cursorShape>
</property> </property>
<property name="styleSheet">
<string notr="true">#btn_done
{
border-radius: 0px;
background-color: rgb(249, 249, 249);
image: url(:/img/close_order1.png);
}
#btn_done:checked
{
border-radius: 0px;
background-color: rgb(233, 239, 251);
image: url(:/img/close_order0.png);
border-right: 2 solid rgb(93,144,237);
}</string>
</property>
<property name="text"> <property name="text">
<string>已关闭</string> <string/>
</property> </property>
<property name="checkable"> <property name="checkable">
<bool>true</bool> <bool>true</bool>
...@@ -564,6 +636,52 @@ QScrollBar::add-page:vertical,QScrollBar::sub-page:vertical ...@@ -564,6 +636,52 @@ QScrollBar::add-page:vertical,QScrollBar::sub-page:vertical
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QPushButton" name="btn_dailyBill">
<property name="minimumSize">
<size>
<width>0</width>
<height>80</height>
</size>
</property>
<property name="cursor">
<cursorShape>PointingHandCursor</cursorShape>
</property>
<property name="styleSheet">
<string notr="true">#btn_dailyBill
{
border-radius: 0px;
background-color: rgb(249, 249, 249);
image: url(:/img/daily_bill1.png);
}
#btn_dailyBill:checked
{
border-radius: 0px;
background-color: rgb(233, 239, 251);
image: url(:/img/daily_bill0.png);
border-right: 2 solid rgb(93,144,237);
}</string>
</property>
<property name="text">
<string/>
</property>
<property name="checkable">
<bool>true</bool>
</property>
<property name="autoExclusive">
<bool>true</bool>
</property>
<property name="index" stdset="0">
<number>7</number>
</property>
<property name="pageName" stdset="0">
<string>wdg_dailyBill_main</string>
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer_3"> <spacer name="verticalSpacer_3">
<property name="orientation"> <property name="orientation">
<enum>Qt::Vertical</enum> <enum>Qt::Vertical</enum>
...@@ -2129,7 +2247,7 @@ QPushButton:hover { ...@@ -2129,7 +2247,7 @@ QPushButton:hover {
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>628</width> <width>628</width>
<height>460</height> <height>421</height>
</rect> </rect>
</property> </property>
<property name="styleSheet"> <property name="styleSheet">
...@@ -2139,7 +2257,7 @@ QPushButton:hover { ...@@ -2139,7 +2257,7 @@ QPushButton:hover {
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>40</x> <x>40</x>
<y>90</y> <y>80</y>
<width>431</width> <width>431</width>
<height>261</height> <height>261</height>
</rect> </rect>
...@@ -2597,7 +2715,7 @@ QPushButton:hover { ...@@ -2597,7 +2715,7 @@ QPushButton:hover {
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>40</x> <x>40</x>
<y>20</y> <y>10</y>
<width>61</width> <width>61</width>
<height>61</height> <height>61</height>
</rect> </rect>
...@@ -2629,7 +2747,7 @@ image: url(:/img/fmclient-icon_payment_success.png);</string> ...@@ -2629,7 +2747,7 @@ image: url(:/img/fmclient-icon_payment_success.png);</string>
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>110</x> <x>110</x>
<y>30</y> <y>20</y>
<width>121</width> <width>121</width>
<height>41</height> <height>41</height>
</rect> </rect>
...@@ -2661,7 +2779,7 @@ font: 75 24px &quot;微软雅黑&quot;;</string> ...@@ -2661,7 +2779,7 @@ font: 75 24px &quot;微软雅黑&quot;;</string>
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>40</x> <x>40</x>
<y>340</y> <y>330</y>
<width>371</width> <width>371</width>
<height>58</height> <height>58</height>
</rect> </rect>
...@@ -3231,8 +3349,114 @@ QHeaderView::section { ...@@ -3231,8 +3349,114 @@ QHeaderView::section {
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>628</width> <width>661</width>
<height>363</height> <height>401</height>
</rect>
</property>
<property name="styleSheet">
<string notr="true">QTableView {
background: white;
font-size: 14px;
font-family: &quot;Microsoft YaHei&quot;;
border: 0 solid silver;
selection-background-color: rgb(160, 160, 160);
}
QHeaderView {
border: none;
}
QHeaderView::section {
border: none;
color: white;
font-size: 16px;
background-color: rgb(93,144,237);
min-height: 34px; max-height: 34px;
font-family: &quot;Microsoft YaHei&quot;;
}</string>
</property>
<property name="alternatingRowColors">
<bool>true</bool>
</property>
<property name="showGrid">
<bool>false</bool>
</property>
</widget>
</widget>
<widget class="QWidget" name="wdg_dailyBill_main" native="true">
<property name="geometry">
<rect>
<x>5</x>
<y>10</y>
<width>631</width>
<height>381</height>
</rect>
</property>
<property name="styleSheet">
<string notr="true">background-color: rgb(255, 255, 255);</string>
</property>
<widget class="QTableView" name="tableView_dailyBill">
<property name="geometry">
<rect>
<x>0</x>
<y>50</y>
<width>621</width>
<height>161</height>
</rect>
</property>
<property name="styleSheet">
<string notr="true">QTableView {
background: white;
font-size: 14px;
font-family: &quot;Microsoft YaHei&quot;;
border: 0 solid silver;
selection-background-color: rgb(160, 160, 160);
}
QHeaderView {
border: none;
}
QHeaderView::section {
border: none;
color: white;
font-size: 16px;
background-color: rgb(93,144,237);
min-height: 34px; max-height: 34px;
font-family: &quot;Microsoft YaHei&quot;;
}</string>
</property>
<property name="alternatingRowColors">
<bool>true</bool>
</property>
<property name="showGrid">
<bool>false</bool>
</property>
</widget>
<widget class="QLabel" name="label">
<property name="geometry">
<rect>
<x>0</x>
<y>10</y>
<width>621</width>
<height>31</height>
</rect>
</property>
<property name="styleSheet">
<string notr="true">font: 75 24px &quot;微软雅黑&quot;;</string>
</property>
<property name="text">
<string>当日账单</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
<widget class="QTableView" name="tableView_failedBill">
<property name="geometry">
<rect>
<x>0</x>
<y>230</y>
<width>621</width>
<height>81</height>
</rect> </rect>
</property> </property>
<property name="styleSheet"> <property name="styleSheet">
...@@ -3266,12 +3490,13 @@ QHeaderView::section { ...@@ -3266,12 +3490,13 @@ QHeaderView::section {
</widget> </widget>
<zorder>wdg_errorPay_main</zorder> <zorder>wdg_errorPay_main</zorder>
<zorder>wdg_refund_main</zorder> <zorder>wdg_refund_main</zorder>
<zorder>wdg_done_main</zorder>
<zorder>wdg_hasPay_main</zorder> <zorder>wdg_hasPay_main</zorder>
<zorder>wdg_query_main</zorder> <zorder>wdg_query_main</zorder>
<zorder>wdg_success_main</zorder>
<zorder>wdg_waitPay_main</zorder> <zorder>wdg_waitPay_main</zorder>
<zorder>wdg_pay_main</zorder> <zorder>wdg_pay_main</zorder>
<zorder>wdg_done_main</zorder>
<zorder>wdg_dailyBill_main</zorder>
<zorder>wdg_success_main</zorder>
</widget> </widget>
</item> </item>
<item> <item>
......
...@@ -16,5 +16,15 @@ ...@@ -16,5 +16,15 @@
<file>img/dlt02.png</file> <file>img/dlt02.png</file>
<file>img/dot01.png</file> <file>img/dot01.png</file>
<file>img/dot02.png</file> <file>img/dot02.png</file>
<file>img/close_order0.png</file>
<file>img/close_order1.png</file>
<file>img/daily_bill0.png</file>
<file>img/daily_bill1.png</file>
<file>img/error_order0.png</file>
<file>img/error_order1.png</file>
<file>img/success_order0.png</file>
<file>img/success_order1.png</file>
<file>img/wait_pay0.png</file>
<file>img/wait_pay1.png</file>
</qresource> </qresource>
</RCC> </RCC>
...@@ -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 15 #define VER_BUILD 16
//! 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