Showing
1 changed file
with
33 additions
and
30 deletions
@@ -23,8 +23,8 @@ const { | @@ -23,8 +23,8 @@ const { | ||
23 | 23 | ||
24 | export function setSelectedCategoryType(index) { | 24 | export function setSelectedCategoryType(index) { |
25 | return { | 25 | return { |
26 | - type: SET_SELECTED_CATEGORY, | ||
27 | - payload: index | 26 | + type: SET_SELECTED_CATEGORY, |
27 | + payload: index | ||
28 | }; | 28 | }; |
29 | } | 29 | } |
30 | 30 | ||
@@ -38,9 +38,9 @@ export function setSelectedCategory(index) { | @@ -38,9 +38,9 @@ export function setSelectedCategory(index) { | ||
38 | let myList = myproductList.list ? myproductList.list.toArray() : []; | 38 | let myList = myproductList.list ? myproductList.list.toArray() : []; |
39 | 39 | ||
40 | if (index == 0 && list.length == 0) { | 40 | if (index == 0 && list.length == 0) { |
41 | - dispatch(getHaggleProductList()); | ||
42 | - }else if (index == 1 && myList.length == 0){ | ||
43 | - dispatch(getMyHaggleProductList()); | 41 | + dispatch(getHaggleProductList()); |
42 | + } else if (index == 1 && myList.length == 0) { | ||
43 | + dispatch(getMyHaggleProductList()); | ||
44 | } | 44 | } |
45 | }; | 45 | }; |
46 | } | 46 | } |
@@ -54,9 +54,9 @@ export function refreshProductList(index) { | @@ -54,9 +54,9 @@ export function refreshProductList(index) { | ||
54 | }); | 54 | }); |
55 | 55 | ||
56 | if (index == 0) { | 56 | if (index == 0) { |
57 | - dispatch(getHaggleProductList()); | ||
58 | - }else if (index == 1){ | ||
59 | - dispatch(getMyHaggleProductList()); | 57 | + dispatch(getHaggleProductList()); |
58 | + } else if (index == 1) { | ||
59 | + dispatch(getMyHaggleProductList()); | ||
60 | } | 60 | } |
61 | 61 | ||
62 | }; | 62 | }; |
@@ -114,6 +114,7 @@ export function myHaggleProductListFailure(error) { | @@ -114,6 +114,7 @@ export function myHaggleProductListFailure(error) { | ||
114 | payload: error | 114 | payload: error |
115 | }; | 115 | }; |
116 | } | 116 | } |
117 | + | ||
117 | export function getResourceRequest() { | 118 | export function getResourceRequest() { |
118 | return { | 119 | return { |
119 | type: RESOURCE_INFO_REQUEST, | 120 | type: RESOURCE_INFO_REQUEST, |
@@ -210,25 +211,25 @@ export function getMyHaggleProductList() { | @@ -210,25 +211,25 @@ export function getMyHaggleProductList() { | ||
210 | }; | 211 | }; |
211 | 212 | ||
212 | ReactNative.NativeModules.YH_CommonHelper.uid() | 213 | ReactNative.NativeModules.YH_CommonHelper.uid() |
213 | - .then(uid => { | ||
214 | - fetchMyHaggleProductList(uid); | ||
215 | - }) | ||
216 | - .catch(error => { | ||
217 | - ReactNative.NativeModules.YH_CommonHelper.login() | ||
218 | - .then(uid => { | 214 | + .then(uid => { |
219 | fetchMyHaggleProductList(uid); | 215 | fetchMyHaggleProductList(uid); |
220 | - }) | ||
221 | - .catch(error => { | 216 | + }) |
217 | + .catch(error => { | ||
218 | + ReactNative.NativeModules.YH_CommonHelper.login() | ||
219 | + .then(uid => { | ||
220 | + fetchMyHaggleProductList(uid); | ||
221 | + }) | ||
222 | + .catch(error => { | ||
222 | 223 | ||
223 | - }); | ||
224 | - }); | 224 | + }); |
225 | + }); | ||
225 | 226 | ||
226 | }; | 227 | }; |
227 | } | 228 | } |
228 | 229 | ||
229 | function exposeProductListData(json) { | 230 | function exposeProductListData(json) { |
230 | let res = json; | 231 | let res = json; |
231 | - try{ | 232 | + try { |
232 | let list = json ? json.list : []; | 233 | let list = json ? json.list : []; |
233 | if (!list) { | 234 | if (!list) { |
234 | return json; | 235 | return json; |
@@ -242,14 +243,16 @@ function exposeProductListData(json) { | @@ -242,14 +243,16 @@ function exposeProductListData(json) { | ||
242 | let inFloorIndex = parseInt(i) + 1 + json.page_size * (json.page - 1) + ''; | 243 | let inFloorIndex = parseInt(i) + 1 + json.page_size * (json.page - 1) + ''; |
243 | item.yh_exposureData = { | 244 | item.yh_exposureData = { |
244 | P_NAME: pageName, | 245 | P_NAME: pageName, |
245 | - P_PARAM:item.activityId, | 246 | + P_PARAM: item.activityId, |
246 | I_INDEX: inFloorIndex, | 247 | I_INDEX: inFloorIndex, |
247 | PRD_SKN: item.productSkn, | 248 | PRD_SKN: item.productSkn, |
249 | + PRD_CHANNEL: item.productType ? "UFO" : "", | ||
248 | exposureEnd: 1 | 250 | exposureEnd: 1 |
249 | }; | 251 | }; |
250 | } | 252 | } |
251 | res.list = list; | 253 | res.list = list; |
252 | - }catch(error){} | 254 | + } catch (error) { |
255 | + } | ||
253 | return res; | 256 | return res; |
254 | } | 257 | } |
255 | 258 | ||
@@ -260,9 +263,9 @@ export function getHaggleStatus(productSkn, activityId, callBack) { | @@ -260,9 +263,9 @@ export function getHaggleStatus(productSkn, activityId, callBack) { | ||
260 | let fetchHaggleStatus = (uid) => { | 263 | let fetchHaggleStatus = (uid) => { |
261 | return new haggleService(app.host).fetcheProductHaggleStatus(uid, activityId, productSkn) | 264 | return new haggleService(app.host).fetcheProductHaggleStatus(uid, activityId, productSkn) |
262 | .then(json => { | 265 | .then(json => { |
263 | - let payload = json; | ||
264 | - dispatch(haggleStatusSuccess(payload)); | ||
265 | - callBack && typeof callBack === 'function' && callBack(payload) | 266 | + let payload = json; |
267 | + dispatch(haggleStatusSuccess(payload)); | ||
268 | + callBack && typeof callBack === 'function' && callBack(payload) | ||
266 | }) | 269 | }) |
267 | .catch(error => { | 270 | .catch(error => { |
268 | ReactNative.NativeModules.YH_CommonHelper.showToast(error.message || '网络请求失败') | 271 | ReactNative.NativeModules.YH_CommonHelper.showToast(error.message || '网络请求失败') |
@@ -271,15 +274,15 @@ export function getHaggleStatus(productSkn, activityId, callBack) { | @@ -271,15 +274,15 @@ export function getHaggleStatus(productSkn, activityId, callBack) { | ||
271 | 274 | ||
272 | ReactNative.NativeModules.YH_CommonHelper.uid() | 275 | ReactNative.NativeModules.YH_CommonHelper.uid() |
273 | .then(uid => { | 276 | .then(uid => { |
274 | - fetchHaggleStatus(uid) | 277 | + fetchHaggleStatus(uid) |
275 | }) | 278 | }) |
276 | .catch(error => { | 279 | .catch(error => { |
277 | ReactNative.NativeModules.YH_CommonHelper.login() | 280 | ReactNative.NativeModules.YH_CommonHelper.login() |
278 | - .then(uid => { | ||
279 | - fetchHaggleStatus(uid) | ||
280 | - }) | ||
281 | - .catch(error => { | ||
282 | - }); | 281 | + .then(uid => { |
282 | + fetchHaggleStatus(uid) | ||
283 | + }) | ||
284 | + .catch(error => { | ||
285 | + }); | ||
283 | }); | 286 | }); |
284 | 287 | ||
285 | }; | 288 | }; |
-
Please register or login to post a comment