/**
 * [OEmarry] (C)2010-2099 OEMARRY.COM Inc.
 * Email:service@phpcoo.com,phpcoo@qq.com
 * This is NOT a freeware, use is subject to license terms
 * $ Last update 2016-03-18 by OEdev $
 */
$(function(){
    //确认收货地址
    $("[f='data-address']").click(function(){
        $("[f='data-address']").removeClass("current");
        $("[f='oe_crt_edit']").removeClass("current");
        $("[f='oe_crt_gou']").removeClass("current");
        $(this).addClass("current");
        $(this).find("[f='oe_crt_edit']").addClass("current");
        $(this).find("[f='oe_crt_gou']").addClass("current");

        $dthtml = $(this).find("dt").html();
        $fonthtml = $(this).find("font").html();
        $("[f='dis-con']").html($dthtml);
        $("[f='dis-address']").html($fonthtml);
        $gid = $(this).attr("gid");
        $("[f='address']").val($gid);
    });

    //修改收货地址
    $("[f='oe_crt_edit']").click(function(){
        $width = 580;
        $height = 450;
        $id = $(this).attr("id");
        $url = _ROOT_PATH+"index.php?c=order&a=editaddress&id="+$id;
        oePopDialog("edit_address", "修改当前收货地址", $url, "ajax", $width, $height);
    });

    //添加新地址
    $("[f='data-add-address']").click(function(){
        $width = 580;
        $height = 450;
        $id = $(this).attr("id");
        $url = _ROOT_PATH+"index.php?c=order&a=addaddress";
        oePopDialog("add_address", "添加新收货地址", $url, "ajax", $width, $height);
    });

    $(".confirmorder_close").click(function(){
        $(".confirmorder_box").css("display","none");
    });

    //余额支付密码
    $('[f="pay_confirm_order"]').click(function(){
        if($('input[name="paytype"]:checked').val()!=0){
            ToastShow("支付方式不是余额支付");
            return false;
        }
        if($("#payword").val()==''){
            ToastShow("请输入支付密码！");
            return false;
        }
        $("#myform").submit();
    });
});
