Authored by weiqingting

个人中心优化

/**
* 个人中心二维码 controller
* @author: weiqingting<qingting.wei@yoho.cn>
* @date: 2016/05/16
*/
'use strict';
const Promise = require('bluebird');
... ...
/**
* 个人中心二维码 controller
* @author: weiqingting<qingting.wei@yoho.cn>
* @date: 2016/05/16
*/
'use strict';
const Promise = require('bluebird');
... ...
/**
* 个人中心二维码 controller
* @author: weiqingting<qingting.wei@yoho.cn>
* @date: 2016/05/16
*/
'use strict';
const Promise = require('bluebird');
... ...
/**
* @author: weiqingting<qingting.wei@yoho.cn>
*/
'use strict';
const api = global.yoho.API;
const getByNodeContent = ($node, $mode)=>{
$mode = $mode || 'release';
const getByNodeContent = (node, mode)=>{
mode = mode || 'release';
let options = {
method: 'web.html.content',
mode: $mode,
node: $node
mode: mode,
node: node
};
return api.get('', options);
};
... ...
/**
* @author: weiqingting<qingting.wei@yoho.cn>
*/
const exchangeDay = 15;
const $exchangeDay = 15;
const $refundDay = 7;
const refundDay = 7;
module.exports = {
$exchangeDay,
$refundDay
exchangeDay,
refundDay
};
... ...
/**
* @author: weiqingting<qingting.wei@yoho.cn>
*/
'use strict';
const helpers = global.yoho.helpers;
const api = global.yoho.API;
const yohoCoinList=($uid, $condition)=>{
$condition=$condition||{};
const yohoCoinList=(uid, condition)=>{
condition=condition||{};
let options = {
method: 'app.yohocoin.lists',
uid: $uid,
uid: uid,
page: 1,
limit: 15
};
Object.assign(options,$condition);
Object.assign(options,condition);
return api.get('', options);
}
... ...
/**
* @author: weiqingting<qingting.wei@yoho.cn>
*/
'use strict';
const Promise = require('bluebird');
... ... @@ -21,105 +24,105 @@ const convertUnitTime = (src) => {
return moment.unix(src).format('YYYY-MM-DD');
};
const currencyData=($uid, $condition)=>{
const currencyData=(uid, condition)=>{
return co(function*(){
let $result={};
let $yohoCoinInfo=yield CurrencyData.yohoCoinTotal($uid);
console.log($yohoCoinInfo);
if($yohoCoinInfo.code&& $yohoCoinInfo.code == 200){
let $yohoCoinInfoData=$yohoCoinInfo.data;
$result.myCurrency = $yohoCoinInfoData.yohocoin_num ? $yohoCoinInfoData.yohocoin_num : 0;
if ($yohoCoinInfoData.nearExpCoinNum && $yohoCoinInfoData.nearExpCoinNum > 0) {
$result.tip.count =$yohoCoinInfoData.nearExpCoinNum;
$result.tip.date ='Y年12月31日';
let result={};
let yohoCoinInfo=yield CurrencyData.yohoCoinTotal(uid);
console.log(yohoCoinInfo);
if(yohoCoinInfo.code&& yohoCoinInfo.code == 200){
let yohoCoinInfoData=yohoCoinInfo.data;
result.myCurrency = yohoCoinInfoData.yohocoin_num ? yohoCoinInfoData.yohocoin_num : 0;
if (yohoCoinInfoData.nearExpCoinNum && yohoCoinInfoData.nearExpCoinNum > 0) {
result.tip.count =yohoCoinInfoData.nearExpCoinNum;
result.tip.date ='Y年12月31日';
}
}
let $currency =yield currencyList($uid, $condition);
$result.currency = $currency.list;
$result.pager = $currency.pager;
$result.coinHelperUrl = '//www.yohobuy.com/help/?category_id=87';//yoho币帮助
$result.tabs = currencyTabs($condition.queryType);
$result.options = currencyOptions($condition);
return $result;
let currency =yield currencyList(uid, condition);
result.currency = currency.list;
result.pager = currency.pager;
result.coinHelperUrl = '//www.yohobuy.com/help/?category_id=87';//yoho币帮助
result.tabs = currencyTabs(condition.queryType);
result.options = currencyOptions(condition);
return result;
})();
}
const currencyList=($uid,$condition)=>{
const currencyList=(uid,condition)=>{
return co(function*(){
let $result={'list':[], 'pager':[]};
$condition.limit=$condition.limit||15;
let result={'list':[], 'pager':[]};
condition.limit=condition.limit||15;
let $data = yield CurrencyData.yohoCoinList($uid, $condition);
let data = yield CurrencyData.yohoCoinList(uid, condition);
if ($data.code&& $data.code ==200 && $data.data.coinlist && !_.isEmpty($data.data.coinlist)) {
// $data.data.coinlist.forEach(function($val,$key){
for(let $key=0;$key<$data.data.coinlist.length;$key++){
let $val=$data.data.coinlist[$key];
$result.list[$key]={
date:$val['date'],
desc:$val['message'],
if (data.code&& data.code ==200 && data.data.coinlist && !_.isEmpty(data.data.coinlist)) {
// data.data.coinlist.forEach(function(val,key){
for(let key=0;key<data.data.coinlist.length;key++){
let val=data.data.coinlist[key];
result.list[key]={
date:val['date'],
desc:val['message'],
isIncome:true
}
//2:订单取消退还,9:下单使用,10:退货退还
if ([2,9,10].indexOf($val.type)>-1 && $val.key) {
$result.list[$key].detailUrl = helpers.urlFormat('/home/orders/detail', {orderCode:$val['key']});
if ([2,9,10].indexOf(val.type)>-1 && val.key) {
result.list[key].detailUrl = helpers.urlFormat('/home/orders/detail', {orderCode:val['key']});
}
//晒单奖励
else if ($val.type == 14 && $val.key) {
let $product = yield SearchData.searchAll({query:Number($val.key),viewNum:1});
if ($product.code && $product.code== 200 && !_.isEmpty($product.data.product_list) && !_.isEmpty($product.data.product_list[0].goods_list)) {
$productId = $product.data.product_list[0].product_id;
$goodsId = $product.data.product_list[0].goods_list[0].goods_id;
$result.list[$key].detailUrl = helpers.getUrlBySkc($productId, $goodsId, $product.data.product_list[0].cn_alphabet);
else if (val.type == 14 && val.key) {
let product = yield SearchData.searchAll({query:Number(val.key),viewNum:1});
if (product.code && product.code== 200 && !_.isEmpty(product.data.product_list) && !_.isEmpty(product.data.product_list[0].goods_list)) {
productId = product.data.product_list[0].product_id;
goodsId = product.data.product_list[0].goods_list[0].goods_id;
result.list[key].detailUrl = helpers.getUrlBySkc(productId, goodsId, product.data.product_list[0].cn_alphabet);
}
}
if (Number($val['num']) < 0) {
$result.list[$key].isIncome = false;
if (Number(val['num']) < 0) {
result.list[key].isIncome = false;
}
$result.list[$key].value = $val['num'] > 0 ? '+'+$val['num'] : $val['num'] ;
result.list[key].value = val['num'] > 0 ? '+'+val['num'] : val['num'] ;
}
//分页
let total = $data.data.total;
let total = data.data.total;
let pagerObj = pager(total, {
page: $data['data']['page'],
limit: $condition['limit']
page: data['data']['page'],
limit: condition['limit']
});
// $result['pager']={};
// $result['pager']['hasCheckAll'] = false;
// $result['pager']['count'] = $data['data']['total'];
// $result['pager']['curPage'] = $data['data']['page'];
// $result['pager']['totalPages'] = Math.ceil($data['data']['total'] / $condition['limit']);
// $result['pager']['pagerHtml'] = HelperSearch::pager($data['data']['total'], $condition['limit']);
// result['pager']={};
// result['pager']['hasCheckAll'] = false;
// result['pager']['count'] = data['data']['total'];
// result['pager']['curPage'] = data['data']['page'];
// result['pager']['totalPages'] = Math.ceil(data['data']['total'] / condition['limit']);
// result['pager']['pagerHtml'] = HelperSearch::pager(data['data']['total'], condition['limit']);
}
return $result;
return result;
})();
}
const currencyTabs=($type)=>{
let $result=['全部明细', '全部收入', '全部支出'];
$result=$result.forEach(function($val,$key){
const currencyTabs=(type)=>{
let result=['全部明细', '全部收入', '全部支出'];
result=result.forEach(function(val,key){
return {
active:$key == $type ? true : false,
url:helpers.urlFormat('/home/currency',{type:$key})
active:key == type ? true : false,
url:helpers.urlFormat('/home/currency',{type:key})
}
});
return $result;
return result;
}
const currencyOptions=($condition)=>{
let $result=[],$paramUrl={};
let $tabs={'90':'最近3个月明细','180':'最近半年明细','360':'最近一年明细'};
for(let name in $tabs){
if($condition.queryType){
$paramUrl.type = $condition.queryType;
const currencyOptions=(condition)=>{
let result=[],paramUrl={};
let tabs={'90':'最近3个月明细','180':'最近半年明细','360':'最近一年明细'};
for(let name in tabs){
if(condition.queryType){
paramUrl.type = condition.queryType;
}
$paramUrl.beginTime = convertUnitTime(new Date() / 1000 - 3600 * 24 );
$result.push({
url:helpers.urlFormat('/home/currency',$paramUrl),
name:$tabs[name],
selected:$condition.beginTime&&$paramUrl.beginTime == $condition.beginTime ? true : false
paramUrl.beginTime = convertUnitTime(new Date() / 1000 - 3600 * 24 );
result.push({
url:helpers.urlFormat('/home/currency',paramUrl),
name:tabs[name],
selected:condition.beginTime&&paramUrl.beginTime == condition.beginTime ? true : false
});
}
return $result;
return result;
}
module.exports = {
... ...
/**
* @author: weiqingting<qingting.wei@yoho.cn>
*/
'use strict';
const helpers = global.yoho.helpers;
const Images = require('../../../utils/Images');
const formatFavBrand = ($brandInfo, $i)=>{
$i = $i || 10;
let $hotBrands = [];
if ($brandInfo.length > 0) {
for (let i = 0; i < $brandInfo.length; i++) {
let $value = $brandInfo[i];
if ($value.is_hot && $value.is_hot == 'Y') {
$hotBrands.push({
'href': helpers.urlFormat('', '', $value['brand_domain']),
'logo': Images.getSourceUrl($value['brand_ico'], 'brandLogo'),
'name': $value.brand_name
const formatFavBrand = (brandInfo, i)=>{
i = i || 10;
let hotBrands = [];
if (brandInfo.length > 0) {
for (let i = 0; i < brandInfo.length; i++) {
let value = brandInfo[i];
if (value.is_hot && value.is_hot == 'Y') {
hotBrands.push({
'href': helpers.urlFormat('', '', value['brand_domain']),
'logo': Images.getSourceUrl(value['brand_ico'], 'brandLogo'),
'name': value.brand_name
});
$i--;
i--;
}
if ($i <= 0) {
if (i <= 0) {
break;
}
}
}
return $hotBrands;
return hotBrands;
};
const formatNew = ($product)=>{
let $result = [];
$product.forEach(function($val, $key) {
$result[$key] = {};
$result[$key]['href'] = helpers.getUrlBySkc($val['product_id'], $val['goods_list'][0]['product_skc'], $val['cn_alphabet']);
$result[$key]['thumb'] = $val['default_images'] ? Images.getImageUrl($val['default_images'], 400, 500) : '';
$result[$key]['name'] = $val['product_name'];
$result[$key]['price'] = $val['sales_price'];
const formatNew = (product)=>{
let result = [];
product.forEach(function(val, key) {
result[key] = {
href:helpers.getUrlBySkc(val['product_id'], val['goods_list'][0]['product_skc'], val['cn_alphabet']),
thumb:val['default_images'] ? Images.getImageUrl(val['default_images'], 400, 500) : '',
name:val['product_name'],
price:val['sales_price']
};
});
return $result;
return result;
};
module.exports = {
... ...
/**
* @author: weiqingting<qingting.wei@yoho.cn>
*/
'use strict';
const api = global.yoho.API;
const getPendingOrderCount = ($uid)=>{
const getPendingOrderCount = uid=>{
let options = {
method: 'web.SpaceOrders.getPendingOrderCount',
uid: $uid
uid: uid
};
return api.get('', options);
};
const infoNum = ($uid, $udid)=>{
const infoNum = (uid, udid)=>{
let options = {
method: 'app.home.getInfoNum',
uid: $uid,
udid: $udid
uid: uid,
udid: udid
};
return api.get('', options);
};
const notCommentRecordCount = ($uid)=>{
const notCommentRecordCount = uid=>{
let options = {
method: 'show.notCommentRecordCount',
uid: $uid
uid: uid
};
return api.get('', options);
};
... ...
/**
* @author: weiqingting<qingting.wei@yoho.cn>
*/
'use strict';
const Promise = require('bluebird');
... ... @@ -18,72 +21,70 @@ const _ = require('lodash');
/**
* 个人中心——消息提示
* @param type $uid
* @param type $udid
* @param type uid
* @param type udid
* @return array
*/
const getInfoNumData = ($uid, $udid)=>{
let $result = [
const getInfoNumData = (uid, udid)=>{
let result = [
{href: helpers.urlFormat('/home/orders'), name: '待处理订单', 'count': 0},
{href: helpers.urlFormat('/home/message'), name: '未读消息', 'count': 0},
{href: helpers.urlFormat('/home/comment'), name: '待评论商品', 'count': 0}
];
return co(function * () {
let $getPendingOrderCount = yield IndexData.getPendingOrderCount($uid);// 待处理订单
let $infoNumData = yield IndexData.infoNum($uid, $udid); // 未读消息
let $notCommentRecordCount = yield IndexData.notCommentRecordCount($uid);// 待评论商品
$result[0]['count'] = $getPendingOrderCount.data.count ? $getPendingOrderCount.data.count : 0;
$result[1]['count'] = $infoNumData.data.inbox_total ? $infoNumData.data.inbox_total : 0;
$result[2]['count'] = $notCommentRecordCount.data ? $notCommentRecordCount.data : 0;
return $result;
let getPendingOrderCount = yield IndexData.getPendingOrderCount(uid);// 待处理订单
let infoNumData = yield IndexData.infoNum(uid, udid); // 未读消息
let notCommentRecordCount = yield IndexData.notCommentRecordCount(uid);// 待评论商品
result[0]['count'] = getPendingOrderCount.data.count ? getPendingOrderCount.data.count : 0;
result[1]['count'] = infoNumData.data.inbox_total ? infoNumData.data.inbox_total : 0;
result[2]['count'] = notCommentRecordCount.data ? notCommentRecordCount.data : 0;
return result;
})();
};
/**
* 个人中心——最新订单
* @param type $uid
* @param type uid
* @return array
*/
const latestOrders = ($uid)=>{
const latestOrders = (uid)=>{
return co(function *() {
let $orders = yield OrderModel.getOrders($uid, 1, 2, 1);
let orders = yield OrderModel.getOrders(uid, 1, 2, 1);
return {
more: helpers.urlFormat('/home/orders'),
orders: $orders
orders: orders
};
})();
};
const homeData = ()=>{
return co(function * () {
let $result = {};
let $url = {};
$url.fav_brand = SearchData.getBrandListUrl();
$url.new = SearchData.getProductUrl({new: 'Y', viewNum: 10});
let $data = yield Promise.all([searchApi.get($url.fav_brand, {}, {cache: true}), searchApi.get($url.new, {}, {cache: true})]);
let result = {};
let url = {};
url.fav_brand = SearchData.getBrandListUrl();
url.new = SearchData.getProductUrl({new: 'Y', viewNum: 10});
let data = yield Promise.all([searchApi.get(url.fav_brand, {}, {cache: true}), searchApi.get(url.new, {}, {cache: true})]);
// 格式化数据
$result['brand'] = $data[0].data && $data[0].data.length > 0 ? HelperHome.formatFavBrand($data[0].data, 6) : [];
$result['new'] = $data[1].data['product_list'] && $data[1].data['product_list'].length > 0 ? HelperHome.formatNew($data[1].data['product_list']) : {};
return $result;
// $result.brand=$data.fav_brand&&!$data.fav_brand?
result['brand'] = data[0].data && data[0].data.length > 0 ? HelperHome.formatFavBrand(data[0].data, 6) : [];
result['new'] = data[1].data['product_list'] && data[1].data['product_list'].length > 0 ? HelperHome.formatNew(data[1].data['product_list']) : {};
return result;
})();
};
/**
* 底部banner
* @param string $code
* @param string code
* @return mixed
*/
const getFooterBanner = ($code)=>{
const getFooterBanner = (code)=>{
$code = $code || '20110609-152143';
code = code || '20110609-152143';
return co(function *() {
let result = '';
let $banner = yield BrandData.getByNodeContent($code);
if ($banner.code && $banner.data) {
result = $banner.data.replace('http://', '//');
let banner = yield BrandData.getByNodeContent(code);
if (banner.code && banner.data) {
result = banner.data.replace('http://', '//');
}
return result;
})();
... ...
/**
* @author: weiqingting<qingting.wei@yoho.cn>
*/
'use strict';
const api = global.yoho.API;
/**
* 我的订单-分页
* @param type $uid
* @param type $page
* @param type $limit
* @param type $type 获取订单类型 type=1全部,type=2待付款,type=3待发货,type=4待收货,type=5待评论(已成功) 7取消
* @param type uid
* @param type page
* @param type limit
* @param type type 获取订单类型 type=1全部,type=2待付款,type=3待发货,type=4待收货,type=5待评论(已成功) 7取消
* @return type
*/
exports.getUserOrders = ($uid, $page, $limit, $type)=>{
$page = $page || 1;
$limit = $limit || 1;
$type = $type || 1;
exports.getUserOrders = (uid, page, limit, type)=>{
page = page || 1;
limit = limit || 1;
type = type || 1;
let options = {
method: 'app.SpaceOrders.get',
uid: $uid,
type: $type,
page: $page,
limit: $limit
uid: uid,
type: type,
page: page,
limit: limit
};
return api.get('', options);
};
/**
* 订单详情
* @param type $uid
* @param type $orderCode
* @param type uid
* @param type orderCode
* @return type
*/
exports.getOrderDetail = ($uid, $orderCode)=>{
exports.getOrderDetail = (uid, orderCode)=>{
let options = {
method: 'app.SpaceOrders.detail',
uid: $uid,
order_code: $orderCode
uid: uid,
order_code: orderCode
};
return api.get('', options);
};
... ... @@ -42,23 +45,23 @@ exports.getOrderDetail = ($uid, $orderCode)=>{
/**
* 取消订单
* @param type $uid
* @param type $orderCode
* @param type uid
* @param type orderCode
* @return type
*/
exports.cancelUserOrder = ($uid, $orderCode, $reason, $reasonId)=>{
$reason = $reason || false;
$reasonId = $reasonId || false;
exports.cancelUserOrder = (uid, orderCode, reason, reasonId)=>{
reason = reason || false;
reasonId = reasonId || false;
let options = {
method: 'app.SpaceOrders.close',
uid: $uid,
order_code: $orderCode
uid: uid,
order_code: orderCode
};
if ($reasonId) {
if (reasonId) {
Object.assign(options, {
reasonId: $reasonId,
reasons: $reason
reasonId: reasonId,
reasons: reason
});
}
return api.get('', options);
... ... @@ -66,28 +69,28 @@ exports.cancelUserOrder = ($uid, $orderCode, $reason, $reasonId)=>{
/**
* 确认订单
* @param type $uid
* @param type $orderCode
* @param type uid
* @param type orderCode
* @return type
*/
exports.confirmUserOrder = ($uid, $orderCode)=>{
exports.confirmUserOrder = (uid, orderCode)=>{
let options = {
method: 'app.SpaceOrders.confirm',
uid: $uid,
order_code: $orderCode
uid: uid,
order_code: orderCode
};
return api.get('', options);
};
/**
* 获取虚拟订单ticketCode
* @param type $orderCode
* @param type orderCode
* @return type
*/
exports.getTicketCode = ($orderCode)=>{
exports.getTicketCode = (orderCode)=>{
let options = {
method: 'app.SpaceOrders.getQrByOrderCode',
order_code: $orderCode
order_code: orderCode
};
return api.get('', options);
};
... ... @@ -95,33 +98,33 @@ exports.getTicketCode = ($orderCode)=>{
/**
* 我的订单-查看物流
*
* @param int $orderCode 订单号
* @param int $uid 用户ID
* @param int orderCode 订单号
* @param int uid 用户ID
* @return array
*/
exports.getLogisticsData = ($orderCode, $uid)=>{
exports.getLogisticsData = (orderCode, uid)=>{
let options = {
method: 'app.express.li',
order_code: $orderCode,
uid: $uid
order_code: orderCode,
uid: uid
};
return api.get('', options);
};
/**
* 获取历史订单
* @param type $uid
* @param type $page
* @param type $limit
* @param type uid
* @param type page
* @param type limit
*/
exports.getHistoryOrders = ($uid, $page, $limit)=>{
$page = $page || 1;
$limit = $limit || 10;
exports.getHistoryOrders = (uid, page, limit)=>{
page = page || 1;
limit = limit || 10;
let options = {
method: 'app.SpaceOrders.history',
uid: $uid,
page: $page,
limit: $limit
uid: uid,
page: page,
limit: limit
};
return api.get('', options);
};
... ... @@ -129,17 +132,17 @@ exports.getHistoryOrders = ($uid, $page, $limit)=>{
/**
* 更新订单的支付方式
*
* @param int $orderCode 订单号
* @param int $payment 支付方式
* @param int $uid 用户ID
* @param int orderCode 订单号
* @param int payment 支付方式
* @param int uid 用户ID
* @return array
*/
exports.updateOrderPayment = ($orderCode, $payment, $uid)=>{
exports.updateOrderPayment = (orderCode, payment, uid)=>{
let options = {
method: 'app.SpaceOrders.updateOrdersPaymentByCode',
order_code: Number($orderCode),
payment: $payment,
uid: $uid
order_code: Number(orderCode),
payment: payment,
uid: uid
};
return api.get('', options);
};
... ... @@ -157,21 +160,21 @@ exports.closeReasons = ()=>{
/**
* 订单详情页——地址修改
* @param type $order_code
* @param type $address_id
* @param type order_code
* @param type address_id
* @return type
*/
exports.updateDeliveryAddress = ($order_code, $user_name, $area_code, $address, $mobile, $phone)=>{
exports.updateDeliveryAddress = (order_code, user_name, area_code, address, mobile, phone)=>{
let options = {
method: 'app.SpaceOrders.updateDeliveryAddress',
order_code: $order_code,
user_name: $user_name,
area_code: $area_code,
order_code: order_code,
user_name: user_name,
area_code: area_code,
address: address,
mobile: $mobile
mobile: mobile
};
if ($phone) {
Object.assign(options, {phone: $phone});
if (phone) {
Object.assign(options, {phone: phone});
}
return api.get('', options);
};
... ... @@ -179,17 +182,17 @@ exports.updateDeliveryAddress = ($order_code, $user_name, $area_code, $address,
/**
* 查看订单详情
*
* @param string $orderCode 订单号
* @param int $uid 用户ID
* @param string $sessionKey 用户会话
* @param string orderCode 订单号
* @param int uid 用户ID
* @param string sessionKey 用户会话
* @return array
*/
exports.viewOrderData = ($orderCode, $uid, $sessionKey)=>{
exports.viewOrderData = (orderCode, uid, sessionKey)=>{
let options = {
method: 'app.SpaceOrders.info',
order_code: $order_code,
uid: $uid,
session_key: $sessionKey
order_code: order_code,
uid: uid,
session_key: sessionKey
};
return api.get('', options);
};
... ...
/**
* @author: weiqingting<qingting.wei@yoho.cn>
*/
'use strict';
const Promise = require('bluebird');
... ... @@ -11,304 +14,304 @@ const Image = require('../../../utils/images');
/**
* 获取我的订单列表数据-分页
* @param type $uid
* @param type $page
* @param type $limit
* @param type $type 获取订单类型 type=1全部,type=2待付款,type=3待发货,type=4待收货,type=5待评论(已成功) 7取消
* @param type uid
* @param type page
* @param type limit
* @param type type 获取订单类型 type=1全部,type=2待付款,type=3待发货,type=4待收货,type=5待评论(已成功) 7取消
*/
const getOrders = ($uid, $page, $limit, $type, $isPage)=>{
const getOrders = (uid, page, limit, type, isPage)=>{
return co(function *() {
$isPage = $isPage || false;
isPage = isPage || false;
let getOrderDescStr = {
1: '您还没有任何订单',
5: '您目前还没有成功的订单',
7: '您还没有任何取消的订单'
};
let $descStr = getOrderDescStr[$type] || '';
let $orders = {empty: $descStr};
let $orderInfo = yield OrderData.getUserOrders($uid, $page, $limit, $type);
if ($orderInfo.data && $orderInfo.data.order_list) {
$orders = {};
$orderInfo.data.order_list.forEach(function($orderV, $orderK) {
$orders[$orderK] = {};
$orders[$orderK]['orderNum'] = $orderV['order_code']; // 订单标识
$orders[$orderK]['orderTime'] = new Date($orderV['create_time']);
let $statusInfo = getOrderStatus($orderV['is_cancel'], $orderV['status'], $orderV['payment_type'], $orderV['payment_status']);
let descStr = getOrderDescStr[type] || '';
let orders = {empty: descStr};
let orderInfo = yield OrderData.getUserOrders(uid, page, limit, type);
if (orderInfo.data && orderInfo.data.order_list) {
orders = {};
orderInfo.data.order_list.forEach(function(orderV, orderK) {
orders[orderK] = {};
orders[orderK]['orderNum'] = orderV['order_code']; // 订单标识
orders[orderK]['orderTime'] = new Date(orderV['create_time']);
let statusInfo = getOrderStatus(orderV['is_cancel'], orderV['status'], orderV['payment_type'], orderV['payment_status']);
// 订单状态
if ($statusInfo['cancel']) {
$orders[$orderK]['cancel'] = $statusInfo['cancel'];
if (statusInfo['cancel']) {
orders[orderK]['cancel'] = statusInfo['cancel'];
}
else {
if ($statusInfo['keyName']) {
$orders[$orderK][$statusInfo['keyName']] = true;
if (statusInfo['keyName']) {
orders[orderK][statusInfo['keyName']] = true;
// 已发货,物流信息
if ($statusInfo['keyName'] == 'shipped') {
let $expressInfo = getExpressInfo($orderV['order_code'], $uid, $orderV['payment_type'], $orderV['create_time']);
$orders[$orderK]['logistics'] = $expressInfo['logistics'];
if (statusInfo['keyName'] == 'shipped') {
let expressInfo = getExpressInfo(orderV['order_code'], uid, orderV['payment_type'], orderV['create_time']);
orders[orderK]['logistics'] = expressInfo['logistics'];
}
}
}
// 订单商品相关信息
let $opRefundStatus = true; // 订单不可操作退换货
if ($orderV['order_goods'] && $orderV['order_goods']) {
let $goods = {}, $refundFlag = {};
$orderV['order_goods'].forEach(function($goval, $gokey) {
$goods[$gokey] = {};
$goods[$gokey]['href'] = helpers.getUrlBySkc($goval['product_id'], $goval['goods_id'], $goval['cn_alphabet']);
$goods[$gokey]['thumb'] = $goval['goods_image'] && $goval['goods_image'] ? Image.getImageUrl($goval['goods_image'], 100, 100) : '';
$goods[$gokey]['name'] = $goval['product_name'];
$goods[$gokey]['color'] = $goval['color_name'];
$goods[$gokey]['size'] = $goval['size_name'];
$goods[$gokey]['price'] = $goval['goods_price'];
let $buyNum = Number($goval['buy_number']);
let $refundNum = Number($goval['refund_num']);
$goods[$gokey]['count'] = $buyNum;
let $refundStatus = ($refundNum > 0) ? true : false; // 只要发生一件退换,退换过的标记
$goods[$gokey]['refundStatus'] = $refundStatus;
$refundFlag = (($buyNum == $refundNum) && $refundNum > 0) ? 'finished' : 'unfinished'; // 某一件商品全部退换结束
$goods[$gokey]['arrivalDate'] = $goval['expect_arrival_time'];
let $goodsTagName = getGoodsTag($orderV['attribute'], $goval['goods_type']);
if ($goodsTagName) {
$goods[$gokey][$goodsTagName] = true;
let opRefundStatus = true; // 订单不可操作退换货
if (orderV['order_goods'] && orderV['order_goods']) {
let goods = {}, refundFlag = {};
orderV['order_goods'].forEach(function(goval, gokey) {
goods[gokey] = {};
goods[gokey]['href'] = helpers.getUrlBySkc(goval['product_id'], goval['goods_id'], goval['cn_alphabet']);
goods[gokey]['thumb'] = goval['goods_image'] && goval['goods_image'] ? Image.getImageUrl(goval['goods_image'], 100, 100) : '';
goods[gokey]['name'] = goval['product_name'];
goods[gokey]['color'] = goval['color_name'];
goods[gokey]['size'] = goval['size_name'];
goods[gokey]['price'] = goval['goods_price'];
let buyNum = Number(goval['buy_number']);
let refundNum = Number(goval['refund_num']);
goods[gokey]['count'] = buyNum;
let refundStatus = (refundNum > 0) ? true : false; // 只要发生一件退换,退换过的标记
goods[gokey]['refundStatus'] = refundStatus;
refundFlag = ((buyNum == refundNum) && refundNum > 0) ? 'finished' : 'unfinished'; // 某一件商品全部退换结束
goods[gokey]['arrivalDate'] = goval['expect_arrival_time'];
let goodsTagName = getGoodsTag(orderV['attribute'], goval['goods_type']);
if (goodsTagName) {
goods[gokey][goodsTagName] = true;
}
$orders[$orderK]['goods'] = $goods;
orders[orderK]['goods'] = goods;
});
if ($refundFlag.indexOf('unfinished')) {
$opRefundStatus = false;
if (refundFlag.indexOf('unfinished')) {
opRefundStatus = false;
}
$orders[$orderK]['pay'] = $orderV['amount']; // 付款数
$orders[$orderK]['fregit'] = $orderV['shipping_cost']; // 邮费
orders[orderK]['pay'] = orderV['amount']; // 付款数
orders[orderK]['fregit'] = orderV['shipping_cost']; // 邮费
}
// 操作
$orders[$orderK]['operation'] = getOperateInfo($orderV['attribute'], $orderV['is_cancel'], $orderV['status'], $orderV['payment_status'], $orderV['update_time'], $orderV['order_type'], $orderV['refund_status'], $orderV['payment_type'], $orderV['order_code'], $opRefundStatus);
orders[orderK]['operation'] = getOperateInfo(orderV['attribute'], orderV['is_cancel'], orderV['status'], orderV['payment_status'], orderV['update_time'], orderV['order_type'], orderV['refund_status'], orderV['payment_type'], orderV['order_code'], opRefundStatus);
});
if ($isPage) {
$orders['pager']['total'] = $orderInfo['data']['total'];
$orders['pager']['pageTotal'] = $orderInfo['data']['page_total'];
$orders['pager']['page'] = $orderInfo['data']['page'];
if (isPage) {
orders['pager']['total'] = orderInfo['data']['total'];
orders['pager']['pageTotal'] = orderInfo['data']['page_total'];
orders['pager']['page'] = orderInfo['data']['page'];
}
return $orders;
return orders;
}
})();
};
const getOrderStatus = ($isCancel, $status, $payType, $payStatus)=>{
const getOrderStatus = (isCancel, status, payType, payStatus)=>{
// 初始化:未取消,待付款
let $ret = {cancel: false, keyName: 'noPay', statusStr: '待付款'};
if ($isCancel == 'Y') {
$ret = {cancel: true, statusStr: '已取消'};
let ret = {cancel: false, keyName: 'noPay', statusStr: '待付款'};
if (isCancel == 'Y') {
ret = {cancel: true, statusStr: '已取消'};
} else {
switch ($status) {
switch (status) {
case 0:
// '订单已成功,等待付款'
if ($payType != 2 && $payStatus == 'N') {
$ret['keyName'] = 'noPay';
$ret['statusStr'] = '待付款';
if (payType != 2 && payStatus == 'N') {
ret['keyName'] = 'noPay';
ret['statusStr'] = '待付款';
}
// '订单已付款,等待备货中'
else if ($payType != 2 && $payStatus == 'Y') {
$ret['keyName'] = 'paid';
$ret['statusStr'] = '备货中';
else if (payType != 2 && payStatus == 'Y') {
ret['keyName'] = 'paid';
ret['statusStr'] = '备货中';
}
// '订单已成功,等待备货中'-货到付款
else if ($payType == 2 && $payStatus == 'N') {
$ret['keyName'] = 'complete';
$ret['statusStr'] = '备货中';
else if (payType == 2 && payStatus == 'N') {
ret['keyName'] = 'complete';
ret['statusStr'] = '备货中';
}
break;
case 1:
case 2:
case 3:
// '订单已付款,等待备货中'
$ret['keyName'] = 'paid';
$ret['statusStr'] = '备货中';
ret['keyName'] = 'paid';
ret['statusStr'] = '备货中';
break;
case 4:
case 5:
// '订单已发货'
$ret['keyName'] = 'shipped';
$ret['statusStr'] = '待收货';
ret['keyName'] = 'shipped';
ret['statusStr'] = '待收货';
break;
case 6:
// '交易完成';
$ret['keyName'] = 'reback';
$ret['statusStr'] = '交易完成';
ret['keyName'] = 'reback';
ret['statusStr'] = '交易完成';
break;
}
}
return $ret;
return ret;
};
const getExpressInfo = ($orderCode, $uid, $paymetType, $createTime, $isDetail)=>{
const getExpressInfo = (orderCode, uid, paymetType, createTime, isDetail)=>{
return co(function * () {
$isDetail = $isDetail || false;
let $result = {};
$result['logisticsUrl'] = '';
$result['logisticsImg'] = '';
$result['logisticsCompany'] = '';
$result['courierNumbe'] = '';
if ($paymetType == 1) {
if ($isDetail) {
$result['logistics'] = [new Date($createTime), ' ', '您的订单已提交,等待付款'];
isDetail = isDetail || false;
let result = {};
result['logisticsUrl'] = '';
result['logisticsImg'] = '';
result['logisticsCompany'] = '';
result['courierNumbe'] = '';
if (paymetType == 1) {
if (isDetail) {
result['logistics'] = [new Date(createTime), ' ', '您的订单已提交,等待付款'];
}
else {
$result['logistics'] = new Date($createTime) + ' ' + '您的订单已提交,等待付款';
result['logistics'] = new Date(createTime) + ' ' + '您的订单已提交,等待付款';
}
}
if ($paymetType == 2) {
if ($isDetail) {
$result['logistics'] = [new Date($createTime), ' ', '您的订单已提交,等待审核'];
if (paymetType == 2) {
if (isDetail) {
result['logistics'] = [new Date(createTime), ' ', '您的订单已提交,等待审核'];
}
else {
$result['logistics'] = new Date($createTime) + ' ' + '您的订单已提交,等待审核';
result['logistics'] = new Date(createTime) + ' ' + '您的订单已提交,等待审核';
}
}
// 有物流
if ($orderCode && _.isNumber($uid)) {
let $logistics = yield OrderData.getLogisticsData($orderCode, $uid);
if ($logistics['data']) {
$result['logisticsUrl'] = $logistics['data']['url'] ? helper.getUrlSafe($logistics['data']['url']) : '';
$result['logisticsImg'] = $logistics['data']['logo'] ? $logistics['data']['logo'] : '';
$result['logisticsCompany'] = $logistics['data']['caption'] ? $logistics['data']['caption'] : '';
$result['courierNumbe'] = $logistics['data']['express_number'] ? $logistics['data']['express_number'] : '';
let $expressDetail = $logistics['data']['express_detail'] ? $logistics['data']['express_detail'] : {};
if ($expressDetail) {
let $logisticsTmp = $result['logistics'][0]; // 暂存
$result['logistics'] = {};
$expressDetail.forEach(function($value) {
let $pos = $value['accept_address'].indexOf(' ') / 3;
let $city = $value['accept_address'].substr(0, $pos);
let $exInfo = $value['accept_address'].substr($pos);
if ($isDetail) {
$result['logistics'] = [$value['acceptTime'], $city, $exInfo];
if (orderCode && _.isNumber(uid)) {
let logistics = yield OrderData.getLogisticsData(orderCode, uid);
if (logistics['data']) {
result['logisticsUrl'] = logistics['data']['url'] ? helper.getUrlSafe(logistics['data']['url']) : '';
result['logisticsImg'] = logistics['data']['logo'] ? logistics['data']['logo'] : '';
result['logisticsCompany'] = logistics['data']['caption'] ? logistics['data']['caption'] : '';
result['courierNumbe'] = logistics['data']['express_number'] ? logistics['data']['express_number'] : '';
let expressDetail = logistics['data']['express_detail'] ? logistics['data']['express_detail'] : {};
if (expressDetail) {
let logisticsTmp = result['logistics'][0]; // 暂存
result['logistics'] = {};
expressDetail.forEach(function(value) {
let pos = value['accept_address'].indexOf(' ') / 3;
let city = value['accept_address'].substr(0, pos);
let exInfo = value['accept_address'].substr(pos);
if (isDetail) {
result['logistics'] = [value['acceptTime'], city, exInfo];
}
else {
$result['logistics'] = $value['acceptTime'] + $city + $exInfo;
result['logistics'] = value['acceptTime'] + city + exInfo;
}
});
// 把最初的处理放最后
$result['logistics'] = $logisticsTmp;
result['logistics'] = logisticsTmp;
}
}
}
return $result;
return result;
})();
};
const getGoodsTag = ($attribute, $goodsType)=>{
let $goodsTagName = '';
switch ($goodsType) {
const getGoodsTag = (attribute, goodsType)=>{
let goodsTagName = '';
switch (goodsType) {
// 赠品
case 'gift':
$goodsTagName = 'freebie';
goodsTagName = 'freebie';
break;
// 加价购
case 'price_gift':
$goodsTagName = 'advanceBuy';
goodsTagName = 'advanceBuy';
break;
// 预售
case 'advance':
$goodsTagName = 'preSaleGood';
goodsTagName = 'preSaleGood';
break;
// outlet
case 'outlet':
$goodsTagName = '';
goodsTagName = '';
break;
// 免单
case 'free':
$goodsTagName = '';
goodsTagName = '';
break;
// 电子
case 'ticket':
$goodsTagName = '';
goodsTagName = '';
break;
default:
break;
}
// 虚拟
if ($attribute == 3) {
$goodsTagName = 'virtualGood';
if (attribute == 3) {
goodsTagName = 'virtualGood';
}
return $goodsTagName;
return goodsTagName;
};
const getOperateInfo = ($attribute, $isCancel, $status, $payStatus, $updateTime, $orderType, $refundStatus, $paymentType, $orderCode, $opRefundStatus)=>{
const getOperateInfo = (attribute, isCancel, status, payStatus, updateTime, orderType, refundStatus, paymentType, orderCode, opRefundStatus)=>{
// 查看订单
let $orderDetailUrl = helpers.urlFormat('/home/orders/detail', {orderCode: $orderCode});
let orderDetailUrl = helpers.urlFormat('/home/orders/detail', {orderCode: orderCode});
// 查看二维码
let $ticketUrl = helpers.urlFormat('/home/orders/tickets', {orderCode: $orderCode});
let ticketUrl = helpers.urlFormat('/home/orders/tickets', {orderCode: orderCode});
// 立即付款
let $payUrl = helpers.urlFormat('/shopping/pay', {orderCode: $orderCode});
let payUrl = helpers.urlFormat('/shopping/pay', {orderCode: orderCode});
// 取消订单
let $cancelOrderUrl = 'javascript:void(0)';
let cancelOrderUrl = 'javascript:void(0)';
// 确认订单
let $confirmOrderUrl = 'javascript:void(0)';
let confirmOrderUrl = 'javascript:void(0)';
// 申请换货
let $exchangeUrl = helpers.urlFormat('/home/returns/exchangeRequest', {orderCode: $orderCode});
let exchangeUrl = helpers.urlFormat('/home/returns/exchangeRequest', {orderCode: orderCode});
// 申请退货
let $refundUrl = helpers.urlFormat('/home/returns/refundrequest', {orderCode: $orderCode});
let refundUrl = helpers.urlFormat('/home/returns/refundrequest', {orderCode: orderCode});
let $operation = {};
let operation = {};
// 立即付款
if ($payStatus == 'N' && $paymentType != 2 && $isCancel == 'N') {
$operation = {payNow: true, href: $payUrl};
if (payStatus == 'N' && paymentType != 2 && isCancel == 'N') {
operation = {payNow: true, href: payUrl};
}
$operation = {href: $orderDetailUrl, name: '查看订单'};
operation = {href: orderDetailUrl, name: '查看订单'};
// 查看订单,虚拟订单查看二维码
if ($attribute == 3) {
if ($payStatus == 'Y') {
$operation = {href: $ticketUrl, name: '查看二维码'};
if (attribute == 3) {
if (payStatus == 'Y') {
operation = {href: ticketUrl, name: '查看二维码'};
}
}
// 取消订单
if ($status < 3 && $isCancel == 'N' && $orderType != 5 && $payStatus == 'N') {
$operation = {href: $cancelOrderUrl, name: '取消订单', cancelOrder: true};
if (status < 3 && isCancel == 'N' && orderType != 5 && payStatus == 'N') {
operation = {href: cancelOrderUrl, name: '取消订单', cancelOrder: true};
}
// 确认收货
if ($status >= 4 && $status < 6 && $refundStatus == 0 && $attribute != 3 && $isCancel == 'N') {
$operation = {href: $confirmOrderUrl, name: '确认收货', confirmReceived: true};
if (status >= 4 && status < 6 && refundStatus == 0 && attribute != 3 && isCancel == 'N') {
operation = {href: confirmOrderUrl, name: '确认收货', confirmReceived: true};
}
// 换货
let $time = (Date.now() - $updateTime);
let $orderExchangeLimitTime = ChannelConfig.$exchangeDay;
if ($status >= 6 && $time < 86400 * $orderExchangeLimitTime && $attribute != 3 && $isCancel == 'N') {
$operation = {href: $exchangeUrl, name: '申请换货', optDis: $opRefundStatus};
let time = (Date.now() - updateTime);
let orderExchangeLimitTime = ChannelConfig.exchangeDay;
if (status >= 6 && time < 86400 * orderExchangeLimitTime && attribute != 3 && isCancel == 'N') {
operation = {href: exchangeUrl, name: '申请换货', optDis: opRefundStatus};
}
// 退货
let $orderRefundLimitTime = ChannelConfig.$refundDay;
if ($status >= 6 && $time < 86400 * $orderRefundLimitTime && $attribute != 3 && $isCancel == 'N') {
$operation = {href: $refundUrl, name: '申请退货', optDis: $opRefundStatus};
let orderRefundLimitTime = ChannelConfig.refundDay;
if (status >= 6 && time < 86400 * orderRefundLimitTime && attribute != 3 && isCancel == 'N') {
operation = {href: refundUrl, name: '申请退货', optDis: opRefundStatus};
}
return $operation;
return operation;
};
... ...
/**
* @author: weiqingting<qingting.wei@yoho.cn>
*/
'use strict';
const querystring = require('querystring');
const searchApi=global.yoho.SearchAPI;
const getUrl = ($type)=>{
const getUrl = (type)=>{
var map = {
sort: '/sortgroup.json',
discount: '/discount.json',
... ... @@ -14,14 +17,14 @@ const getUrl = ($type)=>{
shop: '/shops.json',
brand: '/brand/list.json'
};
return map[$type] || '/search.json';
return map[type] || '/search.json';
};
const getBrandListUrl = ()=>{
return getUrl('brand');
};
const getProductUrl = ($condition, $type)=>{
let $orderMaps = {
const getProductUrl = (condition, type)=>{
let orderMaps = {
s_t_desc: 'shelve_time:desc',
s_t_asc: 'shelve_time:asc',
s_p_asc: 'sales_price:asc',
... ... @@ -38,38 +41,38 @@ const getProductUrl = ($condition, $type)=>{
activities_id_asc: 'activities.activity_id:asc',
brand_desc: 'brand_weight:desc'
};
let $param = {
let param = {
status: 1,
sales: 'Y',
outlets: 2,
stocknumber: 1,
attribute_not: 2
};
if (!$condition.order) {
$param.order = $orderMaps.s_t_desc;
if (!condition.order) {
param.order = orderMaps.s_t_desc;
} else {
$param.order = $orderMaps[$condition.order] ? $orderMaps[$condition.order] : '';
param.order = orderMaps[condition.order] ? orderMaps[condition.order] : '';
}
if (!$condition.page) {
$param.page = 1;
if (!condition.page) {
param.page = 1;
}
if ($condition.viewNum) {
$param.viewNum = $condition.viewNum;
} else if (!$condition.limit) {
$param.viewNum = 60;
if (condition.viewNum) {
param.viewNum = condition.viewNum;
} else if (!condition.limit) {
param.viewNum = 60;
} else {
$param.viewNum = $condition.limit;
delete $condition.limit;
param.viewNum = condition.limit;
delete condition.limit;
}
if (!$condition) {
$param += $condition;
if (!condition) {
param += condition;
}
return getUrl($type) + '?' + querystring.stringify($param);// searchApi.get(getUrl($type), $param,{cache:true});
return getUrl(type) + '?' + querystring.stringify(param);// searchApi.get(getUrl(type), param,{cache:true});
};
const searchAll = ($param)=>{
$param=$param||{};
return searchApi.get(getUrl($type), $param,{cache:true});
const searchAll = (param)=>{
param=param||{};
return searchApi.get(getUrl(type), param,{cache:true});
}
module.exports = {
... ...
... ... @@ -17,51 +17,64 @@ const personalController = require(`${cRoot}/QRcode`);
const commentController = require(`${cRoot}/comment`);
const consultController = require(`${cRoot}/consult`);
const returnsController = require(`${cRoot}/returns`);
const IndexController = require(`${cRoot}/Index`);
const CurrencyController = require(`${cRoot}/Currency`);
const homeNav = [
{
title: '交易管理',
subNav: [
{name: '我的订单', href: helpers.urlFormat('/home/orders'), active: true},
{name: '我的收藏', href: helpers.urlFormat('/home/favorite')},
{name: '我的YOHO币', href: helpers.urlFormat('/home/currency')},
{name: '我的红包', href: helpers.urlFormat('/home/redenvelopes')},
{name: '我的优惠券', href: helpers.urlFormat('/home/coupons')},
{name: '我的VIP', href: helpers.urlFormat('/home/vip')}
{name: '我的订单', href: '/home/orders'},
{name: '我的收藏', href: '/home/favorite'},
{name: '我的YOHO币', href: '/home/currency'},
{name: '我的红包', href: '/home/redenvelopes'},
{name: '我的优惠券', href: '/home/coupons'},
{name: '我的VIP', href: '/home/vip'}
]
},
{
title: '服务中心',
subNav: [
{name: '我的退/换货', href: helpers.urlFormat('/home/returns')},
{name: '我的咨询', href: helpers.urlFormat('/home/consult')},
{name: '我的评论', href: helpers.urlFormat('/home/comment')},
{name: '我的投诉', href: helpers.urlFormat('/home/complaints')},
{name: '我的信息', href: helpers.urlFormat('/home/message'), count: 0},
{name: '我的退/换货', href: '/home/returns'},
{name: '我的咨询', href: '/home/consult'},
{name: '我的评论', href: '/home/comment'},
{name: '我的投诉', href: '/home/complaints'},
{name: '我的信息', href: '/home/message', count: 0},
{name: '在线客服', href: 'http://chat8.live800.com/live800/chatClient/chatbox.jsp?companyID=620092&configID=149091&jid=8732423409&info=', isBlank: true}
]
},
{
title: '个人信息管理',
subNav: [
{name: '编辑个人资料', href: helpers.urlFormat('/home/user')},
{name: '账号安全', href: helpers.urlFormat('/home/account')},
{name: '地址管理', href: helpers.urlFormat('/home/address')},
{name: '兑换礼品卡', href: helpers.urlFormat('/home/gift')}
{name: '编辑个人资料', href: '/home/user'},
{name: '账号安全', href: '/home/account'},
{name: '地址管理', href: '/home/address'},
{name: '兑换礼品卡', href: '/home/gift'}
]
}
];
const getActiveNav=(req)=>{
return homeNav.map((item,index)=>{
item.subNav=item.subNav.map((nav)=>{
if(req.path===nav.href){
nav.active=true;
}
nav.href=nav.href.indexOf("http://")>-1?nav.href:helpers.urlFormat(nav.href);
return nav;
});
});
}
const getHomeNav = (req, res, next) => {
res.locals.path = [{href: helpers.urlFormat('/'), name: 'YOHO!BUY 有货首页'}, {name: '个人中心'}];
res.locals.homeNav = homeNav;
res.locals.homeNav = getActiveNav(req);
res.locals.userThumb = `//img10.static.yhbimg.com/headimg/
2013/11/28/09/01cae078abe5fe320c88cdf4c220212688.gif?imageView/2/w/100/h/100`;
next();
};
const getCommonHeader = (req, res, next) => {
let channel = req.query.channel ? req.query.channel : 'boys';
headerModel.requestHeaderData(channel).then((result)=>{
_.merge(res.locals, result);
next();
... ... @@ -107,10 +120,10 @@ router.get('/returns', returnsController.index);
// router.get('address', addressController.index);
// router.get('address/area', addressController.area);
let Index = require(`${cRoot}/Index`);
router.get('/index', [getCommonHeader, getHomeNav], Index.index);
let Currency = require(`${cRoot}/Currency`);
router.get('/currency', Currency.index);
router.get('/index', [getCommonHeader, getHomeNav], IndexController.index);
router.get('/currency', CurrencyController.index);
module.exports = router;
... ...