ticketsConfirm.js 1.55 KB
'use strict';

const headerModel = require('../../../doraemon/models/header'); // 头部model
const indexModel = require('../models/ticketsConfirm');

const ticketsConfirm = (req, res) => {
    let headerData = headerModel.setNav({
        navTitle: '确认订单',
        navBtn: false
    });

    let responseData = {
        pageHeader: headerData,
        module: 'cart',
        page: 'tickets-confirm',
        title: '确认订单',

        // pageFooter: true,
        localCss: true,
        navBtn: false
    };

    let params = {
        uid: req.user.uid,
        productSku: req.body.productSku,
        buyNumber: req.body.buyNumber,
        useYohoCoin: req.body.useYohoCoin,
        yohoCoinMode: true
    };

    indexModel.ticketsConfirm(params).then(result => {
        res.render('ticketsConfirm', Object.assign(responseData, result));
    });
};

const submitTicket = (req, res) => {
    let params = {
        uid: req.user.uid,
        productSku: req.body.productSku,
        buyNumber: req.body.buyNumber,
        mobile: req.body.mobile,
        useYohoCoin: req.body.useYohoCoin
    };

    indexModel.submitTicket(params).then(result => {
        res.json(result);
    });
};

const checkTickets = (req, res) => {
    let params = {
        uid: req.user.uid,
        productSku: req.body.productSku,
        buyNumber: req.body.buyNumber,
        useYohoCoin: req.body.useYohoCoin
    };

    indexModel.checkTickets(params).then(result => {
        res.json(result);
    });
};

module.exports = {
    ticketsConfirm,
    submitTicket,
    checkTickets
};