Authored by kun

新增html页面

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8"/>
<title>Yoho!Buy运营平台</title>
<script src="/ufoPlatform/js/include.js"></script>
<script src="/ufoPlatform/js/ajaxfileupload.js"></script>
</head>
<body class="easyui-layout" fit="true">
<div region="north" style="height: 230px">
<script>
document.write(addHead('品牌管理', ''));
</script>
<style>
.div_search input {
margin-top: 20px;
}
.div_search .textbox {
margin-top: 20px;
}
.div_search .easyui-linkbutton {
margin-top: 20px;
}
</style>
<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: '关闭'
}]"/>
<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>
</div>
</div>
<div region="center">
<div style="margin-left: 30px;margin-top: 20px;height: 660px">
<table id="brandTable"></table>
</div>
</div>
<script type="text/javascript">
$(function () {
var brandMyDatagrid = $("#brandTable");
brandMyDatagrid.myDatagrid({
fit: true,
fitColumns: true,
nowrap: false,
url: contextPath + "/operations/consult/getList",
method: 'POST',
queryParams: getParams(),
loadFilter: function (data) {
var temp = defaultLoadFilter(data);
temp.rows = temp.list;
return temp;
},
columns: [[{
title: "ID",
field: "id",
width: 40,
align: "center"
}, {
title: "品牌LOGO",
field: "brandLogo",
width: 80,
align: "center",
formatter: function (value, rowData) {
return rowData.askUserName + "(" + rowData.askUserId + ")";
}
}, {
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];
}
}, {
title: "英文名称",
field: "brandNameEn",
width: 80,
align: "center",
formatter: function (value, rowData) {
return "大类:" + rowData.maxSortName + "<br>中类:" + rowData.middleSortName + "<br>小类:" + rowData.smallSortName;
}
}, {
title: "品牌搜索词",
field: "brandSearch",
width: 170,
align: "center"
}, {
title: "状态",
field: "status",
width: 80,
align: "center",
formatter: function (value, rowData) {
if (value == 1) {
return '开启';
}
return '关闭';
}
}, {
title: "创建时间",
field: "createTime",
width: 170,
align: "center"
}, {
title: "操作",
field: "operations",
width: 80,
align: "center",
formatter: function (value, rowData) {
var str = "<a role='edit' dataId='" + rowData.id + "' style='margin-left:10px'>编辑</a>";
if (1 == rowData.status) {
str += "<a role='closeBrand' dataId='" + rowData.id + "' style='margin-left:10px'>关闭品牌</a>";
} else {
str += "<a role='openBrand' dataId='" + rowData.id + "' style='margin-left:10px'>开启品牌</a>";
}
return str;
}
}]],
cache: false,
pagination: true,
pageSize: 10,
pageList: [10],
idField: "id",
singleSelect: false,
checkOnSelect: false,
onLoadSuccess: function () {
// 编辑
$(this).myDatagrid("getPanel").find("a[role='edit']").linkbutton({
iconCls: "icon-edit",
onClick: function () {
var id = $(this).attr("dataId");
editRow(id);
}
});
// 关闭品牌
$(this).myDatagrid("getPanel").find("a[role='closeBrand']").linkbutton({
iconCls: "icon-more",
onClick: function () {
deleteRow($(this).attr("dataId"));
}
});
// 开启品牌
$(this).myDatagrid("getPanel").find("a[role='openBrand']").linkbutton({
iconCls: "icon-more",
onClick: function () {
deleteRow($(this).attr("dataId"));
}
});
}
});
// 搜索
$("#searchLinkButton").linkbutton({
onClick: function () {
var param = getParams();
brandMyDatagrid.myDatagrid("load", param);
}
});
// 搜索全部
$("#searchAllLinkButton").linkbutton({
onClick: function () {
$('#brandStatus').combobox('clear');
var param = {};
brandMyDatagrid.myDatagrid("load", param);
}
});
/**
* 提取出搜索参数
*/
function getParams() {
var brandName = $('#brandName').val();
var status = $('#brandStatus').combobox('getValue');
var param = {};
if (undefined !== brandName && null !== brandName && "" !== brandName) {
param.brandName = brandName;
}
if (undefined !== status && null !== status && "" !== status) {
param.status = status;
}
return param;
}
function editRow(id) {
window.paramObject.id = id;
var div = $("<div>").appendTo($(document.body));
var title = "编辑品牌";
$(div).myDialog({
width: "475px",
height: "267px",
title: title,
href: contextPath + "/html/brandManage/editBrand.html",
queryParams: {
id: id
},
modal: true,
collapsible: true,
cache: false,
buttons: [{
id: "saveBtn",
text: "保存",
handler: function () {
$("#consult_reply_form").form("submit", {
url: contextPath + "/operations/consult/reply",
onSubmit: function () {
$.messager.progress({
title: "正在执行",
msg: "正在执行,请稍后...",
interval: 500,
text: ""
});
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");
}
}
});
}
}]
});
}
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;
}
$.messager.confirm("确认", "确认要恢复该咨询吗?", function (flag) {
if (flag) {
$.messager.progress({
title: "正在执行",
msg: "正在执行,请稍后...",
interval: 500,
text: ""
});
$.post(contextPath + "/operations/consult/restore?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");
}
});
}
});
</script>
</body>
</html>
\ No newline at end of file
... ...
<!DOCTYPE html>
<div id="tt" class="easyui-layout" fit="true" style="overflow-y: scroll">
<form name="activityAddForm" id="activityAddForm" method="post" enctype="multipart/form-data">
<div style="margin-top: 20px;margin-left: 30px">
<table border="0" style="width:95%;margin-top:5px;line-height:30px;" id="tab">
<tr style="height: 60px">
<td width="10%"><span style="color:red">*</span><label>品牌名称</label></td>
<td>
<input class="easyui-combobox" id="brandName" name="brandName" style="width: 380px;">
</input>
</td>
</tr>
<tr style="height: 60px">
<td width="10%"><span style="color:red">*</span>英文名称</td>
<td width="50%">
<input id="brandNameEn" name="brandNameEn" class="easyui-textbox" style="width: 380px;"/></td>
</tr>
<tr style="height: 60px">
<td width="20%"><span style="color:red">*</span>品牌LOGO</td>
<td>
<div id="imageUpload">
</div>
</td>
</tr>
<tr class="coupon" style="height: 60px">
<td width="10%"></span>品牌搜索词</td>
<td width="50%">
<input id="couponId" type="number" name="couponId" class="easyui-textbox" style="width: 380px;" />
</tr>
</table>
</div>
</form>
</div>
<script>
function getStrLength(str) {
var cArr = str.match(/[^\x00-\xff]/ig);
return str.length + (cArr == null ? 0 : cArr.length);
}
$(function () {
$("#imageUpload").imageUpload({
width: 171,
height: 120,
realInputName: "url",
url: contextPath + '/fileupload/uploadFile',
queryParams: {
bucket: "activity"
},
onBeforeSubmit: function () {
$.messager.progress({
title: "正在执行",
msg: "正在执行,请稍后...",
interval: 500,
text: ""
});
},
filterFileName: function (data) {
debugger;
if (!data || data.code != 200) {
$.messager.progress("close");
$.messager.alert("错误",data.message);
return "";
}
return data.data.url;
},
onLoadSuccess: function (data) {
$.messager.progress("close");
return false;
}
});
// 名称不能为空
$("#rewardName").textbox({
required: true,
missingMessage: "奖品名称不能为空",
prompt: "请输入奖品名称(不能超过30个字)",
onChange: function(data){
if (data!="" && getStrLength(data) > 30) {
$.messager.alert("提示", "奖品名称长度不能超过30个字", "info");
$("#rewardName").focus();
$("#rewardName").textbox("setValue","");
}
}
});
// 奖品总数不能为空
$("#totalNum").textbox({
required: true,
missingMessage: "奖品总数不能为空",
prompt: "请输入奖品数量(正整数)",
onChange: function(data){
if(data != "" && Number(data) <= 1 ){
$.messager.alert("提示", "奖品总数必须不小于1!", "info");
$("#totalNum").textbox("setValue","");
}
}
});
// 中奖率不能为空
$("#probability").textbox({
required: true,
missingMessage: "中奖率不能为空",
prompt: "请输入中奖概率(小于100的正整数)",
onChange: function(data){
if(data != "" && (Number(data) <= 0 || Number(data) > 100)){
$.messager.alert("提示", "中奖率必须大于0小于100!", "info");
$("#probability").textbox("setValue","");
}
}
});
$("#orderTime").textbox({
required: false,
prompt: "必须大于0",
onChange: function(data){
if(data < 0){
$.messager.alert("提示", "天数必须大于0!", "info");
$("#orderTime").textbox("setValue","");
}
}
});
$("#minOrderAmount").textbox({
required: false,
prompt: "必须大于0",
onChange: function(data){
var max = $("#minOrderAmount").textbox("getValue");
if(data != "" && Number(data) < 0){
$.messager.alert("提示", "金额必须大于0!", "info");
$("#minOrderAmount").textbox("setValue","");
}
if(Number(data) > Number(max)){
$.messager.alert("提示", "金额必须小于最大值!", "info");
$("#minOrderAmount").textbox("setValue","");
}
}
});
$("#maxOrderAmount").textbox({
required: false,
prompt: "大于最小值",
onChange: function(data){
debugger
var min = $("#minOrderAmount").textbox("getValue");
if(data != "" && Number(data) < 0){
$.messager.alert("提示", "金额必须大于0!", "info");
$("#maxOrderAmount").textbox("setValue","");
}
if(data != "" && Number(data) <Number(min)){
$.messager.alert("提示", "金额必须大于最小值!", "info");
$("#maxOrderAmount").textbox("setValue","");
}
}
});
});
</script>
\ No newline at end of file
... ...