|
|
1
|
+/**
|
|
|
2
|
+ * 优惠券选择
|
|
|
3
|
+ * @author: bikai<kai.bi@yoho.cn>
|
|
|
4
|
+ * @date: 2015/12/10
|
|
|
5
|
+ */
|
|
|
6
|
+
|
1
|
var $ = require('jquery'),
|
7
|
var $ = require('jquery'),
|
2
|
Handlebars = require('yoho.handlebars'),
|
8
|
Handlebars = require('yoho.handlebars'),
|
3
|
ellipsis = require('mlellipsis'),
|
9
|
ellipsis = require('mlellipsis'),
|
4
|
loading = require('../plugin/loading'),
|
10
|
loading = require('../plugin/loading'),
|
5
|
- tip = require('../plugin/tip');
|
11
|
+ tip = require('../plugin/tip'),
|
|
|
12
|
+ orderInfo = require('./order-info');
|
6
|
|
13
|
|
7
|
var page = 1,
|
14
|
var page = 1,
|
8
|
canGetCoupon = true,
|
15
|
canGetCoupon = true,
|
|
@@ -21,9 +28,10 @@ $('#search-coupon').on('submit', function() { |
|
@@ -21,9 +28,10 @@ $('#search-coupon').on('submit', function() { |
21
|
}).then(function(res) {
|
28
|
}).then(function(res) {
|
22
|
if (res.code === 200) {
|
29
|
if (res.code === 200) {
|
23
|
tip.show('优惠券可用');
|
30
|
tip.show('优惠券可用');
|
|
|
31
|
+ orderInfo('couponCode', res.data.coupon_code);
|
24
|
window.location.href = '/shoppingCart/orderEnsure?coupon_code=' + res.data.coupon_code;
|
32
|
window.location.href = '/shoppingCart/orderEnsure?coupon_code=' + res.data.coupon_code;
|
25
|
} else {
|
33
|
} else {
|
26
|
- tip.show(res.msg);
|
34
|
+ tip.show(res.message);
|
27
|
}
|
35
|
}
|
28
|
}).fail(function() {
|
36
|
}).fail(function() {
|
29
|
tip.show('网络错误');
|
37
|
tip.show('网络错误');
|
|
@@ -31,6 +39,10 @@ $('#search-coupon').on('submit', function() { |
|
@@ -31,6 +39,10 @@ $('#search-coupon').on('submit', function() { |
31
|
return false;
|
39
|
return false;
|
32
|
});
|
40
|
});
|
33
|
|
41
|
|
|
|
42
|
+$('#coupon-list').on('touchend', 'employ-main', function() {
|
|
|
43
|
+ orderInfo('couponCode', $(this).data('coupon-code'));
|
|
|
44
|
+});
|
|
|
45
|
+
|
34
|
function getCouponHandle(coupons) {
|
46
|
function getCouponHandle(coupons) {
|
35
|
var notAvailableCoupons = [];
|
47
|
var notAvailableCoupons = [];
|
36
|
|
48
|
|