recommend-product.js
963 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
/**
* 为您优选 | 店铺推荐 | 最近浏览
* @author: wsl<shuiling.wang@yoho.cn>
* @date: 2016/11/21
*/
var recProduct = require('../../../tpl/product/recommend-product.hbs');
var recTemplet = require('../../../tpl/product/recommend-templet.hbs');
var recommmendProduct = {
init: function(params) {
var _this = this;
var obj = {
isGoodsDetail: false
};
if (params.isGoodsDetail) {
obj.isGoodsDetail = true;
}
$(params.dom).append(recTemplet(obj));
_this.getRecommendProduct({
page: 1,
dom: params.dom
});
},
getRecommendProduct: function(params) {
$.get('/product/getRecommendProduct', {
page: params.page
}, function(data) {
if (data) {
$(params.dom).find('.goods-area').html(recProduct(data));
}
});
}
};
module.exports = recommmendProduct;