gift-advance.js
1 KB
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
40
41
/**
* 赠品/加价购
* @author: xuqi<qi.xu@yoho.cn>
* @date: 2015/10/23
*/
var $ = require('jquery'),
lazyLoad = require('yoho.lazyload'),
tip = require('../plugin/tip'),
loading = require('../plugin/loading'),
chosePanel = require('./chose-panel');
var $page = $('.gift-advance-page');
lazyLoad($('.lazy'));
function getProductInfo(skn, promotionId) {
loading.showLoadingMask();
$.get('/cart/index/giftinfo', {
skn: skn,
promotionId: promotionId
}).then(function(html) {
if (!html) {
tip.show('网络错误');
return;
}
chosePanel.show(html);
}).fail(function() {
tip.show('网络错误');
}).always(function() {
loading.hideLoadingMask();
});
}
$page.on('touchend', '.chose', function() {
var $this = $(this),
id = $this.closest('.gift-advance-good').data('id'),
promotionId = $this.closest('.advance-block').data('promotion-id');
getProductInfo(id, promotionId);
});