index.js
5.76 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
//商家管理
'use strict';
var $ = require('jquery'),
common=require('../common/common');
var ENUM={// 审核状态;100 暂存 200 待审核 300 审核通过 900 驳回
status:{100:'暂存',200:'审核中',300:'通过',900:'驳回'}
}
//basicTab
var t = new common.tab({
el:"#basicTab",
click:function(){
if(+t.active){
g.options.url="/supplier/store/ajax/shenhezx";
g.options.columns[1].name="shopsName";
g.options.columns[2]={display:"包含品牌",name:"brands",render:function(item){
var str='';
if(item.brands){
$.each(item.brands,function (index,a) {
str+='<p>'+a.brandName+'</p>';
});
}
return str;
}};
}else{
g.options.columns[1].name="shopName";
g.options.columns[2]={display:"包含品牌",name:"shopRelationList",render:function(item){
var str='';
if(item.shopRelationList){
$.each(item.shopRelationList,function (index,a) {
str+='<p>'+a.brandName+'</p>';
});
}
return str;
}};
g.options.url=$('#url').val();
}
g.reload(1);
},
columns:[
{name:"all",display:"信息审核"},
{name:"1",display:"装修审核"}
]
}).init({});
new common.dropDown({el:"#status"});
new common.dropDown({el:"#store-type"});
new common.dropDown({el:"#store-model"});
new common.dropDown({el:"#brand-name",ajax:"brand"});
new common.dropDown({el:"#supplier-name",ajax:"supplier"});
var authority=JSON.parse($("#authority").val());
$('#filter-btn').on('click',function(){
g.reload(1);
});
var g=new common.grid({
el:'#basicTable',
parms:function(){
return {
"supplierId":common.util.__input("supplier-name"),
"brandId":common.util.__input("brand-name"),
"checkStatus":(+t.active)?200:common.util.__input("status"),
"operationStatus":authority.operationStatus,
"checkStatusArr":authority.checkStatusArr
};
},
columns:[
{display:"店铺ID",name:"shopsId"},
{display:"店铺名称",name:"shopName"},
{display:"包含品牌",name:"shopRelationList",render:function(item){
var str='';
if(item.shopRelationList){
$.each(item.shopRelationList,function (index,a) {
str+='<p>'+a.brandName+'</p>';
});
}
return str;
}},
{display:"创建时间",name:"createTime"},
{display:"更新时间",name:"updateTime"},
{display:"状态",name:"checkStatus",render:function(item){
return ENUM.status[item.checkStatus];
}},
{display:"操作",name:"",render:function(item){
var HtmArr=[];
console.log(t);
if(t.active == "1"){
console.log(item);
HtmArr.push('<a href="/supplier/store/decorationDetail/'+item.shopsId+'/'+item.shopsType+'/check/'+item.id+'/" class="btn btn-info btn-xs">装修查看</a>');
}else{
HtmArr.push('<a href="/supplier/store/'+authority.info+'/'+item.shopsId+'" href="javascript:void(0);" class="btn btn-info btn-xs">查看</a>');
}
//创建
if(authority.create){
if(+item.checkStatus==100||+item.checkStatus==900){
HtmArr.push('<a href="/supplier/store/update/'+item.shopsId+'" href="javascript:void(0);" class="btn btn-success btn-xs">编辑</a>');
}
}
if(authority.btn){
if(+item.checkStatus!=200){
HtmArr.push('<a href="/supplier/store/update/'+item.shopsId+'" href="javascript:void(0);" class="btn btn-success btn-xs">编辑</a>');
}
/* 开关店放到店铺装修列表里面
if(+item.checkStatus!=900){
if(+item.status){
// 1开启 0 关闭
HtmArr.push('<a data-index="'+item.__index+'" href="javascript:void(0);" class="closeshops btn btn-danger btn-xs">关店</a>');
}else{
HtmArr.push('<a data-index="'+item.__index+'" href="javascript:void(0);" class=" openshops btn btn-success btn-xs">开店</a>');
}
}*/
}
return HtmArr.join('');
}}
]
})
g.init($('#url').val());
var Bll={
toast:function(content,url,id){
common.dialog.confirm("温馨提示",content,function(){
common.util.__ajax({
url:url,
data:{shopsId:id}
},function(){
g.reload();
});
});
}
}
//关闭店铺
$('#basicTable').on('click', '.closeshops', function() {
var item=g.rows[$(this).data("index")];
Bll.toast("确定要关闭此店铺吗?","/supplier/store/closeShops",item.shopsId);
});
//开启店铺
$('#basicTable').on('click', '.openshops', function() {
var item=g.rows[$(this).data("index")];
Bll.toast("确定要开启此店铺吗?","/supplier/store/openShops",item.shopsId);
});
//shopsstatus