Authored by shangjf

新人专享和分期列表相关代码提交

... ... @@ -45,7 +45,7 @@ import {
setType,
setShop,
setBrandId,
setoriginParams,
setOriginParams,
setSaleType,
setActivityId,
} from './reducers/app/appActions';
... ... @@ -71,7 +71,7 @@ export default function native(platform) {
render() {
const store = configureStore(getInitialState());
store.dispatch(setPlatform(platform));
let {host,serviceHost, channel,type,brand_id,shop_id,dictParams,saleType,activityId} = this.props;
let {host, serviceHost, channel, type, brand_id, shop_id, dictParams, saleType, activityId} = this.props;
store.dispatch(setHost(host));
store.dispatch(setServiceHost(serviceHost));
... ... @@ -79,7 +79,7 @@ export default function native(platform) {
store.dispatch(setType(type));
store.dispatch(setBrandId(brand_id));
store.dispatch(setShop(shop_id));
store.dispatch(setoriginParams(dictParams));
store.dispatch(setOriginParams(dictParams));
store.dispatch(setSaleType(saleType));
store.dispatch(setActivityId(activityId));
... ... @@ -113,7 +113,12 @@ export default function native(platform) {
<ProductListForShopContainer />
</Provider>
);
} else if (type == 'YH_ProductListPoolView' || type == 'YH_VipProListVC' || type == 'YH_PromotionProductListVC' || type == 'YH_OutLetProListVC') {
} else if (type == 'YH_ProductListPoolView' ||
type == 'YH_VipProListVC' ||
type == 'YH_PromotionProductListVC' ||
type == 'YH_OutLetProListVC' ||
type == 'YH_InstalmentView' ||
type == 'YH_NewUserView') {
return (
<Provider store={store}>
<ProductListPoolContainer />
... ...
... ... @@ -14,7 +14,6 @@ export default class CategoryListHeader extends Component {
constructor(props) {
super(props);
this.onClick = this.onClick.bind(this);
this.clearClick = this.clearClick.bind(this);
}
onClick(event: Event) {
... ... @@ -27,11 +26,6 @@ export default class CategoryListHeader extends Component {
}
}
clearClick(event: Event) {
let item = event.nativeEvent;
console.log(item);
}
render() {
let {dataSource} = this.props;
return (
... ...
... ... @@ -69,7 +69,9 @@ export default class ProductListPool extends Component {
case 'activity':
return(<ActivityCell resource={rowData} key = {rowID + 'activityList'} />);
break;
case 'productList': {
case 'productList':
case 'newUserProductList':
{
let promotionTitleDic = rowData.get('promotionTitleDic');
if (promotionTitleDic) {
return (
... ... @@ -135,6 +137,14 @@ export default class ProductListPool extends Component {
activity: activityInfo.list.toArray(),
productList: productList.list.toArray(),
};
}else if (type == 'YH_InstalmentView') {
dataSource = {
productList: productList.list.toArray(),
};
}else if (type == 'YH_NewUserView') {
dataSource = {
newUserProductList: productList.list.toArray(),
};
}
let isLoadingMore = productList.isFetching && productList.currentPage > 0;
... ...
... ... @@ -73,6 +73,10 @@ class ProductListPoolContainer extends Component {
this.props.actions.getActivity();
}else if (type == 'YH_PromotionProductListVC') {
this.props.actions.getProductList();
}else if (type == 'YH_InstalmentView') {
this.props.actions.getProductList();
}else if (type == 'YH_NewUserView') {
this.props.actions.getProductList();
}
}
... ...
... ... @@ -64,7 +64,7 @@ export function setBrandId(brand_id) {
};
}
export function setoriginParams(originParams) {
export function setOriginParams(originParams) {
return {
type: SET_ORIGINPARAMS,
payload: originParams
... ...
... ... @@ -85,9 +85,6 @@ export function getProductList(reload=false) {
}
allFilterFactors['standard'] = standard;
console.log(allFilterFactors);
dispatch(productListRequest());
return new CategoryProListService(app.host).productList(page, pageSize, originParams, allFilterFactors, order, '')
.then(json => {
... ... @@ -104,7 +101,7 @@ export function getProductList(reload=false) {
let filterCategoryDetailFilterList = payload.filterCategoryDetailFilterList;
let filters = Utils.parsecategoryFilter({categoryFilterList,filterCategoryDetailFilterList});
ReactNative.NativeModules.YH_ProductListRNViewHelper.setFilterData(filters);
ReactNative.NativeModules.YH_ScreenCategoryViewHelper.enableBrandFilter();
ReactNative.NativeModules.YH_FilterHelper.enableBrandFilter(true);
dispatch(productListSuccess(payload));
})
.catch(error => {
... ...
... ... @@ -109,6 +109,13 @@ export function getProductList(reload=false) {
saleType: saleType,
productPool: productPool,
};
}else if (type == 'YH_InstalmentView') {
params = {
method: 'app.search.instalment',
}
}else if (type == 'YH_NewUserView') {
dispatch(getNewUserProductList(reload));
return;
}
let bSelectedFilterFactor,allFilterFactors;
... ... @@ -160,6 +167,73 @@ export function getProductList(reload=false) {
};
}
export function getNewUserProductList(reload=false) {
return (dispatch, getState) => {
let {app, productListPool} = getState();
let {productList, filterFactors} = productListPool;
let {originParams} = app;
if (reload) {
} else {
if (productList.isFetching || productList.endReached || productList.error) {
return;
}
}
let page = productList.currentPage + 1;
let pageSize = productList.pageSize;
let order = productList.order;
let params = {};
let bSelectedFilterFactor,allFilterFactors;
allFilterFactors = filterFactors.toJS();
for (let prop in allFilterFactors) {
if (allFilterFactors.hasOwnProperty(prop)) {
if (allFilterFactors[prop] === '' || !allFilterFactors[prop]) {
delete allFilterFactors[prop];
}
if (prop == 'sizeKey' && allFilterFactors[prop]) {
allFilterFactors['size'] = allFilterFactors[prop];
delete allFilterFactors[prop];
}
}
}
let getList = (uid) => {
dispatch(productListRequest());
return new ProductListPoolService(app.serviceHost).newUserProductList(uid, order, page, pageSize, originParams, allFilterFactors, params)
.then(json => {
let payload = Utils.parseProductList(json);
payload.endReached = payload.currentPage == payload.pageCount;
if (payload.currentPage > 1) {
let oldList = productList.list.toJS();
let list = [...oldList, ...payload.list];
payload.list = list;
}
let categoryFilterList = payload.categoryFilterList;
let filterCategoryDetailFilterList = payload.filterCategoryDetailFilterList;
let filters = Utils.parsecategoryFilter({categoryFilterList,filterCategoryDetailFilterList});
ReactNative.NativeModules.YH_ProductListRNViewHelper.setFilterData(filters);
ReactNative.NativeModules.YH_FilterHelper.enableBrandFilter(true);
dispatch(productListSuccess(payload));
})
.catch(error => {
dispatch(productListFailure(error));
});
}
ReactNative.NativeModules.YH_CommonHelper.uid()
.then(uid => {
getList(uid);
})
.catch(error => {
getList('');
});
};
}
export function getBannerListWithContentCodeRequest() {
return {
type: GET_BANNERLIST_REQUEST,
... ...
... ... @@ -11,7 +11,7 @@ export default class CategoryProListService {
this.api = new Request(baseURL);
}
async productList(page=1, limit=60, originParams={}, filterFactors={}, order, firstProductSkn='') {
async productList(page=1, limit=60, originParams={}, filterFactors={}, order) {
return await this.api.get({
url: '',
... ... @@ -22,8 +22,7 @@ export default class CategoryProListService {
...originParams,
...filterFactors,
fromPage: 'iFP_CategoryProList',
order,
firstProductSkn
order
}
})
.then((json) => {
... ...
... ... @@ -71,4 +71,26 @@ export default class ProductListPoolService {
});
}
async newUserProductList(uid,order,page=1, limit=60,originParams,filterFactors={},params, v=7) {
return await this.api.get({
url: '/operations/api/v5/activitytemplate/getProduct',
body: {
uid,
page,
limit,
order,
...params,
...originParams,
...filterFactors,
v,
}
})
.then((json) => {
return json;
})
.catch((error) => {
throw(error);
});
}
}
... ...