router.js 10.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 myDetail = require(`${cRoot}/myDetail);


// 查看二维码
router.get('/QRcode/:id', personalController.QRcode);
router.get('/user/qrcode', userQrcode.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', installment.sessionKeyAuth, installment.index); // 开通分期首页
router.get('/installment/review', installment.sessionKeyAuth, installment.review); // 开通分期首页
router.get('/installment/starting-service', installment.sessionKeyAuth, installment.startingService); // 分期付款开通
router.get('/installment/starting-service/verify-code', installment.sessionKeyAuth, installment.verifyCode);
router.get('/installment/starting-service/check-verify-code', installment.sessionKeyAuth, installment.checkVerifyCode);
router.get('/installment/get-goods', installment.sessionKeyAuth, installment.getInstallmentGoods); // ajax请求分期专享商品数据

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

router.get('/installment/account', installment.sessionKeyAuth, installment.account); // 账户管理
router.get('/installment/bind-card', installment.sessionKeyAuth, installment.bindCard); // 添加新银行卡
router.get('/installment/post-account', installment.sessionKeyAuth, installment.postAccount); // 添加新卡请求
router.get('/installment/bank-info', installment.sessionKeyAuth, installment.getBankInfo);
router.post('/installment/activate-service', installment.sessionKeyAuth, installment.activateService);
router.get('/installment/order', installment.sessionKeyAuth, installment.orderIndex);
router.get('/installment/order.html', installment.sessionKeyAuth, installment.orderList);
router.get('/installment/order/:id', installment.sessionKeyAuth, installment.orderDetail);
router.get('/installment/total-amount.json', installment.sessionKeyAuth, 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', installment.sessionKeyAuth, installment.bankCard); // 银行卡列表
router.get('/installment/card-detail', installment.sessionKeyAuth, installment.cardDetail); // 银行卡详情
router.get('/installment/delBankCard', installment.sessionKeyAuth, installment.delBankCard); // 删除绑定
router.get('/installment/setMasterCard', installment.sessionKeyAuth, installment.setMasterCard); // 切换主卡

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

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

router.get('/grade', auth, gradeNew.index); // 会员等级
router.get('/gradeNew/content', auth, gradeNew.content); // 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('/tide-command', auth, tideCommand.tideCommand); // 设置潮流口令

router.get('/new-home', auth, newHome.index); // 设置潮流口令
module.exports = router;