Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
F
FMVip_LXJ
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_LXJ
Commits
0b5a3989
Commit
0b5a3989
authored
Feb 09, 2017
by
NitefullWind
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1. 代金券使用异步方式加载。 2. 修改了部分代金券界面、登陆界面的代码。
parent
58fb2639
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
84 additions
and
14 deletions
+84
-14
FMVip_LXJ/task/taskpay.cpp
+28
-7
FMVip_LXJ/task/taskpay.h
+28
-0
FMVip_LXJ/windows/fmviporder.cpp
+9
-5
FMVip_LXJ/windows/fmviporder.h
+1
-2
FMVip_LXJ/windows/forms/fmcouponwidget.ui
+12
-0
FMVip_LXJ/windows/forms/fmviplogin.ui
+6
-0
No files found.
FMVip_LXJ/task/taskpay.cpp
View file @
0b5a3989
...
...
@@ -19,19 +19,27 @@ QByteArray TaskPay::doTask()
}
this
->
_session
=
preTask
->
session
();
del_p
(
preTask
);
preTask
=
new
TaskCoupon
(
posReqJsonObj
,
_session
,
this
);
QByteArray
couponRst
=
preTask
->
doTask
();
if
(
preTask
->
error
()
!=
FM_API_SUCCESS
)
{
return
couponRst
;
}
this
->
_session
=
preTask
->
session
();
TaskCouponThread
couponThread
(
posReqJsonObj
,
_session
,
this
);
couponThread
.
start
();
connect
(
&
couponThread
,
SIGNAL
(
finished
(
Session
*
)),
SLOT
(
onGetCoupons
(
Session
*
)));
return
FMTask
::
doTask
();
}
void
TaskPay
::
onGetCoupons
(
Session
*
session
)
{
_session
->
addData
(
PosProps
.
CouponMap
,
session
->
getCouponMap
(
PosProps
.
CouponMap
));
if
(
_window
!=
nullptr
)
{
qobject_cast
<
FMVipOrder
*>
(
_window
)
->
initCouponItems
();
_window
->
setIsBusy
(
false
);
_window
->
setEnabled
(
true
);
}
}
void
TaskPay
::
setWindow
()
{
_window
=
new
FMVipOrder
;
_window
->
setIsBusy
();
_window
->
setEnabled
(
false
);
for
(
QString
prop
:
{
PosProps
.
OrderAmount
,
PosProps
.
PaidAmount
,
PosProps
.
StandardAmount
})
{
session
()
->
addData
(
prop
,
getPosJsonValue
(
prop
).
toInt
());
...
...
@@ -107,3 +115,16 @@ void TaskPay::onPay()
sendToServer
();
closeWindow
();
}
//TaskPay::TaskCouponThread::TaskCouponThread(QJsonObject &jsonObj, Session *session, QObject *parent):
// _session(session),
// QThread(parent)
//{
// task = new TaskCoupon(jsonObj, session, parent);
//}
//void TaskPay::TaskCouponThread::run()
//{
// task->doTask();
// _session = task->session();
//}
FMVip_LXJ/task/taskpay.h
View file @
0b5a3989
...
...
@@ -2,6 +2,8 @@
#define TASKPAY_H
#include "fmtask.h"
#include "../reader.h"
#include <QThread>
#include "taskothers.h"
class
TaskPay
:
public
FMTask
{
...
...
@@ -16,6 +18,32 @@ public:
private
slots
:
void
onPay
();
void
onGetCoupons
(
Session
*
session
);
};
// 加载代金券的线程类
class
TaskCouponThread
:
public
QThread
{
Q_OBJECT
public
:
TaskCouponThread
(
QJsonObject
&
jsonObj
,
Session
*
session
,
QObject
*
parent
=
0
)
{
_session
=
session
;
task
=
new
TaskCoupon
(
jsonObj
,
session
,
parent
);
}
~
TaskCouponThread
()
{
del_p
(
task
);
del_p
(
_session
);
}
void
run
()
{
task
->
doTask
();
emit
finished
(
_session
);
}
TaskCoupon
*
task
;
Session
*
_session
;
signals
:
void
finished
(
Session
*
);
};
#endif // TASKPAY_H
FMVip_LXJ/windows/fmviporder.cpp
View file @
0b5a3989
...
...
@@ -42,7 +42,6 @@ void FMVipOrder::initWnd(Session *session)
double
standard_amount
=
session
->
data
(
PosProps
.
StandardAmount
).
toInt
()
/
100.0
;
orderInfo
=
new
FMVipOrder
::
OrderInfo
(
amount_str
,
score_str
,
needPay_str
);
orderInfo
->
setCouponMap
(
session
->
getCouponMap
(
PosProps
.
CouponMap
));
ui
->
operator_label
->
setText
(
operator_id
);
ui
->
bd_label
->
setText
(
business_date
);
...
...
@@ -54,7 +53,6 @@ void FMVipOrder::initWnd(Session *session)
ui
->
bir_label
->
setText
(
birthday
);
initCouponItems
();
connect
(
ui
->
coupon_page
,
SIGNAL
(
itemClicked
(
QListWidgetItem
*
)),
this
,
SLOT
(
onItemClicked
(
QListWidgetItem
*
)));
ui
->
pay_chk
->
setText
(
QString
(
"使用积分抵用 %1 元"
).
arg
(
orderInfo
->
getScoreAmount
()));
...
...
@@ -114,16 +112,22 @@ void FMVipOrder::onItemClicked(QListWidgetItem *item)
void
FMVipOrder
::
initCouponItems
()
{
orderInfo
->
setCouponMap
(
_session
->
getCouponMap
(
PosProps
.
CouponMap
));
for
(
Coupon
coupon
:
orderInfo
->
couponMap
().
values
())
{
auto
item
=
new
QListWidgetItem
();
item
->
setData
(
Qt
::
UserRole
,
coupon
.
code
);
ui
->
coupon_page
->
addItem
(
item
);
ui
->
coupon_page
->
update
();
auto
itemWidget
=
new
FMCouponWidget
(
coupon
);
ui
->
coupon_page
->
setItemWidget
(
item
,
itemWidget
);
//item大小
item
->
setSizeHint
(
itemWidget
->
size
());
ui
->
coupon_page
->
addItem
(
item
);
ui
->
coupon_page
->
setItemWidget
(
item
,
itemWidget
);
}
if
(
ui
->
coupon_page
->
count
()
>
0
)
{
connect
(
ui
->
coupon_page
,
SIGNAL
(
itemClicked
(
QListWidgetItem
*
)),
this
,
SLOT
(
onItemClicked
(
QListWidgetItem
*
)));
}
}
...
...
FMVip_LXJ/windows/fmviporder.h
View file @
0b5a3989
...
...
@@ -19,6 +19,7 @@ public:
~
FMVipOrder
();
void
initWnd
(
Session
*
session
);
void
initCouponItems
();
void
setWillPayText
();
signals
:
...
...
@@ -156,8 +157,6 @@ private:
QString
oldPayText
;
void
initCouponItems
();
FMNumPad
*
numpad
;
};
...
...
FMVip_LXJ/windows/forms/fmcouponwidget.ui
View file @
0b5a3989
...
...
@@ -10,6 +10,18 @@
<height>
116
</height>
</rect>
</property>
<property
name=
"minimumSize"
>
<size>
<width>
220
</width>
<height>
116
</height>
</size>
</property>
<property
name=
"maximumSize"
>
<size>
<width>
220
</width>
<height>
116
</height>
</size>
</property>
<property
name=
"windowTitle"
>
<string>
Form
</string>
</property>
...
...
FMVip_LXJ/windows/forms/fmviplogin.ui
View file @
0b5a3989
...
...
@@ -430,6 +430,12 @@ font: 13px "微软雅黑";
</layout>
</widget>
<layoutdefault
spacing=
"6"
margin=
"11"
/>
<tabstops>
<tabstop>
login_edit
</tabstop>
<tabstop>
login_btn
</tabstop>
<tabstop>
login_key
</tabstop>
<tabstop>
close_btn
</tabstop>
</tabstops>
<resources/>
<connections/>
</ui>
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