Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
F
fmp_vip
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
fmp_vip
Commits
c0f570ef
Commit
c0f570ef
authored
Aug 28, 2017
by
NitefullWind
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1. 增加折扣券,修改相关界面。
parent
11854b15
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
51 additions
and
7 deletions
+51
-7
task/coupon.cpp
+12
-3
task/coupon.h
+3
-0
task/taskothers.cpp
+11
-0
task/taskpay.cpp
+3
-2
windows/fmviporder.cpp
+3
-0
windows/forms/fmviporder.ui
+19
-2
No files found.
task/coupon.cpp
View file @
c0f570ef
...
...
@@ -12,8 +12,9 @@ Coupon::Coupon(QString name, QString code, QString type, double disAmount, doubl
_type
(
type
),
_disAmount
(
disAmount
),
_limitAmount
(
limitAmount
),
_limitTime
(
limitTime
),
_isCompatible
(
isCompatible
)
_discountFactor
(
1
),
_isCompatible
(
isCompatible
),
_limitTime
(
limitTime
)
{
}
...
...
@@ -38,7 +39,12 @@ void Coupon::paint(QPainter *painter, const QRect &rect, const QPalette &palette
painter
->
setPen
(
pen
);
QFont
font
(
"Microsoft YaHei"
,
30
,
500
);
painter
->
setFont
(
font
);
QString
disStr
=
QString
::
number
(
this
->
_disAmount
,
'f'
,
2
);
QString
disStr
;
if
(
this
->
_type
==
"discount"
)
{
disStr
=
QString
::
fromLocal8Bit
(
"%1折"
).
arg
(
this
->
_discountFactor
);
}
else
{
disStr
=
QString
::
number
(
this
->
_disAmount
,
'f'
,
2
);
}
QRect
topRect
(
rect
.
x
(),
rect
.
y
(),
rect
.
width
(),
rect
.
height
()
/
2
);
painter
->
drawText
(
topRect
,
Qt
::
AlignCenter
,
disStr
);
// ¥标识
...
...
@@ -48,7 +54,10 @@ void Coupon::paint(QPainter *painter, const QRect &rect, const QPalette &palette
painter
->
setFont
(
font
);
int
flagWidth
=
painter
->
fontMetrics
().
width
(
flagStr
);
int
flagHeight
=
painter
->
fontMetrics
().
height
();
if
(
this
->
_type
!=
"discount"
)
{
painter
->
drawText
(
rect
.
x
()
+
(
rect
.
width
()
-
fontWidth
)
/
2
-
flagWidth
,
topRect
.
center
().
y
()
+
flagHeight
,
flagStr
);
}
// 满额条件
pen
.
setColor
(
QColor
(
127
,
127
,
127
));
painter
->
setPen
(
pen
);
...
...
task/coupon.h
View file @
c0f570ef
...
...
@@ -22,12 +22,15 @@ public:
double
disAmount
()
const
{
return
_disAmount
;}
double
limitAmount
()
const
{
return
_limitAmount
;}
bool
isCompatible
()
const
{
return
_isCompatible
;}
bool
discountFactor
()
const
{
return
_discountFactor
;}
void
setDiscountFactor
(
double
discountFactor
)
{
this
->
_discountFactor
=
discountFactor
;}
private
:
QString
_name
;
QString
_code
;
QString
_type
;
double
_disAmount
;
double
_limitAmount
;
double
_discountFactor
;
bool
_isCompatible
;
QString
_limitTime
;
};
...
...
task/taskothers.cpp
View file @
c0f570ef
...
...
@@ -29,6 +29,8 @@ void TaskCoupon::packageServerReq()
void
TaskCoupon
::
packagePOSRsp
()
{
int
canDisAmount
=
session
()
->
data
(
PosProps
.
OrderAmount
).
toInt
()
-
session
()
->
data
(
PosProps
.
PaidAmount
).
toInt
()
-
session
()
->
data
(
PosProps
.
UndisAmount
).
toInt
();
QMap
<
QString
,
QVariant
>
couponMap
;
foreach
(
auto
value
,
getServerJsonValue
(
PosProps
.
CouponList
).
toArray
())
{
...
...
@@ -39,11 +41,20 @@ void TaskCoupon::packagePOSRsp()
int
type
=
couponOb
[
ServerProps
(
PosProps
.
Coupon_type
)].
toInt
();
QString
limitTime
=
couponOb
[
"expiration_date"
].
toString
();
if
(
amount
<
1
)
// 折扣券
{
Coupon
c
(
desc
,
code
,
"discount"
,
(
1
-
amount
)
*
canDisAmount
/
100
,
0
,
limitTime
,
false
);
c
.
setDiscountFactor
(
amount
*
10
);
QVariant
v
;
v
.
setValue
(
c
);
couponMap
[
code
]
=
v
;
}
else
{
Coupon
c
(
desc
,
code
,
QString
::
number
(
type
),
amount
,
0
,
limitTime
,
false
);
QVariant
v
;
v
.
setValue
(
c
);
couponMap
[
code
]
=
v
;
}
}
session
()
->
addData
(
PosProps
.
CouponMap
,
couponMap
);
}
...
...
task/taskpay.cpp
View file @
c0f570ef
...
...
@@ -34,6 +34,9 @@ QByteArray TaskPay::doTask()
this
->
_session
=
preTask
->
session
();
}
session
()
->
addData
(
PosProps
.
OrderAmount
,
getPosJsonValue
(
PosProps
.
OrderAmount
).
toInt
());
session
()
->
addData
(
PosProps
.
PaidAmount
,
getPosJsonValue
(
PosProps
.
PaidAmount
).
toInt
());
session
()
->
addData
(
PosProps
.
UndisAmount
,
getPosJsonValue
(
PosProps
.
UndisAmount
).
toInt
());
couponThread
=
new
TaskCouponThread
(
posReqJsonObj
,
_session
,
this
);
couponThread
->
start
();
...
...
@@ -56,8 +59,6 @@ void TaskPay::onGetCoupons(Session* session)
void
TaskPay
::
setWindow
()
{
_window
=
new
FMVipOrder
;
session
()
->
addData
(
PosProps
.
OrderAmount
,
getPosJsonValue
(
PosProps
.
OrderAmount
).
toInt
());
session
()
->
addData
(
PosProps
.
PaidAmount
,
getPosJsonValue
(
PosProps
.
PaidAmount
).
toInt
());
connect
(
qobject_cast
<
FMVipOrder
*>
(
_window
),
SIGNAL
(
pay
()),
this
,
SLOT
(
onPay
()));
}
...
...
windows/fmviporder.cpp
View file @
c0f570ef
...
...
@@ -40,6 +40,9 @@ bool FMVipOrder::initWnd(Session *session)
session
->
addData
(
PosProps
.
NeedAmount
,
needPay
);
QString
needPay_str
=
QString
::
number
(
needPay
);
double
undisAmount
=
session
->
data
(
PosProps
.
UndisAmount
).
toInt
()
/
100.0
;
ui
->
undis_label
->
setText
(
DOUBLE_STR
(
undisAmount
));
// 积分可抵扣金额(分)
int
score_value
=
session
->
data
(
PosProps
.
Score
).
toInt
();
orderInfo
=
new
FMVipOrder
::
OrderInfo
(
amount_str
,
score_value
,
needPay_str
);
...
...
windows/forms/fmviporder.ui
View file @
c0f570ef
...
...
@@ -84,14 +84,14 @@
border-top: 0px solid silver;
}
#price_desc_label {
#price_desc_label
,#undis_desc_label
{
background: white;
max-width: 180px;min-width: 180px;
color: rgb(120,120,120);
border: 1 solid silver;
border-top: 0 solid silver;
}
#price_label {
#price_label
,#undis_label
{
font: 42px
"
Microsoft YaHei
"
;
padding-left: 50px;
color: rgb(50,50,50);
...
...
@@ -513,6 +513,23 @@
</property>
</widget>
</item>
<item>
<widget
class=
"QLabel"
name=
"undis_desc_label"
>
<property
name=
"text"
>
<string>
不可优惠
</string>
</property>
<property
name=
"alignment"
>
<set>
Qt::AlignCenter
</set>
</property>
</widget>
</item>
<item>
<widget
class=
"QLabel"
name=
"undis_label"
>
<property
name=
"text"
>
<string>
0.00
</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
...
...
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