Authored by 李靖

联调

... ... @@ -2,8 +2,9 @@
'use strict';
const headerModel = require('../../../doraemon/models/header'); // 头部model
const couponModel = require('../models/coupon-list');
exports.index = (req, res) => {
exports.index = (req, res, next) => {
let responseData = {
module: 'activity',
page: 'coupon-list',
... ... @@ -15,5 +16,11 @@ exports.index = (req, res) => {
localCss: true
};
res.render('coupon-list', Object.assign(responseData, ''));
let params = {
uid: req.user.uid
};
req.ctx(couponModel).index(params).then(result => {
res.render('coupon-list', Object.assign(responseData, result));
}).catch(next);
};
... ...
'use strict';
const _ = require('lodash');
class CouponList extends global.yoho.BaseModel {
constructor(ctx) {
super(ctx);
}
getCoupons(params) {
let options = {
data: {
method: 'app.promotion.queryPersonalityCoupons',
uid: params.uid
},
param: {
cache: true,
code: 200
}
};
return this.get(options).then(result => {
return result;
});
}
index(params) {
return Promise.all([
this.getCoupons(params)
]).then(result => {
let resu = {
shopCoupons: []
};
if (_.get(result, '[0].data')) {
_.forEach(result[0].data, (value) => {
let coupons = [];
_.forEach(value.personalityShopCouponBos, (item) => {
coupons.push({
couponName: item.couponName
});
});
resu.shopCoupons.push(coupons);
});
}
return resu;
});
}
}
module.exports = CouponList;
... ...
... ... @@ -21,7 +21,8 @@
.list-item {
width: 338px;
height: 136px;
background-color: #f00;
background-image: resolve("activity/coupon-list/coupon-2.jpg");
background-size: 100% 100%;
display: inline-block;
margin-bottom: 22px;
... ... @@ -47,12 +48,13 @@
font-size: 0;
line-height: 0;
padding: 0 14px;
margin-bottom: 47px;
margin-bottom: 25px;
.list-item {
width: 228px;
height: 187px;
background-color: #f00;
background-image: resolve("activity/coupon-list/coupon-3.jpg");
background-size: 100% 100%;
display: inline-block;
margin-bottom: 22px;
margin-right: 19px;
... ...