|
|
<!DOCTYPE html>
|
|
|
<html lang="en">
|
|
|
<head>
|
|
|
<meta charset="UTF-8">
|
|
|
<title>Yoho!Buy运营平台</title>
|
|
|
<script src="/union/js/include.js"></script>
|
|
|
<script src="/union/js/ajaxfileupload.js"></script>
|
|
|
</head>
|
|
|
<body class="easyui-layout" fit="true">
|
|
|
<div region="north" style="padding-bottom: 35px; height: auto;">
|
|
|
<script>
|
|
|
document.write(addHead('CPS联盟管理', 'CPS商品返佣比例设置'));
|
|
|
</script>
|
|
|
|
|
|
<div style="margin-left: 15px;margin-top: 10px">
|
|
|
<input class="easyui-textbox" id="skn" style="width: 200px;" data-options="prompt:'SKN'">
|
|
|
<input class="easyui-combobox" id="brand" sytle="width: 200px">
|
|
|
<input class="easyui-combobox" id="state" style="width:150px;" data-options="editable:false"/>
|
|
|
<a id="searchBtn" class="easyui-linkbutton btn-info" >查询</a>
|
|
|
<a id="addBtn" class="easyui-linkbutton btn-primary" >新增</a>
|
|
|
<a id="exportBtn" class="easyui-linkbutton btn-success" >导出</a>
|
|
|
<a id="batchImportBtn" class="easyui-linkbutton btn-success">批量导入</a>
|
|
|
</div>
|
|
|
</div>
|
|
|
|
|
|
<div region="center">
|
|
|
<table id="shareRebateSknTable"></table>
|
|
|
</div>
|
|
|
|
|
|
</body>
|
|
|
</html>
|
|
|
|
|
|
<script>
|
|
|
|
|
|
$(function() {
|
|
|
|
|
|
var sknTextBox = $("#skn");
|
|
|
var brandCombobox = $("#brand");
|
|
|
var stateCombobox = $("#state");
|
|
|
var table = $("#shareRebateSknTable");
|
|
|
|
|
|
sknTextBox.textbox('textbox').bind('keyup', function () {
|
|
|
sknTextBox.textbox('setValue', $(this).val().replace(/[^\d]/g, ""));
|
|
|
});
|
|
|
|
|
|
stateCombobox.myCombobox({
|
|
|
prompt: "状态",
|
|
|
width: 200,
|
|
|
panelHeight : 90,
|
|
|
data: [
|
|
|
{"id":"1", "text":"开启"},
|
|
|
{"id":"2", "text":"关闭"}
|
|
|
],
|
|
|
valueField: "id",
|
|
|
textField: "text"
|
|
|
});
|
|
|
|
|
|
$("#searchBtn").linkbutton({
|
|
|
iconCls: "icon-search",
|
|
|
onClick: function () {
|
|
|
table.datagrid("load", {
|
|
|
skn: sknTextBox.textbox("getValue"),
|
|
|
brand: brandCombobox.combobox("getValue"),
|
|
|
state: sknTextBox.combobox("getValue")
|
|
|
});
|
|
|
}
|
|
|
});
|
|
|
|
|
|
$("#addBtn").linkbutton({
|
|
|
iconCls: "icon-search",
|
|
|
onClick: function () {
|
|
|
saveShareRebateSkn(0);
|
|
|
window.self.paramObject.brandRebateData = null;
|
|
|
}
|
|
|
});
|
|
|
|
|
|
|
|
|
brandCombobox.myCombobox({
|
|
|
editable: false,
|
|
|
valueField: "value",
|
|
|
textField: "text",
|
|
|
required: false,
|
|
|
prompt: "选择品牌",
|
|
|
url: contextPath + "/UnionShareRebateBrandRest/queryAllBrand",
|
|
|
panelHeight: 200,
|
|
|
loadFilter: function (data) {
|
|
|
return defaultLoadFilter(data);
|
|
|
}
|
|
|
});
|
|
|
|
|
|
table.myDatagrid({
|
|
|
fit: true,
|
|
|
fitColumns: true,
|
|
|
nowrap: false,
|
|
|
url: contextPath + "/UnionRebateRest/querySknList",
|
|
|
method: 'POST',
|
|
|
loadFilter: function (data) {
|
|
|
var temp = defaultLoadFilter(data);
|
|
|
temp = null == temp ? [] : temp;
|
|
|
temp.rows = temp.list;
|
|
|
return temp;
|
|
|
},
|
|
|
columns: [[{
|
|
|
title: "SKN",
|
|
|
field: "skn",
|
|
|
width: "20%",
|
|
|
align: "center",
|
|
|
}, {
|
|
|
title: "商品名称",
|
|
|
field: "name",
|
|
|
width: "15%",
|
|
|
align: "center"
|
|
|
}, {
|
|
|
title: "当前销售价",
|
|
|
field: "priceStr",
|
|
|
width: "15%",
|
|
|
align: "center",
|
|
|
}, {
|
|
|
title: "商品返佣比例",
|
|
|
field: "rebate",
|
|
|
width: "20%",
|
|
|
align: "center",
|
|
|
formatter(value, data) {
|
|
|
if (data.type == 1) {
|
|
|
return "品牌比例";
|
|
|
} else {
|
|
|
return value / 100 + "%";
|
|
|
}
|
|
|
}
|
|
|
}, {
|
|
|
title: "商品返佣状态",
|
|
|
field: "state",
|
|
|
width: "15%",
|
|
|
align: "center",
|
|
|
formatter(value, data) {
|
|
|
if (value == 1) {
|
|
|
return "品牌状态";
|
|
|
} else if (value == 2) {
|
|
|
return "开启";
|
|
|
} else {
|
|
|
return "关闭";
|
|
|
}
|
|
|
}
|
|
|
}, {
|
|
|
title: "操作",
|
|
|
field: "ddg",
|
|
|
width: "15%",
|
|
|
align: "center",
|
|
|
formatter: function (value, rowData, rowIndex) {
|
|
|
return "<a role='edit' style='margin-left:10px;' dataId='" + rowData.id + "' index='" + rowIndex + "'>修改</a>"
|
|
|
}
|
|
|
}
|
|
|
]],
|
|
|
cache: false,
|
|
|
pagination: true,
|
|
|
pageSize: 10,
|
|
|
idField: "id",
|
|
|
singleSelect: false,
|
|
|
onLoadSuccess: function () {
|
|
|
$(this).myDatagrid("getPanel").find("a[role='edit']").linkbutton({
|
|
|
iconCls: "icon-more",
|
|
|
onClick: function () {
|
|
|
saveShareRebateSkn($(this).attr("dataId"));
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
});
|
|
|
|
|
|
function saveShareRebateSkn(id) {
|
|
|
var rowData;
|
|
|
if (id != 0) {
|
|
|
var index = table.myDatagrid("getRowIndex", id);
|
|
|
rowData = table.datagrid('getData').rows[index];
|
|
|
window.self.paramObject.sknRebateData = rowData;
|
|
|
}
|
|
|
var div = $("<div>").appendTo($(window.self.document.body));
|
|
|
var action = id != 0 ? "修改" : "新增";
|
|
|
var title = "商品结算比例";
|
|
|
var url = "";
|
|
|
if (id == 0) {
|
|
|
url = contextPath + "/UnionRebateRest/addSkn";
|
|
|
} else {
|
|
|
url = contextPath + "/UnionRebateRest/updateSkn";
|
|
|
}
|
|
|
window.self.$(div).myDialog({
|
|
|
title: action + title,
|
|
|
width: "40%",
|
|
|
height: "50%",
|
|
|
resizable: false,
|
|
|
buttons: [{
|
|
|
id: "saveBtn",
|
|
|
text: '保存',
|
|
|
iconCls: "icon-save",
|
|
|
handler: function () {
|
|
|
window.self.$("#sknRebateEditForm").form("submit", {
|
|
|
url: url,
|
|
|
onSubmit: function (param) {
|
|
|
var skn = $("#sknRebateEditForm #skn").textbox("getValue");
|
|
|
if (skn == "") {
|
|
|
window.self.$.messager.alert("失败", "请输入skn", "error");
|
|
|
return false;
|
|
|
}
|
|
|
var type = $("input[name='type']:checked").val();
|
|
|
var rebate = $("#sknRebateEditForm #rebateStr").textbox("getValue");
|
|
|
if (type == 2) {
|
|
|
if(rebate == ""){
|
|
|
window.self.$.messager.alert("失败", "请填写自定义比例", "error");
|
|
|
return false;
|
|
|
}
|
|
|
if(parseFloat(rebate) > 25){
|
|
|
window.self.$.messager.alert("失败", "返佣比例不能超过25%", "error");
|
|
|
return false;
|
|
|
}
|
|
|
if(parseFloat(rebate) === 0.0){
|
|
|
window.self.$.messager.alert("失败", "返佣比例必须大于0%", "error");
|
|
|
return false;
|
|
|
}
|
|
|
}
|
|
|
if (id != 0) {
|
|
|
param.name = rowData.name;
|
|
|
param.id = id;
|
|
|
}
|
|
|
param.rebatePercentStr = rebate;
|
|
|
return true;
|
|
|
},
|
|
|
success: function (data) {
|
|
|
window.self.$.messager.progress("close");
|
|
|
window.self.$(div).dialog('close');
|
|
|
table.datagrid("reload");
|
|
|
window.self.$.messager.show({
|
|
|
title: "提示",
|
|
|
msg: title + JSON.parse(data).message
|
|
|
});
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
}, {
|
|
|
text: '取消',
|
|
|
id: "closeBtn",
|
|
|
iconCls: "icon-cancel",
|
|
|
handler: function () {
|
|
|
window.self.$(div).dialog('close');
|
|
|
}
|
|
|
}],
|
|
|
modal: true,
|
|
|
href: contextPath + "/html/shareRebate/sknRebateEdit.html",
|
|
|
onOpen: function () {
|
|
|
window.setTimeout(function () {
|
|
|
$("#saveBtn").addClass("btn-success");
|
|
|
$("#closeBtn").addClass("btn-danger");
|
|
|
}, 100);
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
|
|
|
$("#batchImportBtn").linkbutton({
|
|
|
text: "批量导入",
|
|
|
iconCls: "icon-add",
|
|
|
onClick: function () {
|
|
|
var div = $("<div id='batchImportDialogDiv'>").appendTo($(document.body));
|
|
|
$(div).myDialog({
|
|
|
title: "批量导入",
|
|
|
width: "600px",
|
|
|
height: "50%",
|
|
|
href: contextPath + "/html/shareRebate/sknRebateImport.html",
|
|
|
modal: true,
|
|
|
collapsible: true,
|
|
|
cache: false
|
|
|
});
|
|
|
}
|
|
|
});
|
|
|
|
|
|
$("#exportBtn").linkbutton({
|
|
|
onClick: function () {
|
|
|
window.open(contextPath + "/batch/export.do?type=unionShareRebateSkn&queryConf=" + JSON.stringify(getParams()));
|
|
|
}
|
|
|
});
|
|
|
|
|
|
function getParams() {
|
|
|
var params = {};
|
|
|
var skn = sknTextBox.textbox("getValue");
|
|
|
if (skn != "") {
|
|
|
params["skn"] = skn;
|
|
|
}
|
|
|
var brand = brandCombobox.combobox("getValue");
|
|
|
if (brand != "") {
|
|
|
params["brand"] = brand;
|
|
|
}
|
|
|
var state = sknTextBox.combobox("getValue");
|
|
|
if (state != "") {
|
|
|
params["state"] = state;
|
|
|
}
|
|
|
return params;
|
|
|
}
|
|
|
})
|
|
|
|
|
|
|
|
|
</script> |
|
|
\ No newline at end of file |
...
|
...
|
|