<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>