/** * router of sub app cart * @author: xuan.chen@yoho.cn<xuan.chen@yoho.cn> * @date: 2016/09/26 */ 'use strict'; const router = require('express').Router(); //eslint-disable-line const cRoot = './controllers'; const authMW = require('../../doraemon/middleware/auth'); const disableBFCache = require('../../doraemon/middleware/disable-BFCache'); const csrf = require('../../doraemon/middleware/csrf'); const seckill = require(cRoot + '/seckill'); const order = require(cRoot + '/order'); const countController = require(`${cRoot}/count`); const payController = require(`${cRoot}/pay`); const indexController = require(`${cRoot}/index`); const ticketsConfirmController = require(`${cRoot}/ticketsConfirm`); const BuyNowController = require(`${cRoot}/buy-now-controller`); // Your controller here router.all('/index/seckill/', authMW); router.all('/index/seckill/*', authMW); router.get('/index/seckill/', seckill.ensure); router.post('/index/seckill/compute', seckill.compute); router.post('/index/seckill/submit', seckill.submit); router.get('/index/count', countController.cartCount); router.get('/paySuccess/payCod', payController.payCod);// 支付成功,货到付款 router.get('/shopping/pay/aliwapreturn', payController.payAli);// 支付成功,支付宝付款 router.get('/shopping/pay/payZero', payController.payZero);// 支付成功,支付为0 router.get('/index/new/pay', authMW, payController.pay);// 统一支付 URL,支持微信,支付宝 router.get('/index/new/pay/alipayresult', authMW, payController.payAli);// 支付宝付款支付成功 router.get('/index/new/orderEnsure', authMW, disableBFCache, order.orderEnsure); // 订单结算 router.get('/index/new/orderEnsureAjax', authMW, disableBFCache, order.orderEnsure); // 订单结算ajax router.post('/index/new/orderCompute', authMW, order.orderCompute); // 结算页参数改变,重新运算 router.post('/index/new/orderSub', authMW, order.orderSub); // 订单提交 router.get('/index/new/selectCoupon', authMW, order.selectCouponsPage); // 选择优惠券 页面 New! router.post('/index/new/couponList', order.couponList); // [ajax]获取优惠券列表 router.post('/index/new/useCouponCode', order.useCouponCode); // [ajax]购物车输入优惠券码使用优惠券 router.get('/index/new/selectAddress', authMW, csrf, order.selectAddress); // 选择地址 router.get('/index/new/invoiceInfo', authMW, order.invoiceInfo); // 发票信息 router.get('/index/new/jitDetail', authMW, order.jitDetail); // JIT 拆单配送信息 router.get('/index/new/selectGiftcard', authMW, order.selectGiftcard); // 选择礼品卡页面 router.get('/index/new/giftCardSendSms', authMW, order.giftCardSendSms); // 重发验证码 router.post('/index/add', indexController.add); // 加入购物车 router.get('/index/index', indexController.index); // 购物车 TODO: 删除 router.get('/index/new', indexController.index); // 购物车(新版接口) router.post('/index/new/data', indexController.indexData); // 购物车 router.post('/index/new/select', indexController.select); // 选择取消购物车商品 router.post('/index/new/del', indexController.del); // 删除购物车商品 router.post('/index/new/col', indexController.col); // 删除购物车商品 router.post('/index/new/goodinfo', indexController.goodinfo); // 获取购物车商品数据,chosepanel router.post('/index/new/modifyNum', indexController.modifyNum); // 修改购物车商品数量 router.post('/index/new/modify', indexController.modify); // 修改购物车商品数据 router.post('/index/new/modifyPriceGift', indexController.modifyPriceGift); // 修改购物车赠品、加价购商品数据 router.get('/index/new/gift', indexController.gift); // 获取购物车赠品 router.get('/index/new/advanceBuy', indexController.advanceBuy); // 获取购物车加价购 router.post('/index/new/giftinfo', indexController.giftinfo); // 获取购物车加价购商品数据,chosepanel router.post('/index/new/incrbundle', indexController.incrBundle); // 购物车增加套餐数量 router.post('/index/new/decrbundle', indexController.decrBundle); // 购物车减少加套餐数量 router.get('/index/buynow/orderensure', authMW, disableBFCache, BuyNowController.orderEnsure); // 立即购买订单确认页面 router.post('/index/buynow/ordercompute', authMW, BuyNowController.orderCompute); // 立即购买订单重新计算 router.post('/index/buynow/ordersub', authMW, BuyNowController.orderSub); // 立即购买订单提交 router.get('/index/buynow/selectAddress', authMW, csrf, BuyNowController.selectAddress); // 选择地址 router.get('/index/buynow/selectInvoice', authMW, BuyNowController.selectInvoice); // 发票信息 router.get('/index/buynow/selectCoupon', authMW, BuyNowController.selectCoupon); // 选择优惠券页面 router.post('/index/buynow/useCouponCode', BuyNowController.useCouponCode); // [ajax]输入优惠券码使用优惠券 router.post('/index/buynow/couponList', BuyNowController.couponList); // [ajax]获取优惠券列表 router.get('/index/buynow/selectGiftcard', authMW, BuyNowController.selectGiftcard); // 选择礼品卡页面 // 支付中心 URL,由于微信安全限制,在现有 URL 后追加 new ,通过 subDomain 中间件转发到此 router.get('/home/orders/paynew', authMW, payController.payCenter); // 门票确认 router.get('/index/ticketsConfirm', authMW, ticketsConfirmController.ticketsConfirm); // 门票下单 router.post('/index/submitTicket', ticketsConfirmController.submitTicket); // 添加门票 router.post('/index/checkTickets', ticketsConfirmController.checkTickets); module.exports = router;