Authored by 陈峰

Merge branch 'gray' into 'master'

Gray



See merge request !194
@@ -241,7 +241,9 @@ const formatCartGoods = (cartGoods, isAdvanceCart, inValid, isOffShelves, analys @@ -241,7 +241,9 @@ const formatCartGoods = (cartGoods, isAdvanceCart, inValid, isOffShelves, analys
241 * 购物车统计 241 * 购物车统计
242 */ 242 */
243 const formatShoppingCartData = (sc) => { 243 const formatShoppingCartData = (sc) => {
244 - 244 + if (!sc) {
  245 + return {};
  246 + }
245 return { 247 return {
246 discountAmount: sc.discount_amount, // 活动价 248 discountAmount: sc.discount_amount, // 活动价
247 fastShoppingCost: sc.fast_shopping_cost, 249 fastShoppingCost: sc.fast_shopping_cost,
@@ -34,7 +34,7 @@ module.exports = class extends global.yoho.BaseModel { @@ -34,7 +34,7 @@ module.exports = class extends global.yoho.BaseModel {
34 34
35 if (info) { 35 if (info) {
36 Object.assign(resData, { 36 Object.assign(resData, {
37 - yoho_coin: info.yoho_coin.toFixed(2), 37 + yoho_coin: info.yoho_coin ? info.yoho_coin.toFixed(2) : 0,
38 use_yoho_coin: info.use_yoho_coin, 38 use_yoho_coin: info.use_yoho_coin,
39 total_yoho_coin_num: info.total_yoho_coin_num, 39 total_yoho_coin_num: info.total_yoho_coin_num,
40 yoho_coin_pay_rule: info.yoho_coin_pay_rule, 40 yoho_coin_pay_rule: info.yoho_coin_pay_rule,
@@ -190,7 +190,7 @@ module.exports = class favorite extends global.yoho.BaseModel { @@ -190,7 +190,7 @@ module.exports = class favorite extends global.yoho.BaseModel {
190 page = page > pageTotal ? pageTotal : page; 190 page = page > pageTotal ? pageTotal : page;
191 191
192 result.goods = that.getGoodsInfo(productList, page, limit); 192 result.goods = that.getGoodsInfo(productList, page, limit);
193 - result.pager = pager(total, Object.assign(query, {hasCheckAll: true})); 193 + result.pager = pager(total, Object.assign({}, query, {hasCheckAll: true}));
194 194
195 return result; 195 return result;
196 })(); 196 })();
@@ -311,7 +311,7 @@ module.exports = class extends global.yoho.BaseModel { @@ -311,7 +311,7 @@ module.exports = class extends global.yoho.BaseModel {
311 ], 311 ],
312 certifiedName: +isStudent ? '学生身份已验证' : '身份验证', 312 certifiedName: +isStudent ? '学生身份已验证' : '身份验证',
313 certifiedUrl: helpers.urlFormat('/product/students/'), 313 certifiedUrl: helpers.urlFormat('/product/students/'),
314 - latestOrders: Object.assign(indexData.recentOrder, {cancelReason: indexData.reason}) 314 + latestOrders: Object.assign({}, indexData.recentOrder, {cancelReason: indexData.reason})
315 }, 315 },
316 banner: indexData.footerBanner 316 banner: indexData.footerBanner
317 } 317 }
@@ -822,7 +822,7 @@ module.exports = class extends global.yoho.BaseModel { @@ -822,7 +822,7 @@ module.exports = class extends global.yoho.BaseModel {
822 detail.orderInfo = { 822 detail.orderInfo = {
823 receiver: orderDetail.user_name, 823 receiver: orderDetail.user_name,
824 address: orderDetail.area + orderDetail.address, 824 address: orderDetail.area + orderDetail.address,
825 - phone: _.fill(orderDetail.mobile.split(''), '*', 3, 4).join('') + 825 + phone: _.fill((orderDetail.mobile ? orderDetail.mobile.split('') : ''), '*', 3, 4).join('') +
826 (orderDetail.phone ? ',' + _.fill(orderDetail.phone.split(''), '*', 3, 5).join('') : '') 826 (orderDetail.phone ? ',' + _.fill(orderDetail.phone.split(''), '*', 3, 5).join('') : '')
827 }; 827 };
828 828
@@ -1007,7 +1007,7 @@ function _getCoupon(coupons) { @@ -1007,7 +1007,7 @@ function _getCoupon(coupons) {
1007 1007
1008 let pickProp = Fn.pick(['couponName', 'amount', 'couponId', 'acquireStatus', 'rule4ShortName']); 1008 let pickProp = Fn.pick(['couponName', 'amount', 'couponId', 'acquireStatus', 'rule4ShortName']);
1009 let encodeId = Fn.update('couponId', (cid) => crypto.encryption(null, cid + '')); 1009 let encodeId = Fn.update('couponId', (cid) => crypto.encryption(null, cid + ''));
1010 - let replace = Fn.update('rule4ShortName', (r) => r.replace(/¥/g, ')); 1010 + let replace = Fn.update('rule4ShortName', (r) => (r ? r.replace(/¥/g, '¥') : ''));
1011 1011
1012 return Fn.map(Fn.pipe(pickProp, encodeId, replace))(couponList); 1012 return Fn.map(Fn.pipe(pickProp, encodeId, replace))(couponList);
1013 } 1013 }
@@ -209,7 +209,7 @@ class FilterTools { @@ -209,7 +209,7 @@ class FilterTools {
209 const condition = {}; 209 const condition = {};
210 210
211 if (k === 'price') { 211 if (k === 'price') {
212 - if (filter.priceRange[params.price]) { 212 + if (filter.priceRange && filter.priceRange[params.price]) {
213 condition.name = filter.priceRange[params.price].replace('¥', '¥'); 213 condition.name = filter.priceRange[params.price].replace('¥', '¥');
214 } else { 214 } else {
215 const prices = _.split(params.price, ','); 215 const prices = _.split(params.price, ',');