Authored by kuangjiahua

返佣后台页面

package com.yoho.unions.server.restapi;
import com.alibaba.fastjson.JSONArray;
import com.yoho.core.rest.annotation.ServiceDesc;
import com.yoho.service.model.union.bo.UnionShareRebateBo;
import com.yoho.service.model.union.request.UnionShareRebateReqBo;
... ... @@ -31,7 +32,7 @@ public class UnionRebateRest {
* */
@RequestMapping("/addSkn")
@ResponseBody
public UnionResponse addSkn(@RequestBody UnionShareRebateBo bo){
public UnionResponse addSkn(UnionShareRebateBo bo){
log.info("addSkn.req is {}", bo);
int result = unionShareRebateService.addSkn(bo);
return new UnionResponse(200, result>0?"新增成功":"新增失败");
... ... @@ -41,7 +42,7 @@ public class UnionRebateRest {
* */
@RequestMapping("/updateSkn")
@ResponseBody
public UnionResponse updateSkn(@RequestBody UnionShareRebateBo bo){
public UnionResponse updateSkn(UnionShareRebateBo bo){
log.info("updateSkn.req is {}", bo);
int result = unionShareRebateService.updateSkn(bo);
return new UnionResponse(200, result>0?"修改成功":"修改失败");
... ... @@ -61,7 +62,7 @@ public class UnionRebateRest {
* */
@RequestMapping("/querySknList")
@ResponseBody
public UnionResponse querySknList(@RequestBody UnionShareRebateReqBo req){
public UnionResponse querySknList(UnionShareRebateReqBo req){
log.info("querySknList.req is {}", req);
PageResponseBO<UnionShareRebateBo> result = unionShareRebateService.querySknListCon(req);
return new UnionResponse(200,"操作成功", result);
... ... @@ -71,7 +72,7 @@ public class UnionRebateRest {
* */
@RequestMapping("/queryBrandList")
@ResponseBody
public UnionResponse queryBrandList(@RequestBody UnionShareRebateReqBo req){
public UnionResponse queryBrandList(UnionShareRebateReqBo req){
log.info("queryBrandList.req is {}", req);
PageResponseBO<UnionShareRebateBo> result = unionShareRebateService.queryBrandListCon(req);
return new UnionResponse(200,"操作成功", result);
... ... @@ -92,7 +93,7 @@ public class UnionRebateRest {
* */
@RequestMapping("/addBrand")
@ResponseBody
public UnionResponse addBrand(@RequestBody UnionShareRebateBo bo){
public UnionResponse addBrand(UnionShareRebateBo bo){
log.info("addBrand.req is {}", bo);
int result = unionShareRebateService.addBrand(bo);
return new UnionResponse(200, result>0?"新增成功":"新增失败");
... ... @@ -102,9 +103,15 @@ public class UnionRebateRest {
* */
@RequestMapping("/updateBrand")
@ResponseBody
public UnionResponse updateBrand(@RequestBody UnionShareRebateBo bo){
public UnionResponse updateBrand(UnionShareRebateBo bo){
log.info("updateBrand.req is {}", bo);
int result = unionShareRebateService.updateBrand(bo);
return new UnionResponse(200, result>0?"修改成功":"修改失败");
}
@RequestMapping("/queryAllBrandList")
@ResponseBody
public JSONArray queryAllBrandList(){
return unionShareRebateService.queryAllBrandList();
}
}
... ...
package com.yoho.unions.server.service;
import com.alibaba.fastjson.JSONArray;
import com.yoho.service.model.union.bo.UnionShareRebateBo;
import com.yoho.service.model.union.request.UnionShareRebateReqBo;
import com.yoho.service.model.union.response.PageResponseBO;
... ... @@ -18,4 +20,5 @@ public interface IUnionShareRebateService {
PageResponseBO<UnionShareRebateBo> queryBrandListCon(UnionShareRebateReqBo req);
int addBrand(UnionShareRebateBo req);
int updateBrand(UnionShareRebateBo req);
JSONArray queryAllBrandList();
}
... ...
package com.yoho.unions.server.service.impl;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.yoho.core.rest.client.ServiceCaller;
import com.yoho.product.model.BrandBo;
import com.yoho.product.model.ProductBo;
import com.yoho.product.request.BaseRequest;
import com.yoho.product.request.BatchBaseRequest;
import com.yoho.service.model.union.bo.UnionShareRebateBo;
import com.yoho.service.model.union.bo.UnionShareRebateImportBo;
... ... @@ -241,6 +244,24 @@ public class UnionShareRebateServiceImpl implements IUnionShareRebateService,IBu
return result;
}
@Override
public JSONArray queryAllBrandList() {
try {
BrandBo[] boArr = serviceCaller.call("product.queryAllBrandList", new BaseRequest<Integer>(), BrandBo[].class);
JSONArray jsonArray = new JSONArray();
for (BrandBo brand : boArr) {
JSONObject json = new JSONObject();
json.put("text", brand.getBrandName());
json.put("value", brand.getId());
jsonArray.add(json);
}
return jsonArray;
}catch(Exception e){
logger.warn("getBrandInfo error: e is {}", e);
return new JSONArray();
}
}
private int addOptLog(UnionShareRebateBo req, int last, int type, int id) {
logger.info("addOptLog start.req is {}.",req);
UnionShareRebateLog log = new UnionShareRebateLog();
... ...
<!DOCTYPE html>
<div id="brandRebateEditDiv" >
<form id="brandRebateEditForm" name="brandRebateEditForm" method="post">
<table cellspacing="0" border="0" align="center" style="width:90%;margin-top:0px;line-height:10px;height:200px;" id="sknRebateEditTable">
<tr>
<td width="30%" align="left">品牌:</span></td>
<td width="70%" align="left" colspan="3">
<input class="easyui-combobox" id="brand" style="width: 200px;" >
</td>
</tr>
<tr>
<td width="30%" align="left">返佣比例:</td>
<td width="30%" align="left" colspan="2">
<input type="radio" value="1" name="type" style="width:20px" checked >默认</input>&nbsp;&nbsp;
<input type="radio" value="2" name="type" style="width:20px">自定义</input>
</td>
<td width="40%" align="left">
<input type='text' class="easyui-textbox" style="width: 100px" id="rebateStr" name="rebateStr" data-options="prompt:'0.0 ~ 25.0'"/>
<span style="margin-left:-15px">%</span>
</td>
</tr>
<tr>
<td width="30%" align="left" >返佣状态:</td>
<td width="70%" align="left" colspan="3">
<input type="radio" value="1" name="state" style="width:20px" checked >开启</input>&nbsp;&nbsp;
<input type="radio" value="2" name="state" style="width:20px">关闭</input>
</td>
</tr>
</table>
</form>
</div>
<script>
$(function(){
var rebatTextBox = $("#rebateStr");
rebatTextBox.textbox('textbox').bind('keyup', function() {
var tempValue = $(this).val();
var value = tempValue.replace(/[^\d.]/g,"")
.replace(/^(\-)*(\d+)\.(\d).*$/,'$1$2.$3');
rebatTextBox.textbox('setValue',value);
});
var brandCombobox = $("#brandRebateEditDiv #brand");
brandCombobox.myCombobox({
editable: false,
valueField : "value",
textField : "value",
required:false,
prompt: "选择品牌",
url : contextPath + "/UnionRebateRest/queryAllBrandList",
panelHeight:200,
loadFilter: function (data) {
return defaultLoadFilter(data);
}
});
rebatTextBox.textbox('readonly',true);
$('input[type=radio][name=type]').change(function() {
if (this.value == '1') {
rebatTextBox.textbox("setValue", "");
rebatTextBox.textbox('readonly',true);
} else {
rebatTextBox.textbox('readonly',false);
}
});
var data = window.self.paramObject.brandRebateData;
if (data){
brandCombobox.combobox("editable", true);
brandCombobox.combobox("setValue", data.brand);
if(data.type == 1){
$(":radio[name='type'][value='1']").prop("checked",true);
}else if(data.type == 2){
rebatTextBox.textbox('readonly',false);
$(":radio[name='type'][value='2']").prop("checked",true);
}
if(data.state == 1){
$(":radio[name='state'][value='1']").prop("checked",true);
}else if(data.state == 2){
$(":radio[name='state'][value='2']").prop("checked",true);
}
if(data.rebate != 0) {
rebatTextBox.textbox("setValue", data.rebate / 100);
}
}
})
</script>
... ...
<!DOCTYPE html>
<table style="width: 100%">
<tbody>
<tr>
<td style="font-size: medium" width="20%" align="center">上传文件:</td>
<td width="80%">
<div id="batchImportDiv"></div>
</td>
</tr>
<tr>
<td style="font-size: medium" align="center" width="20%">规则:</td>
<td style="font-size: medium" width="80%">
1、上传文件必须是.xls或者.xlsx文件<br>
2、Excel表头:品牌ID 、返佣比例、品牌返佣状态<br>
3、结算比例格式为百分比,百分号内最多包含一位小数。0.0%<取值范围≤25.0%;或默认<br>
4、返佣状态:1开启、2关闭<br>
5、每个csv文件控制在2500行以内<br>
6、<a id="downloadSample">下载样例</a>
</td>
</tr>
</tbody>
</table>
<script type="text/javascript">
$(function () {
//todo
$("#downloadSample").attr("href", contextPath + "/common/shareRebateBrand.xlsx");
$("#batchImportDiv").fileUpload({
text: "请选择文件",
uploadInputName: "file",
url: contextPath + "/batch/import",
queryParams: {
type: "shareRebateImport",//todo
args: "import"
},
showFileName: false,
onLoadSuccess: function (fileName, data) {
//todo
$("#shareRebateBrandTable").myDatagrid("reload");
$("#batchImportDialogDiv").dialog("close");
$.messager.show({
title: "提示",
msg: "导入成功!",
height: 200
});
}
});
});
</script>
... ...
<!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-combobox" id="brand" style="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="batchImportBtn" class="easyui-linkbutton btn-primary">批量导入</a>
</div>
</div>
<div region="center">
<table id="shareRebateBrandTable"></table>
</div>
</body>
</html>
<script>
$("#searchBtn").linkbutton({
iconCls : "icon-search",
onClick : function() {
$("#shareRebateBrandTable").datagrid("load", {
brand : $("#brand").combobox("getValue"),
state : $("#state").combobox("getValue")
});
}
});
$("#addBtn").linkbutton({
iconCls : "icon-search",
onClick : function() {
saveShareRebateBrand(0);
window.self.paramObject.brandRebateData = null;
}
});
$("#state").myCombobox({
prompt: "状态",
width: 200,
panelHeight : 90,
data: [
{"id":"1", "text":"开启"},
{"id":"2", "text":"关闭"}
],
valueField: "id",
textField: "text"
});
$("#brand").myCombobox({
editable: false,
valueField : "value",
textField : "value",
required:false,
prompt: "选择品牌",
url : contextPath + "/UnionRebateRest/queryAllBrandList",
panelHeight:200,
loadFilter: function (data) {
return defaultLoadFilter(data);
}
});
$("#shareRebateBrandTable").myDatagrid({
fit: true,
fitColumns: true,
nowrap: false,
url: contextPath + "/UnionRebateRest/queryBrandList",
method: 'POST',
loadFilter: function (data) {
var temp = defaultLoadFilter(data);
temp=null==temp?[]:temp;
temp.rows = temp.list;
return temp;
},
columns: [[{
title: "品牌ID",
field: "brand",
width: "10%",
align: "center",
}, {
title: "品牌名称",
field: "name",
width: "30%",
align: "center"
}, {
title: "品牌返佣比例",
field: "rebate",
width: "20%",
align: "center",
formatter(value, rowData){
if(rowData.type == 1){
return "默认" ;
}
return value/100 + "%"
}
}, {
title: "品牌返佣状态",
field: "state",
width: "20%",
align: "center",
formatter: function (value, rowData) {
return value == 1 ? "开启" : "关闭";
}
}, {
title: "操作",
field: "ddg",
width: "20%",
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 () {
saveShareRebateBrand($(this).attr("dataId"));
}
});
}
});
function saveShareRebateBrand(id){
var table = $("#shareRebateBrandTable");
if (id != 0) {
var index = table.myDatagrid("getRowIndex", id);
var rowData = table.datagrid('getData').rows[index];
window.self.paramObject.brandRebateData = rowData;
}
var div = $("<div>").appendTo($(window.self.document.body));
var action = id != 0 ? "修改" : "新增";
var title = "品牌结算比例";
window.self.$(div).myDialog({
title: action + title,
width: "40%",
height: "50%",
resizable: false,
buttons: [{
id: "saveBtn",
text: '保存',
iconCls: "icon-save",
handler: function () {
var url = "";
if(id != 0){
url = contextPath + "/UnionRebateRest/updateBrand";
}else{
url = contextPath + "/UnionRebateRest/addBrand";
}
window.self.$("#brandRebateEditForm").form("submit", {
url: url,
onSubmit: function (param) {
var brand = $("#brandRebateEditForm #brand").combobox("getValue");
if(brand == ""){
window.self.$.messager.alert("失败", "请选择品牌", "error");
return false;
}
var type = $("input[name='type']:checked").val();
var rebate = $("#brandRebateEditForm #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.id = id;
}
param.rebatePercentStr = rebate == "" ? 0 : rebate;
param.brand = brand;
param.name = $("#brandRebateEditForm #brand").combobox("getText");
return true;
},
success: function (data) {
window.self.$.messager.progress("close");
window.self.$(div).dialog('close');
$("#shareRebateBrandTable").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/brandRebateEdit.html",
onOpen: function () {
window.setTimeout(function () {
$("#saveBtn").addClass("btn-success");
$("#closeBtn").addClass("btn-danger");
}, 100);
}
});
}
//todo
$("#batchImportBtn").linkbutton({
text: "批量导入",
iconCls: "icon-add",
onClick: function () {
var div = $("<div id='batchImportDialogDiv'>").appendTo($(document.body));
$(div).myDialog({
width: "600px",
title: "批量导入",
height: "50%",
href: contextPath + "/html/shareRebate/brandRebateImport.html",
modal: true,
collapsible: true,
cache: false
});
}
});
</script>
\ No newline at end of file
... ...
<!DOCTYPE html>
<div id="sknRebateEditDiv">
<form id="sknRebateEditForm" name="sknRebateEditForm" method="post">
<table cellspacing="0" border="0" align="center" style="width:90%;margin-top:0px;line-height:10px;height:200px;" id="sknRebateEditTable">
<tr>
<td width="30%" align="left">SKN :</span></td>
<td width="70%" align="left" colspan="3">
<input class="inputParam easyui-textbox" style="width:200px" id="skn" name="skn" />
</td>
</tr>
<tr>
<td width="30%" align="left">返佣比例:</span></td>
<td width="35%" align="left" colspan="2">
<input type="radio" value="1" name="type" style="width:20px" checked >品牌比例</input>&nbsp;&nbsp;
<input type="radio" value="2" name="type" style="width:20px">自定义</input>
</td>
<td width="35%" align="left">
<input class="inputParam easyui-textbox" id="rebateStr" style="width: 100px;" data-options="prompt:'0.0 ~ 25.0'" hidden>
<span style="margin-left:-15px">%</span>
</td>
</tr>
<tr>
<td width="30%" align="left">返佣状态:</span></td>
<td width="70%" align="left" colspan="3">
<input type="radio" value="1" name="state" style="width:20px" checked >品牌状态</input>&nbsp;&nbsp;
<input type="radio" value="2" name="state" style="width:20px">开启</input>&nbsp;&nbsp;
<input type="radio" value="3" name="state" style="width:20px">关闭</input>
</td>
</tr>
</table>
</form>
</div>
<script>
$(function(){
var sknTextBox = $("#sknRebateEditDiv #skn");
sknTextBox.textbox('textbox').bind('keyup', function () {
sknTextBox.textbox('setValue', $(this).val().replace(/[^\d]/g, ""));
});
var rebatTextBox = $("#rebateStr");
rebatTextBox.textbox('textbox').bind('keyup', function() {
var tempValue = $(this).val();
var value = tempValue.replace(/[^\d.]/g,"")
.replace(/^(\-)*(\d+)\.(\d).*$/,'$1$2.$3');
rebatTextBox.textbox('setValue',value);
});
rebatTextBox.textbox('readonly',true);
$('input[type=radio][name=type]').change(function() {
if (this.value == '1') {
rebatTextBox.textbox("setValue", "");
rebatTextBox.textbox('readonly',true);
} else {
rebatTextBox.textbox('readonly',false);
}
});
var data = window.self.paramObject.sknRebateData;
if (data){
sknTextBox.textbox('readonly',true);
sknTextBox.textbox("setValue", data.skn);
if(data.type == 1){
$(":radio[name='type'][value='1']").prop("checked",true);
}else if(data.type == 2){
rebatTextBox.textbox('readonly',false);
$(":radio[name='type'][value='2']").prop("checked",true);
}
if(data.state == 1){
$(":radio[name='state'][value='1']").prop("checked",true);
}else if(data.state == 2){
$(":radio[name='state'][value='2']").prop("checked",true);
}else {
$(":radio[name='state'][value='3']").prop("checked",true);
}
if(data.rebate != 0) {
rebatTextBox.textbox("setValue", data.rebate / 100);
}
}
})
</script>
... ...
<!DOCTYPE html>
<table style="width: 100%">
<tbody>
<tr>
<td style="font-size: medium" width="20%" align="center">上传文件:</td>
<td width="80%">
<div id="batchImportDiv"></div>
</td>
</tr>
<tr>
<td style="font-size: medium" width="20%" align="center">规则:</td>
<td style="font-size: medium" width="80%">
1、上传文件必须是.xls或者.xlsx文件。<br>
2、Excel表头:SKN、商品返佣比例、商品返佣状态。<br>
3、商品返佣比例: 品牌比例 或 自定义结算比例(格式为百分比,百分号内最多包含一位小数,取值范围为(0.0%,25.0%])。<br>
4、返佣状态:1-品牌状态、2-开启、3-关闭。<br>
5、每个csv文件控制在2500行以内。<br>
6、 <a id="downloadSample">下载样例</a>
</td>
</tr>
</tbody>
</table>
<script type="text/javascript">
$(function () {
$("#downloadSample").attr("href", contextPath + "/common/shareRebateSkn.xlsx");
$("#batchImportDiv").fileUpload({
text: "请选择Excel",
uploadInputName: "file",
url: contextPath + "/batch/import",
queryParams: {
type: "unionShareRebateSknImport",
args: "import"
},
showFileName: false,
onLoadSuccess: function (fileName, data) {
$("#shareRebateSknTable").myDatagrid("reload");
$("#batchImportDialogDiv").dialog("close");
$.messager.show({
title: "提示",
msg: "导入成功!",
height: 200
});
}
});
});
</script>
... ...
<!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
... ...