|
@@ -3,6 +3,9 @@ |
|
@@ -3,6 +3,9 @@ |
3
|
*/
|
3
|
*/
|
4
|
var $ = require('jquery'),
|
4
|
var $ = require('jquery'),
|
5
|
common = require('../common/common');
|
5
|
common = require('../common/common');
|
|
|
6
|
+
|
|
|
7
|
+var ZeroClipboard = require("../util/ZeroClipboard.min");
|
|
|
8
|
+ZeroClipboard.config({swfPath: "http://cdn.yoho.cn/yohobuy-portal/assets/images/ZeroClipboard.swf"});
|
6
|
/**
|
9
|
/**
|
7
|
* 列表显示数据
|
10
|
* 列表显示数据
|
8
|
* @type {common.grid}
|
11
|
* @type {common.grid}
|
|
@@ -41,8 +44,8 @@ var g = new common.grid({ |
|
@@ -41,8 +44,8 @@ var g = new common.grid({ |
41
|
display: "token值",
|
44
|
display: "token值",
|
42
|
name: "couponSendToken",
|
45
|
name: "couponSendToken",
|
43
|
render: function (item) {
|
46
|
render: function (item) {
|
44
|
- return '<div class="col-sm-12"><input class="col-sm-10" style="border: 0px" id="couponSendToken' + item.__index + '" value="' + item.couponSendToken + '" readonly/>' +
|
|
|
45
|
- '<input class="col-sm-2 btn couponSendToken" value="复制" data-index="' + item.__index + '"/></div>'
|
47
|
+ return '<div class="col-sm-12"><input class="col-sm-10" style="border: 0px" value="' + item.couponSendToken + '" readonly/>'
|
|
|
48
|
+ + '<a data-index="' + item.__index + '" href="JavaScript:;" class="btn btn-xs info-copy" data-clipboard-text="' + item.couponSendToken + '" id="copy-' + item.__index + '">复制链接</a></div>';
|
46
|
}
|
49
|
}
|
47
|
},
|
50
|
},
|
48
|
{
|
51
|
{
|
|
@@ -55,7 +58,10 @@ var g = new common.grid({ |
|
@@ -55,7 +58,10 @@ var g = new common.grid({ |
55
|
return arr.join('');
|
58
|
return arr.join('');
|
56
|
}
|
59
|
}
|
57
|
}
|
60
|
}
|
58
|
- ]
|
61
|
+ ],
|
|
|
62
|
+ complete: function () {
|
|
|
63
|
+ new ZeroClipboard($(".info-copy"));
|
|
|
64
|
+ }
|
59
|
});
|
65
|
});
|
60
|
g.init("/couponSendManager/queryList1");
|
66
|
g.init("/couponSendManager/queryList1");
|
61
|
/*验证*/
|
67
|
/*验证*/
|
|
@@ -75,41 +81,41 @@ var Bll = { |
|
@@ -75,41 +81,41 @@ var Bll = { |
75
|
width: '70%',
|
81
|
width: '70%',
|
76
|
button: [
|
82
|
button: [
|
77
|
{
|
83
|
{
|
78
|
- value: "保存",
|
|
|
79
|
- callback: function () {
|
|
|
80
|
- var couponIds = Bll.module.couponsIds || [];
|
|
|
81
|
- var flag = true;
|
|
|
82
|
- var ids = [];
|
|
|
83
|
- for (var i = 0; i < couponIds.length; i++) {
|
|
|
84
|
- ids.push(couponIds[i].id);
|
|
|
85
|
- }
|
|
|
86
|
- if (ids.join(",").indexOf("-1") > -1) {
|
|
|
87
|
- flag = false;
|
|
|
88
|
- common.util.__tip("请正确选择优惠券ID", "warning");
|
|
|
89
|
- } else {
|
|
|
90
|
- Bll.module.couponsIds = ids.join(",");
|
|
|
91
|
- }
|
|
|
92
|
- if (edit.validate() && flag) {
|
|
|
93
|
- common.util.__ajax({
|
|
|
94
|
- url: "/couponSendManager/addOrUpdate",
|
|
|
95
|
- data: Bll.module
|
|
|
96
|
- }, function (res) {
|
|
|
97
|
- if (res.code == '200') {
|
|
|
98
|
- g.reload();
|
|
|
99
|
- d.close();
|
|
|
100
|
- }
|
|
|
101
|
- else {
|
|
|
102
|
- common.util.__tip(res.message, "warning");
|
|
|
103
|
- }
|
|
|
104
|
- });
|
|
|
105
|
- }
|
|
|
106
|
- return false;
|
84
|
+ value: "保存",
|
|
|
85
|
+ callback: function () {
|
|
|
86
|
+ var couponIds = Bll.module.couponsIds || [];
|
|
|
87
|
+ var flag = true;
|
|
|
88
|
+ var ids = [];
|
|
|
89
|
+ for (var i = 0; i < couponIds.length; i++) {
|
|
|
90
|
+ ids.push(couponIds[i].id);
|
|
|
91
|
+ }
|
|
|
92
|
+ if (ids.join(",").indexOf("-1") > -1) {
|
|
|
93
|
+ flag = false;
|
|
|
94
|
+ common.util.__tip("请正确选择优惠券ID", "warning");
|
|
|
95
|
+ } else {
|
|
|
96
|
+ Bll.module.couponsIds = ids.join(",");
|
|
|
97
|
+ }
|
|
|
98
|
+ if (edit.validate() && flag) {
|
|
|
99
|
+ common.util.__ajax({
|
|
|
100
|
+ url: "/couponSendManager/addOrUpdate",
|
|
|
101
|
+ data: Bll.module
|
|
|
102
|
+ }, function (res) {
|
|
|
103
|
+ if (res.code == '200') {
|
|
|
104
|
+ g.reload();
|
|
|
105
|
+ d.close();
|
|
|
106
|
+ }
|
|
|
107
|
+ else {
|
|
|
108
|
+ common.util.__tip(res.message, "warning");
|
|
|
109
|
+ }
|
|
|
110
|
+ });
|
|
|
111
|
+ }
|
|
|
112
|
+ return false;
|
|
|
113
|
+ },
|
|
|
114
|
+ css: "btn-primary"
|
107
|
},
|
115
|
},
|
108
|
- css: "btn-primary"
|
|
|
109
|
- },
|
|
|
110
|
{
|
116
|
{
|
111
|
- "value":"取消",
|
|
|
112
|
- "css":"btn-info"
|
117
|
+ "value": "取消",
|
|
|
118
|
+ "css": "btn-info"
|
113
|
}
|
119
|
}
|
114
|
]
|
120
|
]
|
115
|
});
|
121
|
});
|
|
@@ -157,8 +163,8 @@ $(document).on("click", ".addBtn", function () { |
|
@@ -157,8 +163,8 @@ $(document).on("click", ".addBtn", function () { |
157
|
*/
|
163
|
*/
|
158
|
$(document).on("click", ".delBtn", function () {
|
164
|
$(document).on("click", ".delBtn", function () {
|
159
|
var index = $(this).data("index");
|
165
|
var index = $(this).data("index");
|
160
|
- if(Bll.module.couponsIds.length<=1){
|
|
|
161
|
- common.util.__tip("至少有一张优惠券","warning")
|
166
|
+ if (Bll.module.couponsIds.length <= 1) {
|
|
|
167
|
+ common.util.__tip("至少有一张优惠券", "warning")
|
162
|
}
|
168
|
}
|
163
|
else {
|
169
|
else {
|
164
|
Bll.module.couponsIds.splice(index, 1);
|
170
|
Bll.module.couponsIds.splice(index, 1);
|
|
@@ -189,7 +195,7 @@ $('#add-content').on('click', function () { |
|
@@ -189,7 +195,7 @@ $('#add-content').on('click', function () { |
189
|
*/
|
195
|
*/
|
190
|
$(document).on('click', '.update', function () {
|
196
|
$(document).on('click', '.update', function () {
|
191
|
var item = g.rows[$(this).data("index")];
|
197
|
var item = g.rows[$(this).data("index")];
|
192
|
- var item1= $.extend(true,{},item);
|
198
|
+ var item1 = $.extend(true, {}, item);
|
193
|
Bll.toast(item1, "修改");
|
199
|
Bll.toast(item1, "修改");
|
194
|
});
|
200
|
});
|
195
|
|
201
|
|
|
@@ -223,12 +229,7 @@ $(document).on('click', '#filter-btn', function () { |
|
@@ -223,12 +229,7 @@ $(document).on('click', '#filter-btn', function () { |
223
|
/**
|
229
|
/**
|
224
|
* 复制token点击事件
|
230
|
* 复制token点击事件
|
225
|
*/
|
231
|
*/
|
226
|
-$(document).on('click', '.couponSendToken', function () {
|
|
|
227
|
- var index = $(this).data("index");
|
|
|
228
|
- var id = "couponSendToken" + index;
|
|
|
229
|
- var Url2 = document.getElementById(id);
|
|
|
230
|
- Url2.select(); // 选择对象
|
|
|
231
|
- document.execCommand("Copy"); // 执行浏览器复制命令
|
232
|
+$(document).on('click', '.info-copy', function () {
|
232
|
common.util.__tip("Token链接已复制好,可贴粘", "success")
|
233
|
common.util.__tip("Token链接已复制好,可贴粘", "success")
|
233
|
});
|
234
|
});
|
234
|
|
235
|
|