...
|
...
|
@@ -5,25 +5,48 @@ |
|
|
*/
|
|
|
|
|
|
var $ = require('jquery'),
|
|
|
lazyLoad = require('yoho.lazyload');
|
|
|
lazyLoad = require('yoho.lazyload'),
|
|
|
Handlebars = require('yoho.handlebars'),
|
|
|
tip = require('../plugin/tip'),
|
|
|
chosePanel = require('./chose-panel');
|
|
|
|
|
|
//var chosePanel = require('./chose-panel');
|
|
|
var panelTmpl,
|
|
|
$page = $('.gift-advance-page'),
|
|
|
$chosePanel = $('#chose-panel');
|
|
|
|
|
|
lazyLoad($('.lazy'));
|
|
|
|
|
|
//$('.gift-advance-page').on('touchstart', '.chose', function() {
|
|
|
// var id = $(this).closest('.gift-advance-good').data('id');
|
|
|
//
|
|
|
// $.ajax({
|
|
|
// type: 'GET',
|
|
|
// url: '/shoppingCart/goodinfo',
|
|
|
// data: {
|
|
|
// id: id
|
|
|
// },
|
|
|
// success: function(data) {
|
|
|
// if (data.code === 200) {
|
|
|
// chosePanel.show(data.data);
|
|
|
// }
|
|
|
// }
|
|
|
// });
|
|
|
//}); |
|
|
\ No newline at end of file |
|
|
$.get('/cart/index/giftinfoTpl', function(html) {
|
|
|
if (!html) {
|
|
|
tip.show('网络错误');
|
|
|
return;
|
|
|
}
|
|
|
panelTmpl = Handlebars.compile(html);
|
|
|
}).fail(function() {
|
|
|
tip.show('网络错误');
|
|
|
});
|
|
|
|
|
|
function getProductInfo(skn, promotionId) {
|
|
|
$.get('/cart/index/giftinfo', {
|
|
|
skn: skn,
|
|
|
promotionId: promotionId
|
|
|
}).then(function(res) {
|
|
|
if (!res) {
|
|
|
tip.show('网络错误');
|
|
|
return;
|
|
|
}
|
|
|
console.log(res);
|
|
|
$chosePanel.html(panelTmpl(res));
|
|
|
chosePanel.show();
|
|
|
}).fail(function() {
|
|
|
tip.show('网络错误');
|
|
|
});
|
|
|
}
|
|
|
|
|
|
$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);
|
|
|
}); |
...
|
...
|
|