Showing
7 changed files
with
132 additions
and
345 deletions
@@ -28,6 +28,12 @@ const getProductInfo = (req, res, next) => { | @@ -28,6 +28,12 @@ const getProductInfo = (req, res, next) => { | ||
28 | }).catch(next); | 28 | }).catch(next); |
29 | }; | 29 | }; |
30 | 30 | ||
31 | +/** | ||
32 | + * 获取产品数据json信息 | ||
33 | + * @param req | ||
34 | + * @param res | ||
35 | + * @param next | ||
36 | + */ | ||
31 | const getProductData = (req, res, next) => { | 37 | const getProductData = (req, res, next) => { |
32 | let pid = req.query.productId || ''; | 38 | let pid = req.query.productId || ''; |
33 | 39 | ||
@@ -63,6 +69,12 @@ const setShoppingCookie = (req, res) => { | @@ -63,6 +69,12 @@ const setShoppingCookie = (req, res) => { | ||
63 | }); | 69 | }); |
64 | }; | 70 | }; |
65 | 71 | ||
72 | +/** | ||
73 | + * 首页迷你购物车数据信息json | ||
74 | + * @param req | ||
75 | + * @param res | ||
76 | + * @param next | ||
77 | + */ | ||
66 | const miniCart = (req, res, next) => { | 78 | const miniCart = (req, res, next) => { |
67 | 79 | ||
68 | let uid = req.user.uid; | 80 | let uid = req.user.uid; |
@@ -89,8 +101,7 @@ const miniCart = (req, res, next) => { | @@ -89,8 +101,7 @@ const miniCart = (req, res, next) => { | ||
89 | */ | 101 | */ |
90 | const cart = (req, res, next) => { | 102 | const cart = (req, res, next) => { |
91 | 103 | ||
92 | - let uid = req.user.uid; // 8040155; // req.user.uid; 20422448 | ||
93 | -// console.log('====================> ' + uid); | 104 | + let uid = req.user.uid; |
94 | let shoppingKey = helper.getShoppingKeyByCookie(req); | 105 | let shoppingKey = helper.getShoppingKeyByCookie(req); |
95 | let cartDelList = req.cookies['cart-del-list']; | 106 | let cartDelList = req.cookies['cart-del-list']; |
96 | 107 | ||
@@ -247,8 +258,6 @@ const moveToFav = (req, res) => { | @@ -247,8 +258,6 @@ const moveToFav = (req, res) => { | ||
247 | 258 | ||
248 | co(function * () { | 259 | co(function * () { |
249 | let uid = req.user.uid; | 260 | let uid = req.user.uid; |
250 | - | ||
251 | - // let shoppingKey = helper.getShoppingKeyByCookie(req); | ||
252 | let skuList = req.body.skuList; | 261 | let skuList = req.body.skuList; |
253 | let hasPromotion = req.body.hasPromotion || false; | 262 | let hasPromotion = req.body.hasPromotion || false; |
254 | let isReFav = !!req.body.isReFav || false; | 263 | let isReFav = !!req.body.isReFav || false; |
@@ -350,7 +359,9 @@ const getIncreasePurchase = (req, res) => { | @@ -350,7 +359,9 @@ const getIncreasePurchase = (req, res) => { | ||
350 | }); | 359 | }); |
351 | }; | 360 | }; |
352 | 361 | ||
353 | -// 修改购物车商品颜色和尺寸 | 362 | +/** |
363 | + * 修改购物车商品颜色和尺寸 | ||
364 | + */ | ||
354 | const modifyProduct = (req, res, next) => { | 365 | const modifyProduct = (req, res, next) => { |
355 | const uid = req.user && req.user.uid; | 366 | const uid = req.user && req.user.uid; |
356 | const shoppingKey = helper.getShoppingKeyByCookie(req); | 367 | const shoppingKey = helper.getShoppingKeyByCookie(req); |
@@ -360,15 +371,16 @@ const modifyProduct = (req, res, next) => { | @@ -360,15 +371,16 @@ const modifyProduct = (req, res, next) => { | ||
360 | const swapData = req.body.swapData; | 371 | const swapData = req.body.swapData; |
361 | 372 | ||
362 | service.modifyProduct({swapData, shoppingKey, uid}, uid, shoppingKey, cartDelList).then((result) => { | 373 | service.modifyProduct({swapData, shoppingKey, uid}, uid, shoppingKey, cartDelList).then((result) => { |
363 | - /* if (result.code === 200) { | ||
364 | - | ||
365 | - } else { | ||
366 | - res.json(result); | ||
367 | - }*/ | ||
368 | res.send(result); | 374 | res.send(result); |
369 | }).catch(next); | 375 | }).catch(next); |
370 | }; | 376 | }; |
371 | 377 | ||
378 | +/** | ||
379 | + * 换购赠品或加价购 | ||
380 | + * @param req | ||
381 | + * @param res | ||
382 | + * @param next | ||
383 | + */ | ||
372 | const swapGift = (req, res, next) => { | 384 | const swapGift = (req, res, next) => { |
373 | 385 | ||
374 | let uid = req.user && req.user.uid; | 386 | let uid = req.user && req.user.uid; |
@@ -143,45 +143,6 @@ const addToFav = (uid, skuList /* , hasPromotion*/) =>{ | @@ -143,45 +143,6 @@ const addToFav = (uid, skuList /* , hasPromotion*/) =>{ | ||
143 | return api.get('', param); | 143 | return api.get('', param); |
144 | }; | 144 | }; |
145 | 145 | ||
146 | - | ||
147 | -/** | ||
148 | - * 获取购物车商品详情数据 | ||
149 | - * | ||
150 | - * @param int $uid 用户ID | ||
151 | - * @param int $skn 商品skn | ||
152 | - * @return array 接口返回的数据 | ||
153 | - */ | ||
154 | -const cartProductData = (uid, skn) => { | ||
155 | - | ||
156 | - let param = { | ||
157 | - method: 'app.product.data', | ||
158 | - product_skn: skn, | ||
159 | - showcomment: 'N', | ||
160 | - uid: uid | ||
161 | - }; | ||
162 | - | ||
163 | - return api.get('', param); | ||
164 | -}; | ||
165 | - | ||
166 | - | ||
167 | -/** | ||
168 | - * 获取加价购商品详情数据 | ||
169 | - * | ||
170 | - * @param int $skn 商品skn | ||
171 | - * @param int $promotionId 加价购商品促销ID | ||
172 | - * @return array 接口返回的数据 | ||
173 | - */ | ||
174 | -const giftProductData = (skn, promotionId) => { | ||
175 | - | ||
176 | - let param = { | ||
177 | - method: 'app.product.gift', | ||
178 | - product_skn: skn, | ||
179 | - promotion_id: promotionId | ||
180 | - }; | ||
181 | - | ||
182 | - return api.get('', param); | ||
183 | -}; | ||
184 | - | ||
185 | /** | 146 | /** |
186 | * 增减购物车商品数量 | 147 | * 增减购物车商品数量 |
187 | * | 148 | * |
@@ -221,160 +182,6 @@ const modifyProductNum = (uid, sku, increaseNum, decreaseNum, shoppingKey) => { | @@ -221,160 +182,6 @@ const modifyProductNum = (uid, sku, increaseNum, decreaseNum, shoppingKey) => { | ||
221 | }; | 182 | }; |
222 | 183 | ||
223 | /** | 184 | /** |
224 | - * 修改购物车商品数据 | ||
225 | - * | ||
226 | - * @param int $uid 用户ID | ||
227 | - * @param string $swapData 商品数据 | ||
228 | - * @param string $shoppingKey 未登录用户唯一识别码 | ||
229 | - * @return array 接口返回的数据 | ||
230 | - */ | ||
231 | -const modifyCartProduct = (uid, swapData, shoppingKey) => { | ||
232 | - | ||
233 | - let param = { | ||
234 | - method: 'app.Shopping.swap', | ||
235 | - swap_data: swapData | ||
236 | - }; | ||
237 | - | ||
238 | - if (uid) { | ||
239 | - param.uid = uid; | ||
240 | - } | ||
241 | - if (shoppingKey) { | ||
242 | - param.shopping_key = shoppingKey; | ||
243 | - } | ||
244 | - | ||
245 | - return api.get('', param); | ||
246 | -}; | ||
247 | - | ||
248 | -/** | ||
249 | - * 购物车结算 | ||
250 | - * | ||
251 | - * @param int $uid 用户ID | ||
252 | - * @param string $cartType 购物车类型,ordinary表示普通, advance表示预售 | ||
253 | - * @param int $isUseYohoCoin 是否使用有货币,默认0不使用, 1使用 | ||
254 | - * @return array 接口返回的数据 | ||
255 | - */ | ||
256 | -const cartPay = (uid, cartType, isUseYohoCoin) => { | ||
257 | - | ||
258 | - let param = { | ||
259 | - method: 'app.Shopping.payment', | ||
260 | - cart_type: cartType, | ||
261 | - yoho_coin_mode: isUseYohoCoin || 0, | ||
262 | - uid: uid | ||
263 | - }; | ||
264 | - | ||
265 | - if (_.indexOf(['ordinary', 'advance'], cartType) === -1) { | ||
266 | - return { | ||
267 | - code: 400, | ||
268 | - message: '购物车参数类型有误!', | ||
269 | - data: {} | ||
270 | - }; | ||
271 | - } | ||
272 | - | ||
273 | - return api.get('', param); | ||
274 | -}; | ||
275 | - | ||
276 | -/** | ||
277 | - * 购物车结算--支付方式和配送方式选择 | ||
278 | - * | ||
279 | - * @param int $uid 用户ID | ||
280 | - * @param string $cartType 购物车类型,ordinary表示普通, advance表示预售 | ||
281 | - * @param int $deliveryWay 配送方式,1表示普通快递,2表示顺丰速运 | ||
282 | - * @param int $paymentType 支付方式,1表示在线支付,2表示货到付款 | ||
283 | - * @param string $couponCode 优惠券码 | ||
284 | - * @param string $promotionCode 优惠码 | ||
285 | - * @param mixed $yohoCoin 使用的有货币数量 | ||
286 | - * @param int $redEnvelopes 红包 | ||
287 | - * @return array 接口返回的数据 | ||
288 | - */ | ||
289 | -const orderCompute = (uid, cartType, deliveryWay, paymentType, couponCode, promotionCode, yohoCoin, redEnvelopes) =>{ | ||
290 | - | ||
291 | - let param = { | ||
292 | - method: 'app.Shopping.compute', | ||
293 | - cart_type: cartType, | ||
294 | - delivery_way: deliveryWay, | ||
295 | - payment_type: paymentType, | ||
296 | - check_yohocoin_amount: 'Y', // 控制是否判断有货币超出订单金额 | ||
297 | - uid: uid | ||
298 | - }; | ||
299 | - | ||
300 | - if (_.indexOf(['ordinary', 'advance'], cartType) === -1) { | ||
301 | - return { | ||
302 | - code: 400, | ||
303 | - message: '购物车参数类型有误!', | ||
304 | - data: {} | ||
305 | - }; | ||
306 | - } | ||
307 | - | ||
308 | - if (couponCode) { | ||
309 | - param.coupon_code = couponCode; | ||
310 | - } | ||
311 | - if (promotionCode) { | ||
312 | - param.promotion_code = promotionCode; | ||
313 | - } | ||
314 | - if (yohoCoin) { | ||
315 | - param.use_yoho_coin = yohoCoin; | ||
316 | - } | ||
317 | - if (redEnvelopes) { | ||
318 | - param.use_red_envelopes = redEnvelopes; | ||
319 | - } | ||
320 | - | ||
321 | - return api.get('', param); | ||
322 | -}; | ||
323 | - | ||
324 | -/** | ||
325 | - * 购物车结算--使用优惠券 | ||
326 | - * | ||
327 | - * @param int $uid 用户ID | ||
328 | - * @param string $couponCode 优惠券代码 | ||
329 | - * @return array 接口返回的数据 | ||
330 | - */ | ||
331 | -const searchCoupon = (uid, couponCode) => { | ||
332 | - | ||
333 | - let param = { | ||
334 | - method: 'app.Shopping.useCoupon', | ||
335 | - coupon_code: couponCode, | ||
336 | - uid: uid | ||
337 | - }; | ||
338 | - | ||
339 | - return api.get('', param); | ||
340 | -}; | ||
341 | - | ||
342 | -/** | ||
343 | - * 购物车结算--获取优惠券列表 | ||
344 | - * | ||
345 | - * @param int $uid 用户ID | ||
346 | - * @return array 接口返回的数据 | ||
347 | - */ | ||
348 | -const getCouponList = (uid, limit) => { | ||
349 | - | ||
350 | - let param = { | ||
351 | - method: 'app.coupons.lists', | ||
352 | - type: 'notuse', | ||
353 | - page: 1, | ||
354 | - limit: limit || 10, | ||
355 | - uid: uid | ||
356 | - }; | ||
357 | - | ||
358 | - return api.get('', param); | ||
359 | -}; | ||
360 | - | ||
361 | -/** | ||
362 | - * 购物车结算--获取用户可用和不可用的优惠券列表 | ||
363 | - * | ||
364 | - * @param int $uid 用户ID | ||
365 | - * @return array 接口返回的数据 | ||
366 | - */ | ||
367 | -const getListCoupon = (uid) => { | ||
368 | - | ||
369 | - let param = { | ||
370 | - method: 'app.Shopping.listCoupon', | ||
371 | - uid: uid | ||
372 | - }; | ||
373 | - | ||
374 | - return api.get('', param); | ||
375 | -}; | ||
376 | - | ||
377 | -/** | ||
378 | * 购物车数量 | 185 | * 购物车数量 |
379 | * | 186 | * |
380 | * @param int $uid 用户ID | 187 | * @param int $uid 用户ID |
@@ -417,103 +224,11 @@ const togetherProduct = (page) => { | @@ -417,103 +224,11 @@ const togetherProduct = (page) => { | ||
417 | }; | 224 | }; |
418 | 225 | ||
419 | /** | 226 | /** |
420 | - * 浏览记录数据 | ||
421 | - * | ||
422 | - * @param int $uid 用户ID | ||
423 | - * @param int $udid 客户端唯一标识 | ||
424 | - * @param int $page 第几页,默认为1 | ||
425 | - * @param int $limit 限制多少条,默认100 | ||
426 | - * @return array 接口返回的数据 | ||
427 | - */ | ||
428 | -const browseRecord = (uid, udid, page, limit) => { | ||
429 | - | ||
430 | - let param = { | ||
431 | - method: 'app.browse.product', | ||
432 | - uid: uid, | ||
433 | - udid: udid, | ||
434 | - page: page || 1, | ||
435 | - limit: limit || 10 | ||
436 | - }; | ||
437 | - | ||
438 | - return api.get('', param); | ||
439 | -}; | ||
440 | - | ||
441 | -/** | ||
442 | - * 通过搜索查询商品信息 | ||
443 | - * | ||
444 | - * 备注:因默认的搜索方法会有过滤, 浏览记录不需要过滤 | ||
445 | - * | ||
446 | - * @param string $query 查询的条件 | ||
447 | - * @param int $limit 查询的限制数 | ||
448 | - * @return array | ||
449 | - */ | ||
450 | -const browseRecordFromSearch = (query, limit) => { | ||
451 | - | ||
452 | - let param = { | ||
453 | - method: 'web.search.search', | ||
454 | - order: 'shelve_time:desc', | ||
455 | - page: 1, | ||
456 | - viewNum: limit || 10, | ||
457 | - query: query | ||
458 | - }; | ||
459 | - | ||
460 | - return api.get('', param); | ||
461 | -}; | ||
462 | - | ||
463 | -/** | ||
464 | - * 选择支付,校验时间间隔,插入数据 | ||
465 | - * @param string $uid | ||
466 | - * @param string $orderCode | ||
467 | - * @param int $payment 14:银联手机支付 15:支付宝手机 18:支付宝wap(wap) 19:微信支付 22:微信wap(wap) 26:QQ钱包手机支付 | ||
468 | - * @return type | ||
469 | - */ | ||
470 | -const savePrePayInfo = (uid, orderCode, payment) => { | ||
471 | - | ||
472 | - let param = { | ||
473 | - method: 'app.order.savePrePayInfo', | ||
474 | - uid: uid, | ||
475 | - orderCode: orderCode, | ||
476 | - payment: payment | ||
477 | - }; | ||
478 | - | ||
479 | - return api.get('', param); | ||
480 | -}; | ||
481 | - | ||
482 | -/** | ||
483 | - * 电子票添加和查询 | ||
484 | - * @param int $uid 用户ID | ||
485 | - * @param type int $productSku 产品sku | ||
486 | - * @param type int $buyNumber 购买数量,范围1-4 | ||
487 | - * @param type int $yohoCoin 有货币 | ||
488 | - * @return type [] | 227 | + * 判断商品列表是否收藏情况 |
228 | + * @param uid | ||
229 | + * @param pidList | ||
230 | + * @returns {Promise.<T>} | ||
489 | */ | 231 | */ |
490 | -const addTicket = (uid, productSku, buyNumber, yohoCoin) => { | ||
491 | - | ||
492 | - let param = { | ||
493 | - method: 'app.shopping.ticket', | ||
494 | - uid: Number(uid), | ||
495 | - product_sku: Number(productSku), | ||
496 | - buy_number: Number(buyNumber) | ||
497 | - }; | ||
498 | - | ||
499 | - // 有货币转换成元,1有货币等于一分钱 | ||
500 | - if (yohoCoin && yohoCoin > 0) { | ||
501 | - param.use_yoho_coin = yohoCoin / 100; | ||
502 | - } | ||
503 | - | ||
504 | - return api.get('', param).then(ret => { | ||
505 | - // 展览票不显示区域,上面要求的。@高扬、@徐洪云,2016/7/6 | ||
506 | - if (ret && ret.data && ret.data.goods_list) { | ||
507 | - _.forEach(() => { | ||
508 | - // it.size_name = it.product_skn * 1 === EXHIBITION_TICKET ? '' : it.size_name; | ||
509 | - // ret.data.goods_list[key] = it; | ||
510 | - }); | ||
511 | - } | ||
512 | - | ||
513 | - return ret; | ||
514 | - }); | ||
515 | -}; | ||
516 | - | ||
517 | const checkUserIsFavProductList = (uid, pidList) => { | 232 | const checkUserIsFavProductList = (uid, pidList) => { |
518 | 233 | ||
519 | pidList = _.isArray(pidList) ? pidList : []; | 234 | pidList = _.isArray(pidList) ? pidList : []; |
@@ -649,21 +364,9 @@ module.exports = { | @@ -649,21 +364,9 @@ module.exports = { | ||
649 | selectGoods, | 364 | selectGoods, |
650 | removeFromCart, | 365 | removeFromCart, |
651 | addToFav, | 366 | addToFav, |
652 | - cartProductData, | ||
653 | - giftProductData, | ||
654 | modifyProductNum, | 367 | modifyProductNum, |
655 | - modifyCartProduct, | ||
656 | - cartPay, | ||
657 | - orderCompute, | ||
658 | - searchCoupon, | ||
659 | - getCouponList, | ||
660 | - getListCoupon, | ||
661 | cartCount, | 368 | cartCount, |
662 | togetherProduct, | 369 | togetherProduct, |
663 | - browseRecord, | ||
664 | - browseRecordFromSearch, | ||
665 | - savePrePayInfo, | ||
666 | - addTicket, | ||
667 | checkUserIsFavProductList, | 370 | checkUserIsFavProductList, |
668 | newPreference, | 371 | newPreference, |
669 | modifyProduct, | 372 | modifyProduct, |
@@ -411,6 +411,13 @@ const getCoupons = (uid) => api.get('', { | @@ -411,6 +411,13 @@ const getCoupons = (uid) => api.get('', { | ||
411 | return result; | 411 | return result; |
412 | }); | 412 | }); |
413 | 413 | ||
414 | +/** | ||
415 | + * 购物车数据 | ||
416 | + * @param uid | ||
417 | + * @param shoppingKey | ||
418 | + * @param cartDelList | ||
419 | + * @returns {*} | ||
420 | + */ | ||
414 | const getCartData = (uid, shoppingKey, cartDelList) => { | 421 | const getCartData = (uid, shoppingKey, cartDelList) => { |
415 | return cartApi.cartData(uid, shoppingKey).then(cartDataRet => { | 422 | return cartApi.cartData(uid, shoppingKey).then(cartDataRet => { |
416 | return chelper.formatCart(cartDataRet, uid, shoppingKey, cartDelList); | 423 | return chelper.formatCart(cartDataRet, uid, shoppingKey, cartDelList); |
@@ -734,9 +741,6 @@ const getRecommendProduct = (channel, uid, udid, page) => { | @@ -734,9 +741,6 @@ const getRecommendProduct = (channel, uid, udid, page) => { | ||
734 | let item = { | 741 | let item = { |
735 | id: it.product_id, | 742 | id: it.product_id, |
736 | skn: it.product_skn, | 743 | skn: it.product_skn, |
737 | - | ||
738 | - // href: Helpers::getUrlBySkc($value['product_id'], | ||
739 | - // $value['goods_list'][0]['product_skc'], $value['cn_alphabet']), | ||
740 | title: it.product_name, | 744 | title: it.product_name, |
741 | img: it.default_images ? helpers.image(it.default_images, 190, 250) : '', | 745 | img: it.default_images ? helpers.image(it.default_images, 190, 250) : '', |
742 | alt: it.product_name, | 746 | alt: it.product_name, |
@@ -757,8 +761,6 @@ const getRecommendProduct = (channel, uid, udid, page) => { | @@ -757,8 +761,6 @@ const getRecommendProduct = (channel, uid, udid, page) => { | ||
757 | }); | 761 | }); |
758 | 762 | ||
759 | Object.assign(result.data, { | 763 | Object.assign(result.data, { |
760 | - // hasPrev: page > 1, | ||
761 | - // hasNext: plist.length >= end, | ||
762 | item: items | 764 | item: items |
763 | }); | 765 | }); |
764 | 766 | ||
@@ -813,13 +815,6 @@ const getTogetherProduct = (page) => { | @@ -813,13 +815,6 @@ const getTogetherProduct = (page) => { | ||
813 | price: Number(it.price.sales_price) | 815 | price: Number(it.price.sales_price) |
814 | }; | 816 | }; |
815 | 817 | ||
816 | - // 商品链接 | ||
817 | - /* let cnAlphaBet = it.cn_alphabet ? it.cn_alphabet : md5(it.product_name); | ||
818 | - let firstGoods = it.goods_list && it.goods_list[0]; | ||
819 | - let productSkc = firstGoods && firstGoods.product_skc; | ||
820 | - | ||
821 | - item.href = helpers.url(`/product/pro_${it.product_id}_${productSkc}/${cnAlphaBet}.html`, null, 'item');*/ | ||
822 | - | ||
823 | if (item.price !== Number(it.price.market_price)) { | 818 | if (item.price !== Number(it.price.market_price)) { |
824 | it.marketPrice = Number(it.price.market_price); | 819 | it.marketPrice = Number(it.price.market_price); |
825 | } | 820 | } |
@@ -840,6 +835,13 @@ const getTogetherProduct = (page) => { | @@ -840,6 +835,13 @@ const getTogetherProduct = (page) => { | ||
840 | })(); | 835 | })(); |
841 | }; | 836 | }; |
842 | 837 | ||
838 | +/** | ||
839 | + * 修改购物车商品 | ||
840 | + * @param param | ||
841 | + * @param uid | ||
842 | + * @param shoppingKey | ||
843 | + * @param cartDelList | ||
844 | + */ | ||
843 | const modifyProduct = (param, uid, shoppingKey, cartDelList) => { | 845 | const modifyProduct = (param, uid, shoppingKey, cartDelList) => { |
844 | 846 | ||
845 | return co(function * () { | 847 | return co(function * () { |
@@ -861,6 +863,15 @@ const modifyProduct = (param, uid, shoppingKey, cartDelList) => { | @@ -861,6 +863,15 @@ const modifyProduct = (param, uid, shoppingKey, cartDelList) => { | ||
861 | })(); | 863 | })(); |
862 | }; | 864 | }; |
863 | 865 | ||
866 | +/** | ||
867 | + * 重选赠品或加价购商品 | ||
868 | + * @param uid | ||
869 | + * @param shoppingKey | ||
870 | + * @param promotionId | ||
871 | + * @param newSkn | ||
872 | + * @param newSku | ||
873 | + * @param cartDelList | ||
874 | + */ | ||
864 | const swapGift = (uid, shoppingKey, promotionId, newSkn, newSku, cartDelList) => { | 875 | const swapGift = (uid, shoppingKey, promotionId, newSkn, newSku, cartDelList) => { |
865 | return co(function * () { | 876 | return co(function * () { |
866 | 877 | ||
@@ -883,6 +894,12 @@ const swapGift = (uid, shoppingKey, promotionId, newSkn, newSku, cartDelList) => | @@ -883,6 +894,12 @@ const swapGift = (uid, shoppingKey, promotionId, newSkn, newSku, cartDelList) => | ||
883 | 894 | ||
884 | }; | 895 | }; |
885 | 896 | ||
897 | +/** | ||
898 | + * 查询指定优惠下的可选赠品或加价购 | ||
899 | + * @param promotionId 优惠ID | ||
900 | + * @param uid | ||
901 | + * @param shoppingKey | ||
902 | + */ | ||
886 | const queryUserPromotionGift = (promotionId, uid, shoppingKey) => { | 903 | const queryUserPromotionGift = (promotionId, uid, shoppingKey) => { |
887 | 904 | ||
888 | return co(function * () { | 905 | return co(function * () { |
@@ -932,6 +949,11 @@ const queryUserPromotionGift = (promotionId, uid, shoppingKey) => { | @@ -932,6 +949,11 @@ const queryUserPromotionGift = (promotionId, uid, shoppingKey) => { | ||
932 | 949 | ||
933 | }; | 950 | }; |
934 | 951 | ||
952 | +/** | ||
953 | + * 首页mini购物车数据 | ||
954 | + * @param uid | ||
955 | + * @param shoppingKey | ||
956 | + */ | ||
935 | const getMiniCartData = (uid, shoppingKey) => { | 957 | const getMiniCartData = (uid, shoppingKey) => { |
936 | 958 | ||
937 | return co(function * () { | 959 | return co(function * () { |
@@ -990,20 +1012,20 @@ const getMiniCartData = (uid, shoppingKey) => { | @@ -990,20 +1012,20 @@ const getMiniCartData = (uid, shoppingKey) => { | ||
990 | }; | 1012 | }; |
991 | 1013 | ||
992 | module.exports = { | 1014 | module.exports = { |
993 | - getProductInfoAsync, // 获取某一个商品详情主页面 | ||
994 | - getCartData, | ||
995 | - getCartCount, | ||
996 | - addToCart, | ||
997 | - selectGoods, | ||
998 | - modifyProductNum, | ||
999 | - removeFromCart, | ||
1000 | - addToFav, | ||
1001 | - checkUserIsFav, | ||
1002 | - getRecommendProduct, | ||
1003 | - getTogetherProduct, | ||
1004 | - modifyProduct, | ||
1005 | - swapGift, | ||
1006 | - queryUserPromotionGift, | ||
1007 | - getCoupons, // 获取优惠券列表 | ||
1008 | - getMiniCartData | 1015 | + getProductInfoAsync, /** 获取商品信息 **/ |
1016 | + getCartData, /** 购物车数据 **/ | ||
1017 | + getCartCount, /** 得到购物车数量 **/ | ||
1018 | + addToCart, /** 加入到购物车 **/ | ||
1019 | + selectGoods, /** 选中/取消选中商品 **/ | ||
1020 | + modifyProductNum, /** 修改商品数量 **/ | ||
1021 | + removeFromCart, /** 从购物车中删除 **/ | ||
1022 | + addToFav, /** 移入收藏 **/ | ||
1023 | + checkUserIsFav, /** 判断商品是否已收藏 **/ | ||
1024 | + getRecommendProduct, /** 为您优选商品 **/ | ||
1025 | + getTogetherProduct, /** 凑单商品 **/ | ||
1026 | + modifyProduct, /** 修改购物车商品 **/ | ||
1027 | + swapGift, /** 重选赠品或加价购商品 **/ | ||
1028 | + queryUserPromotionGift, /** 查询指定优惠下的可选赠品或加价购 **/ | ||
1029 | + getCoupons, /** 获取优惠券列表 **/ | ||
1030 | + getMiniCartData /** 首页mini购物车数据 **/ | ||
1009 | }; | 1031 | }; |
@@ -5,6 +5,12 @@ | @@ -5,6 +5,12 @@ | ||
5 | 5 | ||
6 | 'use strict'; | 6 | 'use strict'; |
7 | 7 | ||
8 | +/** | ||
9 | + * and 逻辑运算 | ||
10 | + * {{and arg1 arg2 ...}} | ||
11 | + * {{#and arg1 arg2 ...}}{{/and}} | ||
12 | + * @returns {*} | ||
13 | + */ | ||
8 | exports.and = function() { | 14 | exports.and = function() { |
9 | 15 | ||
10 | let options = arguments[arguments.length - 1]; | 16 | let options = arguments[arguments.length - 1]; |
@@ -31,6 +37,10 @@ exports.and = function() { | @@ -31,6 +37,10 @@ exports.and = function() { | ||
31 | } | 37 | } |
32 | }; | 38 | }; |
33 | 39 | ||
40 | +/** | ||
41 | + * or 逻辑运算 {{or arg1 arg2 ... }} | ||
42 | + * @returns {*} | ||
43 | + */ | ||
34 | exports.or = function() { | 44 | exports.or = function() { |
35 | let options = arguments[arguments.length - 1]; | 45 | let options = arguments[arguments.length - 1]; |
36 | let ret = false; | 46 | let ret = false; |
@@ -56,6 +66,13 @@ exports.or = function() { | @@ -56,6 +66,13 @@ exports.or = function() { | ||
56 | } | 66 | } |
57 | }; | 67 | }; |
58 | 68 | ||
69 | +/** | ||
70 | + * 大于逻辑 v1 > v2 | ||
71 | + * @param v1 | ||
72 | + * @param v2 | ||
73 | + * @param options | ||
74 | + * @returns {*} | ||
75 | + */ | ||
59 | exports.gt = function(v1, v2, options) { | 76 | exports.gt = function(v1, v2, options) { |
60 | var ret = v1 > v2; | 77 | var ret = v1 > v2; |
61 | 78 | ||
@@ -71,6 +88,13 @@ exports.gt = function(v1, v2, options) { | @@ -71,6 +88,13 @@ exports.gt = function(v1, v2, options) { | ||
71 | } | 88 | } |
72 | }; | 89 | }; |
73 | 90 | ||
91 | +/** | ||
92 | + * 大于等于逻辑 v1 >= v2 | ||
93 | + * @param v1 | ||
94 | + * @param v2 | ||
95 | + * @param options | ||
96 | + * @returns {*} | ||
97 | + */ | ||
74 | exports.ge = function(v1, v2, options) { | 98 | exports.ge = function(v1, v2, options) { |
75 | var ret = v1 >= v2; | 99 | var ret = v1 >= v2; |
76 | 100 | ||
@@ -86,6 +110,13 @@ exports.ge = function(v1, v2, options) { | @@ -86,6 +110,13 @@ exports.ge = function(v1, v2, options) { | ||
86 | } | 110 | } |
87 | }; | 111 | }; |
88 | 112 | ||
113 | +/** | ||
114 | + * 小于逻辑 v1 < v2 | ||
115 | + * @param v1 | ||
116 | + * @param v2 | ||
117 | + * @param options | ||
118 | + * @returns {*} | ||
119 | + */ | ||
89 | exports.lt = function(v1, v2, options) { | 120 | exports.lt = function(v1, v2, options) { |
90 | var ret = v1 < v2; | 121 | var ret = v1 < v2; |
91 | 122 | ||
@@ -101,6 +132,13 @@ exports.lt = function(v1, v2, options) { | @@ -101,6 +132,13 @@ exports.lt = function(v1, v2, options) { | ||
101 | } | 132 | } |
102 | }; | 133 | }; |
103 | 134 | ||
135 | +/** | ||
136 | + * 小于等于逻辑 v1 <= v2 | ||
137 | + * @param v1 | ||
138 | + * @param v2 | ||
139 | + * @param options | ||
140 | + * @returns {*} | ||
141 | + */ | ||
104 | exports.le = function(v1, v2, options) { | 142 | exports.le = function(v1, v2, options) { |
105 | var ret = v1 <= v2; | 143 | var ret = v1 <= v2; |
106 | 144 | ||
@@ -116,6 +154,13 @@ exports.le = function(v1, v2, options) { | @@ -116,6 +154,13 @@ exports.le = function(v1, v2, options) { | ||
116 | } | 154 | } |
117 | }; | 155 | }; |
118 | 156 | ||
157 | +/** | ||
158 | + * 相等逻辑 v1 === v2 | ||
159 | + * @param v1 | ||
160 | + * @param v2 | ||
161 | + * @param options | ||
162 | + * @returns {*} | ||
163 | + */ | ||
119 | exports.eq = function(v1, v2, options) { | 164 | exports.eq = function(v1, v2, options) { |
120 | var ret = v1 === v2; | 165 | var ret = v1 === v2; |
121 | 166 |
@@ -36,7 +36,12 @@ | @@ -36,7 +36,12 @@ | ||
36 | <a {{#unless isOffShelve}}href="{{link}}" target="_blank"{{/unless}}> | 36 | <a {{#unless isOffShelve}}href="{{link}}" target="_blank"{{/unless}}> |
37 | {{#if tag}}<code class="good-mark">{{tag}}</code>{{/if}}{{productTitle}} | 37 | {{#if tag}}<code class="good-mark">{{tag}}</code>{{/if}}{{productTitle}} |
38 | </a> | 38 | </a> |
39 | - <em class="pay-pro-detail"><span><b title="{{productColor}}">颜色:{{productColor}}</b> 尺码:{{productSize}}<i class="iconfont"></i></span></em> | 39 | + <em class="{{#unless isOffShelve}}pay-pro-detail{{/unless}}"> |
40 | + <span> | ||
41 | + <b title="{{productColor}}">颜色:{{productColor}}</b> | ||
42 | + 尺码:{{productSize}}<i class="iconfont"></i> | ||
43 | + </span> | ||
44 | + </em> | ||
40 | {{#and isAdvance preSellDate}} | 45 | {{#and isAdvance preSellDate}} |
41 | <span class="presell">上市期:{{preSellDate}}</span> | 46 | <span class="presell">上市期:{{preSellDate}}</span> |
42 | {{/and}} | 47 | {{/and}} |
@@ -84,7 +89,7 @@ | @@ -84,7 +89,7 @@ | ||
84 | <p class="tip-message tip-message-coin"><i class="yoho-coin"></i>返{{yohoIcon}}有货币</p> | 89 | <p class="tip-message tip-message-coin"><i class="yoho-coin"></i>返{{yohoIcon}}有货币</p> |
85 | {{/if}} | 90 | {{/if}} |
86 | </div> | 91 | </div> |
87 | - <div style="width:100px;" class="cart-operation td"> | 92 | + <div style="width:100px;" class="cart-operation td"> |
88 | <span class="cart-del-btn" data-role="cart-del-btn">删除</span> | 93 | <span class="cart-del-btn" data-role="cart-del-btn">删除</span> |
89 | <span class="cart-col-btn" data-role="cart-mov2fav-btn">移入收藏</span> | 94 | <span class="cart-col-btn" data-role="cart-mov2fav-btn">移入收藏</span> |
90 | </div> | 95 | </div> |
@@ -134,7 +134,7 @@ Cart = { | @@ -134,7 +134,7 @@ Cart = { | ||
134 | promotion_id: $item.data('promotionid') || 0 | 134 | promotion_id: $item.data('promotionid') || 0 |
135 | }); | 135 | }); |
136 | 136 | ||
137 | - if (!$this.data('gift')) { | 137 | + if (!$this.data('gift') && !$item.hasClass('tr-disabled')) { |
138 | countJSON = { | 138 | countJSON = { |
139 | productPrice: $item.find('.product-price').text(), | 139 | productPrice: $item.find('.product-price').text(), |
140 | productTitle: $item.find('.pay-pro-info a').text(), | 140 | productTitle: $item.find('.pay-pro-info a').text(), |
@@ -146,7 +146,7 @@ Cart = { | @@ -146,7 +146,7 @@ Cart = { | ||
146 | } | 146 | } |
147 | 147 | ||
148 | new RConfirm(content, function() { | 148 | new RConfirm(content, function() { |
149 | - capi.cartItemDel(selectArray, true, [countJSON]); | 149 | + capi.cartItemDel(selectArray, true, countJSON ? [countJSON] : ''); |
150 | }); | 150 | }); |
151 | }, | 151 | }, |
152 | delAll: function() { | 152 | delAll: function() { |
@@ -21,12 +21,12 @@ function pyStat() { | @@ -21,12 +21,12 @@ function pyStat() { | ||
21 | } | 21 | } |
22 | }); | 22 | }); |
23 | 23 | ||
24 | - window.py('event', 'viewCart', { | 24 | + window.py && window.py('event', 'viewCart', { |
25 | money: money, | 25 | money: money, |
26 | items: items | 26 | items: items |
27 | }).track('MC.Ok.7NFMIlCH_F_LE2riRlF2r_'); | 27 | }).track('MC.Ok.7NFMIlCH_F_LE2riRlF2r_'); |
28 | } | 28 | } |
29 | 29 | ||
30 | $(function() { | 30 | $(function() { |
31 | - setTimeout(pyStat, 0); | 31 | + setTimeout(pyStat, 3000); |
32 | }); | 32 | }); |
-
Please register or login to post a comment