订单的页面

这是一个使用Vue.js编写的模板,用于展示订单列表。每个订单项包含商品名称、数量、总价和创建时间,并在点击时通过`navToGoodsInfo`方法跳转至订单详情页面。数据是从后台接口动态获取并加载到界面上。在`getOutInfo`方法中,对数据进行处理,隐藏重复订单的商品联盟名称。
摘要由CSDN通过智能技术生成

<template>
    <view class="content">
        <view class="goods_list" v-for="item in order" :key="item.order_id" @click="navToGoodsInfo(item.order_id)">
            <view class="union" >{{item.super_union_name}}</view>
            <view class="goods_item" >
                
                <view class="left_image">  <!-- 左侧图片 -->
                    <image :src="item.super_goods_pic" mode="heightFix"></image>
                </view>
                <view class="right_text">
                    
                    <view class="goods_name">{{item.super_goods_name}}</view>
                
                    <view class="goods_info">数目:{{item.num}}</view>
                    <view class="goods_info">总价:{{item.total_price}}元</view>
                    <view class="goods_info">时间:{{item.createtime}}</view>
                </view>    
            </view>     
        </view>    
    </view>
</template>

<script>
    export default{
        data(){
            return{
                order:[],
            
            }
        },
        methods:{
            navToGoodsInfo(order_id) {
                console.log(order_id)
                uni.navigateTo({
                url:"./order_detail?order_id="+order_id
                });
            },
            async getOutInfo(){//这里和主页一样,从后台拿数据动态加载到界面上
                const res = await this.$myRequest({
                url: '/order/listAllOrders',
                method: 'POST',
                data :{"super_union_id":'1',
                    "user_id":1,
                },
                })
                console.log(res)
                
                this.order=res.data.description;
                let j=this.order[0].order_id
                console.log(j)
                for(let i=1;i<this.order.length;i++){
                    
                    if(this.order[i].order_id==j){
                        console.log(this.order[i].super_union_name)
                        this.order[i].super_union_name=null
                        console.log(this.order[i].super_union_name)
                    }
                    else{
                        j=this.order[i].order_id
                    }
                }
                    
                },
            
        },
        
        onLoad(){
            
            this.getOutInfo();
            
        }    
    }
</script>

<style lang="scss">
    .content{
        .goods_list {
            .union{
                display: flex;
                justify-content: center;
                font-size: 40rpx;
            }
            .goods_item {
                background: white;
                display: flex;
                border-bottom: 8rpx solid #eee;
                .left_image {
                    image {
                        padding: 12rpx;  
                        height: 200rpx;
                    }
                }
                
                .right_text {
                    padding: 10rpx;
                    word-wrap: break-word; // 允许换行
                    .goods_name {
                        font-size: 35rpx;
                        line-height: 60rpx;
                    }
                    
                    .goods_info {
                        font-size: 30rpx;
                        line-height: 50rpx;
                        color: #555555;
                    }
                }
            }
        }
    }
</style>

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值