refund.js 1.15 KB
/**
 * 退换货
 * @type {Object}
 */
'use strict';
const refundModel = require('../models/refund');

const refund = {
    refund(req, res) {
        res.render('refund');
    },
    order(req, res, next) {
        const uid = req.user.uid || 8050882;
        const orderId = req.query.orderId;

        if (!orderId) {
            return next();
        }

        refundModel.getOrderData(uid, orderId).then(result => {
            res.json(result);
        }).catch(next);
    },
    submit(req, res, next) {
        const uid = req.user.uid || 8050882;

        refundModel.submitRefundData(uid, req.body).then(result => {
            res.json(result);
        }).catch(next);
    },
    logistics(req, res) {
        res.render('logistics', {
            module: 'home',
            page: 'logistics'
        });
    },
    companylist(req, res, next) {
        refundModel.getExpressCompany().then(result => {
            res.json(result);
        }).catch(next);
    },
    saveLogistics(req, res, next) {
        const company = req.body.company;
        const num = req.body.num;

        res.json({
            code: 200
        });
    }
};

module.exports = refund;