returns.js 1.09 KB
/**
 *  个人中心 退换货
 *  @author 陈轩 <xuan.chen@yoho.cn>
 */
'use strict';

const cookie = global.yoho.cookie;
const returnsModel = require('../models/returns');

/*
    我的退换货-列表页
 */
exports.index = (req, res, next) => {
    const uid = cookie.getUid(req);
    const page = req.query.page;

    returnsModel.getReturnsList(uid, page /* ,limit=10*/)
        .then(data => {
            const viewData = Object.assign({
                module: 'home',
                page: 'returns',
                meReturnsPage: true
            }, data);

            res.render('returns/returns', viewData);
        })
        .catch(next);
};

/*
    我的订单-退货申请页
 */
exports.refundRequest = (req, res, next) => {
    const orderCode = req.query.orderCode;
    const uid = cookie.getUid(req);

    returnsModel.getRefund()
        .then(data => {
            const viewData = Object.assign({
                module: 'home',
                page: 'returns',
                me
            })
            res.render('resturns/returns-apply', viewData);
        })
        .catch(next)
};