<!--{include file="<!--{$oetplpath}-->block_head.tpl"}-->

<!--{if $a == "money"}-->
<div class="layui-fluid oe_fluid">

  <div class="oe_breadcrumb_box clearfix">
    <div class="layui-breadcrumb fl" lay-filter="breadcrumb" style="visibility: visible;">
      <a href="javascript:;">财务管理</a><span lay-separator="">/</span>
      <a href="javascript:;">会员余额</a><span lay-separator="">/</span>
      <a><cite>添加余额</cite></a>
    </div>
    <div class="oe_tool_bar ft">
      <button class="layui-btn layui-btn-sm layui-btn-radius" id="but_submit_post2" lay-submit lay-filter="addform">
        添加保存
        <span class="oe_btn_loading layui-anim layui-icon layui-anim-rotate layui-anim-loop" style="display:none;">&#xe63d;</span>
      </button>
      <span class="layui-btn layui-btn-sm layui-btn-primary layui-btn-radius">
        <a href="<!--{$oefile}-->&c=money">&lt;&lt;返回上一页</a>
      </span>
    </div> 
  </div>

  <div class="layui-card">
    <div class="layui-card-header">操作会员余额</div>
    <div class="layui-card-body">
      <table class="oe_tbl_form layui-form">
        <tr>
          <th width="15%"><font color="red">*</font>用户UID：</th>
          <td width="85%">
            <input type="text" name="userid" id="userid" class="layui-input input-200" placeholder="请输入用户UID" /> 
            <span id="userid_tips"></span>
          </td>
        </tr>

        <tr>
          <th><font color="red">*</font>金额去向：</th>
          <td>
            <div class="input-200">
            <select name="actiontype" id="actiontype">
              <option value="">请选择</option>
              <option value="1">增加</option>
              <option value="2">减少</option>
            </select>
            </div>
          </td>
        </tr>
        <tr>
          <th><font color="red">*</font>操作金额：</th>
          <td>
            <input type="text" name="quantity" id="quantity" class="layui-input input-200" placeholder="请输入金额" />
            &nbsp;<span class="text_tip_inline"><!--{$config.moneyname}--></span>
          </td>
        </tr>
        <tr>
          <th><font color="red">*</font>明细备注：</th>
          <td><textarea name="logcontent" id="logcontent" class="layui-textarea" style="width:50%;height:90px;" placeholder="请输入明细内容"></textarea></td>
        </tr>
        <tr>
          <th><font color="red">*</font>安全密码：</th>
          <td>
            <input type="password" name="safeword" id="safeword" maxlength="16" class="layui-input input-200" placeholder="请输入操作安全密码" />
          </td>
        </tr>
        
      </table>
    </div>
  </div>

  <div class="oe_tbl_form_btn">
    <button class="layui-btn" id="but_submit_post" lay-submit lay-filter="addform">
      添加保存
      <span class="oe_btn_loading layui-anim layui-icon layui-anim-rotate layui-anim-loop" style="display:none;">&#xe63d;</span>
    </button>
  </div>
  
</div>

