coupon-new.js
957 Bytes
const headerModel = require('../../../doraemon/models/header'); // 头部model
const CouponNewModel = require('../models/coupon-new');
class CouponNew {
page(req, res) {
res.render('coupons/page', {
module: 'home',
page: 'coupon-new',
localCss: true,
width750: true,
pageHeader: headerModel.setNav({
navTitle: '优惠券',
myConponPageNavBtn: true,
navBtn: false
})
});
}
/**
* 优惠券数据
*/
coupons(req, res, next) {
req.ctx(CouponNewModel).couponData({
method: 'app.coupons.li',
uid: req.user.uid,
status: parseInt(req.body.status || 0, 10),
page: parseInt(req.body.page || 1, 10),
limit: 10,
}).then(result => {
res.json(result);
}).catch(next);
}
}
module.exports = new CouponNew();