...
|
...
|
@@ -11,22 +11,36 @@ const _ = require('lodash'); |
|
|
|
|
|
exports.index = (req, res) => {
|
|
|
cartModel.getCartInfo().then((result) => {
|
|
|
console.log('proLength:', result[0].length && result[1].length && result[2].length);
|
|
|
|
|
|
const mock = {
|
|
|
loggedIn: true,
|
|
|
prosNum: result[0].length && result[1].length && result[2].length,
|
|
|
selectedGoods: {
|
|
|
prePros: result[0],
|
|
|
normalPros: result[1],
|
|
|
noMorePros: result[2]
|
|
|
}
|
|
|
prosNum: result[0].preSalePros.length && result[1].commonPros.length && result[2].invalidPros.length
|
|
|
};
|
|
|
|
|
|
if (result[0].preSalePros) {
|
|
|
_.merge(mock, {
|
|
|
preSalePros: result[0].preSalePros
|
|
|
});
|
|
|
}
|
|
|
|
|
|
if (result[1].commonPros) {
|
|
|
_.merge(mock, {
|
|
|
commonPros: result[1].commonPros
|
|
|
});
|
|
|
}
|
|
|
|
|
|
if (result[2].invalidPros) {
|
|
|
_.merge(mock, {
|
|
|
invalidPros: result[2].invalidPros
|
|
|
});
|
|
|
}
|
|
|
|
|
|
console.log(mock);
|
|
|
|
|
|
res.display('cart', _.merge({
|
|
|
module: 'shopping',
|
|
|
page: 'cart'
|
|
|
}, result[0], result[1], result[2],
|
|
|
mock));
|
|
|
}, mock));
|
|
|
|
|
|
}).catch((err) => {
|
|
|
res.send(err);
|
...
|
...
|
|