<script type="text/javascript">
$(function(){
    //获取会员资料
    $(document).on("blur", "#userid", function(){
      $_uid = $(this).val();
      if ($_uid.length > 0) {
          $("#userid_tips").html("");
          $.ajax({
              type: "POST",
              url: "<!--{$oefile}-->&c=<!--{$c}-->",
              cache: false,
              data: {
                  a:"getuser", id:$_uid, r:get_rndnum(8)
              },
              dataType: "json",
              success: function(data) {
                  $json = eval(data);
                  $response = $json.response;
                  $result = $json.result;
                  if ($response == '1') {
                      $("#userid_tips").html($result);
                  }
                  else {
                      if ($result.length > 0) {
                          layer.msg($result);
                      }
                      else {
                          layer.msg("会员资料不存在");
                      }
                  }
              },
              error: function() {
                  layer.msg("系统繁忙，请稍后再试！");
              }
          });
      }
    });
  
    layui.use('form', function(){
        $form = layui.form;
        //保存...
        $form.on('submit(addform)', function(data){
            $obj_id = data.elem.getAttribute("id");
            if (!$("#"+$obj_id).hasClass("forbid_submit")) {
            
                $userid = $("#userid").val();
                if ($userid.length == 0) {
                    layer.msg("请输入用户UID");
                    return false;
                }
                $actiontype = $("#actiontype").val();
                if ($actiontype.length == 0) {
                    layer.msg("请选择金额去向");
                    return false;
                }
                $quantity = $("#quantity").val();
                if ($quantity.length == 0) {
                    layer.msg("请输入金额");
                    return false;
                }
                $logcontent = $("#logcontent").val();
                if ($logcontent.length == 0) {
                    layer.msg("请输入明细内容");
                    return false;
                }
                $safeword = $("#safeword").val();
                if ($safeword.length == 0) {
                    layer.msg("请输入操作安全密码");
                    return false;
                }
                
                $("#"+$obj_id).addClass("forbid_submit");
                if ($("#"+$obj_id).find("span").length > 0) {
                    $("#"+$obj_id).find("span").show();
                }
                $.ajax({
                    type: "POST",
                    url: "<!--{$oefile}-->&c=<!--{$c}-->",
                    cache: false,
                    data: {
                        a:"savemoney", userid:$userid, actiontype:$actiontype, quantity:$quantity, 
                        logcontent:$logcontent, safeword:$safeword, r:get_rndnum(8)
                    },
                    dataType: "json",
                    success: function(data) {
                        $json = eval(data);
                        $response = $json.response;
                        $result = $json.result;
                        if ($response == '1') {
                            layer.msg("操作成功");
                            setTimeout(function(){
                                window.location.reload();
                            }, 800);
                        }
                        else {
                            if ($result.length > 0) {
                                layer.msg($result);
                            }
                            else {
                                layer.msg("操作失败");
                            }
                            $("#"+$obj_id).removeClass("forbid_submit");
                            if ($("#"+$obj_id).find("span").length > 0) {
                                $("#"+$obj_id).find("span").hide();
                            }
                        }
                        
                    },
                    error: function() {
                        layer.msg("系统繁忙，请稍后再试！");
                        $("#"+$obj_id).removeClass("forbid_submit");
                        if ($("#"+$obj_id).find("span").length > 0) {
                            $("#"+$obj_id).find("span").hide();
                        }
                    }
                });
                
                
            }
        });   
    });
    
});
</script>
<!--{/if}-->


<!--//9.11.19 -->
<!--{if $a == "money2"}-->
<div class="layui-fluid oe_fluid" style="padding-top:10px;">

  <div class="layui-card">
    <div class="layui-card-header">操作[<!--{$username}-->]帐户余额(<!--{$config.moneyname}-->)</div>
    <div class="layui-card-body">
      <table class="oe_tbl_form layui-form">
        <tr style="display:none;">
          <th><font color="red"></font>用户UID：</th>
          <td>
            <input type="hidden" name="userid" id="userid" class="layui-input input-200" value="<!--{$id}-->" />
          </td>
        </tr>
        <tr>
          <th width="20%"><font color="red">*</font>余额去向：</th>
          <td width="80%">
            <div class="input-200">
              <select name="actiontype" id="actiontype">
                <option value="">请选择</option>
                <option value="1">增加</option>
                <option value="2">减少</option>
              </select>
            </div>
          </td>
        </tr>
        <tr>
          <th><font color="red">*</font>操作数量：</th>
          <td>
            <input type="text" name="quantity" id="quantity" class="layui-input input-200" placeholder="请输入数量" />
            &nbsp;<span class="text_tip_inline"><!--{$config.moneyname}--></span>
          </td>
        </tr>
        <tr>
          <th><font color="red">*</font>明细备注：</th>
          <td><textarea name="logcontent" id="logcontent" class="layui-textarea" style="width:70%;height:90px;" placeholder="请输入明细内容"></textarea></td>
        </tr>
        <tr>
          <th><font color="red">*</font>安全密码：</th>
          <td>
            <input type="password" name="safeword" id="safeword" maxlength="16" class="layui-input input-200" placeholder="请输入操作安全密码" />
          </td>
        </tr>
      </table>
    </div>
  </div>

  
  <div class="oe_tbl_form_btn">
    <button class="layui-btn" id="but_submit_post" lay-submit lay-filter="addform">
      完成
      <span class="oe_btn_loading layui-anim layui-icon layui-anim-rotate layui-anim-loop" style="display:none;">&#xe63d;</span>
    </button>
  </div>
  
</div>

