router.js 5.17 KB
/**
 * router of sub app home
 * @author: shenzm<zhimin.shen@yoho.cn>
 * @date: 2016/07/18
 */

'use strict';

const expressRouter = require('express').Router;
const cRoot = './controllers';
const home = require(cRoot);
const favorite = require(cRoot + '/favorite');
const refund = require(cRoot + '/refund');
const order = require(cRoot + '/order');
const exchange = require(cRoot + '/exchange');
const help = require(cRoot + '/help');
const auth = require(`${global.doraemon}/middleware/auth`);
const router = expressRouter();

// Your controller here
router.get('/me/', home.index); // 个人中心主页
router.get('/me/userdata', home.userdata); // 个人中心数据

router.get('/me/order', auth, order.orders); // 订单
router.get('/me/order/detail', auth, order.orderDetail); // 订单详情
router.get('/me/order/cancelreason', auth, order.cancelReason); // 取消订单原因选择

router.get('/me/getOrderList', auth, order.getOrderData); // 获取订单数据
router.get('/me/get-order', auth, order.getOrderDetailData); // AJAX 获取订单详情数据
router.get('/me/getCancelOrderReason', auth, order.getCancelReason); // 获取取消订单原因
router.post('/me/cancelOrder', auth, order.cancelOrder); // 取消订单
router.post('/me/readdorder', auth, order.readdData); // 再次购买
router.post('/me/deleteOrder', auth, order.deleteOrder); // AJAX 删除订单
router.post('/me/confirmReceive', auth, order.confirmOrder); // 确认订单

router.get('/me/mycurrency', auth, order.coin); // yoho币
router.get('/me/coin-detail', auth, order.getCoinDetail); // ajax yoho币明细

router.get('/me/service', home.service); // 在线客服
// router.get('/help', home.help); // 帮助中心列表页
router.get('/help', help.index); // 帮助中心列表页(写死的内容)
router.get('/help-detail', help.helpDetail); // 帮助中心详情页(写死的内容)
router.get('/me/feedback', home.feedback); // 个人中心-意见反馈
router.post('/me/save-feedback', auth, home.saveFeedback); // 个人中心-提交意见反馈

router.get('/me/collection', auth, favorite.favorite); // 个人中心 - 收藏
router.get('/me/collection/favpaging', auth, favorite.favpaging); // 个人中心 - 收藏商品/品牌/资讯(翻页)
router.post('/me/del-favdel', auth, favorite.deletefav); // 个人中心 - 收藏商品/品牌/资讯(刪除)
router.get('/me/favoriteNum', auth, home.favoriteNum);// 收藏个数

// 退换货
router.get('/me/return', auth, refund.refundOrders); // 退换货 - 订单列表
router.get('/me/return/getOrderList', auth, refund.getRefundOrders); // 退换货 - 获取订单列表数据
router.get('/me/return/refund/detail/:applyId', auth, refund.refundStatus); // 退换货 - 退货状态
router.get('/me/return/exchange/detail/:applyId', auth, refund.exchangeStatus); // 退换货 - 换货状态
router.get('/me/return/status-detail', auth, refund.statusDetail); // 退换货 - 状态详细信息

// 退货申请
router.get('/me/return/refund', auth, refund.refund); // 退货申请
router.get('/me/return/refund/order', auth, refund.order); // AJAX 查询订单数据
router.post('/me/return/refund/submit', auth, refund.submit); // AJAX 提交信息
router.get('/me/return/logistics', auth, refund.logistics); // 退换货 - 商品寄回信息
router.post('/me/return/save-logistics', auth, refund.saveLogistics); // 退换货 - 添加寄回物流信息
router.post('/me/return/refund/cancel-apply', auth, refund.cancelApply); // 退货 - 取消申请

// 换货申请
router.get('/me/return/exchange', auth, exchange.exchange);
router.get('/me/return/exchange/order', auth, exchange.order); // AJAX 获取订单 商品
router.get('/me/return/exchange/delivery', auth, exchange.delivery); // AJAX 获取 退货方式
router.post('/me/return/exchange/submit', auth, exchange.submit); // AJAX 提交换货 申请
router.post('/me/return/exchange/cancel-apply', auth, exchange.cancelApply); // AJAX 取消换货申请

router.get('/me/mydetails', auth, home.mydetails); // 个人信息
router.post('/me/save-mydetails', auth, home.saveMydetails); // AJAX 保存个人信息

router.get('/me/about', home.about); // 个人中心 - 关于我们
router.get('/me/provisions', home.provisions); // 个人中心 - 隐私条款
router.get('/me/agreement', home.agreement); // 个人中心 - 服务条款

router.get('/me/logistic', auth, order.logistic); // 个人中心 - 退换货物流设置页面
router.get('/me/get-order-logistic-date', auth, order.getOrderLogisticdate); // 个人中心 - 订单物流详情数据

// 浏览记录
router.get('/me/records', auth, home.records);
router.get('/me/recordData', auth, home.recordData);
router.get('/me/recordDataNew', auth, home.recordDataNew);
router.get('/me/deleteRecordData', auth, home.deleteRecordData);
router.get('/me/recordNum', auth, home.recordNum);
router.get('/me/addRecords', auth, home.addRecords);

// 为你优选
router.get('/me/prefer', require(cRoot + '/prefer').index);
router.get('/me/preferlist', require(cRoot + '/prefer').list);

// 会员等级
router.get('/me/grade', auth, home.grade);
router.get('/me/gradeData', home.gradeData);
router.get('/me/privilege', auth, home.preferential);

router.get('/me/editorialNum', auth, home.editorialNum);

module.exports = router;