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
58fb2639
Commit
58fb2639
authored
Feb 08, 2017
by
NitefullWind
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1. 新增支付时查询可用代金券。 2. 修改了几个界面的大小。
parent
d68793a5
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
74 additions
and
32 deletions
+74
-32
FMVip_LXJ/global.h
+4
-2
FMVip_LXJ/task/tasklogin.cpp
+13
-13
FMVip_LXJ/task/taskothers.cpp
+36
-5
FMVip_LXJ/task/taskothers.h
+3
-2
FMVip_LXJ/task/taskpay.cpp
+12
-3
FMVip_LXJ/task/taskpay.h
+0
-1
FMVip_LXJ/windows/forms/fmvipfund.ui
+2
-2
FMVip_LXJ/windows/forms/fmviporder.ui
+2
-2
FMVip_LXJ/windows/forms/fmvippanel.ui
+2
-2
No files found.
FMVip_LXJ/global.h
View file @
58fb2639
...
...
@@ -28,7 +28,8 @@ const static QStringList FM_Server_Type = QString(
"order_correct_request,"
// 冲正
"order_recharge_request,"
"order_cardlock_request,"
"order_cardactive_request"
).
split
(
","
);
"order_cardactive_request,"
"order_coupon_request"
).
split
(
","
);
// 请求类型的枚举值
enum
FM_TYPE
{
...
...
@@ -40,8 +41,8 @@ enum FM_TYPE {
FM_Fund
,
FM_Card_Lock
,
FM_Card_Active
,
FM_Coupon
,
FM_Order_Revoke
};
...
...
@@ -116,6 +117,7 @@ struct{
const
QString
Coupon_code
=
"code"
;
// 优惠券 / 代金券编码
const
QString
Coupon_disAmount
=
"disAmount"
;
// 代金券抵扣金额
const
QString
Coupon_desc
=
"desc"
;
// 代金券描述
const
QString
Coupon_name
=
"name"
;
// 优惠券名
const
QString
CouponMap
=
"payCouponMap"
;
// 代金券map
// 产品
const
QString
Products
=
"products"
;
...
...
FMVip_LXJ/task/tasklogin.cpp
View file @
58fb2639
...
...
@@ -63,20 +63,20 @@ void TaskLogin::onLogin()
session
()
->
addData
(
PosProps
.
Fm_open_id
,
account
);
session
()
->
addData
(
PosProps
.
Score
,
getServerJsonValue
(
PosProps
.
Score
).
toInt
());
QMap
<
QString
,
QVariant
>
couponMap
;
for
(
auto
value
:
getServerJsonValue
(
PosProps
.
CouponList
).
toArray
())
{
QJsonObject
couponOb
=
value
.
toObject
();
QString
code
=
couponOb
[
ServerProps
(
PosProps
.
Coupon_code
)].
toString
();
double
amount
=
couponOb
[
ServerProps
(
PosProps
.
Coupon_disAmount
)].
toInt
()
/
100.0
;
QString
desc
=
couponOb
[
ServerProps
(
PosProps
.
Coupon_desc
)].
toString
();
//
QMap<QString, QVariant> couponMap;
//
for (auto value : getServerJsonValue(PosProps.CouponList).toArray())
//
{
//
QJsonObject couponOb = value.toObject();
//
QString code = couponOb[ServerProps(PosProps.Coupon_code)].toString();
//
double amount = couponOb[ServerProps(PosProps.Coupon_disAmount)].toInt() / 100.0;
//
QString desc = couponOb[ServerProps(PosProps.Coupon_desc)].toString();
Coupon
c
{
code
,
amount
,
desc
};
QVariant
v
;
v
.
setValue
(
c
);
couponMap
[
code
]
=
v
;
}
session
()
->
addData
(
PosProps
.
CouponMap
,
couponMap
);
//
Coupon c{code, amount, desc};
//
QVariant v;
//
v.setValue(c);
//
couponMap[code] = v;
//
}
//
session()->addData(PosProps.CouponMap, couponMap);
}
closeWindow
();
}
...
...
FMVip_LXJ/task/taskothers.cpp
View file @
58fb2639
#include "taskothers.h"
/// 优惠券查询
TaskCoupon
::
TaskCoupon
(
QJsonObject
&
jsonObj
,
QObject
*
parent
)
:
FMTaskNoWnd
(
jsonObj
,
FM_Coupon
,
0
,
parent
)
TaskCoupon
::
TaskCoupon
(
QJsonObject
&
jsonObj
,
Session
*
session
,
QObject
*
parent
)
:
FMTaskNoWnd
(
jsonObj
,
FM_Coupon
,
session
,
parent
)
{
}
void
TaskCoupon
::
packageServerReq
()
{
serverReqJsonObj
[
ServerProps
(
PosProps
.
Coupon
)]
=
getPosJsonValue
(
PosProps
.
Coupon
);
serverReqJsonObj
[
ServerProps
(
PosProps
.
TransId
)]
=
getPosJsonValue
(
PosProps
.
TransId
);
QJsonObject
transaction
;
transaction
[
ServerProps
(
PosProps
.
Fm_open_id
)]
=
session
()
->
data
(
PosProps
.
Fm_open_id
).
toString
();
transaction
[
ServerProps
(
PosProps
.
PaidAmount
)]
=
getPosJsonValue
(
PosProps
.
OrderAmount
);
// 产品列表
QJsonArray
propducts
;
for
(
auto
pValue
:
getPosJsonValue
(
PosProps
.
Products
).
toArray
())
{
auto
po
=
pValue
.
toObject
();
QJsonObject
spo
;
for
(
auto
prop
:
{
PosProps
.
ConsumeNum
,
PosProps
.
Price
,
PosProps
.
ProductId
})
{
spo
[
ServerProps
(
prop
)]
=
po
[
prop
];
}
propducts
.
append
(
spo
);
}
transaction
[
ServerProps
(
PosProps
.
Products
)]
=
propducts
;
serverReqJsonObj
[
ServerProps
(
PosProps
.
Transaction
)]
=
transaction
;
}
void
TaskCoupon
::
packagePOSRsp
()
...
...
@@ -17,8 +35,21 @@ void TaskCoupon::packagePOSRsp()
for
(
auto
prop
:
{
PosProps
.
Fm_open_id
,
PosProps
.
StatusCode
,
PosProps
.
Msg
})
{
posRspJsonObj
[
prop
]
=
getServerJsonValue
(
ServerProps
(
prop
));
}
posRspJsonObj
[
"pid"
]
=
serverRspJsonObj
[
"productCode"
];
posRspJsonObj
[
PosProps
.
Prompt
]
=
1
;
QMap
<
QString
,
QVariant
>
couponMap
;
for
(
auto
value
:
getServerJsonValue
(
PosProps
.
CouponList
).
toArray
())
{
QJsonObject
couponOb
=
value
.
toObject
();
QString
code
=
couponOb
[
ServerProps
(
PosProps
.
Coupon_code
)].
toString
();
double
amount
=
couponOb
[
ServerProps
(
PosProps
.
Coupon_disAmount
)].
toInt
()
/
100.0
;
QString
desc
=
couponOb
[
ServerProps
(
PosProps
.
Coupon_name
)].
toString
();
Coupon
c
{
code
,
amount
,
desc
};
QVariant
v
;
v
.
setValue
(
c
);
couponMap
[
code
]
=
v
;
}
session
()
->
addData
(
PosProps
.
CouponMap
,
couponMap
);
}
...
...
FMVip_LXJ/task/taskothers.h
View file @
58fb2639
...
...
@@ -3,12 +3,12 @@
#include "fmtasknownd.h"
//
优惠券查询
//
获取可用代金券列表
class
TaskCoupon
:
public
FMTaskNoWnd
{
Q_OBJECT
public
:
explicit
TaskCoupon
(
QJsonObject
&
jsonObj
,
QObject
*
parent
=
0
);
explicit
TaskCoupon
(
QJsonObject
&
jsonObj
,
Session
*
session
=
0
,
QObject
*
parent
=
0
);
void
packageServerReq
();
void
packagePOSRsp
();
};
...
...
@@ -52,4 +52,5 @@ public:
void
packageServerReq
();
void
packagePOSRsp
();
};
#endif // TASKOTHERS_H
FMVip_LXJ/task/taskpay.cpp
View file @
58fb2639
#include "taskpay.h"
#include "fmviporder.h"
#include "tasklogin.h"
#include "taskothers.h"
TaskPay
::
TaskPay
(
QJsonObject
&
jsonObj
,
QObject
*
parent
)
:
FMTask
(
jsonObj
,
FM_Pay
,
0
,
parent
)
{
posReqJsonObj
[
PosProps
.
TransId
]
=
createTransId
();
}
QByteArray
TaskPay
::
doTask
()
...
...
@@ -17,6 +18,14 @@ QByteArray TaskPay::doTask()
return
loginRst
;
}
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
();
return
FMTask
::
doTask
();
}
...
...
@@ -46,7 +55,7 @@ void TaskPay::packageServerReq()
transObj
[
ServerProps
(
PosProps
.
Coupons
)]
=
couponArr
;
serverReqJsonObj
[
ServerProps
(
PosProps
.
Transaction
)]
=
transObj
;
serverReqJsonObj
[
ServerProps
(
PosProps
.
TransId
)]
=
createTransId
(
);
serverReqJsonObj
[
ServerProps
(
PosProps
.
TransId
)]
=
getPosJsonValue
(
PosProps
.
TransId
);
}
void
TaskPay
::
packagePOSRsp
()
...
...
@@ -79,7 +88,7 @@ void TaskPay::packagePOSRsp()
QJsonObject
cp
=
coupon
.
toObject
();
pay_id
[
PosProps
.
Pay_id
]
=
"77"
;
pay_id
[
PosProps
.
Pay_str
]
=
"代金券支付"
;
int
couponAmount
=
cp
[
PosProps
.
Coupon_disAmount
].
toInt
();
int
couponAmount
=
cp
[
ServerProps
(
PosProps
.
Coupon_disAmount
)
].
toInt
();
pay_id
[
PosProps
.
Paid_total_amount
]
=
couponAmount
;
paidTotalAmount
+=
couponAmount
;
pay_id
[
PosProps
.
Coupon_code
]
=
cp
[
ServerProps
(
PosProps
.
Coupon_code
)];
...
...
FMVip_LXJ/task/taskpay.h
View file @
58fb2639
...
...
@@ -16,7 +16,6 @@ public:
private
slots
:
void
onPay
();
};
#endif // TASKPAY_H
FMVip_LXJ/windows/forms/fmvipfund.ui
View file @
58fb2639
...
...
@@ -145,8 +145,8 @@ QPushButton#fund_btn:hover {
<widget
class=
"QWidget"
name=
"FMVipWnd"
native=
"true"
>
<property
name=
"maximumSize"
>
<size>
<width>
9
50
</width>
<height>
7
50
</height>
<width>
9
68
</width>
<height>
7
68
</height>
</size>
</property>
<layout
class=
"QVBoxLayout"
name=
"verticalLayout"
>
...
...
FMVip_LXJ/windows/forms/fmviporder.ui
View file @
58fb2639
...
...
@@ -290,8 +290,8 @@ QWidget {
<widget
class=
"QWidget"
name=
"FMVipWnd"
native=
"true"
>
<property
name=
"maximumSize"
>
<size>
<width>
9
50
</width>
<height>
7
50
</height>
<width>
9
68
</width>
<height>
7
68
</height>
</size>
</property>
<layout
class=
"QVBoxLayout"
name=
"verticalLayout"
>
...
...
FMVip_LXJ/windows/forms/fmvippanel.ui
View file @
58fb2639
...
...
@@ -193,8 +193,8 @@ QWidget {
<widget
class=
"QWidget"
name=
"FMVipWnd"
native=
"true"
>
<property
name=
"maximumSize"
>
<size>
<width>
9
50
</width>
<height>
7
50
</height>
<width>
9
68
</width>
<height>
7
68
</height>
</size>
</property>
<layout
class=
"QVBoxLayout"
name=
"verticalLayout"
>
...
...
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