sknRebateEdit.html 3.5 KB
<!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>