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
5b724e4f
Commit
5b724e4f
authored
Sep 12, 2016
by
unknown
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加OrderInfo内部类管理付款信息
parent
a2417bef
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
73 additions
and
15 deletions
+73
-15
FMVip/fmviporder.cpp
+8
-14
FMVip/fmviporder.h
+65
-1
No files found.
FMVip/fmviporder.cpp
View file @
5b724e4f
...
@@ -17,25 +17,16 @@ FMVipOrder::FMVipOrder(QDialog *parent) :
...
@@ -17,25 +17,16 @@ FMVipOrder::FMVipOrder(QDialog *parent) :
QString
score
=
FMVipForward
::
instance
()
->
sessionData
(
"score"
);
QString
score
=
FMVipForward
::
instance
()
->
sessionData
(
"score"
);
QString
needPay_str
=
FMVipForward
::
instance
()
->
sessionData
(
"needPay"
);
QString
needPay_str
=
FMVipForward
::
instance
()
->
sessionData
(
"needPay"
);
double
amount
=
amount_str
.
toInt
()
/
100.0
;
orderInfo
=
new
FMVipOrder
::
OrderInfo
(
amount_str
,
score
,
needPay_str
);
double
needPay
=
needPay_str
.
toInt
()
/
100.0
;
QString
show_amount_str
=
QString
::
number
(
amount
,
'f'
,
2
);
QString
show_needPay_str
=
QString
::
number
(
needPay
,
'f'
,
2
);
ui
->
operator_label
->
setText
(
operator_id
);
ui
->
operator_label
->
setText
(
operator_id
);
ui
->
bd_label
->
setText
(
business_date
);
ui
->
bd_label
->
setText
(
business_date
);
ui
->
id_label
->
setText
(
fm_id
);
ui
->
id_label
->
setText
(
fm_id
);
ui
->
balance_label
->
setText
(
show_amount_str
);
ui
->
point_label
->
setText
(
score
);
ui
->
point_label
->
setText
(
score
);
ui
->
price_label
->
setText
(
show_needPay_str
);
ui
->
balance_label
->
setText
(
orderInfo
->
amountStr
());
ui
->
price_label
->
setText
(
orderInfo
->
needPayStr
());
// 如果账户余额充足则默认付全部待付,否则默认付全部余额
if
(
amount
>=
needPay
)
{
ui
->
pay_edit
->
setText
(
orderInfo
->
defaultPayStr
());
ui
->
pay_edit
->
setText
(
show_needPay_str
);
}
else
{
ui
->
pay_edit
->
setText
(
show_amount_str
);
}
}
}
FMVipOrder
::~
FMVipOrder
()
FMVipOrder
::~
FMVipOrder
()
...
@@ -68,6 +59,9 @@ void FMVipOrder::on_pay_btn_clicked()
...
@@ -68,6 +59,9 @@ void FMVipOrder::on_pay_btn_clicked()
void
FMVipOrder
::
on_pay_chk_clicked
(
bool
checked
)
void
FMVipOrder
::
on_pay_chk_clicked
(
bool
checked
)
{
{
qDebug
()
<<
__FUNCTION__
<<
checked
;
qDebug
()
<<
__FUNCTION__
<<
checked
;
ui
->
pay_edit
->
setText
(
orderInfo
->
defaultPayStr
(
checked
));
int
is
=
checked
?
1
:
0
;
int
is
=
checked
?
1
:
0
;
FMVipForward
::
instance
()
->
addSessionData
(
"isUseScore"
,
QString
::
number
(
is
));
FMVipForward
::
instance
()
->
addSessionData
(
"isUseScore"
,
QString
::
number
(
is
));
}
}
...
...
FMVip/fmviporder.h
View file @
5b724e4f
...
@@ -21,10 +21,74 @@ public slots:
...
@@ -21,10 +21,74 @@ public slots:
void
on_pay_btn_clicked
();
void
on_pay_btn_clicked
();
void
on_pay_chk_clicked
(
bool
checked
);
void
on_pay_chk_clicked
(
bool
checked
);
protected
:
private
:
class
OrderInfo
{
public
:
OrderInfo
()
{
_amountStr
=
_scoreStr
=
_needPayStr
=
""
;
_amount
=
_score
=
_needPay
=
0
.
0
;
}
OrderInfo
(
QString
amountStr
,
QString
scoreStr
,
QString
needPayStr
)
{
this
->
_amountStr
=
amountStr
;
this
->
_scoreStr
=
scoreStr
;
this
->
_needPayStr
=
needPayStr
;
_amount
=
_amountStr
.
toInt
()
/
100
.
0
;
_score
=
_scoreStr
.
toInt
()
/
100
.
0
;
_needPay
=
_needPayStr
.
toInt
()
/
100
.
0
;
}
double
amount
()
{
return
_amount
;
}
QString
amountStr
()
{
return
QString
::
number
(
_amount
,
'f'
,
2
);
}
double
needPay
()
{
return
_needPay
;
}
QString
needPayStr
()
{
return
QString
::
number
(
_needPay
,
'f'
,
2
);
}
// 如果账户余额充足则默认付全部待付,否则默认付全部余额
double
defaultPay
(
bool
isUseScore
=
false
)
{
double
need
=
needPay
();
if
(
isUseScore
)
{
need
-=
_score
;
}
double
pay
;
if
(
amount
()
>
need
)
{
pay
=
need
;
}
else
{
pay
=
amount
();
}
return
pay
;
}
QString
defaultPayStr
(
bool
isUseScore
=
false
)
{
return
QString
::
number
(
defaultPay
(
isUseScore
),
'f'
,
2
);
}
private
:
QString
_amountStr
,
_scoreStr
,
_needPayStr
;
double
_amount
,
_score
,
_needPay
;
};
private
:
private
:
Ui
::
FMVipOrder
*
ui
;
Ui
::
FMVipOrder
*
ui
;
FMVipOrder
::
OrderInfo
*
orderInfo
;
};
};
#endif // FMVIPORDER_H
#endif // FMVIPORDER_H
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