<script type="text/javascript">
$(function(){
    layui.use('form', function(){
        $form = layui.form;
        
        //保存...
        $form.on('submit(addform)', function(data){
            $obj_id = data.elem.getAttribute("id");
            if (!$("#"+$obj_id).hasClass("forbid_submit")) {
            
                $userid = $("#userid").val();
                if ($userid.length == 0) {
                    layer.msg("请输入用户UID");
                    return false;
                }
                $actiontype = $("#actiontype").val();
                if ($actiontype.length == 0) {
                    layer.msg("请选择余额去向");
                    return false;
                }
                $quantity = $("#quantity").val();
                if ($quantity.length == 0) {
                    layer.msg("请输入数量");
                    return false;
                }
                $logcontent = $("#logcontent").val();
                if ($logcontent.length == 0) {
                    layer.msg("请输入明细内容");
                    return false;
                }
                $safeword = $("#safeword").val();
                if ($safeword.length == 0) {
                    layer.msg("请输入操作安全密码");
                    return false;
                }
                
                $("#"+$obj_id).addClass("forbid_submit");
                if ($("#"+$obj_id).find("span").length > 0) {
                    $("#"+$obj_id).find("span").show();
                }
                $.ajax({
                    type: "POST",
                    url: "<!--{$oefile}-->&c=<!--{$c}-->",
                    cache: false,
                    data: {
                        a:"savemoney", userid:$userid, actiontype:$actiontype, quantity:$quantity, 
                        logcontent:$logcontent, safeword:$safeword, r:get_rndnum(8)
                    },
                    dataType: "json",
                    success: function(data) {
                        $json = eval(data);
                        $response = $json.response;
                        $result = $json.result;
                        if ($response == '1') {
                            layer.msg("操作成功");
                            setTimeout(function(){
                                window.parent.location.reload();
                            }, 800);
                        }
                        else {
                            if ($result.length > 0) {
                                layer.msg($result);
                            }
                            else {
                                layer.msg("操作失败");
                            }
                            $("#"+$obj_id).removeClass("forbid_submit");
                            if ($("#"+$obj_id).find("span").length > 0) {
                                $("#"+$obj_id).find("span").hide();
                            }
                        }
                        
                    },
                    error: function() {
                        layer.msg("系统繁忙，请稍后再试！");
                        $("#"+$obj_id).removeClass("forbid_submit");
                        if ($("#"+$obj_id).find("span").length > 0) {
                            $("#"+$obj_id).find("span").hide();
                        }
                    }
                });
                
                
            }
        });   
        
        
    });
    
});
</script>
<!--{/if}-->

<!--{if $a == "income"}-->
<div class="layui-fluid oe_fluid">
  
  <div class="oe_breadcrumb_box clearfix">
    <div class="layui-breadcrumb fl" lay-filter="breadcrumb" style="visibility: visible;">
      <a href="javascript:;">财务管理</a><span lay-separator="">/</span>
      <a href="javascript:;">会员钱包</a><span lay-separator="">/</span>
      <a><cite>添加钱包</cite></a>
    </div>
    <div class="oe_tool_bar ft">
      <button class="layui-btn layui-btn-sm layui-btn-radius" id="but_submit_post2" lay-submit lay-filter="addform">
        添加保存
        <span class="oe_btn_loading layui-anim layui-icon layui-anim-rotate layui-anim-loop" style="display:none;">&#xe63d;</span>
      </button>
      <span class="layui-btn layui-btn-sm layui-btn-primary layui-btn-radius">
        <a href="<!--{$oefile}-->&c=income">&lt;&lt;返回上一页</a>
      </span>
    </div> 
  </div>
  
  <blockquote class="layui-elem-quote" style="margin-top:10px;">
    <strong>温馨提示：</strong>
    会员的钱包请谨慎操作
  </blockquote>

  <div class="layui-card">
    <div class="layui-card-header">操作会员钱包</div>
    <div class="layui-card-body">
      <table class="oe_tbl_form layui-form">
        <tr>
          <th width="15%"><font color="red">*</font>用户UID：</th>
          <td width="85%">
            <input type="text" name="userid" id="userid" class="layui-input input-200" placeholder="请输入用户UID" /> 
            <span id="userid_tips"></span>
          </td>
        </tr>

        <tr>
          <th><font color="red">*</font>金额去向：</th>
          <td>
            <div class="input-200">
            <select name="actiontype" id="actiontype">
              <option value="">请选择</option>
              <option value="1">增加</option>
              <option value="2">减少</option>
            </select>
            </div>
          </td>
        </tr>
        <tr>
          <th><font color="red">*</font>操作金额：</th>
          <td>
            <input type="text" name="quantity" id="quantity" class="layui-input input-200" placeholder="请输入金额" />
            &nbsp;<span class="text_tip_inline">元</span>
          </td>
        </tr>
        <tr>
          <th><font color="red">*</font>明细备注：</th>
          <td><textarea name="logcontent" id="logcontent" class="layui-textarea" style="width:50%;height:90px;" placeholder="请输入明细内容"></textarea></td>
        </tr>
        <tr>
          <th><font color="red">*</font>安全密码：</th>
          <td>
            <input type="password" name="safeword" id="safeword" maxlength="16" class="layui-input input-200" placeholder="请输入操作安全密码" />
          </td>
        </tr>
        
      </table>
    </div>
  </div>

  <div class="oe_tbl_form_btn">
    <button class="layui-btn" id="but_submit_post" lay-submit lay-filter="addform">
      添加保存
      <span class="oe_btn_loading layui-anim layui-icon layui-anim-rotate layui-anim-loop" style="display:none;">&#xe63d;</span>
    </button>
  </div>
  
