staticFileManager.js
5.97 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
/**
* Created by wangqianjun on 16/5/16.
* 静态文件管理
*/
var $ = require('jquery');
common = require('../common/common');
datepicker = require('../util/datepicker');
require('../common/umeditor.config');
require('../common/umeditor');
require('../common/zh-cn');
var baidu;
var ENUM = {
AuditEnum: {
'0': '待审核',
'1': '审核通过',
'2': '审核失败',
},
RecommendEnum: {
true: '已推荐',
false: '未推荐'
},
RewardEnum: {
false: '未发送奖励',
true: '奖励已发放'
}
};
var g = new common.grid({
el: '#basicTable',
size: 10,
parms: function () {
return {
status: $('#status').val(),
recomReward: $('#recomReward').val(),
hasImage: $('#hasImage').val(),
beginTime: common.util.__input('beginTime'),
endTime: common.util.__input('endTime'),
uid: common.util.__input('uid'),
productName: common.util.__input('productName'),
productSkn: common.util.__input('productSkn'),
orderCode: common.util.__input('orderCode')
};
},
columns: [{
display: '订单号',
name: "orderId"
}, {
display: '商品名称',
render: function (item) {
var goods = item.goods;
if (goods != null) {
productHref = "http://item.yohobuy.com/product/pro_" + item.productId + "_" + goods.goodsId + "/" + goods.cnAlphabet + ".html";
}
return '<a href="' + item.productHref + '">' + item.productName + '</a>'
}
}, {
display: '用户id',
name: "uid"
}, {
display: '商品图片',
render: function (item) {
var goods = item.goods;
var goodImgUrl = "";
if (goods != null && goods.goodsImg != null && goods.goodsImg.length > 0) {
goodImgUrl = goods.goodsImg[0].imageUrl;
}
return '<img src="' + goodImgUrl + '" width="100" height="60"/>'
}
}, {
display: "评价图片",
render: function (item) {
//item.url = common.util.__template(item.url,{mode:2,width:100,height:100});
return '<img src="' + item.url + '" width="100" height="60"/>'
}
}, {
display: '评价内容',
name: "content",
//width:'15%',
style: "width:15%; word-break:break-all;"
}
, {
display: '评价星级',
name: "satisfied"
}, {
display: '审核状态',
render: function (item) {
return "<p>" + ENUM.AuditEnum[item.status] + "</p>";
}
},
{
display: '审核返币',
render: function (item) {
return "<p>" + ENUM.RewardEnum[item.shareReward] + "</p>";
}
},
{
display: '推荐状态',
render: function (item) {
return "<p>" + ENUM.RecommendEnum[item.recomReward] + "</p>";
}
}, {
display: "创建时间",
render: function (item) {
var t = new Date(item.createTime * 1000);
var formatted = common.util.__dateFormat(t, "yyyy-MM-dd hh:mm:ss");
return "<p>" + formatted + "</p>";
}
}, {
display: '备注',
name: "remark"
}, {
display: '操作',
//}
render: function (items) {
var HtmArr = [];
HtmArr.push('<a data-index="' + items.__index + '" style="margin-bottom:10px;" href="JavaScript:;" class="btn btn-info btn-xs info-modify">编辑</a>');
HtmArr.push('<a data-index="' + items.__index + '" href="JavaScript:;" class="btn btn-danger btn-xs info-del">删除</a>');
return HtmArr.join('');
}
}
]
});
g.init('/shareOrder/shareOrderList');
//添加
$(document).on('click', '#add', function () {
staticFileOP("新增", '', {});
});
//删除
$(document).on('click', '.info-del', function () {
var item = g.rows[$(this).data("index")];
common.dialog.confirm("温馨提示", "确定要删除吗?", function () {
common.util.__ajax({
url: '',
data: {
uid: item.uid,
}
}, function (res) {
if (res.code == 200) {
g.reload();
} else {
common.util.__tip(res.message);
}
});
});
});
$(document).on('click', '#filter', function () {
g.reload();
});
$(document).on('click', '#add', function () {
g.reload();
});
//编辑
$(document).on('click', '.info-modify', function () {
var item = g.rows[$(this).data("index")];
staticFileOP("编辑", '/guang/relationship/updateRel', item);
});
function staticFileOP(prefix, url, item) {
var a = new common.edit(".confirm", {
//"bucket" : "author"
});
//下拉框
new common.dropDown({
el: "#type"
});
var dialog = new common.dialog({
title: prefix + '静态文件',
content: common.util.__template2($("#template").html(), item),
button: [{
value: '提交',
callback: function () {
a.submit(url, function (option) {
//option.data.
option.success = function (res) {
res = res.data;
if (res.code == 200) {
a.$tip('提交成功', function () {
g.reload();
})
} else {
a.$tip(res.message);
}
}
});
return false;
}
}]
});
baidu && baidu.destroy();
baidu = UM.getEditor('baidueditor');
//baidu.setContent(module.contentData.data.text);
a.init();
}