Authored by biao

Merge branch 'release/1.0' of http://git.yoho.cn/fe/yoho-blk into release/1.0

/**
* [个人中心]收货地址
* @author: jiangmin
* @date: 2016/07/05
*/
... ... @@ -23,10 +22,11 @@ const _setDefault = (id, uid) => {
const index = (req, res, next) => {
let uid = req.user.uid;
addressModel.getAddressDataAsync(uid, 20).then(result => {
let resultData = result.data ? result.data : result;
let length = resultData.length ? (resultData.length > 7 ? 7 : resultData.length) : 0;
Promise.all([addressModel.getAddressDataAsync(uid, 20), mcHandler.getMeThumb()]).then(result => {
let resultData = result[0].data ? result[0].data : [];
let length = resultData.length > 7 ? 7 : resultData.length;
let reg = /(\d{3})\d{4}(\d{4})/;
let thumb = result[1];
for (let i = 0; i < length; i++) {
resultData[i].default = resultData[i].is_default === 'Y';
... ... @@ -34,6 +34,7 @@ const index = (req, res, next) => {
}
resultData.leftLength = 7 - length;
resultData.length = length;
res.display('index', {
module: 'me',
page: 'address',
... ... @@ -41,7 +42,7 @@ const index = (req, res, next) => {
content: {
nav: mcHandler.getMeCrumb('收货地址'),
navigation: mcHandler.getSideMenu('收货地址'),
banner: 'http://placehold.it/150x120',
banner: thumb,
address: true,
title: '收货地址',
data: resultData
... ...
... ... @@ -47,14 +47,16 @@ const index = (req, res, next) => {
let date2 = getDate(beginTime);
let selectIndex = parseInt((date1 - date2) / (90 * 3600 * 24), 10);
currencyModel.getIndexData(uid, page, queryType, beginTime).then(result=> {
result.list.tabs[queryType].isActive = true;
result.list.coinList.forEach(function(x) {
Promise.all([currencyModel.getIndexData(uid, page, queryType, beginTime), mcHandler.getMeThumb()]).then(result => {
const thumb = result[1];
result[0].list.tabs[queryType].isActive = true;
result[0].list.coinList.forEach(function(x) {
x.date = x.date.replace(/\-/g, '.');
});
result.list.selects[selectIndex > 2 ? 2 : selectIndex].isSelected = 'selected';
if (result.list.paginationOpts) {
result.list.paginationOpts.queryParams = {
result[0].list.selects[selectIndex > 2 ? 2 : selectIndex].isSelected = 'selected';
if (result[0].list.paginationOpts) {
result[0].list.paginationOpts.queryParams = {
queryType: queryType,
beginTime: beginTime
};
... ... @@ -67,16 +69,16 @@ const index = (req, res, next) => {
content: {
nav: mcHandler.getMeCrumb('我的YOHO币'),
navigation: mcHandler.getSideMenu('我的YOHO币'),
banner: 'http://placehold.it/150x120',
banner: thumb,
currency: true,
tabs: result.list.tabs,
tabs: result[0].list.tabs,
title: '我的YOHO币',
currentYear: new Date().getFullYear(),
data: result.list.coinList,
paginationOpts: result.list.paginationOpts,
num: result.num.data,
selects: result.list.selects,
total: result.list.total ? result.list.total : 0
data: result[0].list.coinList,
paginationOpts: result[0].list.paginationOpts,
num: result[0].num.data,
selects: result[0].list.selects,
total: result[0].list.total ? result[0].list.total : 0
}
});
}).catch(next);
... ...
... ... @@ -36,13 +36,15 @@ const favorite = {
}
};
FavoriteData.getFavoriteProduct({
Promise.all([FavoriteData.getFavoriteProduct({
page: 1,
limit: 500,
uid: uid
}).then(result => {
if (result && result.code === 200 && result.data) {
let data = camelCase(result.data);
}), mcHandler.getMeThumb()]).then(result => {
let thumb = result[1];
if (result[0] && result[0].code === 200 && result[0].data) {
let data = camelCase(result[0].data);
let retData = {
siteUrl: config.siteUrl
};
... ... @@ -84,12 +86,11 @@ const favorite = {
});
ret.content.favorite.data = retData;
ret.content.banner = thumb;
}
res.display('index', ret);
}).catch(next);
},
// 品牌收藏页
... ... @@ -115,13 +116,15 @@ const favorite = {
}
};
FavoriteData.getFavoriteBrand({
Promise.all([FavoriteData.getFavoriteBrand({
page: page,
limit: limit,
uid: uid
}).then(result => {
if (result && result.code === 200 && result.data) {
let data = camelCase(result.data);
}), mcHandler.getMeThumb()]).then(result => {
let thumb = result[1];
if (result[0] && result[0].code === 200 && result[0].data) {
let data = camelCase(result[0].data);
let retData = {
siteUrl: config.siteUrl
};
... ... @@ -148,6 +151,7 @@ const favorite = {
});
}
ret.content.favorite.data = retData;
ret.content.banner = thumb;
}
res.display('index', ret);
... ... @@ -177,13 +181,15 @@ const favorite = {
}
};
FavoriteData.getFavoriteEditoreial({
Promise.all([FavoriteData.getFavoriteEditoreial({
uid: uid,
page: page,
limit: limit
}).then(result => {
if (result && result.code === 200 && result.data) {
let data = camelCase(result.data);
}), mcHandler.getMeThumb()]).then(result => {
let thumb = result[1];
if (result[0] && result[0].code === 200 && result[0].data) {
let data = camelCase(result[0].data);
let retData = {
siteUrl: config.siteUrl,
editorialList: data.data
... ... @@ -199,6 +205,7 @@ const favorite = {
};
ret.content.favorite.data = retData;
ret.content.banner = thumb;
}
res.display('index', ret);
}).catch(next);
... ...
... ... @@ -43,10 +43,24 @@ const refund = (req, res, next) => {
return next();
}
returns.getRefundGoodsData(code, uid).then(result => {
// returns.getRefundGoodsData(code, uid).then(result => {
// res.display('index', {
// page: 'refund',
// content: result
// });
// }).catch(next);
Promise.all([returns.getRefundGoodsData(code, uid), mcHandler.getMeThumb()]).then(result => {
let refundGoods = result[0];
let thumb = result[1];
res.display('index', {
page: 'refund',
content: result
content: Object.assign({
nav: mcHandler.getMeCrumb('我的退/换货'),
navigation: mcHandler.getSideMenu('我的退/换货'),
banner: thumb
}, refundGoods)
});
}).catch(next);
};
... ... @@ -85,10 +99,17 @@ const refundDetail = (req, res, next) => {
return next();
}
returns.getRefundDetailData(applyId, uid).then(result => {
Promise.all([returns.getRefundDetailData(applyId, uid), mcHandler.getMeThumb()]).then(result => {
let refundDetailData = result[0];
let thumb = result[1];
res.display('index', {
page: 'refund-detail',
content: result
content: Object.assign({
nav: mcHandler.getMeCrumb('我的退/换货'),
navigation: mcHandler.getSideMenu('我的退/换货'),
banner: thumb
}, refundDetailData)
});
}).catch(next);
};
... ... @@ -100,15 +121,18 @@ const exchange = (req, res, next) => {
const code = parseInt(req.query.orderCode, 10);
const uid = req.user.uid;
returns.getChangeGoodsList(code, uid).then(result => {
Promise.all([returns.getChangeGoodsList(code, uid), mcHandler.getMeThumb()]).then(result => {
let exchangeData = result[0];
let thumb = result[1];
res.display('index', {
page: 'exchange',
isMe: true,
content: Object.assign({
nav: mcHandler.getMeCrumb('我的退/换货'),
navigation: mcHandler.getSideMenu('我的退/换货'),
banner: 'http://placehold.it/{width}x{height}'
}, result)
banner: thumb
}, exchangeData)
});
}).catch(next);
};
... ... @@ -136,7 +160,8 @@ const exchangeDeatail = (req, res) => {
let id = parseInt(req.query.orderCode, 10),
uid = req.user.uid;
returns.getExchangeDetailData(id, uid).then(result => {
Promise.all([returns.getExchangeDetailData(id, uid), mcHandler.getMeThumb()]).then(result => {
let thumb = result[1];
res.display('index', {
page: 'exchange-detail',
... ... @@ -144,14 +169,13 @@ const exchangeDeatail = (req, res) => {
content: {
nav: mcHandler.getMeCrumb('我的退/换货'),
navigation: mcHandler.getSideMenu('我的退/换货'),
banner: 'http://placehold.it/{width}x{height}',
banner: thumb,
returns: {
title: '换货申请',
exchange: result.exchangeDetail
exchange: result[0].exchangeDetail
}
}
});
});
};
... ...
... ... @@ -79,26 +79,28 @@ const _getTitle = (type)=> {
const index = (req, res, next) => {
let uid = req.user.uid;
settingModel.getUserInfo(uid).then(result=> {
result.info.gender ? result.genders[result.info.gender - 1].checked = true :
result.genders[2].checked = true;
result.info.head_ico = result.info.head_ico ? helpers.image(result.info.head_ico, 400, 300, 2) : '';
result.info.mobile = result.info.mobile ? result.info.mobile.replace(regMobile, '$1****$2') : '';
result.stepUrl = '/me/setting/step1';
if (result.info.birthday) {
let a = result.info.birthday.split('-');
_.forEach(result.date.selectYear, function(x) {
Promise.all([settingModel.getUserInfo(uid), mcHandler.getMeThumb()]).then(result => {
const thumb = result[1];
result[0].info.gender ? result[0].genders[result[0].info.gender - 1].checked = true :
result[0].genders[2].checked = true;
result[0].info.head_ico = result[0].info.head_ico ? helpers.image(result[0].info.head_ico, 400, 300, 2) : '';
result[0].info.mobile = result[0].info.mobile ? result[0].info.mobile.replace(regMobile, '$1****$2') : '';
result[0].stepUrl = '/me/setting/step1';
if (result[0].info.birthday) {
let a = result[0].info.birthday.split('-');
_.forEach(result[0].date.selectYear, function(x) {
if (x.value === a[0]) {
x.isSelected = 'selected';
}
});
_.forEach(result.date.selectMonth, function(x) {
_.forEach(result[0].date.selectMonth, function(x) {
if (parseInt(x.value, 10) === parseInt(a[1], 10)) {
x.isSelected = 'selected';
}
});
_.forEach(result.date.selectDay, function(x) {
_.forEach(result[0].date.selectDay, function(x) {
if (parseInt(x.value, 10) === parseInt(a[2], 10)) {
x.isSelected = 'selected';
}
... ... @@ -112,10 +114,10 @@ const index = (req, res, next) => {
content: {
nav: mcHandler.getMeCrumb('个人设置'),
navigation: mcHandler.getSideMenu('个人设置'),
banner: 'http://placehold.it/150x120',
banner: thumb,
setting: true,
title: '个人设置',
userInfo: result
userInfo: result[0]
}
});
}).catch(next);
... ...
... ... @@ -62,7 +62,7 @@ const navigation = [
const getMeCrumb = name => {
return [
{
link: blk.config.sitUrl,
link: blk.config.siteUrl,
name: 'YOHO!BLK首页'
},
{
... ...
var $ = require('yoho-jquery'),
Confirm = require('../plugins/dialog').Confirm;
Confirm = require('../plugins/dialog').Confirm,
lazyLoad = require('yoho-jquery-lazyload');
var id = $('.exchange-detail-page').data('id');
... ... @@ -14,6 +15,8 @@ var $expressCompany = $('.express-company'),
var expressList = $editExpress.data(),
remark = $('.reason-info').find('span').text().length;
lazyLoad($('.banner-img'));
function cancelExchangeApply() {
$.ajax({
type: 'POST',
... ...
var colorTpl = require('../../tpl/me/color-list.hbs');
var sizeTpl = require('../../tpl/me/size-list.hbs');
var lazyLoad = require('yoho-jquery-lazyload');
var dialog = require('../plugins/dialog');
var _alert = dialog.Alert;
... ... @@ -42,6 +43,8 @@ var validateMap = {
}
};
lazyLoad($('.banner-img'));
// 添加.check方法
require('../plugins/check');
... ...
... ... @@ -25,6 +25,8 @@ require('yoho-jquery-dotdotdot');
require('../common/header'); // header
require('../common/return-top'); // return-top
lazyload($('.banner-img'));
// dot
$('.goods-item .title').dotdotdot({
wrap: 'letter'
... ...
... ... @@ -26,6 +26,8 @@ var imgBoxTpl = require('../../tpl/me/thumbnail.hbs');
var checked;
lazyload($('.banner-img'));
$('.blk-footer .return-top').remove(); // 移除通用的返回顶部组件
require('yoho-jquery-dotdotdot');
... ...