</div>

<script type="text/javascript">
$(function(){
    //获取会员资料
    $(document).on("blur", "#userid", function(){
      $_uid = $(this).val();
      if ($_uid.length > 0) {
          $("#userid_tips").html("");
          $.ajax({
              type: "POST",
              url: "<!--{$oefile}-->&c=<!--{$c}-->",
              cache: false,
              data: {
                  a:"getuser", id:$_uid, r:get_rndnum(8)
              },
              dataType: "json",
              success: function(data) {
                  $json = eval(data);
                  $response = $json.response;
                  $result = $json.result;
                  if ($response == '1') {
                      $("#userid_tips").html($result);
                  }
                  else {
                      if ($result.length > 0) {
                          layer.msg($result);
                      }
                      else {
                          layer.msg("会员资料不存在");
                      }
                  }
              },
              error: function() {
                  layer.msg("系统繁忙，请稍后再试！");
              }
          });
      }
    });
  
    layui.use('form', function(){
        $form = layui.form;
        //保存...
        $form.on('submit(addform)', function(data){
            $obj_id = data.elem.getAttribute("id");
            if (!$("#"+$obj_id).hasClass("forbid_submit")) {
            
                $userid = $("#userid").val();
                if ($userid.length == 0) {
                    layer.msg("请输入用户UID");
                    return false;
                }
                $actiontype = $("#actiontype").val();
                if ($actiontype.length == 0) {
                    layer.msg("请选择金额去向");
                    return false;
                }
                $quantity = $("#quantity").val();
                if ($quantity.length == 0) {
                    layer.msg("请输入金额");
                    return false;
                }
                $logcontent = $("#logcontent").val();
                if ($logcontent.length == 0) {
                    layer.msg("请输入明细内容");
                    return false;
                }
                $safeword = $("#safeword").val();
                if ($safeword.length == 0) {
                    layer.msg("请输入操作安全密码");
                    return false;
                }
                
                $("#"+$obj_id).addClass("forbid_submit");
                if ($("#"+$obj_id).find("span").length > 0) {
                    $("#"+$obj_id).find("span").show();
                }
                $.ajax({
                    type: "POST",
                    url: "<!--{$oefile}-->&c=<!--{$c}-->",
                    cache: false,
                    data: {
                        a:"saveincome", userid:$userid, actiontype:$actiontype, quantity:$quantity, 
                        logcontent:$logcontent, safeword:$safeword, r:get_rndnum(8)
                    },
                    dataType: "json",
                    success: function(data) {
                        $json = eval(data);
                        $response = $json.response;
                        $result = $json.result;
                        if ($response == '1') {
                            layer.msg("操作成功");
                            setTimeout(function(){
                                window.location.reload();
                            }, 800);
                        }
                        else {
                            if ($result.length > 0) {
                                layer.msg($result);
                            }
                            else {
                                layer.msg("操作失败");
                            }
                            $("#"+$obj_id).removeClass("forbid_submit");
                            if ($("#"+$obj_id).find("span").length > 0) {
                                $("#"+$obj_id).find("span").hide();
                            }
                        }
                        
                    },
                    error: function() {
                        layer.msg("系统繁忙，请稍后再试！");
                        $("#"+$obj_id).removeClass("forbid_submit");
                        if ($("#"+$obj_id).find("span").length > 0) {
                            $("#"+$obj_id).find("span").hide();
                        }
                    }
                });
                
                
            }
        });   
    });
    
});
</script>
<!--{/if}-->
</body>
</html>