|
@@ -15,6 +15,7 @@ var $ = require('yoho-jquery'), |
|
@@ -15,6 +15,7 @@ var $ = require('yoho-jquery'), |
15
|
var isGetData;
|
15
|
var isGetData;
|
16
|
|
16
|
|
17
|
var $newCoupon = $('#new-coupon'),
|
17
|
var $newCoupon = $('#new-coupon'),
|
|
|
18
|
+ linkUrl = document.referrer,
|
18
|
$couponList = $('#coupon-list');
|
19
|
$couponList = $('#coupon-list');
|
19
|
|
20
|
|
20
|
var winH = $(window).height();
|
21
|
var winH = $(window).height();
|
|
@@ -37,6 +38,14 @@ function fixedLayOut() { |
|
@@ -37,6 +38,14 @@ function fixedLayOut() { |
37
|
|
38
|
|
38
|
ellipsis.init();
|
39
|
ellipsis.init();
|
39
|
|
40
|
|
|
|
41
|
+function goToBack() {
|
|
|
42
|
+ if (linkUrl) {
|
|
|
43
|
+ window.location.href = linkUrl;
|
|
|
44
|
+ } else {
|
|
|
45
|
+ history.go(-1);
|
|
|
46
|
+ }
|
|
|
47
|
+}
|
|
|
48
|
+
|
40
|
$newCoupon.on('submit', function() {
|
49
|
$newCoupon.on('submit', function() {
|
41
|
var $this = $(this);
|
50
|
var $this = $(this);
|
42
|
|
51
|
|
|
@@ -59,7 +68,7 @@ $newCoupon.on('submit', function() { |
|
@@ -59,7 +68,7 @@ $newCoupon.on('submit', function() { |
59
|
orderInfo('yohoCoin', 0);
|
68
|
orderInfo('yohoCoin', 0);
|
60
|
orderInfo('couponCode', res.data.coupon_code);
|
69
|
orderInfo('couponCode', res.data.coupon_code);
|
61
|
orderInfo('couponName', res.data.coupon_title);
|
70
|
orderInfo('couponName', res.data.coupon_title);
|
62
|
- history.go(-1);
|
71
|
+ goToBack();
|
63
|
}
|
72
|
}
|
64
|
}).fail(function() {
|
73
|
}).fail(function() {
|
65
|
tip.show('网络错误');
|
74
|
tip.show('网络错误');
|
|
@@ -85,7 +94,7 @@ $('body').on('touchend', '.not-use', function() { |
|
@@ -85,7 +94,7 @@ $('body').on('touchend', '.not-use', function() { |
85
|
|
94
|
|
86
|
// 实付金额发生变化,使用有货币为0
|
95
|
// 实付金额发生变化,使用有货币为0
|
87
|
orderInfo('yohoCoin', 0);
|
96
|
orderInfo('yohoCoin', 0);
|
88
|
- history.go(-1);
|
97
|
+ goToBack();
|
89
|
});
|
98
|
});
|
90
|
|
99
|
|
91
|
|
100
|
|
|
@@ -142,7 +151,7 @@ function getCouponHandle(allCoupons) { |
|
@@ -142,7 +151,7 @@ function getCouponHandle(allCoupons) { |
142
|
|
151
|
|
143
|
// 实付金额发生变化,使用有货币为0
|
152
|
// 实付金额发生变化,使用有货币为0
|
144
|
orderInfo('yohoCoin', 0);
|
153
|
orderInfo('yohoCoin', 0);
|
145
|
- history.go(-1);
|
154
|
+ goToBack();
|
146
|
} else if (res.message) {
|
155
|
} else if (res.message) {
|
147
|
tip.show(res.message);
|
156
|
tip.show(res.message);
|
148
|
}
|
157
|
}
|