shop.modular.Index.js
5.53 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
webpackJsonp([175],[
/* 0 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
var $ = __webpack_require__(1),
common=__webpack_require__(2);
var ENUM = {
decoratorStatus: {0: "待装修", 1: "待审核", 2: "已发布", 3: "驳回"}
}
var g;
// 有货店铺、BLK店铺切换
var t = new common.tab({
el: "#basicTab",
columns: [
{name: "all", display: "有货"},
{name: "1", display: "BLK"}
],
click: function() {
g.reload(1);
}
}).init({});
// 初始化筛选框
new common.dropDown({el: "#shop-name", ajax: "shopsRest"});
new common.dropDown({el: "#supplier-name", ajax: "supplier"});
new common.dropDown({el: "#brand-name", ajax: "brand"});
new common.dropDown({el: "#open-status"});
new common.dropDown({el: "#decorator-status"});
// 装修列表
g = new common.grid({
el: "#basicTable",
parms: function() {
return {
"shopId": common.util.__input("shop-name"),
"supplierId": common.util.__input("supplier-name"),
"brandId": common.util.__input("brand-name"),
"openStatus": common.util.__input("open-status"),
"decoratorStatus": common.util.__input("decorator-status"),
"appType": +t.active ? 1 : 0
};
},
columns: [
{name: "shopId", display: "店铺ID"},
{name: "shopName", display: "店铺名称"},
{display: "品牌", render: function(item) {
if(item.brandNames) {
var brandArr = item.brandNames.split(',');
var _brands = [];
$.each(brandArr, function(i, value) {
if($.inArray(value, _brands) === -1) {
_brands.push(value);
}
});
var htmlArr = [];
htmlArr.push('<span>');
htmlArr.push(_brands[0]);
htmlArr.push('</span>');
if(_brands.length > 1) {
htmlArr.push('<div class="hover-me">');
htmlArr.push('<div class="brand-tips" style="display: none;"><div class="hover-left"></div>');
htmlArr.push('<div class="hover-pop"><div class="pop-arrow"></div><div class="hover-right"><p>');
htmlArr.push(_brands.join('</p><p>'));
htmlArr.push('</p></div></div></div>');
}
return htmlArr.join(' ');
} else {
return '';
}
}},
{display: "发布时间", render: function(item) {
if (item.publishTime && item.publishTime != 0) {
return common.util.__dateFormat(new Date(item.publishTime * 1000), "yyyy-MM-dd hh:mm:ss");
} else {
return '';
}
}},
{display: "状态", render: function(item) {
if (item.decoratorStatus) {
return ENUM.decoratorStatus[item.decoratorStatus];
} else {
return '待装修';
}
}},
{display: "操作人", render: function(item) {
if (item.operatorName) {
return item.operatorName;
} else {
return '';
}
}},
{display: "操作", render: function(item) {
var HtmArr = [];
HtmArr.push('<div>');
var uri = '/shop/decorator/modulartool?shopId=' + item.shopId;
uri += '&shopName=' + encodeURIComponent(item.shopName);
uri += '&appType=' + (+t.active ? 1 : 0);
HtmArr.push('<a href="' + uri + '" target="_blank" class="btn btn-primary btn-xs">APP装修</a>');
HtmArr.push('<a href="/supplier/store/decorationDetail/'+item.shopId+'/'+item.shopsType+'/editor/" class="btn btn-info btn-xs">PC装修</a>');
if(+item.decoratorStatus == 2) {
// 店铺装修模板发布之后,才涉及开店、关店
if(+item.shopStatus == 1){
// 1开启 0 关闭
HtmArr.push('<a data-shop-id="'+item.shopId+'" href="javascript:void(0);" class="closeshops btn btn-danger btn-xs">关店</a>');
}else{
HtmArr.push('<a data-shop-id="'+item.shopId+'" href="javascript:void(0);" class="openshops btn btn-success btn-xs">开店</a>');
}
}
HtmArr.push('</div>');
return HtmArr.join('');
}}
]
});
$('#filter-btn').on('click', function () {
g.reload(1);
});
g.init('/shop/ModularDecoratorRest/findShopsDecorator');
$(document).on('mouseover', '.hover-me', function() {
$(this).parent().find('.brand-tips').show();
});
$(document).on('mouseout', '.hover-me', function() {
$(this).parent().find('.brand-tips').hide();
});
$(document).on('click', '.openshops', function() {
var shopId = $(this).data('shop-id');
common.dialog.confirm("温馨提示", "确定要开启此有货店铺吗?", function() {
common.util.__ajax({
url: '/supplier/store/openShops',
data: {
shopsId: shopId
}
}, function() {
g.reload();
});
})
});
$(document).on('click', '.closeshops', function() {
var shopId = $(this).data('shop-id');
common.dialog.confirm("温馨提示", "确定要关闭此有货店铺吗?", function() {
common.util.__ajax({
url: '/supplier/store/closeShops',
data: {
shopsId: shopId
}
}, function() {
g.reload();
});
})
})
/***/ }
]);