Authored by shangjf

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

@@ -45,7 +45,7 @@ import { @@ -45,7 +45,7 @@ import {
45 setType, 45 setType,
46 setShop, 46 setShop,
47 setBrandId, 47 setBrandId,
48 - setoriginParams, 48 + setOriginParams,
49 setSaleType, 49 setSaleType,
50 setActivityId, 50 setActivityId,
51 } from './reducers/app/appActions'; 51 } from './reducers/app/appActions';
@@ -71,7 +71,7 @@ export default function native(platform) { @@ -71,7 +71,7 @@ export default function native(platform) {
71 render() { 71 render() {
72 const store = configureStore(getInitialState()); 72 const store = configureStore(getInitialState());
73 store.dispatch(setPlatform(platform)); 73 store.dispatch(setPlatform(platform));
74 - let {host,serviceHost, channel,type,brand_id,shop_id,dictParams,saleType,activityId} = this.props; 74 + let {host, serviceHost, channel, type, brand_id, shop_id, dictParams, saleType, activityId} = this.props;
75 75
76 store.dispatch(setHost(host)); 76 store.dispatch(setHost(host));
77 store.dispatch(setServiceHost(serviceHost)); 77 store.dispatch(setServiceHost(serviceHost));
@@ -79,7 +79,7 @@ export default function native(platform) { @@ -79,7 +79,7 @@ export default function native(platform) {
79 store.dispatch(setType(type)); 79 store.dispatch(setType(type));
80 store.dispatch(setBrandId(brand_id)); 80 store.dispatch(setBrandId(brand_id));
81 store.dispatch(setShop(shop_id)); 81 store.dispatch(setShop(shop_id));
82 - store.dispatch(setoriginParams(dictParams)); 82 + store.dispatch(setOriginParams(dictParams));
83 store.dispatch(setSaleType(saleType)); 83 store.dispatch(setSaleType(saleType));
84 store.dispatch(setActivityId(activityId)); 84 store.dispatch(setActivityId(activityId));
85 85
@@ -113,7 +113,12 @@ export default function native(platform) { @@ -113,7 +113,12 @@ export default function native(platform) {
113 <ProductListForShopContainer /> 113 <ProductListForShopContainer />
114 </Provider> 114 </Provider>
115 ); 115 );
116 - } else if (type == 'YH_ProductListPoolView' || type == 'YH_VipProListVC' || type == 'YH_PromotionProductListVC' || type == 'YH_OutLetProListVC') { 116 + } else if (type == 'YH_ProductListPoolView' ||
  117 + type == 'YH_VipProListVC' ||
  118 + type == 'YH_PromotionProductListVC' ||
  119 + type == 'YH_OutLetProListVC' ||
  120 + type == 'YH_InstalmentView' ||
  121 + type == 'YH_NewUserView') {
117 return ( 122 return (
118 <Provider store={store}> 123 <Provider store={store}>
119 <ProductListPoolContainer /> 124 <ProductListPoolContainer />
@@ -14,7 +14,6 @@ export default class CategoryListHeader extends Component { @@ -14,7 +14,6 @@ export default class CategoryListHeader extends Component {
14 constructor(props) { 14 constructor(props) {
15 super(props); 15 super(props);
16 this.onClick = this.onClick.bind(this); 16 this.onClick = this.onClick.bind(this);
17 - this.clearClick = this.clearClick.bind(this);  
18 } 17 }
19 18
20 onClick(event: Event) { 19 onClick(event: Event) {
@@ -27,11 +26,6 @@ export default class CategoryListHeader extends Component { @@ -27,11 +26,6 @@ export default class CategoryListHeader extends Component {
27 } 26 }
28 } 27 }
29 28
30 - clearClick(event: Event) {  
31 - let item = event.nativeEvent;  
32 - console.log(item);  
33 - }  
34 -  
35 render() { 29 render() {
36 let {dataSource} = this.props; 30 let {dataSource} = this.props;
37 return ( 31 return (
@@ -69,7 +69,9 @@ export default class ProductListPool extends Component { @@ -69,7 +69,9 @@ export default class ProductListPool extends Component {
69 case 'activity': 69 case 'activity':
70 return(<ActivityCell resource={rowData} key = {rowID + 'activityList'} />); 70 return(<ActivityCell resource={rowData} key = {rowID + 'activityList'} />);
71 break; 71 break;
72 - case 'productList': { 72 + case 'productList':
  73 + case 'newUserProductList':
  74 + {
73 let promotionTitleDic = rowData.get('promotionTitleDic'); 75 let promotionTitleDic = rowData.get('promotionTitleDic');
74 if (promotionTitleDic) { 76 if (promotionTitleDic) {
75 return ( 77 return (
@@ -135,6 +137,14 @@ export default class ProductListPool extends Component { @@ -135,6 +137,14 @@ export default class ProductListPool extends Component {
135 activity: activityInfo.list.toArray(), 137 activity: activityInfo.list.toArray(),
136 productList: productList.list.toArray(), 138 productList: productList.list.toArray(),
137 }; 139 };
  140 + }else if (type == 'YH_InstalmentView') {
  141 + dataSource = {
  142 + productList: productList.list.toArray(),
  143 + };
  144 + }else if (type == 'YH_NewUserView') {
  145 + dataSource = {
  146 + newUserProductList: productList.list.toArray(),
  147 + };
138 } 148 }
139 149
140 let isLoadingMore = productList.isFetching && productList.currentPage > 0; 150 let isLoadingMore = productList.isFetching && productList.currentPage > 0;
@@ -73,6 +73,10 @@ class ProductListPoolContainer extends Component { @@ -73,6 +73,10 @@ class ProductListPoolContainer extends Component {
73 this.props.actions.getActivity(); 73 this.props.actions.getActivity();
74 }else if (type == 'YH_PromotionProductListVC') { 74 }else if (type == 'YH_PromotionProductListVC') {
75 this.props.actions.getProductList(); 75 this.props.actions.getProductList();
  76 + }else if (type == 'YH_InstalmentView') {
  77 + this.props.actions.getProductList();
  78 + }else if (type == 'YH_NewUserView') {
  79 + this.props.actions.getProductList();
76 } 80 }
77 } 81 }
78 82
@@ -64,7 +64,7 @@ export function setBrandId(brand_id) { @@ -64,7 +64,7 @@ export function setBrandId(brand_id) {
64 }; 64 };
65 } 65 }
66 66
67 -export function setoriginParams(originParams) { 67 +export function setOriginParams(originParams) {
68 return { 68 return {
69 type: SET_ORIGINPARAMS, 69 type: SET_ORIGINPARAMS,
70 payload: originParams 70 payload: originParams
@@ -85,9 +85,6 @@ export function getProductList(reload=false) { @@ -85,9 +85,6 @@ export function getProductList(reload=false) {
85 } 85 }
86 86
87 allFilterFactors['standard'] = standard; 87 allFilterFactors['standard'] = standard;
88 -  
89 - console.log(allFilterFactors);  
90 -  
91 dispatch(productListRequest()); 88 dispatch(productListRequest());
92 return new CategoryProListService(app.host).productList(page, pageSize, originParams, allFilterFactors, order, '') 89 return new CategoryProListService(app.host).productList(page, pageSize, originParams, allFilterFactors, order, '')
93 .then(json => { 90 .then(json => {
@@ -104,7 +101,7 @@ export function getProductList(reload=false) { @@ -104,7 +101,7 @@ export function getProductList(reload=false) {
104 let filterCategoryDetailFilterList = payload.filterCategoryDetailFilterList; 101 let filterCategoryDetailFilterList = payload.filterCategoryDetailFilterList;
105 let filters = Utils.parsecategoryFilter({categoryFilterList,filterCategoryDetailFilterList}); 102 let filters = Utils.parsecategoryFilter({categoryFilterList,filterCategoryDetailFilterList});
106 ReactNative.NativeModules.YH_ProductListRNViewHelper.setFilterData(filters); 103 ReactNative.NativeModules.YH_ProductListRNViewHelper.setFilterData(filters);
107 - ReactNative.NativeModules.YH_ScreenCategoryViewHelper.enableBrandFilter(); 104 + ReactNative.NativeModules.YH_FilterHelper.enableBrandFilter(true);
108 dispatch(productListSuccess(payload)); 105 dispatch(productListSuccess(payload));
109 }) 106 })
110 .catch(error => { 107 .catch(error => {
@@ -109,6 +109,13 @@ export function getProductList(reload=false) { @@ -109,6 +109,13 @@ export function getProductList(reload=false) {
109 saleType: saleType, 109 saleType: saleType,
110 productPool: productPool, 110 productPool: productPool,
111 }; 111 };
  112 + }else if (type == 'YH_InstalmentView') {
  113 + params = {
  114 + method: 'app.search.instalment',
  115 + }
  116 + }else if (type == 'YH_NewUserView') {
  117 + dispatch(getNewUserProductList(reload));
  118 + return;
112 } 119 }
113 120
114 let bSelectedFilterFactor,allFilterFactors; 121 let bSelectedFilterFactor,allFilterFactors;
@@ -160,6 +167,73 @@ export function getProductList(reload=false) { @@ -160,6 +167,73 @@ export function getProductList(reload=false) {
160 }; 167 };
161 } 168 }
162 169
  170 +export function getNewUserProductList(reload=false) {
  171 + return (dispatch, getState) => {
  172 + let {app, productListPool} = getState();
  173 + let {productList, filterFactors} = productListPool;
  174 + let {originParams} = app;
  175 +
  176 + if (reload) {
  177 +
  178 + } else {
  179 + if (productList.isFetching || productList.endReached || productList.error) {
  180 + return;
  181 + }
  182 + }
  183 + let page = productList.currentPage + 1;
  184 + let pageSize = productList.pageSize;
  185 + let order = productList.order;
  186 + let params = {};
  187 +
  188 + let bSelectedFilterFactor,allFilterFactors;
  189 + allFilterFactors = filterFactors.toJS();
  190 +
  191 + for (let prop in allFilterFactors) {
  192 + if (allFilterFactors.hasOwnProperty(prop)) {
  193 + if (allFilterFactors[prop] === '' || !allFilterFactors[prop]) {
  194 + delete allFilterFactors[prop];
  195 + }
  196 + if (prop == 'sizeKey' && allFilterFactors[prop]) {
  197 + allFilterFactors['size'] = allFilterFactors[prop];
  198 + delete allFilterFactors[prop];
  199 + }
  200 + }
  201 + }
  202 +
  203 + let getList = (uid) => {
  204 + dispatch(productListRequest());
  205 + return new ProductListPoolService(app.serviceHost).newUserProductList(uid, order, page, pageSize, originParams, allFilterFactors, params)
  206 + .then(json => {
  207 + let payload = Utils.parseProductList(json);
  208 + payload.endReached = payload.currentPage == payload.pageCount;
  209 +
  210 + if (payload.currentPage > 1) {
  211 + let oldList = productList.list.toJS();
  212 + let list = [...oldList, ...payload.list];
  213 + payload.list = list;
  214 + }
  215 + let categoryFilterList = payload.categoryFilterList;
  216 + let filterCategoryDetailFilterList = payload.filterCategoryDetailFilterList;
  217 + let filters = Utils.parsecategoryFilter({categoryFilterList,filterCategoryDetailFilterList});
  218 + ReactNative.NativeModules.YH_ProductListRNViewHelper.setFilterData(filters);
  219 + ReactNative.NativeModules.YH_FilterHelper.enableBrandFilter(true);
  220 + dispatch(productListSuccess(payload));
  221 + })
  222 + .catch(error => {
  223 + dispatch(productListFailure(error));
  224 + });
  225 + }
  226 +
  227 + ReactNative.NativeModules.YH_CommonHelper.uid()
  228 + .then(uid => {
  229 + getList(uid);
  230 + })
  231 + .catch(error => {
  232 + getList('');
  233 + });
  234 + };
  235 +}
  236 +
163 export function getBannerListWithContentCodeRequest() { 237 export function getBannerListWithContentCodeRequest() {
164 return { 238 return {
165 type: GET_BANNERLIST_REQUEST, 239 type: GET_BANNERLIST_REQUEST,
@@ -11,7 +11,7 @@ export default class CategoryProListService { @@ -11,7 +11,7 @@ export default class CategoryProListService {
11 this.api = new Request(baseURL); 11 this.api = new Request(baseURL);
12 } 12 }
13 13
14 - async productList(page=1, limit=60, originParams={}, filterFactors={}, order, firstProductSkn='') { 14 + async productList(page=1, limit=60, originParams={}, filterFactors={}, order) {
15 15
16 return await this.api.get({ 16 return await this.api.get({
17 url: '', 17 url: '',
@@ -22,8 +22,7 @@ export default class CategoryProListService { @@ -22,8 +22,7 @@ export default class CategoryProListService {
22 ...originParams, 22 ...originParams,
23 ...filterFactors, 23 ...filterFactors,
24 fromPage: 'iFP_CategoryProList', 24 fromPage: 'iFP_CategoryProList',
25 - order,  
26 - firstProductSkn 25 + order
27 } 26 }
28 }) 27 })
29 .then((json) => { 28 .then((json) => {
@@ -71,4 +71,26 @@ export default class ProductListPoolService { @@ -71,4 +71,26 @@ export default class ProductListPoolService {
71 }); 71 });
72 } 72 }
73 73
  74 + async newUserProductList(uid,order,page=1, limit=60,originParams,filterFactors={},params, v=7) {
  75 + return await this.api.get({
  76 + url: '/operations/api/v5/activitytemplate/getProduct',
  77 + body: {
  78 + uid,
  79 + page,
  80 + limit,
  81 + order,
  82 + ...params,
  83 + ...originParams,
  84 + ...filterFactors,
  85 + v,
  86 + }
  87 + })
  88 + .then((json) => {
  89 + return json;
  90 + })
  91 + .catch((error) => {
  92 + throw(error);
  93 + });
  94 + }
  95 +
74 } 96 }