<!--{assign var="menu_id" value="pay"}-->
<!--{include file="<!--{$oetplpath}-->block_header.tpl"}-->
<div class="oe_ntop">
  <i class="iconfont" onclick="goBack();">&#xe616;</i>
  <p>选择支付方式</p>
</div>

<div class="oe_pay">
  <ul>
    <li>
	  支付单号：<br /><!--{$paynum}--><br />（<!--{$payorder.title}-->）
	</li>
    <li>应付金额：<span>￥<!--{$payorder.amount}--></span></li>
  </ul>
</div>
<div class="ge"></div>

<div class="oe_pay_list">
  <h2>请选择以下支付方式</h2>
  <div class="ge"></div>
  <!--{assign var='paymentlist' value=vo_list("mod={payment} where={v.type='wap'}")}-->
  <!--{if !empty($paymentlist)}-->
      <!--{foreach $paymentlist as $volist}-->
        <!--{if $volist.sdkname == "wapalipay"}-->
      <dl f="but_select_payment" data-name="<!--{$volist.sdkname}-->" data-sdkid="<!--{$volist.sdkid}-->">
        <dt class="dt_1"><i class="iconfont">&#xe62f;</i></dt>
        <dd>
          <h3>支付宝支付</h3>
          <i class="iconfont">&#xe615;</i>
        </dd>
      </dl>
      <!--{elseif $volist.sdkname == "wapyjpay"}-->
      <dl f="but_select_payment" data-name="<!--{$volist.sdkname}-->" data-sdkid="<!--{$volist.sdkid}-->">
        <dt class="dt_3"><i class="iconfont">&#xe630;</i></dt>
        <dd>
          <h3>银行卡支付</h3>
          <i class="iconfont">&#xe615;</i>
        </dd>
      </dl>
      <!--{/if}-->
      <!--{/foreach}-->
  <!--{/if}-->
    <!--{if $login.user.money>=$payorder.amount && $payorder.paytype != 'recharge'}-->
    <dl sdkid="999" bankid="999" <!--{if empty($login.user.payword)}--> onclick="goUrl('<!--{$oefile}-->&c=profile&a=setpay')"<!--{else}-->f="depositpay_play"<!--{/if}--> class="dl_5">
    <dt class="dt_5"><i class="iconfont" style="color:#f40">&#xe67f;</i></dt>
    <dd>
        <h3>余额支付</h3>
        <!--{if empty($login.user.payword)}-->
        <p style="color: red;">请先到会员中心设置支付密码</p>
        <!--{else}-->
        <p>使用账户余额支付</p>
        <!--{/if}-->
        <i class="iconfont">&#xe615;</i></dd>
    </dl>
    <!--{/if}-->
  <div class="clear"></div>
</div>
<script type="text/javascript">
$(function(){
	
	//选择支付方式
	$("[f='but_select_payment']").bind("click", function(){
		$_sdkid = $(this).attr("data-sdkid");
		$_sdkname = $(this).attr("data-name");
		$.ajax({
			type: "POST",
			url: "<!--{$oefile}-->&c=pay",
			cache: false,
			data: {a:"savepaysdk", paynum:"<!--{$paynum}-->", sdkid:$_sdkid, sdkname:$_sdkname, r:get_rndnum(8)},
			dataType: "json",
			success: function($data) {
				$json = eval($data);
				$response = $json.response;
				$result = $json.result;
				if ($response == '1') {
					goUrl("<!--{$oefile}-->&c=pay&a=submit&paynum=<!--{$paynum}-->&sdk="+$_sdkname);
				}
				else {
					if ($result.length > 0) {
						ToastShow($result);
					}
					else {
						ToastShow("提交失败");
					}
				}
			},
			error: function() {
				ToastShow("系统繁忙，请稍后再试");
			}
		});

	});

});
</script>

<div class="ge"></div>
<div class="oe_pay_content">
  <h2>其他付款方式</h2>
  <div class="con"> <!--{$config.wap_payment|nl2br}--> </div>
</div>
<!--//oe_pay_content End-->

<div class="oe_shades" f="depositpay_show" style="display:none;">
    <div class="oe_boxclose" f="depositpay_close"></div>
    <div class="oe_choice" style="display: none;">
        <div class="bd">
            <ul>
                <li class="title">输入支付密码 <span f="depositpay_close">取消</span></li>
                <li class="text"><input type="password" name="payword" id="payword" placeholder="支付密码" /></li>
            </ul>
        </div>
        <div class="hd">
            <ul>
                <li class="text" f='depositpay'>确认支付</li>
            </ul>
        </div>
    </div>
</div>
<script>
    $(function(){
        $('[f="depositpay_play"]').click(function(){
            $('[f="depositpay_show"]').fadeIn(200);
            $('[f="depositpay_show"]').find($(".oe_choice")).slideDown(200);
        });
        $('[f="depositpay_close"]').click(function(){
            $('[f="depositpay_show"]').find($(".oe_choice")).slideUp(200, function(){
                $('[f="depositpay_show"]').fadeOut(200);
            });
        });


        $(document).on("click", "[f='depositpay']", function(){
            $payword = $("#payword").val();
            if ($payword.length == 0){
                ToastShow("请输入支付密码", "payword");
                return false;
            }
            $url = "<!--{$oefile}-->&c=<!--{$c}-->&a=depositpay&paynum=<!--{$payorder.paynum}-->&payword="+$payword;
            $.ajax({
                type: "POST",
                url: $url,
                cache: false,
                data: {r:get_rndnum(8)},
                dataType: "json",
                success: function($data) {
                    $json = eval($data);
                    $response = $json.response;
                    $result = $json.result;
                    if ($response == "1") {
                        if ($result.length > 0){
                            ToastShow($result);
                        }
                        else{
                            ToastShow("支付成功");
                        }
                        setTimeout(function(){window.location.reload();}, 800);
                    }
                    else if($response == "2"){
                        window.location.reload();
                    }
                    else{
                        if ($result.length > 0) {
                            ToastShow($result);
                        }
                        else {
                            ToastShow("余额支付失败，请选择其他支付方式");
                        }
                    }
                },
                error: function() {
                    ToastShow("系统繁忙，请稍后再试");
                }
            });
        });
    });
</script>

</body>
</html>