...
|
...
|
@@ -25,21 +25,11 @@ |
|
|
}
|
|
|
</style>
|
|
|
<div style="margin-left: 30px;" class="div_search">
|
|
|
<a id="addBrand" class="easyui-linkbutton btn-success">添加品牌</a>
|
|
|
</div>
|
|
|
<div style="margin-left: 30px;" class="div_search">
|
|
|
<input id="brandName" type="text">
|
|
|
<input id="brandStatus" class="easyui-combobox" value="" data-options="
|
|
|
editable: false,
|
|
|
valueField: 'id',
|
|
|
textField: 'text',
|
|
|
data: [{
|
|
|
id: '',
|
|
|
text: '选择状态'
|
|
|
}, {
|
|
|
id: '1',
|
|
|
text: '开启'
|
|
|
}, {
|
|
|
id: '2',
|
|
|
text: '关闭'
|
|
|
}]"/>
|
|
|
<input id="brandStatus" type="text"/>
|
|
|
|
|
|
<a id="searchLinkButton" class="easyui-linkbutton btn-info" data-options="iconCls:'icon-search'">筛选</a>
|
|
|
<a id="searchAllLinkButton" class="easyui-linkbutton btn-info" data-options="iconCls:'icon-search'">全部</a>
|
...
|
...
|
@@ -52,7 +42,15 @@ |
|
|
</div>
|
|
|
|
|
|
<script type="text/javascript">
|
|
|
|
|
|
var brandId;
|
|
|
$(function () {
|
|
|
$('#addBrand').linkbutton({
|
|
|
iconCls: "icon-edit",
|
|
|
onClick: function () {
|
|
|
editRow(0);
|
|
|
}
|
|
|
});
|
|
|
|
|
|
$.ajax({
|
|
|
contentType: "application/json",
|
...
|
...
|
@@ -76,18 +74,31 @@ |
|
|
}
|
|
|
});
|
|
|
|
|
|
$("#brandStatus").myCombobox({
|
|
|
prompt: "选择状态",
|
|
|
width: 200,
|
|
|
data: [{
|
|
|
id: '1',
|
|
|
text: '开启'
|
|
|
}, {
|
|
|
id: '2',
|
|
|
text: '关闭'
|
|
|
}],
|
|
|
valueField: "id",
|
|
|
textField: "text"
|
|
|
});
|
|
|
|
|
|
|
|
|
var brandMyDatagrid = $("#brandTable");
|
|
|
brandMyDatagrid.myDatagrid({
|
|
|
$("#brandTable").myDatagrid({
|
|
|
fit: true,
|
|
|
fitColumns: true,
|
|
|
nowrap: false,
|
|
|
url: contextPath + "/brand/getBrandPageList",
|
|
|
method: 'POST',
|
|
|
queryParams: {
|
|
|
/*queryParams: {
|
|
|
'brandName':'',
|
|
|
'status':''
|
|
|
},
|
|
|
},*/
|
|
|
loadFilter: function (data) {
|
|
|
var temp = defaultLoadFilter(data);
|
|
|
temp.rows = temp.list;
|
...
|
...
|
@@ -103,25 +114,19 @@ |
|
|
field: "brandLogo",
|
|
|
width: 80,
|
|
|
align: "center",
|
|
|
formatter: function (value, rowData) {
|
|
|
return rowData.askUserName + "(" + rowData.askUserId + ")";
|
|
|
formatter: function (value) {
|
|
|
return '<img src="' + value + '" style="width:98px;height:98px"/></a>';
|
|
|
}
|
|
|
}, {
|
|
|
title: "品牌名称",
|
|
|
field: "brandName",
|
|
|
width: 100,
|
|
|
align: "center",
|
|
|
formatter: function (value, rowData) {
|
|
|
return "<a href='" + rowData.productUrl + "' target='_blank'>" + rowData.productName + "</a><br>SKN:" + rowData.skn + "<br>品牌:" + brandDataObj[rowData.brandId];
|
|
|
}
|
|
|
align: "center"
|
|
|
}, {
|
|
|
title: "英文名称",
|
|
|
field: "brandNameEn",
|
|
|
width: 80,
|
|
|
align: "center",
|
|
|
formatter: function (value, rowData) {
|
|
|
return "大类:" + rowData.maxSortName + "<br>中类:" + rowData.middleSortName + "<br>小类:" + rowData.smallSortName;
|
|
|
}
|
|
|
align: "center"
|
|
|
}, {
|
|
|
title: "品牌搜索词",
|
|
|
field: "brandSearch",
|
...
|
...
|
@@ -178,7 +183,7 @@ |
|
|
$(this).myDatagrid("getPanel").find("a[role='closeBrand']").linkbutton({
|
|
|
iconCls: "icon-more",
|
|
|
onClick: function () {
|
|
|
deleteRow($(this).attr("dataId"));
|
|
|
updateBrandStatus($(this).attr("dataId"), 2);
|
|
|
}
|
|
|
});
|
|
|
|
...
|
...
|
@@ -186,7 +191,7 @@ |
|
|
$(this).myDatagrid("getPanel").find("a[role='openBrand']").linkbutton({
|
|
|
iconCls: "icon-more",
|
|
|
onClick: function () {
|
|
|
deleteRow($(this).attr("dataId"));
|
|
|
updateBrandStatus($(this).attr("dataId"), 1);
|
|
|
}
|
|
|
});
|
|
|
}
|
...
|
...
|
@@ -197,7 +202,7 @@ |
|
|
$("#searchLinkButton").linkbutton({
|
|
|
onClick: function () {
|
|
|
var param = getParams();
|
|
|
brandMyDatagrid.myDatagrid("load", param);
|
|
|
$("#brandTable").myDatagrid("load", param);
|
|
|
}
|
|
|
});
|
|
|
|
...
|
...
|
@@ -205,8 +210,9 @@ |
|
|
$("#searchAllLinkButton").linkbutton({
|
|
|
onClick: function () {
|
|
|
$('#brandStatus').combobox('clear');
|
|
|
$('#brandName').combobox('clear');
|
|
|
var param = {};
|
|
|
brandMyDatagrid.myDatagrid("load", param);
|
|
|
$("#brandTable").myDatagrid("load", param);
|
|
|
}
|
|
|
});
|
|
|
|
...
|
...
|
@@ -214,9 +220,8 @@ |
|
|
* 提取出搜索参数
|
|
|
*/
|
|
|
function getParams() {
|
|
|
var brandName = $('#brandName').val();
|
|
|
var brandName = $('#brandName').combobox('getText');
|
|
|
var status = $('#brandStatus').combobox('getValue');
|
|
|
|
|
|
var param = {};
|
|
|
if (undefined !== brandName && null !== brandName && "" !== brandName) {
|
|
|
param.brandName = brandName;
|
...
|
...
|
@@ -229,12 +234,17 @@ |
|
|
|
|
|
|
|
|
function editRow(id) {
|
|
|
window.paramObject.id = id;
|
|
|
brandId = id;
|
|
|
var div = $("<div>").appendTo($(document.body));
|
|
|
var title = "编辑品牌";
|
|
|
var message = "确认修改品牌信息吗?";
|
|
|
if (id == 0) {
|
|
|
title = "添加品牌";
|
|
|
message = "确认添加品牌信息吗?";
|
|
|
}
|
|
|
$(div).myDialog({
|
|
|
width: "475px",
|
|
|
height: "267px",
|
|
|
width: "800px",
|
|
|
height: "500px",
|
|
|
title: title,
|
|
|
href: contextPath + "/html/brandManage/editBrand.html",
|
|
|
queryParams: {
|
...
|
...
|
@@ -247,93 +257,83 @@ |
|
|
id: "saveBtn",
|
|
|
text: "保存",
|
|
|
handler: function () {
|
|
|
$("#consult_reply_form").form("submit", {
|
|
|
url: contextPath + "/operations/consult/reply",
|
|
|
onSubmit: function () {
|
|
|
$.messager.progress({
|
|
|
title: "正在执行",
|
|
|
msg: "正在执行,请稍后...",
|
|
|
interval: 500,
|
|
|
text: ""
|
|
|
$.messager.confirm("确认", message, function (flag) {
|
|
|
if(flag) {
|
|
|
var url = contextPath + "/brand/saveOrUpdateBrand";
|
|
|
$("#brandEditForm").form("submit", {
|
|
|
url: url,
|
|
|
onSubmit: function () {
|
|
|
if (!$("#brandEditForm").form("validate")) {
|
|
|
return false;
|
|
|
}
|
|
|
if ($("#brandEditForm #imageUpload").imageUpload("getValue") == null || $("#brandEditForm #imageUpload").imageUpload("getValue") == "") {
|
|
|
$.messager.alert("失败", "请上传图片", "error");
|
|
|
return false;
|
|
|
}
|
|
|
$.messager.progress({
|
|
|
title: "正在执行",
|
|
|
msg: "正在执行,请稍后..."
|
|
|
});
|
|
|
return true;
|
|
|
},
|
|
|
success: function (data) {
|
|
|
$.messager.progress("close");
|
|
|
data = JSON.parse(data);
|
|
|
if (data.code == 200) {
|
|
|
$(div).dialog("close");
|
|
|
$("#brandTable").myDatagrid("reload");
|
|
|
$.messager.show({
|
|
|
title: "提示",
|
|
|
msg: title + "成功!",
|
|
|
height: 120
|
|
|
});
|
|
|
} else {
|
|
|
$.messager.alert("失败", data.message, "error");
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
return true;
|
|
|
},
|
|
|
success: function (data) {
|
|
|
$.messager.progress("close");
|
|
|
data = JSON.parse(data);
|
|
|
if (data.code == 200) {
|
|
|
$(div).dialog("close");
|
|
|
$("#brandTable").myDatagrid("reload");
|
|
|
$.messager.show({
|
|
|
title: "提示",
|
|
|
msg: title + "成功!",
|
|
|
height: 120
|
|
|
});
|
|
|
} else {
|
|
|
$.messager.alert("失败", data.message, "error");
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
}, {
|
|
|
text: "关闭",
|
|
|
iconCls: "icon-cancel",
|
|
|
handler: function () {
|
|
|
$(div).dialog("close");
|
|
|
}
|
|
|
}]
|
|
|
});
|
|
|
|
|
|
}
|
|
|
|
|
|
function deleteRow(id) {
|
|
|
if (undefined === id || null === id || "" === id) {
|
|
|
$.messager.alert("提示消息", "请选择要删除的咨询!");
|
|
|
return;
|
|
|
}
|
|
|
$.messager.confirm("确认", "确认要删除该咨询吗?", function (flag) {
|
|
|
if (flag) {
|
|
|
$.messager.progress({
|
|
|
title: "正在执行",
|
|
|
msg: "正在执行,请稍后...",
|
|
|
interval: 500,
|
|
|
text: ""
|
|
|
});
|
|
|
$.post(contextPath + "/operations/consult/del?id=" + id, function (data) {
|
|
|
$.messager.progress("close");
|
|
|
if (data.code == 200) {
|
|
|
$("#brandTable").myDatagrid("reload");
|
|
|
$.messager.show({
|
|
|
title: "提示",
|
|
|
msg: "删除成功!",
|
|
|
height: 120
|
|
|
});
|
|
|
} else {
|
|
|
$.messager.alert("失败", data.message, "error");
|
|
|
}
|
|
|
}, "json");
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
|
|
|
function restoreRow(id) {
|
|
|
if (undefined === id || null === id || "" === id) {
|
|
|
$.messager.alert("提示消息", "请选择要恢复的咨询!");
|
|
|
return;
|
|
|
function updateBrandStatus(id, status) {
|
|
|
var message = "";
|
|
|
var msg = "";
|
|
|
if (status == 1) {
|
|
|
message = "确认要开启品牌吗?";
|
|
|
msg = "开启品牌成功!";
|
|
|
} else {
|
|
|
message = "确认要关闭品牌吗?";
|
|
|
msg = "关闭品牌成功!";
|
|
|
}
|
|
|
$.messager.confirm("确认", "确认要恢复该咨询吗?", function (flag) {
|
|
|
window.top.$.messager.confirm("确认", message, function (flag) {
|
|
|
if (flag) {
|
|
|
$.messager.progress({
|
|
|
window.top.$.messager.progress({
|
|
|
title: "正在执行",
|
|
|
msg: "正在执行,请稍后...",
|
|
|
interval: 500,
|
|
|
text: ""
|
|
|
});
|
|
|
$.post(contextPath + "/operations/consult/restore?id=" + id, function (data) {
|
|
|
$.messager.progress("close");
|
|
|
$.post(contextPath + "/brand/updateBrandStatus",{"id":id, "status":status}, function (data) {
|
|
|
window.top.$.messager.progress("close");
|
|
|
if (data.code == 200) {
|
|
|
$("#brandTable").myDatagrid("reload");
|
|
|
$.messager.show({
|
|
|
window.top.$.messager.show({
|
|
|
title: "提示",
|
|
|
msg: "恢复成功!",
|
|
|
msg: msg,
|
|
|
height: 120
|
|
|
});
|
|
|
} else {
|
|
|
$.messager.alert("失败", data.message, "error");
|
|
|
window.top.$.messager.alert("失败", data.message, "error");
|
|
|
}
|
|
|
}, "json");
|
|
|
}
|
...
|
...
|
|