coupons.js
921 Bytes
// 优惠券 by acgpiano
'use strict';
const headerModel = require('../../../doraemon/models/header'), // 头部model
model = require('../models/coupons');
// 处理Ajax请求,status为使用状态
const index = (req, res, next) => {
model.couponData({
method: 'app.coupons.li',
uid: req.user.uid,
status: req.body.status || 0,
page: req.body.page || 1,
limit: 10,
}).then(result => {
let options = {
module: 'home',
page: 'coupons',
pageHeader: headerModel.setNav({
navTitle: '优惠券'
}),
title: '优惠券',
pageFooter: true,
list: result,
};
req.body.page && (req.body.page !== '1' || req.body.status === '1') && (options.layout = false);
res.render('coupons', options);
}).catch(next);
};
module.exports = {
index,
};