order_page.html 7.9 KB
<!DOCTYPE html>
<html lang="en">

<head>
    <meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
    <meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0;" name="viewport" />
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>学考无忧-确认订单</title>
    <link rel="stylesheet" href="__TMPL__/public/assets/css/reset.css">
    <link rel="stylesheet" href="__TMPL__/public/assets/css/base.css">
    <style>
        .order_address {
            padding-bottom: 0.26rem;
            background-repeat: no-repeat;
            background-image: url("__TMPL__/public/assets/images/32.png");
            background-position: bottom;
            background-size: 100% 0.06rem;
            background-color: white;
        }
    </style>
</head>

<body>
<div class="order_box">
    <!-- 顶部 -->
    <div class="order_top">
        <a href="javascript:history.back(-1)">
            <img src="__TMPL__/public/assets/images/left.png" alt="">
        </a>
        <p>订单确认</p>
    </div>
    <!-- 地址  -->
    <div class="order_address">
        <!-- 暂无 -->
        <if condition="$address eq 4">
                <div class="order_addressNo">
                    <div class="order_adImg">
                        <img src="__TMPL__/public/assets/images/31.png" alt="">
                    </div>
                    <p class="order_addressGo">暂无默认收货地址,<a href="{:url('Personalcenter/shop_address')}">去添加</a></p>
                </div>
            <else/>
            <div class="order_addressYes">
                <div class="or_addressYesImg1">
                    <img src="__TMPL__/public/assets/images/38.png" alt="">
                </div>
                <div class="or_addressYesTxt1">
                    <div class="or_addressYesTxt2">
                        <div class="or_addressName" id="name">{$address.name}</div>
                        <p class="or_addressPhone" id="phone">{$address.phone}</p>
                    </div>
                    <p class="or_address_detailed" id="detailed">{$address.region}{$address.detailed}</p>
                </div>
                <div class="or_addressYesImg2">
                    <a href="{:url('Personalcenter/shop_address')}">
                        <img src="__TMPL__/public/assets/images/29.png" alt="">
                    </a>
                </div>
            </div>
        </if>
        <!-- 有地址 -->

    </div>
    <!-- 订单信息 -->
    <div class="order_news">
        <h1 class="order_newsTit">订单信息</h1>
        <ul class="order_newsUl">
            <input type="hidden" name="indet_id" value="{$indent_id}">
            <volist name="data" id="vo">
                <li>
                    <div class="order_newsImg">
                        <img src="{:cmf_get_image_url($vo.thumbnail)}" alt="">
                    </div>
                    <div class="order_newsCon">
                        <div class="order_newsTxt1 txt-cut">{$vo.book_name}</div>
                        <div class="order_newsTxt2">×<span>{$vo.number}</span></div>
                        <div class="order_newsTxt3">
                            <p class="de_topTxt1_1"><span>{$vo.price}</span></p>
                            <p class="de_topTxt1_2"><span>{$vo.pricing0}</span>.{$vo.pricing1}</p>
                            <div class="order_newsNum">
                                <div class="order_newsJian" onclick="jian({$vo.id},{$vo.price})">-</div>
                                <input class="order_newsnum" type="text" readonly="readonly" value="{$vo.number}">
                                <div class="order_newsJia" onclick="jia({$vo.id},{$vo.price})">+</div>
                            </div>
                        </div>
                    </div>
                </li>
            </volist>
        </ul>
    </div>
    <!-- 支付方式/配送方式 -->
    <div class="order_Etc">
        <div class="order_Etc1">
            <p class="order_EtcTxt">支付方式</p>
            <img class="order_EtcImg" src="__TMPL__/public/assets/images/34.png" alt="">
        </div>
        <div class="order_Etc1">
            <p class="order_EtcTxt">配送方式</p>
            <span class="order_EtcTxt2">快递</span>
        </div>
        <div class="order_Etc2">
            <p class="order_EtcTxt">买家留言</p>
            <textarea placeholder="在此填写您的留言" id="liuyan"></textarea>
        </div>
    </div>
    <!-- 底部 -->
    <div class="order_bottom">
        <div class="order_bottom1">
            <p class="order_bottomHe">合计金额:</p>
            <p class="de_topTxt1_1 zoji"><span>{$money}</span></p>
        </div>

        <div class="order_bottom2" onclick="go_pay()">
                立即支付
        </div>
    </div>
</div>
<script src="__TMPL__/public/assets/js/base.js"></script>
<script src="__TMPL__/public/assets/js/jquery.js"></script>
<script>
    /**
     *点击去支付
     */
    function go_pay(){
        name = $('#name').text();
        phone = $('#phone').text();
        detailed = $('#detailed').text();
        if(name == ''){
            alert('姓名不能为空');
        }else if(phone == ''){
            alert('手机号不能为空');
        }else if(detailed == ''){
            alert('地址不能为空');
        }else{
            id = {$indent_id};
            liuyan = $('#liuyan').val();
            $.post("{:url('Orderpage/goods_leave_word_update')}",{id:id,leave_word:liuyan},function(data){
                if(data){
                    window.location.href = "{:url('Pay/index',array('id'=>$indent_id))}";
                }else{
                    alert('订单更新失败!');
                }
            });

        }
    }

    /**
     *点击加一
     */
    function jia(id,price){
        $.post("{:url('Orderpage/shop_cart_numadd')}",{id:id,price:price},function(data){
        });
    }

    /**
     * 点击减一
     */
    function jian(id,price){
        $.post("{:url('Orderpage/shop_cart_numdec')}",{id:id,price:price},function(data){

        });
    }
</script>
<script>
    $(document).ready(function() {
        // 为减少和添加商品数量的按钮绑定事件回调
        $('.order_newsNum div').on('click', function(evt) {
            if ($(this).text() == '-') {
                var count = parseInt($(this).next().val());
                if (count > 1) {
                    count -= 1;
                    $(this).next().val(count);
                } else {
                    alert('商品数量最少为1');
                }
                $(this).parents('.order_newsCon').find('.order_newsTxt2 span').text(count);
            } else {
                var count = parseInt($(this).prev().val());
                if (count < 200) {
                    count += 1;
                    $(this).prev().val(count);
                } else {
                    alert('商品数量最多为200');
                }
                $(this).parents('.order_newsCon').find('.order_newsTxt2 span').text(count);
            }
            var price = parseFloat($(this).parents('.order_newsTxt3').children('.de_topTxt1_1').text().split('¥')[1]);
            calcTotal();
        });
        // 计算总计
        function calcTotal() {
            var priceSpans = $('.order_newsTxt3 .de_topTxt1_1 span');
            var countInputs = $('.order_newsNum .order_newsnum');
            var totalCount = 0;
            var totalPrice = 0;
            for (var i = 0; i < priceSpans.length; i += 1) {
                // 强调: jQuery对象使用下标运算或get方法会还原成原生的JavaScript对象
                var price = parseFloat($(priceSpans[i]).text());
                var count = parseInt($(countInputs[i]).val());
                totalCount += count;
                totalPrice += price * count;
            }
            $('.zoji span').html(totalPrice.toFixed(2));
        }
    })
</script>
</body>

</html>