Toggle navigation
Toggle navigation
This project
Loading...
Sign in
mobile
/
YH_RNComponent
·
Commits
Go to a project
GitLab
Go to group
Project
Activity
Files
Commits
Pipelines
0
Builds
0
Graphs
Milestones
Issues
0
Merge Requests
0
Members
Labels
Wiki
Forks
Network
Create a new issue
Download as
Email Patches
Plain Diff
Browse Files
Authored by
张文文
6 years ago
Commit
40e5222aaef7421478e5a94b67673c8cb47aad31
1 parent
949cee08
礼包添加已作废状态&领取礼包异常提示
reviewd by 朱傲哲
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
61 additions
and
9 deletions
js/associatorGift/components/AssociatorGift.js
js/associatorGift/components/CouponsBagListCell.js
js/associatorGift/constants/actionTypes.js
js/associatorGift/containers/AssociatorGiftContainer.js
js/associatorGift/reducers/associatorGift/associatorGiftActions.js
js/associatorGift/reducers/associatorGift/associatorGiftInitialState.js
js/associatorGift/reducers/associatorGift/associatorGiftReducer.js
js/associatorGift/components/AssociatorGift.js
View file @
40e5222
...
...
@@ -16,6 +16,7 @@ import {Immutable, Map} from 'immutable';
import
ReceiveGiftAlert
from
'./ReceiveGiftAlert'
;
import
ProductListCell
from
'../../common/components/ListCell/ProductListCell'
;
import
CouponsBagListCell
from
"./CouponsBagListCell"
;
import
Prompt
from
'../../common/components/Prompt'
;
export
default
class
AssociatorGift
extends
Component
{
constructor
(
props
)
{
...
...
@@ -101,7 +102,8 @@ export default class AssociatorGift extends Component {
showGiftAlert
,
couponsBag
,
productList
,
drawCouponsBag
drawCouponsBag
,
bagTipMessage
}
=
this
.
props
;
let
dataSource
=
{
...
...
@@ -131,6 +133,15 @@ export default class AssociatorGift extends Component {
renderRow
=
{
this
.
_renderRow
}
renderHeader
=
{
this
.
_renderHeader
}
/
>
{
bagTipMessage
!=
''
?
<
Prompt
text
=
{
bagTipMessage
}
duration
=
{
800
}
onPromptHidden
=
{
this
.
props
.
onHiddenBagTipMessage
}
/
>
:
null
}
<
/View
>
);
}
...
...
js/associatorGift/components/CouponsBagListCell.js
View file @
40e5222
...
...
@@ -25,9 +25,9 @@ export default class CouponsBagListCell extends React.Component {
let
nameStyle
=
data
.
get
(
'notExpired'
)
?
{
color
:
'#222222'
}
:
{
color
:
'#B0B0B0'
};
let
bgStyle
=
data
.
get
(
'status'
)
===
0
&&
data
.
get
(
'notExpired'
)
?
{
backgroundColor
:
'#A69073'
}
:
{
backgroundColor
:
'#B0B0B0'
};
let
textStyle
=
data
.
get
(
'status'
)
===
0
&&
data
.
get
(
'notExpired'
)
?
{
fontFamily
:
'PingFang-SC-Bold'
}
:
{
fontFamily
:
'PingFang-SC-Medium'
};
//"status": 是否已领取 未领取:0,已领取:1;
//"status": 是否已领取 未领取:0,已领取:1
,已作废:2
;
//"notExpired": 未过期:true,过期:false;
let
text
=
data
.
get
(
'status'
)
===
1
?
'已领取'
:
data
.
get
(
'notExpired'
)
?
'领取'
:
'已失效'
;
let
text
=
data
.
get
(
'status'
)
===
2
?
'已作废'
:
data
.
get
(
'status'
)
===
1
?
'已领取'
:
data
.
get
(
'notExpired'
)
?
'领取'
:
'已失效'
;
return
(
<
View
style
=
{
styles
.
container
}
>
<
View
style
=
{
styles
.
contentContainer
}
>
...
...
js/associatorGift/constants/actionTypes.js
View file @
40e5222
...
...
@@ -6,7 +6,7 @@ export default keyMirror({
SET_HOST
:
null
,
SET_CHANNEL
:
null
,
SHOWGIFTALERT
:
null
,
DISMISSGIFTALERT
:
null
,
DISMISSGIFTALERT
:
null
,
COUPONS_BAG_REQUEST
:
null
,
COUPONS_BAG_SUCCESS
:
null
,
...
...
@@ -24,4 +24,7 @@ export default keyMirror({
COUPONS_BAG_CNT_SUCCESS
:
null
,
COUPONS_BAG_CNT_FAILURE
:
null
,
SHOW_BAG_TIP_MESSAGE
:
null
,
HIDDEN_BAG_TIP_MESSAGE
:
null
,
});
...
...
js/associatorGift/containers/AssociatorGiftContainer.js
View file @
40e5222
...
...
@@ -48,6 +48,7 @@ class AssociatorGiftContainer extends Component {
this
.
_onPressShopCar
=
this
.
_onPressShopCar
.
bind
(
this
);
this
.
_onPressCouponItem
=
this
.
_onPressCouponItem
.
bind
(
this
);
this
.
_onPressLookDetail
=
this
.
_onPressLookDetail
.
bind
(
this
);
this
.
_onHiddenBagTipMessage
=
this
.
_onHiddenBagTipMessage
.
bind
(
this
);
}
componentDidMount
()
{
...
...
@@ -72,6 +73,10 @@ class AssociatorGiftContainer extends Component {
this
.
props
.
actions
.
hiddenGiftAlert
();
}
_onHiddenBagTipMessage
(){
this
.
props
.
actions
.
hiddenBagTipMessage
();
}
_onPressCouponItem
(
data
){
let
url
=
`
http
:
//m.yohobuy.com?openby:yohobuy={"action":"go.couponProductList",
"params"
:
{
"coupon_id"
:
"${data.get("
id
")}"
,
"coupon_code"
:
"${data.get("
couponCode
")}"
},
"coupon_title"
:
"${data.get("
couponName
")}"
}
`
;
...
...
@@ -134,7 +139,8 @@ class AssociatorGiftContainer extends Component {
couponsBagCnt
,
couponsBag
,
productList
,
drawCouponsBag
drawCouponsBag
,
bagTipMessage
}
=
this
.
props
.
associatorGift
;
return
(
<
AssociatorGift
...
...
@@ -150,6 +156,8 @@ class AssociatorGiftContainer extends Component {
onPressShopCar
=
{
this
.
_onPressShopCar
}
onPressCouponItem
=
{
this
.
_onPressCouponItem
}
onPressLookDetail
=
{
this
.
_onPressLookDetail
}
bagTipMessage
=
{
bagTipMessage
}
onHiddenBagTipMessage
=
{
this
.
_onHiddenBagTipMessage
}
/
>
);
}
...
...
js/associatorGift/reducers/associatorGift/associatorGiftActions.js
View file @
40e5222
...
...
@@ -5,8 +5,8 @@ import AssociatorGiftService from '../../services/AssociatorGiftService';
const
Platform
=
require
(
'Platform'
);
const
{
SHOWGIFTALERT
,
DISMISSGIFTALERT
,
SHOWGIFTALERT
,
DISMISSGIFTALERT
,
COUPONS_BAG_REQUEST
,
COUPONS_BAG_SUCCESS
,
...
...
@@ -24,6 +24,9 @@ const {
COUPONS_BAG_CNT_SUCCESS
,
COUPONS_BAG_CNT_FAILURE
,
SHOW_BAG_TIP_MESSAGE
,
HIDDEN_BAG_TIP_MESSAGE
,
}
=
require
(
'../../constants/actionTypes'
).
default
;
export
function
displayGiftAlert
()
{
...
...
@@ -118,6 +121,19 @@ export function couponsBagCntFailure(error) {
};
}
export
function
showBagTipMessage
(
message
)
{
return
{
type
:
SHOW_BAG_TIP_MESSAGE
,
payload
:
message
}
}
export
function
hiddenBagTipMessage
()
{
return
{
type
:
HIDDEN_BAG_TIP_MESSAGE
,
}
}
export
function
getCouponsBagList
()
{
return
(
dispatch
,
getState
)
=>
{
let
{
app
}
=
getState
();
...
...
@@ -179,6 +195,7 @@ export function getDrawCouponsBag(couponsBagId) {
})
.
catch
(
error
=>
{
dispatch
(
drawCouponsBagFailure
(
error
));
dispatch
(
showBagTipMessage
(
error
.
message
));
});
};
...
...
@@ -301,4 +318,4 @@ export function reportFavoriteData(payload) {
}
}
}
\ No newline at end of file
}
...
...
js/associatorGift/reducers/associatorGift/associatorGiftInitialState.js
View file @
40e5222
...
...
@@ -3,7 +3,8 @@
import
{
Record
,
List
,
Map
}
from
'immutable'
;
let
InitialState
=
Record
({
showGiftAlert
:
false
,
showGiftAlert
:
false
,
bagTipMessage
:
''
,
couponsBagCnt
:
new
(
Record
({
isFetching
:
false
,
...
...
js/associatorGift/reducers/associatorGift/associatorGiftReducer.js
View file @
40e5222
...
...
@@ -23,6 +23,9 @@ const {
COUPONS_BAG_CNT_SUCCESS
,
COUPONS_BAG_CNT_FAILURE
,
SHOW_BAG_TIP_MESSAGE
,
HIDDEN_BAG_TIP_MESSAGE
,
}
=
require
(
'../../constants/actionTypes'
).
default
;
const
initialState
=
new
InitialState
;
...
...
@@ -111,6 +114,15 @@ export default function couponReducer(state = initialState, action) {
return
state
.
setIn
([
'couponsBagCnt'
,
'isFetching'
],
false
)
.
setIn
([
'couponsBagCnt'
,
'error'
],
action
.
payload
);
}
case
SHOW_BAG_TIP_MESSAGE
:
{
return
state
.
set
(
'bagTipMessage'
,
Immutable
.
fromJS
(
action
.
payload
));
}
case
HIDDEN_BAG_TIP_MESSAGE
:
{
return
state
.
set
(
'bagTipMessage'
,
''
);
}
}
return
state
;
...
...
Please
register
or
login
to post a comment