Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
F
FMVip_Today
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
zhenfei.zhang
FMVip_Today
Commits
907d8b1a
Commit
907d8b1a
authored
Jul 04, 2017
by
NitefullWind
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1. 优化登陆后代金券券选择功能。
parent
932c2c54
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
87 additions
and
123 deletions
+87
-123
FMVip/FMVip.pro
+2
-2
FMVip/fmcouponwidget.cpp
+4
-5
FMVip/fmcouponwidget.h
+2
-2
FMVip/fmvipcouponlist.cpp
+6
-1
FMVip/fmvipdispatcher.cpp
+38
-11
FMVip/fmvipforward.cpp
+14
-22
FMVip/fmvipforward.h
+3
-0
FMVip/fmviporder.cpp
+7
-2
FMVip/forms/fmcouponwidget.ui
+4
-74
FMVip/forms/fmvipcouponlist.ui
+7
-4
No files found.
FMVip/FMVip.pro
View file @
907d8b1a
...
...
@@ -49,8 +49,8 @@ FORMS += forms/fmviporder.ui \
forms
/
fmvipfund
.
ui
\
forms
/
fmmsgwnd
.
ui
\
forms
/
fmloading
.
ui
\
forms
/
fm
couponwidge
t
.
ui
\
forms
/
fm
vipcouponlis
t
.
ui
forms
/
fm
vipcouponlis
t
.
ui
\
forms
/
fm
couponwidge
t
.
ui
RESOURCES
+=
\
res
/
FMVip
.
qrc
...
...
FMVip/fmcouponwidget.cpp
View file @
907d8b1a
#include "fmcouponwidget.h"
#
include
"fmcouponwidget.h"
#include "ui_fmcouponwidget.h"
#include <QPainter>
FMCouponWidget
::
FMCouponWidget
(
Coupon
co
n
pon
,
QWidget
*
parent
)
:
FMCouponWidget
::
FMCouponWidget
(
Coupon
co
u
pon
,
QWidget
*
parent
)
:
QWidget
(
parent
),
ui
(
new
Ui
::
FMCouponWidget
)
{
ui
->
setupUi
(
this
);
ui
->
code_lab
->
setText
(
conpon
.
code
);
ui
->
amount_lab
->
setText
(
QString
::
number
(
conpon
.
disAmount
,
'f'
,
2
));
ui
->
desc_lab
->
setText
(
conpon
.
desc
);
ui
->
desc_lab
->
setText
(
coupon
.
desc
);
ui
->
code_lab
->
setText
(
coupon
.
limitTime
);
}
FMCouponWidget
::~
FMCouponWidget
()
...
...
FMVip/fmcouponwidget.h
View file @
907d8b1a
#ifndef FMCOUPONWIDGET_H
#
ifndef
FMCOUPONWIDGET_H
#define FMCOUPONWIDGET_H
#include <QWidget>
...
...
@@ -13,7 +13,7 @@ class FMCouponWidget : public QWidget
Q_OBJECT
public
:
explicit
FMCouponWidget
(
Coupon
co
n
pon
,
QWidget
*
parent
=
0
);
explicit
FMCouponWidget
(
Coupon
co
u
pon
,
QWidget
*
parent
=
0
);
~
FMCouponWidget
();
void
paintEvent
(
QPaintEvent
*
event
);
...
...
FMVip/fmvipcouponlist.cpp
View file @
907d8b1a
...
...
@@ -17,7 +17,7 @@ FMVipCouponList::FMVipCouponList(QDialog *parent) :
QString
name
=
SESSIONDATA_STRING
(
"name"
);
QString
birthday
=
SESSIONDATA_STRING
(
"birthday"
);
_couponMap
=
SESSIONDATA_COUPONMAP
(
"couponMap"
);
_couponMap
=
SESSIONDATA_COUPONMAP
(
"couponMap
SPQ
"
);
ui
->
operator_label
->
setText
(
operator_id
);
ui
->
bd_label
->
setText
(
business_date
);
...
...
@@ -49,6 +49,7 @@ void FMVipCouponList::onItemClicked(QListWidgetItem *item)
void
FMVipCouponList
::
initCouponItems
()
{
QStringList
posCouponCodes
=
SESSIONDATA
(
"PosReqCouponCodes"
).
toStringList
();
for
(
Coupon
coupon
:
_couponMap
)
{
auto
item
=
new
QListWidgetItem
();
...
...
@@ -59,6 +60,10 @@ void FMVipCouponList::initCouponItems()
ui
->
coupon_page
->
setItemWidget
(
item
,
itemWidget
);
//item大小
item
->
setSizeHint
(
itemWidget
->
size
());
if
(
posCouponCodes
.
contains
(
coupon
.
code
))
{
onItemClicked
(
item
);
}
}
}
...
...
FMVip/fmvipdispatcher.cpp
View file @
907d8b1a
...
...
@@ -7,11 +7,13 @@
#include <QDebug>
#include <QJsonDocument>
#include <QJsonObject>
#include <QJsonArray>
#include <QApplication>
#include <QMessageBox>
#include <QMenu>
#include <QTimer>
#include <winsock2.h>
#include "fmvipcouponlist.h"
FMVipDispatcher
::
FMVipDispatcher
(
QObject
*
parent
)
:
QObject
(
parent
),
...
...
@@ -201,8 +203,9 @@ void FMVipDispatcher::onFinished()
void
FMVipDispatcher
::
onServerResponsed
(
const
QJsonObject
&
rspObj
)
{
int
status
=
rspObj
[
"statusCode"
].
toInt
();
int
prompt
=
rspObj
[
"prompt"
].
toInt
();
QJsonObject
posRspObj
=
rspObj
;
int
status
=
posRspObj
[
"statusCode"
].
toInt
();
int
prompt
=
posRspObj
[
"prompt"
].
toInt
();
if
(
_vindow
!=
0
)
{
_vindow
->
setIsBusy
(
false
);
...
...
@@ -214,17 +217,34 @@ void FMVipDispatcher::onServerResponsed(const QJsonObject &rspObj)
// 失败则弹出错误信息
if
(
status
!=
100
)
{
_vindow
->
resetWnd
();
FMMsgWnd
::
FailureWnd
(
r
spObj
[
"msg"
].
toString
());
FMMsgWnd
::
FailureWnd
(
posR
spObj
[
"msg"
].
toString
());
return
;
}
// 成功,且是最后一步,则弹出认证信息
// else if(isLastOne) {
// QString account = SESSIONDATA_STRING("fm_open_id");
// QString name = SESSIONDATA_STRING("name");
// QString birthday = SESSIONDATA_STRING("birthday");
// FMMsgWnd::LoginSuccess(account, name, birthday);
// }
else
if
(
isLastOne
)
{
if
(
canPay
==
1
)
{
// 展示商品券界面
FMVipCouponList
couponListWnd
;
couponListWnd
.
exec
();
// 返回选中的商品券
QJsonArray
coupons
;
QMap
<
QString
,
Coupon
>
selectCouponMap
=
SESSIONDATA_COUPONMAP
(
"usedCoupons"
);
foreach
(
Coupon
coupon
,
selectCouponMap
)
{
QJsonObject
couponObj
;
couponObj
[
"code"
]
=
coupon
.
code
;
couponObj
[
"pid"
]
=
coupon
.
pid
;
coupons
.
append
(
couponObj
);
}
posRspObj
[
"coupons"
]
=
coupons
;
}
else
{
QString
account
=
SESSIONDATA_STRING
(
"fm_open_id"
);
QString
name
=
SESSIONDATA_STRING
(
"name"
);
QString
birthday
=
SESSIONDATA_STRING
(
"birthday"
);
FMMsgWnd
::
LoginSuccess
(
account
,
name
,
birthday
);
}
}
// 成功,是支付认证,但不能支付
else
if
(
isPayLogin
)
{
if
(
canPay
!=
1
)
{
...
...
@@ -239,7 +259,7 @@ void FMVipDispatcher::onServerResponsed(const QJsonObject &rspObj)
_vindow
->
deleteLater
();
}
QJsonDocument
rspDoc
(
r
spObj
);
QJsonDocument
rspDoc
(
posR
spObj
);
QByteArray
rspData
=
rspDoc
.
toJson
();
_serverRspData
=
rspData
;
...
...
@@ -247,7 +267,7 @@ void FMVipDispatcher::onServerResponsed(const QJsonObject &rspObj)
requestSuccess
=
false
;
if
(
prompt
==
0
)
{
QString
msg
=
r
spObj
[
"msg"
].
toString
();
QString
msg
=
posR
spObj
[
"msg"
].
toString
();
FMMsgWnd
::
FailureWnd
(
msg
);
}
_vindow
=
0
;
...
...
@@ -268,6 +288,13 @@ void FMVipDispatcher::onDoPost()
void
FMVipDispatcher
::
login
()
{
isLogin
=
true
;
QStringList
posReqCouponCodes
;
for
(
QJsonValue
v
:
_posReqObj
[
"coupons"
].
toArray
())
{
posReqCouponCodes
.
append
(
v
.
toString
());
}
SESSIONDATA_ADD
(
"PosReqCouponCodes"
,
posReqCouponCodes
);
if
(
!
_vindow
)
{
FMVipLogin
*
login
=
new
FMVipLogin
(
isPayLogin
);
connect
(
login
,
SIGNAL
(
destroyed
(
QObject
*
)),
SLOT
(
onFinished
()));
...
...
FMVip/fmvipforward.cpp
View file @
907d8b1a
...
...
@@ -13,7 +13,6 @@
#include <QFuture>
#include <QSharedPointer>
#include <QSemaphore>
#include "fmvipcouponlist.h"
#include "fmbackup.h"
#include <QDebug>
...
...
@@ -385,7 +384,7 @@ void FMVipForward::logined(const QJsonObject &serverJob, QJsonObject &posJob)
QJsonArray
couponArr
=
memberObj
[
"couponList"
].
toArray
();
QMap
<
QString
,
QVariant
>
couponMap
;
QMap
<
QString
,
QVariant
>
couponMap
SPQ
,
couponMapDJQ
;
foreach
(
QJsonValue
value
,
couponArr
)
{
QJsonObject
co
=
value
.
toObject
();
...
...
@@ -393,12 +392,22 @@ void FMVipForward::logined(const QJsonObject &serverJob, QJsonObject &posJob)
double
amount
=
co
[
"disAmount"
].
toInt
()
/
100.0
;
QString
desc
=
co
[
"desc"
].
toString
();
QString
pid
=
co
[
"productCode"
].
toString
();
QString
type
=
co
[
"typeCode"
].
toString
();
QString
startTime
=
co
[
"startTime"
].
toString
().
mid
(
0
,
10
);
QString
endTime
=
co
[
"endTime"
].
toString
().
mid
(
0
,
10
);
QString
limitTime
=
QString
(
"%1 ~ %2"
).
arg
(
startTime
).
arg
(
endTime
);
QVariant
v
;
v
.
setValue
(
Coupon
{
codeStr
,
amount
,
desc
,
pid
});
couponMap
[
co
[
"couponCode"
].
toString
()]
=
v
;
v
.
setValue
(
Coupon
{
codeStr
,
amount
,
desc
,
pid
,
type
,
limitTime
});
if
(
type
==
"CTYPE001"
)
{
couponMapDJQ
[
codeStr
]
=
v
;
}
else
{
couponMapSPQ
[
codeStr
]
=
v
;
}
}
SESSIONDATA_ADD
(
"couponMap"
,
couponMap
);
SESSIONDATA_ADD
(
"couponMapDJQ"
,
couponMapDJQ
);
SESSIONDATA_ADD
(
"couponMapSPQ"
,
couponMapSPQ
);
QString
name
=
memberObj
[
"name"
].
toString
();
name
=
(
name
.
isEmpty
())
?
"未知"
:
name
;
...
...
@@ -409,23 +418,6 @@ void FMVipForward::logined(const QJsonObject &serverJob, QJsonObject &posJob)
SESSIONDATA_ADD
(
"name"
,
name
);
SESSIONDATA_ADD
(
"mobile"
,
mobile
);
SESSIONDATA_ADD
(
"birthday"
,
birthday
);
// 展示用户代金券
if
(
SESSIONDATA_STRING
(
"canPay"
)
!=
""
)
{
FMVipCouponList
couponListWnd
;
couponListWnd
.
exec
();
}
QJsonArray
coupons
;
QMap
<
QString
,
Coupon
>
selectCouponMap
=
SESSIONDATA_COUPONMAP
(
"usedCoupons"
);
foreach
(
Coupon
coupon
,
selectCouponMap
)
{
QJsonObject
couponObj
;
couponObj
[
"code"
]
=
coupon
.
code
;
couponObj
[
"pid"
]
=
coupon
.
pid
;
coupons
.
append
(
couponObj
);
}
posJob
[
"coupons"
]
=
coupons
;
}
void
FMVipForward
::
funded
(
const
QJsonObject
&
serverJob
,
QJsonObject
&
posJob
)
...
...
FMVip/fmvipforward.h
View file @
907d8b1a
...
...
@@ -7,6 +7,7 @@
#include <QNetworkReply>
#include <QNetworkRequest>
#include <QJsonObject>
#include <QDateTime>
#define AppId "T007"
#define KeyCode "98d094a7-0d07-4cf5-b23b-d18783f0d76a"
...
...
@@ -36,6 +37,8 @@ struct Coupon
double
disAmount
;
QString
desc
;
QString
pid
;
QString
type
;
QString
limitTime
;
};
Q_DECLARE_METATYPE
(
Coupon
)
// 使Coupon类型可以和QVariant类型互相转换
...
...
FMVip/fmviporder.cpp
View file @
907d8b1a
#include "fmviporder.h"
#
include
"fmviporder.h"
#include "fmmsgwnd.h"
#include "fmcouponwidget.h"
#include "ui_fmviporder.h"
...
...
@@ -21,7 +21,7 @@ FMVipOrder::FMVipOrder(QDialog *parent) :
double
standard_amount
=
SESSIONDATA_INT
(
"standard_amount"
)
/
100.0
;
orderInfo
=
new
FMVipOrder
::
OrderInfo
(
amount_str
,
score_str
,
needPay_str
);
orderInfo
->
setCouponMap
(
SESSIONDATA_COUPONMAP
(
"couponMap"
));
orderInfo
->
setCouponMap
(
SESSIONDATA_COUPONMAP
(
"couponMap
DJQ
"
));
ui
->
operator_label
->
setText
(
operator_id
);
ui
->
bd_label
->
setText
(
business_date
);
...
...
@@ -102,6 +102,7 @@ void FMVipOrder::onItemClicked(QListWidgetItem *item)
void
FMVipOrder
::
initCouponItems
()
{
QStringList
posCouponCodes
=
SESSIONDATA
(
"PosReqCouponCodes"
).
toStringList
();
for
(
Coupon
coupon
:
orderInfo
->
couponMap
().
values
())
{
auto
item
=
new
QListWidgetItem
();
...
...
@@ -112,6 +113,10 @@ void FMVipOrder::initCouponItems()
ui
->
coupon_page
->
setItemWidget
(
item
,
itemWidget
);
//item大小
item
->
setSizeHint
(
itemWidget
->
size
());
if
(
posCouponCodes
.
contains
(
coupon
.
code
))
{
onItemClicked
(
item
);
}
}
}
...
...
FMVip/forms/fmcouponwidget.ui
View file @
907d8b1a
...
...
@@ -30,23 +30,9 @@
color: rgb(127,127,127);
font: 12px
"
Microsoft YaHei
"
;
}
#amount_lab, #currency
{
color: rgb(229, 11, 72);
font: bold 30px
"
Microsoft YaHei
"
;
}
#currency
{
font: bold 15px;
margin-top: 11px;
}
#desc_lab
{
max-height: 21;
min-height: 21;
color: rgb(252,255,255);
background-color: rgb(229, 11, 72);
font: bold 15px
"
Microsoft YaHei
"
;
margin-left: 4px;
margin-bottom: 3px;
...
...
@@ -77,62 +63,6 @@
<number>
0
</number>
</property>
<item>
<layout
class=
"QHBoxLayout"
name=
"horizontalLayout_2"
>
<property
name=
"spacing"
>
<number>
0
</number>
</property>
<item>
<spacer
name=
"horizontalSpacer"
>
<property
name=
"orientation"
>
<enum>
Qt::Horizontal
</enum>
</property>
<property
name=
"sizeHint"
stdset=
"0"
>
<size>
<width>
40
</width>
<height>
20
</height>
</size>
</property>
</spacer>
</item>
<item>
<widget
class=
"QLabel"
name=
"currency"
>
<property
name=
"text"
>
<string>
¥
</string>
</property>
<property
name=
"alignment"
>
<set>
Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
</set>
</property>
</widget>
</item>
<item>
<widget
class=
"QLabel"
name=
"amount_lab"
>
<property
name=
"text"
>
<string>
40.00
</string>
</property>
<property
name=
"alignment"
>
<set>
Qt::AlignCenter
</set>
</property>
</widget>
</item>
<item>
<spacer
name=
"horizontalSpacer_2"
>
<property
name=
"orientation"
>
<enum>
Qt::Horizontal
</enum>
</property>
<property
name=
"sizeHint"
stdset=
"0"
>
<size>
<width>
40
</width>
<height>
20
</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<widget
class=
"QLabel"
name=
"coupon_separator"
/>
</item>
<item>
<layout
class=
"QHBoxLayout"
name=
"horizontalLayout_3"
>
<item>
<spacer
name=
"horizontalSpacer_3"
>
...
...
@@ -152,17 +82,17 @@
<property
name=
"maximumSize"
>
<size>
<width>
16777215
</width>
<height>
24
</height>
<height>
16777215
</height>
</size>
</property>
<property
name=
"text"
>
<string>
测试代金券
</string>
<string>
3.5元金牌香肠免费兑换券
测试代金券
</string>
</property>
<property
name=
"alignment"
>
<set>
Qt::AlignCenter
</set>
</property>
<property
name=
"wordWrap"
>
<bool>
fals
e
</bool>
<bool>
tru
e
</bool>
</property>
</widget>
</item>
...
...
@@ -184,7 +114,7 @@
<item>
<widget
class=
"QLabel"
name=
"code_lab"
>
<property
name=
"text"
>
<string>
123456789
</string>
<string>
20170508~20170907
</string>
</property>
<property
name=
"alignment"
>
<set>
Qt::AlignCenter
</set>
...
...
FMVip/forms/fmvipcouponlist.ui
View file @
907d8b1a
...
...
@@ -105,8 +105,8 @@
}
#coupon_prev_btn, #coupon_next_btn {
font: 400 16px
"
Microsoft YaHei
"
;
min-height:
60px; max-height: 6
0px;
min-width:
70px; max-width: 7
0px;
min-height:
180px; max-height: 18
0px;
min-width:
40px; max-width: 4
0px;
border: 1 solid rgb(228,228,228);
border-radius: 7px;
background: white;
...
...
@@ -491,8 +491,11 @@
<property
name=
"autoScroll"
>
<bool>
true
</bool>
</property>
<property
name=
"editTriggers"
>
<set>
QAbstractItemView::NoEditTriggers
</set>
</property>
<property
name=
"selectionMode"
>
<enum>
QAbstractItemView::
Multi
Selection
</enum>
<enum>
QAbstractItemView::
No
Selection
</enum>
</property>
<property
name=
"verticalScrollMode"
>
<enum>
QAbstractItemView::ScrollPerItem
</enum>
...
...
@@ -504,7 +507,7 @@
<enum>
QListView::Static
</enum>
</property>
<property
name=
"spacing"
>
<number>
1
0
</number>
<number>
0
</number>
</property>
<property
name=
"gridSize"
>
<size>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment