router.js 11.5 KB
/**
 * router of sub app home
 * @author: Bi Kai<kai.bi@yoho.cn>
 * @date: 2016/05/09
 */

'use strict';

const express = require('express');

const router = express.Router(); // eslint-disable-line
const auth = require('../../doraemon/middleware/auth');
const disableBFCache = require('../../doraemon/middleware/disable-BFCache');

const cRoot = './controllers';
const installment = require(cRoot + '/installment');

const personalController = require(`${cRoot}/qrcode`);

// const userQrcode = require(`${cRoot}/myqrcode`);
const homeController = require(`${cRoot}/index`);
const addressController = require(`${cRoot}/address`);
const favorite = require(`${cRoot}/favorite`);
const orderController = require(`${cRoot}/order`);
const orderDetailController = require(`${cRoot}/orderDetail`);
const currencyController = require(`${cRoot}/myCurrency`);
const coupons = require(`${cRoot}/coupons`);
const suggest = require(`${cRoot}/suggest`);
const message = require(`${cRoot}/message`);
const onlineService = require(`${cRoot}/onlineService`);
const gradeNew = require(`${cRoot}/grade-new`);
const refund = require(`${cRoot}/refund`);
const exchange = require(`${cRoot}/exchange`);
const tideCommand = require(`${cRoot}/tide-command`);
const newHome = require(`${cRoot}/new-home`);
const family = require(`${cRoot}/family`);
const newQrcode = require(`${cRoot}/newQrcode`);
const freeShipping = require(`${cRoot}/free-shipping`);

// const myDetail = require(`${cRoot}/myDetail);


// 查看二维码
router.get('/QRcode/:id', personalController.QRcode);

// router.get('/user/qrcode', userQrcode.index);
router.get('/user/qrcode', auth, newQrcode.index);

/* 个人中心地址管理相关路由 */
router.get('/address', auth, addressController.address); // 地址管理页面
router.get('/addressAct', auth, addressController.addressAct); // 地址添加页面
router.get('/addressAct/:id', auth, addressController.addressAct); // 地址添加修改页面
router.post('/saveAddress', addressController.saveAddress); // 新增或者保存地址
router.post('/defaultAddress', addressController.defaultAddress); // 设置默认地址
router.post('/delAddress', addressController.delAddress); // 删除地址
router.get('/locationList', auth, addressController.locationList); // 异步获取三级地址数据
router.get('/addressModify', auth, addressController.addressModify); // 订单详情地址列表
router.get('/chooseAddress', auth, addressController.chooseAddress); // 订单详情地址修改
router.get('/address.json', auth, addressController.addressJson); // 地址列表

/* 个人中心订单相关路由 */
router.get('/orders', auth, orderController.order); // 订单列表
router.get('/getOrders', auth, orderController.getOrders); // 获取订单列表数据
router.get('/orderDetail', auth, orderDetailController.orderDetailData); // 订单详情页
router.get('/orders/detail', auth, orderDetailController.orderDetailData); // 订单详情页兼容老的
router.get('/delOrder', auth, orderDetailController.delOrder); // 删除订单
router.get('/readd', auth, orderDetailController.readdData); // 再次购买
router.get('/cancelOrder', auth, orderDetailController.cancelOrder); // 取消订单
router.get('/refundApply', auth, orderDetailController.refundApply); // 申请退款
router.get('/orders/addressModify', auth, orderDetailController.addressModify); // 订单详情地址修改页面
router.post('/orders/changeAddress', orderDetailController.changeAddress); // 提交新的地址数据
router.post('/orders/sure', auth, orderController.sure); // 确认收货


// router.get('/', disableBFCache, homeController.index); // 个人中心首页
router.get('/mydetails', auth, disableBFCache, homeController.myDetails); // 个人基本资料页面

// router.get('/grade', auth, homeController.grade); // 会员等级页
router.get('/privilege', homeController.preferential); // 会员特权列表页

router.get('/mycurrency', auth, currencyController.myCurrency); // yoho币总数
router.get('/currencyDetail', auth, currencyController.currencyDetail); // yoho币列表
router.post('/ajaxCurrencyDetail', auth, currencyController.ajaxCurrencyDetail); // yoho币列表

router.get('/record', auth, homeController.record); // 浏览记录
router.get('/recordContent', homeController.recordContent); // 浏览记录
router.get('/delRecord', homeController.delRecord); // 删除浏览记录

router.get('/favorite', auth, favorite.favorite);// 我的收藏
router.get('/favProduct', auth, favorite.favProduct);// 收藏的商品
router.get('/favBrand', auth, favorite.favfavBrand);// 收藏的品牌
router.post('/favoriteDel', auth, favorite.favoriteDelete);// 取消收藏

// 优惠券
router.use('/coupons', auth, coupons.index);
router.use('/couponsAjax', coupons.couponsAjax);

// 意见反馈
router.get('/suggest', suggest.suggestData);
router.post('/upAndDown', suggest.upAndDown);
router.get('/suggestSub', auth, suggest.suggestSub);
router.post('/savesuggest', auth, suggest.saveSuggest);

