brandRebateEdit.html
3.91 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
<!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" id="brandIdTR">
<input class="easyui-combobox" id="brand" style="width: 200px;">
</td>
<td width="70%" align="left" colspan="3" id="brandNameTR" hidden>
<span id="brandName" hidden></span>
</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>
<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>
<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 : "text",
required:false,
prompt: "选择品牌",
url : contextPath + "/UnionRebateRest/queryAllBrandList",
panelHeight:200,
loadFilter: function (data) {
return 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.myCombobox("setValue", data.brand);
$("#brandIdTR").hide();
var brandNameSpan = $("#brandNameTR");
brandNameSpan.show();
brandNameSpan.html(data.name);
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>