Authored by zhangxiaoru

editorial

/**
* 获取各个楼层的数据
* @author: 赵彪<bill.zhao@yoho.cn>
* @date: 2016/08/05
*/
'use strict';
const _ = require('lodash');
/**
* 获取楼层title
* @param {String || Object} 原始title
* @return {Object} 转换后的title
*/
const _getTitle = t => {
const reg = /\w+/g;
let arr = [];
let r;
let cn;
let en;
if (!t) {
return {
en: '',
cn: ''
};
}
if (_.isObject(t)) {
t = t.title;
}
do {
r = reg.exec(t);
if (r) {
arr.push(r[0]);
}
} while (r);
en = arr.join(' ');
cn = t.replace(en, '');
return {
en,
cn
};
};
/**
* 获取slider楼层数据
* @param {Object} d 接口返回的楼层数据
* @return {Object} 处理之后的数据
*/
const getSliderData = d => {
return {
slider: d
};
};
/**
* 获取BrandsAd楼层数据
* @param {Object} d 接口返回的楼层数据
* @return {Object} 处理之后的数据
*/
const getBrandAdFloor = d => {
const list = d.list;
_.forEach(list, data => {
data.btnText = 'shop now';
});
return {
brandsAd: list
};
};
/**
* 获取new arrivals楼层数据
* @param {Object} d 接口返回的楼层数据
* @return {Object} 处理之后的数据
*/
const getNewArrivals = d => {
const list = d.list;
const title = _getTitle(d.title);
_.forEach(list, (data, index) => {
if (index === 0 || index === list.length - 1) {
data.smallImg = true;
}
if (index % 2 !== 0) {
data.even = true;
}
});
return {
floorZh: title.cn,
floorEn: title.en,
newArrivals: list
};
};
/**
* 获取classic brands楼层数据
* @param {Object} d 接口返回的楼层数据
* @return {Object} 处理之后的数据
*/
const getClassicBrands = d => {
let brands = [];
let subArr;
let i = 0;
const list = d.list;
const title = _getTitle(d.title);
_.forEach(list, (data, index) => {
if (index === 0 || index === 1 || index === 6 || index === 7) {
brands.push({
big: [list[index]]
});
} else if ((index > 1 && index < 6 || index > 7 && index < 12) && index % 2 === 0) {
if (i < 4) {
subArr = list.slice(index, index + 2);
brands[i].small = subArr;
i += 1;
}
}
});
_.forEach(brands, (data, index) => {
if (index < 2) {
data.bottomSpace = true;
}
if (index === 1 || index === 3) {
data.right = true;
}
});
return {
floorZh: title.cn,
floorEn: title.en,
classicBrands: brands
};
};
/**
* 获取潮流标志楼层数据
* @param {Object} d 接口返回的楼层数据
* @return {Object} 处理之后的数据
*/
const getStyleIcon = d => {
const list = d.list;
const title = _getTitle(d.title);
_.forEach(list, data => {
data.btnText = '去看看';
});
return {
floorZh: title.cn,
floorEn: title.en,
styleIcon: list
};
};
/**
* 获取广告楼层数据
* @param {Object} d 接口返回的楼层数据
* @return {Object} 处理之后的数据
*/
const getAdBanner = d => {
return {
adBanner: d
};
};
/**
* 获取咨询楼层数据
* @param {Object} d 接口返回的楼层数据
* @return {Object} 处理之后的数据
*/
const getEditorial = d => {
const list = d.list;
const title = _getTitle(d.title);
let e = {
big: {},
small: []
};
_.forEach(list, (data, index) => {
if (index === 0) {
e.big = data;
} else {
e.small.push(data);
}
});
_.forEach(e.small, (data, index) => {
if (index === 0 || index === 1) {
data.bottomSpace = true;
}
if (index === 0 || index === 2) {
data.rightSpace = true;
}
});
return {
floorZh: title.cn,
floorEn: title.en,
editorial: e
};
};
module.exports = {
getSliderData,
getBrandAdFloor,
getNewArrivals,
getClassicBrands,
getStyleIcon,
getAdBanner,
getEditorial
};
... ...
... ... @@ -6,199 +6,90 @@
'use strict';
const channelApi = require('./channel-api');
const floorDataHandler = require('./floor-data-handler');
const camelCase = global.yoho.camelCase;
const _ = require('lodash');
/**
* 获取slider楼层数据
* @param {Object} d 接口返回的楼层数据
* @return {Object} 处理之后的数据
*/
const _getSliderData = d => {
return {
slider: d
};
};
/**
* 获取BrandsAd楼层数据
* 获取模板名为single_image的数据
* @param {Object} d 接口返回的楼层数据
* @return {Object} 处理之后的数据
*/
const _getBrandAdFloor = d => {
_.forEach(d, data => {
data.btnText = 'shop now';
});
return {
brandsAd: d
};
const _processSingleImage = (d) => {
return floorDataHandler.getAdBanner(d);
};
/**
* 获取new arrivals楼层数据
* 获取模板名为focus的数据
* @param {Object} d 接口返回的楼层数据
* @return {Object} 处理之后的数据
*/
const _getNewArrivals = d => {
_.forEach(d, (data, index) => {
if (index === 0 || index === d.length - 1) {
data.smallImg = true;
}
if (index % 2 !== 0) {
data.even = true;
}
});
return {
floorZh: '新品抢鲜看',
floorEn: 'NEW ARRIVALS',
newArrivals: d
};
const _processFocus = (d) => {
return floorDataHandler.getSliderData(d);
};
/**
* 获取classic brands楼层数据
* 获取模板名为blk_brand的数据
* @param {Object} d 接口返回的楼层数据
* @return {Object} 处理之后的数据
*/
const _getClassicBrands = d => {
let brands = [];
let subArr;
let i = 0;
const _processBlkBrand = (d) => {
let len;
_.forEach(d, (data, index) => {
if (index === 0 || index === 1 || index === 6 || index === 7) {
brands.push({
big: [d[index]]
});
} else if ((index > 1 && index < 6 || index > 7 && index < 12) && index % 2 === 0) {
if (i < 4) {
subArr = d.slice(index, index + 2);
brands[i].small = subArr;
i += 1;
}
}
});
if (!d.list) {
return false;
}
_.forEach(brands, (data, index) => {
if (index < 2) {
data.bottomSpace = true;
}
if (index === 1 || index === 3) {
data.right = true;
}
});
len = d.list.length;
return {
floorZh: '经典品牌',
floorEn: 'CLASSIC BRANDS',
classicBrands: brands
};
if (len === 2) {
return floorDataHandler.getBrandAdFloor(d);
} else if (len === 4) {
return floorDataHandler.getStyleIcon(d);
}
};
/**
* 获取潮流标志楼层数据
* 获取模板名为image_list的数据
* @param {Object} d 接口返回的楼层数据
* @return {Object} 处理之后的数据
*/
const _getStyleIcon = d => {
_.forEach(d, data => {
data.btnText = '去看看';
});
const _processImageList = (d) => {
let len;
return {
floorZh: '潮流标志',
floorEn: 'STYLE ICON',
styleIcon: d
};
};
if (!d.list) {
return false;
}
const _getAdBanner = d => {
return {
adBanner: d
};
len = d.list.length;
if (len === 4) {
return floorDataHandler.getNewArrivals(d);
} else if (len === 5) {
return floorDataHandler.getEditorial(d);
}
};
/**
* 获取咨询楼层数据
* 获取模板名为recommend_content_five的数据
* @param {Object} d 接口返回的楼层数据
* @return {Object} 处理之后的数据
*/
const _getEditorial = d => {
let e = {
big: {},
small: []
};
_.forEach(d, (data, index) => {
if (index === 0) {
e.big = data;
} else {
e.small.push(data);
}
});
_.forEach(e.small, (data, index) => {
if (index === 0 || index === 1) {
data.bottomSpace = true;
}
if (index === 0 || index === 2) {
data.rightSpace = true;
}
});
return {
floorZh: '资讯',
floorEn: 'EDITORIAL',
editorial: e
};
const _processRecommendContentFive = (d) => {
return floorDataHandler.getClassicBrands(d);
};
const floorMap = {
slider: _getSliderData,
标题: _getBrandAdFloor,
NEW: _getNewArrivals,
CLASSIC: _getClassicBrands,
STYLE: _getStyleIcon,
EDITORIAL: _getEditorial,
adBanner: _getAdBanner
};
/**
* 获取floorMap中对应的key
* @param {String} d 含有key的字符串
* @return {String} 得到的key值
*/
const _getKey = d => {
let k = d.split(' ')[0];
return k;
};
/**
* 判断title类型是否为对象
* @param {Object} t title
* @return {Boolen}
*/
const _isObjectTitle = t => {
return _.isObject(t);
// 根据templete_name字段找到不同的处理方法
const templateMap = {
single_image: _processSingleImage,
blkBrand: _processBlkBrand,
image_list: _processImageList,
focus: _processFocus,
recommend_content_five: _processRecommendContentFive
};
/**
* 判断是否为Banner焦点图楼层
* @param {Object} d 楼层数据
* @return {Boolen}
*/
const _isBannerFloor = d => {
return d.templateName === 'focus' && d.templateIntro === '焦点图';
};
/**
* 获取用于渲染模板的数据
... ... @@ -209,32 +100,14 @@ const _processFloorData = d => {
let floorList = [];
_.forEach(d, data => {
let floorTitle;
let floorData;
if (!data.data) {
return false;
}
// 处理banner
if (_isBannerFloor(data)) {
floorData = floorMap.slider(data.data);
// 判断标题类型
} else if (_isObjectTitle(data.data.title)) {
floorTitle = _getKey(data.data.title.title);
if (floorMap[floorTitle]) {
floorData = floorMap[floorTitle](data.data.list);
}
} else if (data.data.title) {
floorTitle = _getKey(data.data.title);
if (floorMap[floorTitle]) {
floorData = floorMap[floorTitle](data.data.list);
}
} else if (data.templateName === 'single_image') {
floorData = floorMap.adBanner(data.data);
if (templateMap[data.templateName]) {
floorData = templateMap[data.templateName](data.data);
}
floorList.push(floorData);
... ... @@ -243,6 +116,11 @@ const _processFloorData = d => {
return floorList;
};
/**
* 获取楼层数据
* @param {String} type 当前的频道
* @return {Object} 完整的楼层数据
*/
const getContent = type => {
return channelApi.getChannelDataAsync(type).then(result => {
if (result.data && result.data.list) {
... ... @@ -254,259 +132,6 @@ const getContent = type => {
return floor;
}
});
/* eslint-disable */
const content = {
content: [
{
slider: [
{
img: '//placehold.it/{width}x{height}',
link: '/'
},
{
img: '//img10.static.yhbimg.com/yhb-img01/2016/06/28/11/015a86ade17dc6213bab85b2162adebcd6.jpg?imageView2/2/w/1920/h/650',
link: '/'
},
{
img: '//img10.static.yhbimg.com/yhb-img01/2016/06/23/13/01ebff30179db84975c42a4f3c8b1f4d44.jpg?imageView2/1/w/1150/h/450',
link: '/'
},
{
img: '//img10.static.yhbimg.com/yhb-img01/2016/06/23/13/01ebff30179db84975c42a4f3c8b1f4d44.jpg?imageView2/1/w/1150/h/450',
link: '/'
},
{
img: '//img10.static.yhbimg.com/yhb-img01/2016/06/23/13/01ebff30179db84975c42a4f3c8b1f4d44.jpg?imageView2/1/w/1150/h/450',
link: '/'
},
{
img: '//placehold.it/{width}x{height}',
link: '/'
},
{
img: '//img10.static.yhbimg.com/yhb-img01/2016/06/28/11/015a86ade17dc6213bab85b2162adebcd6.jpg?imageView2/2/w/1150/h/450',
link: '/'
},
{
img: '//img10.static.yhbimg.com/yhb-img01/2016/06/28/11/015a86ade17dc6213bab85b2162adebcd6.jpg?imageView2/2/w/1150/h/450',
link: '/'
},
{
img: '//img10.static.yhbimg.com/yhb-img01/2016/06/28/11/015a86ade17dc6213bab85b2162adebcd6.jpg?imageView2/2/w/1150/h/450',
link: '/'
},
{
img: '//img10.static.yhbimg.com/yhb-img01/2016/06/28/11/015a86ade17dc6213bab85b2162adebcd6.jpg?imageView2/2/w/1150/h/450',
link: '/'
}
]
},
{
brandsAd: [
{
img: '//placehold.it/{width}x{height}',
name: 'GINZA',
des: '藤原浩于银座停车场藤原浩于银座停车场藤原浩于银座停车场藤原浩于银座停车场藤原浩于银座停车场藤原浩于银座停车场藤原浩于银座停车场',
btnText: 'shop now'
},
{
img: '//placehold.it/{width}x{height}',
name: 'STUSSY',
des: '藤原浩于银座停车场藤原浩于银座停车场藤原浩于银座停车场藤原浩于银座停车场藤原浩于银座停车场藤原浩于银座停车场藤原浩于银座停车场',
btnText: 'shop now'
}
]
},
{
floorZh: '新品抢鲜看',
floorEn: 'NEW ARRIVALS',
newArrivals: [
{
img: '//placehold.it/{width}x{height}',
name: 'STUSSY',
link: '/',
smallImg: true
},
{
img: '//placehold.it/{width}x{height}',
name: 'DAILY PAPER',
link: '/',
even: true
},
{
img: '//placehold.it/{width}x{height}',
name: 'BAPE',
link: '/'
},
{
img: '//placehold.it/{width}x{height}',
name: 'SUPREME',
link: '/',
even: true,
smallImg: true
}
]
},
{
floorZh: '经典品牌',
floorEn: 'CLASSIC BRANDS',
classicBrands: [
{
big: [
{
img: '//placehold.it/{width}x{height}',
link: ''
}
],
small: [
{
img: '//img10.static.yhbimg.com/yhb-img01/2016/06/30/10/01714bacda5e9fa323a1dc5f720a7f7140.jpg?imageView2/1/w/185/h/248',
link: ''
},
{
img: '//img10.static.yhbimg.com/yhb-img01/2016/06/30/10/01714bacda5e9fa323a1dc5f720a7f7140.jpg?imageView2/1/w/185/h/248',
link: ''
}
],
bottomSpace: true
},
{
big: [
{
img: '//placehold.it/{width}x{height}',
link: ''
}
],
small: [
{
img: '//placehold.it/{width}x{height}',
link: ''
},
{
img: '//placehold.it/{width}x{height}',
link: ''
}
],
right: true,
bottomSpace: true
},
{
big: [
{
img: '//placehold.it/{width}x{height}',
link: ''
}
],
small: [
{
img: '//placehold.it/{width}x{height}',
link: ''
},
{
img: '//placehold.it/{width}x{height}',
link: ''
}
]
},
{
big: [
{
img: '//placehold.it/{width}x{height}',
link: ''
}
],
small: [
{
img: '//placehold.it/{width}x{height}',
link: ''
},
{
img: '//placehold.it/{width}x{height}',
link: ''
}
],
right: true
}
]
},
{
floorZh: '潮流标志',
floorEn: 'STYLE ICON',
styleIcon: [
{
img: '//placehold.it/{width}x{height}',
name: 'COTE&CIEL',
des: '这都什么时代了?短发女生这都什么时代了?短发女生这都什么时代了?短发女生这都什么时代了?短发女生',
link: '/ ',
btnText: '去看看'
},
{
img: '//placehold.it/{width}x{height}',
name: 'COTE&CIEL',
des: '这都什么时代了?短发女生这都什么时代了?短发女生这都什么时代了?短发女生这都什么时代了?短发女生',
link: '/ ',
btnText: '去看看'
},
{
img: '//placehold.it/{width}x{height}',
name: 'COTE&CIEL',
des: '这都什么时代了?短发女生这都什么时代了?短发女生这都什么时代了?短发女生这都什么时代了?短发女生',
link: '/ ',
btnText: '去看看'
},
{
img: '//placehold.it/{width}x{height}',
name: 'COTE&CIEL',
des: '这都什么时代了?短发女生这都什么时代了?短发女生这都什么时代了?短发女生这都什么时代了?短发女生',
link: '/ ',
btnText: '去看看'
}
]
},
{
adBanner: {
img: '//placehold.it/{width}x{height}',
link: ''
}
},
{
floorZh: '资讯',
floorEn: 'EDITORIAL',
editorial: {
big: {
img: '//placehold.it/{width}x{height}',
link: ''
},
small: [
{
img: '//placehold.it/{width}x{height}',
link: '/',
bottomSpace: true,
rightSpace: true
},
{
img: '//placehold.it/{width}x{height}',
link: '/',
bottomSpace: true
},
{
img: '//placehold.it/{width}x{height}',
link: '/',
rightSpace: true
},
{
img: '//placehold.it/{width}x{height}',
link: ''
}
]
}
}
]
};
/* eslint-enable */
// return content;
};
module.exports = {
... ...
{{# classicBrands}}
<div class="brand-img-box {{#if right}}right{{/if}} {{#if bottomSpace}}mb10{{/if}}">
<a href="{{url}}">
<a href="{{url}}" target="_blank">
{{# big}}
<img class="big-img lazy-img" data-original="{{image src 565 340}}" alt="big-img">
{{/ big}}
... ...
... ... @@ -65,6 +65,7 @@ const getOrderList = (req, res) => {
page: 'order',
isMe: true,
orderList: result.order.orderList,
paginationOpts: result.order.paginationOpts,
orderData: result.order.orderData
});
});
... ...
... ... @@ -16,15 +16,18 @@ const index = (req, res, next) => {
const uid = req.user.uid;
const page = req.query.page;
returns.getUserReturn(uid, page).then(result => {
Promise.all([returns.getUserReturn(uid, page), mcHandler.getMeThumb()]).then(result => {
const pageData = result[0];
const thumb = result[1];
res.display('index', {
page: 'return-list',
isMe: true,
content: Object.assign({
nav: mcHandler.getMeCrumb('我的退/换货'),
navigation: mcHandler.getSideMenu('我的退/换货'),
banner: 'http://placehold.it/{width}x{height}'
}, result)
banner: thumb
}, pageData)
});
}).catch(next);
};
... ...
... ... @@ -43,6 +43,7 @@ const btnMap = {
classStr: 'btn white cancel-btn mr'
},
{
isEditBtn: true,
name: '修改订单',
classStr: 'btn white edit-btn'
}
... ... @@ -518,6 +519,12 @@ const getOrderDetail = (uid, code) => {
}
});
if (detail.canUpdateDeliveryAddress === 'N') {
_.remove(detail.btns, btn => {
return btn.isEditBtn;
});
}
if (parseInt(detail.paymentType, 10) === 2 &&
(statusMap[st].valueStr === '备货中' ||
detail.statusStr === '备货中')) {
... ...
... ... @@ -86,8 +86,8 @@
{{!-- 在线客服和返回顶部 --}}
<div class="service-top">
<a class="service" href="http://chat8.live800.com/live800/chatClient/chatbox.jsp?companyID=703953&configID=149819&jid=1099911094" target="_blank">
<span class="iconfont">&#xe61c;</span>
<span class="hover-text hide">在线<br>客服</span>
<span class="iconfont hide">&#xe61c;</span>
<span class="hover-text">在线<br>客服</span>
</a>
<div class="return-top hide">
<span class="iconfont bold">&#xe617;</span>
... ...
... ... @@ -16,14 +16,15 @@
<td class="width-name">{{consignee}}</td>
<td class="width-address">{{area}}</td>
<td class="width-fulladdress">{{address}}</td>
<td class="width-mobile"><p>{{mobile}}</p><p>{{phone}}</p></td>
<td class="width-mobile"><p>{{mobile}}</p>
<p>{{phone}}</p></td>
<td class="width-opearte">
<div>
<span class="blue opreation update-address" data-id="{{address_id}}">修改</span>
<em class="op-sep">|</em>
<span class="blue opreation del-address" data-id="{{address_id}}">删除</span>
{{#if default}}
<span class="btn set-default opreation current-default ">默认地址</span>
<span class="btn set-default opreation current-default" data-id={{address_id}}>默认地址</span>
{{else}}
<span class="btn set-default opreation " data-id={{address_id}}>设为默认</span>
{{/if}}
... ...
... ... @@ -15,6 +15,5 @@
{{/each}}
</select>
<span class="blue">{{> icon/doubt}}什么是YOHO币</span>
</div>
</div>
... ...
... ... @@ -7,7 +7,7 @@
{{> order/goods-box}}
<div class="common-column special-border">
<p class="bold">¥{{amount}}</p>
<p class="subtext">{{paymentTypeStr}}</p>
<p class="subtext no-pointer">{{paymentTypeStr}}</p>
{{#if isRefundOrder}}
<p class="subtext refund-tag">换货订单</p>
{{/if}}
... ...
... ... @@ -87,15 +87,24 @@ const helpers = {
* 男女条件
* @returns {*[]}
*/
genders() {
return [
{
name: '男士',
value: '1,3'
}, {
name: '女士',
value: '2,3'
}];
genders(gender) {
if (gender) {
return Object.keys(gender).map(g => {
return {
name: gender[g],
value: g
};
});
} else {
return [
{
name: '男士',
value: '1,3'
}, {
name: '女士',
value: '2,3'
}];
}
},
/**
... ... @@ -216,7 +225,7 @@ const helpers = {
filterHandle(filter, q) {
let priceRange = filter.priceRange;
let sizeInfo = filter.size;
let genders = this.genders();
let genders = this.genders(filter.gender);
let brands = filter.brand;
let colors = this.colorConvert(filter.color);
let sorts = filter.groupSort;
... ... @@ -234,20 +243,20 @@ const helpers = {
});
if (sorts) {
// singleSort = true;
//
// if (sorts[0].sub && sorts[0].sub.length === 1) {
// sorts[0].sub[0].checked = true;
// }
//
// if (q.misort) {
// sorts[0].sub.forEach(s => {
// s.checked = s.categoryId === q.misort;
// });
// }
//
// sorts = sorts[0].sub;
// } else if (sorts && sorts.length > 1) {
// singleSort = true;
//
// if (sorts[0].sub && sorts[0].sub.length === 1) {
// sorts[0].sub[0].checked = true;
// }
//
// if (q.misort) {
// sorts[0].sub.forEach(s => {
// s.checked = s.categoryId === q.misort;
// });
// }
//
// sorts = sorts[0].sub;
// } else if (sorts && sorts.length > 1) {
_.forEach(sorts, s => {
s.sub.unshift({
... ...
... ... @@ -140,11 +140,11 @@ const getProductItemData = (params, url, uid) => {
* 获取商品尺寸,颜色,和缩略图
* @function getProductInfo
* @param { Number } productId 商品ID
* @param { String } uid 用户ID
* @param { Number } skn 商品skn
* @param { String } uid 用户ID
* @return { Object } 接口返回单个商品的基本信息
*/
const getProductInfo = (productId, uid, skn) => {
const getProductInfo = (productId, skn, uid) => {
return itemApi.getProductBaseAsync(productId, uid, skn).then(result => {
return itemFun.setProductData(result);
});
... ...
... ... @@ -9,6 +9,13 @@
{{# goodInfo}}
<div class="product-main clearfix" data-id="{{id}}">
<div class="thumbs left clearfix">
<div class="thumb-show right">
<img id="main-thumb" src="{{image img 482 643}}" style="display: block;">
<div class="check-btns">
<span class="iconfont pre-thumb">&#xe62c;</span>
<span class="iconfont next-thumb">&#xe629;</span>
</div>
</div>
<div class="thumb-list hide">
{{# colors}}
<div class="thumb-wrap{{#unless cur}} hide{{/unless}}">
... ... @@ -24,13 +31,6 @@
</div>
{{/ colors}}
</div>
<div class="thumb-show right">
<img id="main-thumb" src="{{image img 482 643}}" style="display: block;">
<div class="check-btns">
<span class="iconfont pre-thumb">&#xe62c;</span>
<span class="iconfont next-thumb">&#xe629;</span>
</div>
</div>
</div>
<div class="infos left clearfix">
<p class="brand-name">{{brandName}}</p>
... ...
... ... @@ -74,7 +74,7 @@
<div class="brand-list nano">
<div class="nano-content">
{{#each brandData}}
<div class="input-radio {{#if checked}}default-check{{/if}}" data-value="{{id}}">
<div class="input-radio {{#if checked}}default-check{{/if}}" data-value="{{id}}" data-word="{{brandAlif}}">
{{> icon/radio}}
{{#if brandNameEn}}
<label>{{brandNameEn}}</label>
... ...
... ... @@ -79,13 +79,13 @@ const callback = (req, res) => {
if (result.code === 200) {
let data = result.data;
res.render('pay-success', {
res.display('pay-success', {
defaultHeader: false,
content: {
cost: data.pay,
orderNum: data.orderCode,
onlineCost: data.pay,
orderHref: helpers.urlFormat('/me/order/detail', {code: data.orderCode}),
orderHref: helpers.urlFormat('/me/order/detail', {orderCode: data.orderCode}),
walkHref: helpers.urlFormat('/')
}
});
... ...
... ... @@ -18,7 +18,7 @@ const pay = require(`${cRoot}/pay`); // 支付
router.get('/cart', cartCtrl.index);
router.post('/cart/product/change_num', cartCtrl.changeProductNum);
router.delete('/cart/product/remove', cartCtrl.removeProduct);
router.post('/cart/product/send_to_favorite', cartCtrl.sendToFavorite);
router.post('/cart/product/send_to_favorite', auth, cartCtrl.sendToFavorite);
router.post('/cart/add', cartCtrl.addToCart);
router.post('/cart/toggleSelectGoods', cartCtrl.toggleSelectGoods);
router.get('/cart/checkStorage', cartCtrl.checkStorage);
... ...
... ... @@ -21,7 +21,7 @@
1.每天15:00以前成功支付的订单将在当天发货,15:00-00:00成功付款的订单将在第二天发货。
2.当订单发货后,您可以登录<a class="blue" href="/me/order">订单中心</a>查询快递发货详情。
3.YOHO!BLK有货支持“开箱验货”和“15天退换货保障”收货后请当面验货,如果发现商品有任何问题请致电客服电话400-889-9646,
<a class="blue" href="">“退换货政策”</a>请点击查看。<em class="blue">4.尊敬的用户:近期为网络诈骗高发期,YOHO!BLK有货郑重声明,不会以任何形式索取客户的账户信息或引导转账,敬请提高警惕,谨防诈骗</em>
<a class="blue" href="/help?id=43">“退换货政策”</a>请点击查看。<em class="blue">4.尊敬的用户:近期为网络诈骗高发期,YOHO!BLK有货郑重声明,不会以任何形式索取客户的账户信息或引导转账,敬请提高警惕,谨防诈骗</em>
</p>
</div>
{{/ content}}
... ...
... ... @@ -33,9 +33,9 @@
{{/if}}
<span class="iconfont">&#xe63c;</span>
</div>
{{#expect_arrival_time}}
{{#if expect_arrival_time}}
<div class="published-at">上市期: {{expect_arrival_time}}</div>
{{/expect_arrival_time}}
{{/if}}
</li>
<li class="price-num">
<span class="price sale-price">¥ {{round sales_price 2}}</span>
... ...
... ... @@ -8,7 +8,7 @@
</label>
</div>
<div class="item product">货品</div>
<div class="item price">价格</div>
<div class="item price">单价</div>
<div class="item num">数量</div>
<div class="item pro-total-price">总价</div>
<div class="item actions">操作</div>
... ...
... ... @@ -7,7 +7,7 @@
</p>
{{^}}
<p class="info-text">
温馨提示: 亲爱的顾客,您还没有<a href="/passport/login">登录</a>哦, 所有的商品价、活动信息以登录后显示为准。
温馨提示: 亲爱的顾客,您还没有<a href="/passport/login">登录</a>哦, 所有的商品价、活动信息以登录后显示为准。
<span class="iconfont pull-right close">&#xe608;</span>
</p>
{{/if}}
... ...
... ... @@ -84,7 +84,7 @@ const getBrandItems = (data) => {
_.forEach(data, item => {
brandItems.push({
link: item.sort_url,
hot: item.is_hot === 'Y' ? true : false,
hot: item.is_hot === 'Y',
name: item.sort_name
});
});
... ... @@ -103,16 +103,15 @@ const getThirdNav = (data) => {
_.forEach(data, item => {
let obj = {
link: item.sort_url,
name: item.sort_name
hot: item.is_hot === 'Y',
name: item.sort_name,
category: true
};
thirdNav.push(obj);
if (item.sub) {
thirdNav = _.concat(thirdNav, getBrandItems(item.sub));
obj.category = true;
// obj.brandItems = getBrandItems(item.sub);
}
});
... ... @@ -183,6 +182,9 @@ const requestNavBar = (type) => {
cache: true,
code: 200
}).then(res => {
if (!res) {
return {};
}
return setHeaderData(res.data, type);
});
};
... ...
... ... @@ -10,6 +10,7 @@
<meta name="apple-mobile-web-app-status-bar-style" content="black" />
<meta content="telephone=no" name="format-detection" />
<meta content="email=no" name="format-detection" />
<meta name="renderer" content="webkit">
<link rel="dns-prefetch" href="//cdn.yoho.cn">
<link rel="dns-prefetch" href="//static.yohobuy.com">
<link rel="dns-prefetch" href="//img12.static.yhbimg.com">
... ...
... ... @@ -35,6 +35,9 @@
{{#if category}}
<dt>
<a href="{{link}}">{{name}}</a>
{{#if hot}}
<span class="hot"></span>
{{/if}}
</dt>
{{^}}
<dd>
... ...
... ... @@ -7,7 +7,7 @@ module.exports = function(leftNumber) {
leftNumber = typeof num1 === 'number' ? leftNumber : parseFloat(leftNumber, 10);
if (leftNumber <= 3 && leftNumber >= 0) {
return `仅剩${leftNumber}件`;
return '仅剩' + leftNumber + '件';
} else if (leftNumber < 0) {
return '库存不足';
}
... ...
... ... @@ -17,6 +17,19 @@ function showOrNot() {
}
}
function reposReturnTop() {
var $top = $returnTop.parent();
if (!$top.hasClass('service-top')) {
$top = $returnTop;
}
if ($(window).width() < 1380) {
$top.addClass('for-min');
} else {
$top.removeClass('for-min');
}
}
$returnTop.click(function() {
$('html,body').animate({
scrollTop: 0
... ... @@ -36,4 +49,10 @@ if ($returnTop.hasClass('hide')) {
$('img').load(showOrNot);
}
reposReturnTop();
if ($returnTop.length) {
$(window).resize(reposReturnTop);
}
exports.returnTopShowOrNot = showOrNot;
... ...
... ... @@ -25,11 +25,11 @@ require('../common/return-top'); // return-top
lazyLoad($('.banner-img'));
// 浮动在线客服和返回顶部的鼠标移入移出切换效果
$('.service, .return-top').hover(function() {
$(this).find('.iconfont').addClass('hide').end().find('.hover-text').removeClass('hide');
}, function() {
$(this).find('.iconfont').removeClass('hide').end().find('.hover-text').addClass('hide');
});
function toggleShow(e) {
$(e.target).find('span').toggleClass('hide');
}
$('.service, .return-top').hover(toggleShow, toggleShow);
// repos service-return when window resize
$(window).resize(reposServiceTop);
... ...
... ... @@ -19,7 +19,6 @@ var confirmReceive = require('./order/confirm-receive');
// 订单剩余时间显示及倒计时
var countDown = require('./order/countdown');
require('../common/foreach-polyfill');
// 更新表格
var tableOperation = {
... ... @@ -41,6 +40,8 @@ var typeMap = {
delivering: 3
};
require('../common/foreach-polyfill');
// 个人中心共用代码加载
require('./me');
... ... @@ -150,9 +151,9 @@ function updateTableContent($el) {
// 绑定分页点击事件
function bindPaginationClick() {
$('.blk-pagination li').off('click').on('click', function(e) {
$('.blk-pagination a').off('click').on('click', function(e) {
var $this = $(this);
var page = $this.find('a').attr('href').split('=')[1];
var page = $this.attr('href').split('=')[1];
var type = getCurrentTabType();
e.preventDefault();
... ...
var _alert = require('../plugins/dialog').Alert;
var lazyLoad = require('yoho-jquery-lazyload');
lazyLoad($('img.banner-img'));
$('.cancel-apply').on('click', function() {
var id = $(this).data('applyId');
... ...
... ... @@ -338,16 +338,18 @@ var YohoListPage = {
},
filterBrand: function(letter) {
$('.yoho-product-list .brand-list .input-radio').each(function() {
if (letter === '0-9') {
var first = $('label', this).text().toLowerCase().charAt(0); // eslint-disable-line
var first = $(this).data('word').toString(); // eslint-disable-line
first = first.toLowerCase();
if (letter === '0-9') {
console.log(first);
if ((first >= 'a' && first <= 'z') || (first >= 'A' && first <= 'Z')) {
$(this).hide();
} else {
$(this).show();
}
} else {
if ($('label', this).text().toLowerCase().indexOf(letter) === 0) {
if (!letter || first === letter) {
$(this).show();
} else {
$(this).hide();
... ...
... ... @@ -72,8 +72,8 @@ $(function() {
// 编辑商品颜色和属性
Cart.editColorOrSize(
$this.attr('data-productId'),
$this.attr('data-productSkn'),
$this.attr('data-productid'),
$this.attr('data-productskn'),
$this.find('.default-color').text(),
$this.find('.default-size').text(), function() {
editable = true;
... ... @@ -91,7 +91,7 @@ $(function() {
if ($('.chk-group').length) {
// 防止回退history.go(-1)时页面状态不改变
// 这里可以添加loading效果
window.location.reload();
// window.location.reload();
Cart.checkStorage(function() {
if (!$(this).hasClass('disable')) {
window.location.href = '/shopping/order';
... ...
... ... @@ -22,7 +22,19 @@ var removedProsInfo = [];
var removedGoodsTpl = require('../../../tpl/shopping/removed-goods.hbs');
var editTpl = require('../../../tpl/shopping/edit-color-size.hbs');
var Cart = {
var Cart;
require('yoho-jquery-dotdotdot');
function dotName() {
// product name dotdotdot
$('.pro-name a').dotdotdot({
wrap: 'letter'
});
}
Cart = {
/*
* 添加到购物车
* @function [addToCart]
... ... @@ -111,6 +123,7 @@ var Cart = {
success: function(res) {
Util.refreshCart(res, function() {
Stepper.init();
if (callback) {
return callback();
}
... ... @@ -298,6 +311,7 @@ var Cart = {
success: function(res) {
Util.refreshCart(res, function() {
Stepper.init();
if (callback) {
return callback();
}
... ... @@ -445,6 +459,9 @@ var Cart = {
},
fail: function() {
new _alert('此商品无法编辑颜色和尺寸').show();
},
complete: function() {
setEditable();
}
});
... ... @@ -471,4 +488,6 @@ var Cart = {
}
};
dotName();
module.exports = Cart;
... ...
... ... @@ -11,8 +11,15 @@
position: relative;
h4 {
height: 18px;
line-height: 18px;
padding-right: 10px;
display: -webkit-box;
font-size: 16px;
font-weight: bold;
overflow: hidden;
-webkit-line-clamp: 1;
-webkit-box-orient: vertical;
}
p {
... ...
... ... @@ -53,7 +53,7 @@
img {
width: 1150px;
height: auto;
height: $sliderHeight;
}
}
}
... ...
... ... @@ -79,10 +79,9 @@
border: 1px solid #404040;
border-left: none;
* {
p,
h4 {
display: block;
}
p {
display: -webkit-box;
}
}
... ...
... ... @@ -42,8 +42,10 @@
color: #fff;
}
&.min {
margin-left: 505px;
&.for-min {
right: 20px;
left: auto;
margin-left: auto;
}
}
}
... ...
... ... @@ -14,6 +14,10 @@
margin: $space 0;
}
.no-pointer {
cursor: auto !important;
}
.refund-tag {
width: 55%;
padding: 5px 0;
... ... @@ -122,7 +126,7 @@
.iconfont {
font-weight: normal;
color: #000000;
color: #000;
}
&.last {
... ...
... ... @@ -112,9 +112,6 @@ $hoverColor: #379ed6;
width: 234px;
word-wrap: break-word;
margin-bottom: 13px;
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 2;
line-height: 1.3em;
overflow: hidden;
:hover {
... ...