router.js 2.26 KB
/**
 * router of sub app product
 * @author: weiqingting<qingting.wei@yoho.cn>
 * @date: 2016/05/06
 */
'use strict';

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

const personalController = require(`${cRoot}/qrcode`);
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 myDetail = require(`${cRoot}/myDetail);

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

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

/* 个人中心订单相关路由 */
router.get('/orders', orderController.order); // 订单列表
router.get('/getOrders', orderController.getOrders); // 获取订单列表数据
router.get('/orderDetail', orderDetailController.orderDetailData); // 订单详情页
router.get('/delOrder', orderDetailController.delOrder); // 删除订单
router.get('/readd', orderDetailController.readdData); // 再次购买
router.get('/cancelOrder', orderDetailController.cancelOrder); // 取消订单

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

// 我的收藏
router.get('/favorite', favorite.favorite);

// 收藏的商品
router.get('/favProduct', favorite.favProduct);

// 收藏的品牌
router.get('/favBrand', favorite.favfavBrand);

// 取消收藏
router.post('/favoriteDel', favorite.favoriteDelete);

module.exports = router;