controller

appcontrollerdefaultuser.js
    async orderinfo() {
        // this.ctx.body = '用户订单';



        const uid = this.ctx.service.cookies.get('userinfo')._id;
        const id = this.ctx.request.query.id;

        var orderResult = await this.ctx.model.Order.find({ "uid": uid, "_id": id });


        //不可扩展对象的解决方法
        orderResult = JSON.parse(JSON.stringify(orderResult));

        orderResult[0].orderItems = await this.ctx.model.OrderItem.find({ "order_id": id });

        await this.ctx.render('default/user/order_info.html', {

            orderInfo: orderResult[0]
        });
    }

view

appviewdefaultuserorder_info.html
<% include  ../public/header.html%>
    <!--end header -->

    <!-- start banner_x -->
    <% include  ../public/banner.html%>
        <!-- end banner_x -->
        <link rel="stylesheet" href="/public/default/css/order.css" />
        <!-- self_info -->
        <div class="grzxbj">
            <div class="selfinfo center">
                <div class="lfnav fl">
                    <% include  ./user_left.html%>
                </div>
                <div class="rtcont fr">
                    <h1>订单详情</h1>
                    <div class="uc-content-box">
                        <div class="uc-box uc-main-box">
                            <div class="uc-content-box order-view-box">
                                <div class="box-hd">
                                    <div class="more clearfix">
                                        <h2 class="subtitle">订单号:
                                            <%=orderInfo.order_id%> <span class="tag tag-subsidy"></span>
                                        </h2>
                                        <div class="actions">
                                            <a title="申请售后" href="#" class="btn btn-small btn-line-gray" data-stat-id="12e905752ea93db8" onclick="_msq.push(['trackEvent', '4a854694de3347de-12e905752ea93db8', 'http://service.order.mi.com/apply/order/id/1160529723001145', 'pcpid', '']);">申请售后</a>
                                        </div>
                                    </div>
                                </div>
                                <div class="box-bd">
                                    <div class="uc-order-item uc-order-item-finish">
                                        <div class="order-detail">
                                            <div class="order-summary">

                                                <div class="order-status">

                                                    <%if(orderInfo.order_status==0){%>
                                                        已下单 未支付
                                                        <%}else if(orderInfo.order_status==1){%>
                                                            已付款
                                                            <%}else if(orderInfo.order_status==2){%>
                                                                已配货
                                                                <%}else if(orderInfo.order_status==3){%>
                                                                    已发货
                                                                    <%}else if(orderInfo.order_status==4){%>

                                                                        交易成功
                                                                        <%}else if(orderInfo.order_status==5){%>

                                                                            已退货
                                                                            <%}else if(orderInfo.order_status==6){%>

                                                                                无效 已取消
                                                                                <%}%>




                                                </div>

                                                <div class="order-progress">
                                                    <ol class="progress-list clearfix progress-list-5">
                                                        <li class="step step-first <%if(orderInfo.order_status>=0){%> step-done
                                                            <%}%> ">
                                                            <div class="progress"><span class="text">下单</span></div>
                                                            <div class="info">
                                                                <%=helper.formatTime(orderInfo.add_time) %>
                                                            </div>
                                                        </li>
                                                        <li class="step <%if(orderInfo.order_status>=1){%> step-done
                                                            <%}%>">
                                                            <div class="progress"><span class="text">付款</span></div>
                                                            <div class="info">
                                                                <%=helper.formatTime(orderInfo.add_time) %>
                                                            </div>
                                                        </li>
                                                        <li class="step <%if(orderInfo.order_status>=2){%> step-done
                                                            <%}%>">
                                                            <div class="progress"><span class="text">配货</span></div>
                                                            <div class="info">
                                                                <%=helper.formatTime(orderInfo.add_time) %>
                                                            </div>
                                                        </li>
                                                        <li class="step <%if(orderInfo.order_status>=3){%> step-done
                                                            <%}%>">
                                                            <div class="progress"><span class="text">出库</span></div>
                                                            <div class="info">
                                                                <%=helper.formatTime(orderInfo.add_time) %>
                                                            </div>
                                                        </li>
                                                        <li class="step step-active step-last">
                                                            <div class="progress"><span class="text">交易成功</span></div>
                                                            <div class="info">2016年06月04日 13:58</div>
                                                        </li>
                                                    </ol>
                                                </div>

                                                <div class="order-delivery order-delivery-detail" style="display:block;border:none;">
                                                    <p class="delivery-num">
                                                        物流公司:
                                                        <a href="##" target="_blank" data-stat-id="d4af14ade0c175da">顺丰(北京) </a> 运单号:199384067236
                                                    </p>

                                                </div>
                                            </div>

                                            <table class="order-items-table">
                                                <tbody>
                                                    <%for(var j=0;j<orderInfo.orderItems.length;j++){%>
                                                        <tr>
                                                            <td class="col col-thumb">
                                                                <div class="figure figure-thumb">
                                                                    <a target="_blank" href="#">
                                                                            <img src="<%=orderInfo.orderItems[j].product_img%>" width="80" height="80" alt="">
                                                                        </a>
                                                                </div>
                                                            </td>
                                                            <td class="col col-name">
                                                                <p class="name">
                                                                    <a target="_blank" href="#">
                                                                        <%=orderInfo.orderItems[j].product_title%>
                                                                    </a>

                                                                </p>
                                                            </td>
                                                            <td class="col col-price">
                                                                <p class="price">
                                                                    <%=orderInfo.orderItems[j].product_price%>元 ×
                                                                        <%=orderInfo.orderItems[j].product_num%>
                                                                </p>
                                                            </td>
                                                            <td class="col col-actions">

                                                            </td>
                                                        </tr>

                                                        <%}%>

                                                </tbody>
                                            </table>
                                        </div>

                                        <!-- 订金盲约订单 -->

                                        <div id="editAddr" class="order-detail-info">

                                            <h3>收货信息</h3>
                                            <table class="info-table">
                                                <tbody>
                                                    <tr>
                                                        <th>姓&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;名:</th>
                                                        <td>
                                                            <%=orderInfo.name%>
                                                        </td>
                                                    </tr>
                                                    <tr>
                                                        <th>联系电话:</th>
                                                        <td>
                                                            <%=orderInfo.phone%>
                                                        </td>
                                                    </tr>
                                                    <tr>
                                                        <th>收货地址:</th>
                                                        <td>
                                                            <%=orderInfo.address%>
                                                        </td>
                                                    </tr>
                                                </tbody>
                                            </table>
                                            <div class="actions">
                                            </div>

                                        </div>

                                        <div id="editTime" class="order-detail-info">
                                            <h3>支付方式</h3>
                                            <table class="info-table">
                                                <tbody>
                                                    <tr>
                                                        <th>支付方式:</th>
                                                        <td>在线支付</td>
                                                    </tr>

                                                </tbody>
                                            </table>
                                            <div class="actions">
                                            </div>
                                        </div>
                                        <div class="order-detail-info">
                                            <h3>发票信息</h3>
                                            <table class="info-table">
                                                <tbody>
                                                    <tr>
                                                        <th>发票类型:</th>
                                                        <td>电子发票</td>
                                                    </tr>
                                                    <tr>
                                                        <th>发票内容:</th>
                                                        <td>购买商品明细</td>
                                                    </tr>
                                                    <tr>
                                                        <th>发票抬头:</th>
                                                        <td>个人</td>
                                                    </tr>
                                                </tbody>

                                            </table>

                                        </div>

                                        <div class="order-detail-total">
                                            <table class="total-table">

                                                <tbody>
                                                    <tr>
                                                        <th>商品总价:</th>
                                                        <td><span class="num"><%=orderInfo.all_price%></span>元</td>
                                                    </tr>
                                                    <tr>
                                                        <th>运费:</th>
                                                        <td><span class="num">0</span>元</td>
                                                    </tr>
                                                    <tr>
                                                        <th class="total">实付金额:</th>
                                                        <td class="total"><span class="num"><%=orderInfo.all_price%></span>元</td>
                                                    </tr>

                                                </tbody>
                                            </table>
                                        </div>

                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="clear"></div>
            </div>
        </div>
        <!-- self_info -->

        <footer class="mt20 center">
            <div class="mt20">小米商城|MIUI|米聊|多看书城|小米路由器|视频电话|小米天猫店|小米淘宝直营店|小米网盟|小米移动|隐私政策|Select Region</div>
            <div>©mi.com 京ICP证110507号 京ICP备10046444号 京公网安备11010802020134号 京网文[2014]0059-0009号</div>
            <div>违法和不良信息举报电话:185-0130-1238,本网站所列数据,除特殊说明,所有数据均出自我司实验室测试</div>
        </footer>
        </body>

        </html>

效果

clipboard.png


渣渣辉
1.3k 声望147 粉丝

引用和评论

0 条评论