<%@ Page Language="C#" AutoEventWireup="true" %>
<script runat="server">
    protected string GetCustomKey(string pKey)
    {
        string __mini = app.Setting("custom_" + pKey + "_mini");
        string __max = app.Setting("custom_" + pKey + "_max");
        return __mini + "," + __max;
    }
</script>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title></title>
</head>
<body>
<form action="action.ashx" method="post" id="config_form_caifutong">
<input type="hidden" name="sys_all_payconfig" value="form.type.allpay" />
<table class="opera">

<tr><td class="t1">财付通:</td>
<td >
<input type="radio" id="com_caifutong_pay1" name="com_caifutong_pay"  value="on" <%if(app.Setting("com_caifutong_pay")=="on"){ %> checked="checked" <%}%> /><label  for="com_caifutong_pay1">开启</label>
<input type="radio" id="com_caifutong_pay2" name="com_caifutong_pay" value="off" <%if(app.Setting("com_caifutong_pay")=="off"){ %> checked="checked" <%}%> /><label for="com_caifutong_pay2">关闭</label>
</td>
<td class="t1">溢价:</td><td ><input name="premiun_tenpay_pay" value="<%=app.Setting("premiun_tenpay_pay") %>" /></td>
<td class="t1">金额:</td><td data="<%=app.Setting("premiun_tenpay_pay_moneys") %>" custom="<%=GetCustomKey("premiun_tenpay_pay_moneys") %>" name="premiun_tenpay_pay_moneys" class="ShowPayMoney"></td>
</tr>


</table>
<div class="postdiv"><input style=' padding-left:10px;' class="ui-button ui-widget ui-state-default ui-corner-all" value="保存设置" type="submit" /></div>
</form>

<script type="text/javascript">
<![CDATA[
    AjaxForm({ finder: '#config_form_caifutong', succEnd: 'msg', refurl: '', message: "提交成功" });
    function InitPayMoney() {
        $(".ShowPayMoney").each(function (i, d) {
            var slef = $(d);
            var hasMoney = new Array();
            var _customMoney = new Array();
            hasMoney = (slef.attr("data")).split(',');
            if (typeof (slef.attr("custom")) != "undefined") {
                _customMoney = (slef.attr("custom")).split(',');
            }
            var name = slef.attr("name");
            for (var i = 0; i < moneys.length; i++) {
                var input_value = moneys[i];
                if (hasMoney.InArray(input_value)) {
                    var _html_ = money_temp_check.replace("{0}", name).replace("{1}", input_value).replace("{2}", input_value);
                    slef.append(_html_);
                } else {
                    var _html_ = money_temp.replace("{0}", name).replace("{1}", input_value).replace("{2}", input_value);
                    slef.append(_html_);
                }
            }
            /** 自定义范围 **/
            slef.append(customMoneys(name, _customMoney));
        })
    }

    function customMoneys(nm, cm) {
        var _mini = "1";
        var _max = "100000";
        if (cm.length == 2) {
            _mini = cm[0];
            _max = cm[1];
        }
        var _h1 = "<span style=' padding-left:10px;color:#f44'>";
        _h1 += "自定义范围:";
        _h1 += "<input class='minicustom' value='" + _mini + "' name='custom_" + nm + "_mini' >";
        _h1 += "到";
        _h1 += "<input class='minicustom' value='" + _max + "' name='custom_" + nm + "_max' >";
        _h1 += "</span>";
        return _h1;
    }

    setTimeout(InitPayMoney, 400);
//]]>
</script>
</body>
</html>
