...
|
...
|
@@ -2,9 +2,41 @@ var $ = require('yoho-jquery'), |
|
|
Swiper = require('yoho-swiper'),
|
|
|
tip = require('../../plugin/tip');
|
|
|
|
|
|
var appVersion = window.queryString.app_version || window.queryString.appVersion;
|
|
|
require('../../common');
|
|
|
|
|
|
$('.coupon-content .receive-btn').closest('.swiper-slide').on('click', function() {
|
|
|
var shopCoupon = {};
|
|
|
|
|
|
shopCoupon = {
|
|
|
common: {
|
|
|
appVersion: window.queryString.app_version || window.queryString.appVersion,
|
|
|
uid: window.queryString.uid,
|
|
|
couponTemplate: require('product/shop/shop-coupon.hbs')
|
|
|
},
|
|
|
init: function() {
|
|
|
this.getShopCouponsList();
|
|
|
},
|
|
|
getShopCouponsList: function() {
|
|
|
var that = this;
|
|
|
|
|
|
$.ajax({
|
|
|
method: 'POST',
|
|
|
url: location.protocol + '//m.yohobuy.com/product/index/getShopCouponsList',
|
|
|
data: {
|
|
|
uid: that.common.uid
|
|
|
},
|
|
|
xhrFields: {
|
|
|
withCredentials: true
|
|
|
},
|
|
|
success: function(result) {
|
|
|
// $('.product-list').html(that.common.couponTemplate(result));
|
|
|
that.userCoupon();
|
|
|
}
|
|
|
});
|
|
|
},
|
|
|
userCoupon: function() {
|
|
|
var $self = this;
|
|
|
|
|
|
$('.coupon-content .receive-btn').closest('.swiper-slide').on('click', function() {
|
|
|
var that = this,
|
|
|
code = $(this).data('id') || '';
|
|
|
|
...
|
...
|
@@ -19,8 +51,8 @@ $('.coupon-content .receive-btn').closest('.swiper-slide').on('click', function( |
|
|
url: location.protocol + '//m.yohobuy.com/product/index/userCoupon',
|
|
|
data: {
|
|
|
couponID: code,
|
|
|
app_version: appVersion,
|
|
|
uid: window.queryString.uid
|
|
|
app_version: $self.common.appVersion,
|
|
|
uid: $self.common.uid
|
|
|
},
|
|
|
xhrFields: {
|
|
|
withCredentials: true
|
...
|
...
|
@@ -48,9 +80,13 @@ $('.coupon-content .receive-btn').closest('.swiper-slide').on('click', function( |
|
|
that.isCouponClick = true;
|
|
|
}
|
|
|
});
|
|
|
});
|
|
|
});
|
|
|
}
|
|
|
};
|
|
|
|
|
|
$(function() {
|
|
|
shopCoupon.init();
|
|
|
|
|
|
new Swiper('.coupon-content', {
|
|
|
slideElement: '.coupon-small',
|
|
|
slidesPerView: 'auto',
|
...
|
...
|
|