// 消息
router.use('/message', auth, disableBFCache, message.index);
router.get('/messageDetail', auth, message.index);
router.post('/ajaxDelMes', auth, message.ajaxDelMes);
router.post('/pickCoupon', auth, message.pickCoupon);

// 生日券消息
router.get('/birthCoupon', auth, message.birthCoupon);

// 在线客服
router.get('/onlineservice', onlineService.getOnlineServiceInfo);
router.get('/onlineservicedetail', onlineService.getOnlineServiceDetail);

// 分期付款
router.get('/installment/index', auth, installment.index); // 开通分期首页
router.get('/installment/review', auth, installment.review); // 开通分期首页
router.get('/installment/starting-service', auth, installment.startingService); // 分期付款开通
router.get('/installment/starting-service/verify-code', auth, installment.verifyCode);
router.get('/installment/starting-service/check-verify-code', auth, installment.checkVerifyCode);
router.get('/installment/get-goods', auth, installment.getInstallmentGoods); // ajax请求分期专享商品数据

router.get('/installment/repay/overdue', auth, installment.overdueList); // 逾期未还款列表
router.get('/installment/repay/7daylist', auth, installment.sevenDayList); // 7日待还款列表
router.get('/installment/repay/month', auth, installment.monthRepayList); // 本月待还款列表
router.get('/installment/repay/total', auth, installment.totalRepayList); // 待还总金额列表
router.get('/installment/repay/record', auth, installment.repayRecordPage); // 还款记录
router.get('/installment/repay/get-record', auth, installment.getRepayRecord); // ajax请求还款记录
router.get('/installment/repay/detail', auth, installment.repayDetail); // 还款详情

router.get('/installment/account', auth, installment.account); // 账户管理
router.get('/installment/bind-card', auth, installment.bindCard); // 添加新银行卡
router.get('/installment/post-account', auth, installment.postAccount); // 添加新卡请求
router.get('/installment/bank-info', auth, installment.getBankInfo);
router.post('/installment/activate-service', auth, installment.activateService);
router.get('/installment/order', auth, installment.orderIndex);
router.get('/installment/order.html', auth, installment.orderList);
router.get('/installment/order/:id', auth, installment.orderDetail);
router.get('/installment/total-amount.json', auth, installment.totalAmount);

router.get('/installment/help', installment.sessionKeyAuth, installment.help);// 帮助静态页面
router.get('/installment/agreement', installment.sessionKeyAuth, installment.agreement);// 服务协议静态页面

router.get('/installment/server-crash', installment.sessionKeyAuth, installment.serverCrash); // 服务器崩溃
router.get('/installment/bank-card', auth, installment.bankCard); // 银行卡列表
router.get('/installment/card-detail', auth, installment.cardDetail); // 银行卡详情
router.get('/installment/delBankCard', auth, installment.delBankCard); // 删除绑定
router.get('/installment/setMasterCard', auth, installment.setMasterCard); // 切换主卡

router.get('/getaddress.json', addressController.newGetAddress); // TODO 模拟省数据

router.get('/logistic', auth, orderDetailController.logistic); // 查看物流页面

router.get('/grade', auth, gradeNew.upgrade); // 会员等级
router.get('/gradeNew/content', auth, gradeNew.upgradeApp); // app要提供我的等级单独tab部分页面
router.get('/gradeNew/grow', auth, gradeNew.grow); // 成长记录
router.get('/gradeNew/getHis', gradeNew.getHis); // 成长记录

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

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

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

router.get('/tide-command', auth, tideCommand.tideCommand); // 设置潮流口令

router.get('/', newHome.index); // 新个人中心首页


router.get('/family', auth, disableBFCache, family.familyIndex); // family首页
router.get('/family/vipDetailData', auth, family.familyVip); // 获取VIP信息
router.get('/family/downLoadData', family.downLoadData); // 下载弹窗
router.get('/family/coinDetail', auth, family.coinDetail); // 积分详情页
router.get('/family/coinDetail/getCoinData', auth, family.getCoinData); // 筛选积分详情
router.get('/family/userInfo', auth, disableBFCache, family.userInfo); // family个人信息页
router.get('/family/userInfo/getCity', auth, family.getCity); // family个人信息页-获取城市
router.get('/family/coinMall', auth, family.coinMall); // 积分商城
router.get('/family/coinMall/getList', auth, family.getList); // 积分商城-获取积分列表
router.get('/family/modify', auth, family.modify); // family修改个人信息页
router.get('/family/integralCharts', auth, family.integralCharts); // family积分商城
router.get('/family/set-trend-word', auth, family.setTrendWord); // family设置潮流口令
router.get('/newQrcode', auth, newQrcode.index); // 新二维码页面
router.get('/newQrcode/reload', auth, newQrcode.reload); // 刷新二维码页面

router.get('/freeShipping', freeShipping.index); // 免邮落地页

module.exports = router;