Commit 10d384ee by 刘帅

添加查询页面的商品展示

parent 1cfec17a
fmp_home @ da1606bb
Subproject commit ae1170745403d24c3d1cbd1ce5bd418732b02075
Subproject commit da1606bbad4d543b107d1e16c892d9d36dba92cd
......@@ -5,7 +5,7 @@
#define VER_MINOR 1
#define VER_REVISION 0
#define VER_BUILD 95
#define VER_BUILD 96
//! Convert version numbers to string
#define _STR(S) #S
......
......@@ -5,7 +5,7 @@
#define VER_MINOR 1
#define VER_REVISION 0
#define VER_BUILD 95
#define VER_BUILD 96
//! Convert version numbers to string
#define _STR(S) #S
......
......@@ -5,7 +5,7 @@
#define VER_MINOR 1
#define VER_REVISION 0
#define VER_BUILD 95
#define VER_BUILD 96
//! Convert version numbers to string
#define _STR(S) #S
......
......@@ -5,7 +5,7 @@
#define VER_MINOR 1
#define VER_REVISION 0
#define VER_BUILD 95
#define VER_BUILD 96
//! Convert version numbers to string
#define _STR(S) #S
......
#include "consumptiondialog.h"
#include "ui_consumptiondialog.h"
#include <QDebug>
#include <QJsonObject>
#include <QCheckBox>
#include <QJsonArray>
#include <QButtonGroup>
#include <QRadioButton>
#include <QDebug>
ConsumptionDialog::ConsumptionDialog(QWidget * parent, Qt::WindowFlags f) :
QDialog(parent, f),
......@@ -41,6 +47,79 @@ bool ConsumptionDialog::ShowForUnConsum(const QString& act_name, double face_amo
return false;
}
bool ConsumptionDialog::ShowForUnConsum(const QString coupon, const QJsonObject object, QJsonArray & products, QWidget *parent)
{
QJsonObject codeInfo = object["codeInfo"].toObject();
QString act_name = codeInfo["act_name"].toString();
QString channel = object["channel"].toString();
QString fullChannel = object["channel"].toString();
int index = fullChannel.indexOf("-");
if( index != -1)
{
channel = fullChannel.left(index);
}
double realAmount = codeInfo["originalPrice"].toInt()/100.0; // 面值
double amount = codeInfo["paid"].toInt()/100.0; //实付
QJsonArray _products_info = codeInfo["products"].toArray();
ConsumptionDialog v(parent);
v.ui->topNoConsumeWidget->setObjectName( "topNoConsumeWidget");
v.ui->topNoConsumeWidget->setStyleSheet( v.ui->topNoConsumeWidget->styleSheet());
v.ui->btnConsumption->setObjectName( "btnConsumption");
v.ui->btnConsumption->setStyleSheet( v.ui->btnConsumption->styleSheet());
v.ui->btnConsumption->setEnabled( true);
v.setData(act_name, realAmount, amount, channel, "", coupon);
QButtonGroup *group = new QButtonGroup();
int checkedIndex = 0; //默认选中的商品选项
for(int i = 0; i < _products_info.size(); i++)
{
QJsonObject product;
product.insert("seq", i+1);
product.insert("pid", _products_info[i].toObject()["pid"]);
product.insert("consume_num", _products_info[i].toObject()["number"]);
QString name = _products_info[i].toObject()["name"].toString();
if(name.contains(QString::fromLocal8Bit("92"), Qt::CaseSensitive))
{
checkedIndex = i;
}
QRadioButton *radioButton = new QRadioButton(name);
group->addButton(radioButton, i);
v.ui->selectLayout->addWidget(radioButton);
}
realAmount = _products_info[checkedIndex].toObject()["price_act"].toInt()/100.0; // 面值
QAbstractButton* button = group->button(checkedIndex);
if(button)
button->setChecked(true);
if( v.exec() == QDialog::Accepted)
{
QJsonArray _products;
foreach(auto item, group->buttons()) //QList<QAbstractButton *> buttons() const
{
if(item->isChecked())
{
QString text = item->text();
for(int i = 0; i < _products_info.size(); i++)
{
if(text == _products_info[i].toObject()["name"].toString())
{
QJsonObject product;
product.insert("seq", 1);
product.insert("pid", _products_info[i].toObject()["pid"]);
product.insert("consume_num", _products_info[i].toObject()["number"]);
_products.append(product);
break;
}
}
break;
}
}
products = _products;
return true;
}
return false;
}
bool ConsumptionDialog::ShowForHasConsum(const QString& act_name, const QString channel, const QString& code_name, const QString& time_name, const QString& coupon, QWidget *parent)
{
ConsumptionDialog v(parent);
......@@ -121,7 +200,8 @@ void ConsumptionDialog::setData(const QString &act_name, double face_amount, dou
{
ui->labCode->setText(coupon);
ui->labCodeName->setText(QString::fromLocal8Bit("面值: %1 元").arg(face_amount));
ui->actualAmount->setText(QString::fromLocal8Bit("实收: %1 元").arg(actual_amount));
//ui->actualAmount->setText(QString::fromLocal8Bit("实收: %1 元").arg(actual_amount));
ui->actualAmount->hide();
ui->ebname->setText(QString::fromLocal8Bit("渠道: ") + eb_name);
ui->labActName->setText(act_name);
ui->labTime->setText(time_name);
......
......@@ -21,6 +21,13 @@ public:
void setData(const QString& act_name, const QString channel, const QString& code_name, const QString& time_name, const QString& coupon);
void setData(const QString &act_name, double face_amount, double actual_amount, const QString& eb_name, const QString& time_name, const QString& coupon);
static bool ShowForUnConsum(const QString &act_name, double face_amount, double actual_amount, const QString& eb_name, const QString& time_name, const QString& coupon, QWidget *parent = 0);
/* 描述:展示查询成功且券有效页面,重载函数
* 参数:
* coupon 券
* object 查询接口返回数据
*/
static bool ShowForUnConsum(const QString coupon, const QJsonObject object, QJsonArray &products, QWidget *parent = 0);
static bool ShowForHasConsum(const QString& act_name, const QString channel, const QString& code_name, const QString& time_name, const QString& coupon, QWidget *parent = 0);
void ShowForWaiting(QString context, QString coupon, QWidget *parent = 0);
void HideForWaiting();
......
......@@ -59,21 +59,25 @@
/**/
#labActName{
/*font: 30 bold &quot;微软雅黑&quot;;*/
font-size:25px;
font-family:&quot;微软雅黑&quot;;
font-weight:bold;
font: 65 13pt &quot;微软雅黑&quot;;
color: rgb(255, 255, 0);
border:none;
}
#ebname{
font: 65 20pt &quot;微软雅黑&quot;;
font: 65 15pt &quot;微软雅黑&quot;;
color: rgb(255,255,255);
border:none;
}
#labCodeName, #actualAmount{
font: 65 15pt &quot;微软雅黑&quot;;
font: 65 13pt &quot;微软雅黑&quot;;
color: rgb(255, 255, 0);
border:none;
}
#QRadioButton{
font: 65 13pt &quot;微软雅黑&quot;;
color: rgb(255, 255, 0);
border:none;
}
......@@ -174,7 +178,7 @@
<property name="geometry">
<rect>
<x>0</x>
<y>90</y>
<y>40</y>
<width>330</width>
<height>50</height>
</rect>
......@@ -195,10 +199,13 @@
<string>查询中</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
<property name="wordWrap">
<bool>true</bool>
<bool>false</bool>
</property>
<property name="indent">
<number>10</number>
</property>
</widget>
<widget class="QLabel" name="labTime">
......@@ -233,7 +240,7 @@
<property name="geometry">
<rect>
<x>0</x>
<y>186</y>
<y>110</y>
<width>330</width>
<height>37</height>
</rect>
......@@ -267,7 +274,7 @@
<property name="geometry">
<rect>
<x>0</x>
<y>220</y>
<y>140</y>
<width>330</width>
<height>37</height>
</rect>
......@@ -301,7 +308,7 @@
<property name="geometry">
<rect>
<x>0</x>
<y>150</y>
<y>80</y>
<width>330</width>
<height>37</height>
</rect>
......@@ -331,6 +338,17 @@
<number>10</number>
</property>
</widget>
<widget class="QWidget" name="verticalLayoutWidget">
<property name="geometry">
<rect>
<x>170</x>
<y>120</y>
<width>161</width>
<height>151</height>
</rect>
</property>
<layout class="QVBoxLayout" name="selectLayout"/>
</widget>
</widget>
</item>
<item>
......
......@@ -186,7 +186,7 @@ QJsonObject FMPRedeem::Redeem(const QJsonArray& productsInfo)
json.insert("ver", 2);
json.insert("clientReqCount", ++_clientReqCount%=10000000);
json.insert("reqtype", 0);
// json.insert("partnerId", _partner_id);
json.insert("partnerId", _partner_id);
json.insert("store_id", _store_id);
json.insert("station_id", _station_id);
json.insert("operator_id", _operator_id);
......@@ -314,13 +314,15 @@ QJsonObject FMPRedeem::ShowForUnConsum(QJsonObject json)
QString time_name = QString::fromLocal8Bit("有效期至: ").append(QDate::fromString(vdata, "yyyyMMdd").toString("yyyy-MM-dd"));
//UNUSED(time_name);
int couponType = json["couponType"].toInt();
if( ConsumptionDialog::ShowForUnConsum(act_name, realAmount, amount, channel, "", coupon))
//if( ConsumptionDialog::ShowForUnConsum(act_name, realAmount, amount, channel, "", coupon))
QJsonArray products;
if( ConsumptionDialog::ShowForUnConsum(coupon, json, products))
{
_redeem_json = QJsonObject();
_redeem_json["ver"] = 2;
_redeem_json["clientReqCount"] = (++_clientReqCount%=10000000);
_redeem_json["reqtype"] = 71;
// _redeem_json["partnerId"] = _partner_id;
_redeem_json["partnerId"] = _partner_id;
_redeem_json["store_id"] = _store_id;
_redeem_json["station_id"] = _station_id;
_redeem_json["trans_id"] = QString::number(QDateTime::currentDateTimeUtc().toTime_t());
......@@ -332,17 +334,6 @@ QJsonObject FMPRedeem::ShowForUnConsum(QJsonObject json)
QJsonArray transactions;
transaction["code"] = coupon;
transaction["ebcode"] = ebcode;
QJsonArray products;
for(int i = 0; i < _products_info.size(); i++)
{
QJsonObject product;
product.insert("seq", i+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;
transactions.append(transaction);
_redeem_json["transactions"] = transactions;
......@@ -494,7 +485,6 @@ QByteArray FMPRedeem::CheckSendArray(QByteArray &jsonArray)
strLength ++;
QByteArray array(tmpBuf);
return array;
}
......
......@@ -5,7 +5,7 @@
#define VER_MINOR 1
#define VER_REVISION 0
#define VER_BUILD 95
#define VER_BUILD 96
//! Convert version numbers to string
#define _STR(S) #S
......
......@@ -5,7 +5,7 @@
#define VER_MINOR 1
#define VER_REVISION 0
#define VER_BUILD 95
#define VER_BUILD 96
//! Convert version numbers to string
#define _STR(S) #S
......
......@@ -47,6 +47,7 @@ for /f "tokens=1-3 delims=." %%h in ("%ver_tag%") do (
)
for /f %%i in ('git rev-list HEAD --count') do set ver_build=%%i
set ver_build=96
set version=%ver_maj%.%ver_min%.%ver_rev%
echo %version%
......
......@@ -16,7 +16,7 @@ Level=0
[Home]
Server=http://115.159.226.87:20001/api/user/login
PartnerId=1739
StoreId=SH058
StoreId=98
PosId=01
Position=2586, 177
CashierId=001
......
[Home]
PartnerId=1739
PartnerId=1946
[Pay]
Server="http://115.159.119.32:27935/api?partner=yhdw"
Server="http://115.159.65.101:8001/api"
Timeout=60
[Coupon]
Server=http://115.159.142.32/api
RedeemLog=http://115.159.119.32:27935/getRedeemLog
\ No newline at end of file
RedeemLog=http://couponbackstage.freemudvip.com:8111/report/getLogList
\ No newline at end of file
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