Files
integral-shop/single_uniapp22miao/pages/sub-pages/shop-order/index.vue
panchengyong 786bf78282 更新项目配置和添加小程序模块
- 修改 ArticleController.java
- 更新 application.yml 配置
- 更新 frontend/.env.production 环境配置
- 添加 single_uniapp22miao 小程序模块
- 添加 logs 目录
2026-03-13 13:27:13 +08:00

216 lines
4.4 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<template>
<view class="shop-order-page">
<scroll-view
scroll-y
class="scroll-view"
@scrolltolower="loadMore"
>
<view class="order-list">
<view
v-for="(order, index) in orderList"
:key="order.id"
class="order-item"
>
<!-- 订单头部 -->
<view class="order-header">
<view class="order-no">订单号{{ order.order_no }}</view>
<view class="order-status">{{ order.status_text }}</view>
</view>
<!-- 商品信息 -->
<view class="goods-info" @click="viewOrderDetail(order)">
<image :src="order.goods_image" class="goods-image"></image>
<view class="goods-detail">
<view class="goods-name">{{ order.goods_name }}</view>
<view class="goods-price">¥{{ order.price }}</view>
</view>
</view>
<!-- 订单时间 -->
<view class="order-time">下单时间{{ order.created_at }}</view>
</view>
<!-- 加载更多 -->
<view class="load-more" v-if="orderList.length > 0">
<text v-if="loading">加载中...</text>
<text v-else-if="noMore">没有更多了</text>
</view>
<!-- 空状态 -->
<view class="empty-state" v-if="orderList.length === 0 && !loading">
<text class="icon">📦</text>
<text class="text">暂无订单</text>
</view>
</view>
</scroll-view>
</view>
</template>
<script>
export default {
data() {
return {
orderList: [],
page: 1,
limit: 20,
loading: false,
noMore: false
}
},
onLoad() {
this.loadOrderList();
},
methods: {
// 加载订单列表
async loadOrderList() {
if (this.loading || this.noMore) return;
this.loading = true;
try {
const res = await this.$http.get('/api/order/list', {
page: this.page,
limit: this.limit,
type: 0 // 0: 商城订单
});
if (res.code === 0) {
const list = res.data.list || [];
if (list.length < this.limit) {
this.noMore = true;
}
this.orderList = this.page === 1 ? list : [...this.orderList, ...list];
}
} catch (error) {
console.error('加载订单失败:', error);
} finally {
this.loading = false;
}
},
// 加载更多
loadMore() {
if (!this.loading && !this.noMore) {
this.page++;
this.loadOrderList();
}
},
// 查看订单详情
viewOrderDetail(order) {
uni.navigateTo({
url: `/pages/sub-pages/rushing-order/detail?id=${order.id}`
});
}
}
}
</script>
<style lang="scss" scoped>
.shop-order-page {
height: 100vh;
background-color: #f5f5f5;
}
.scroll-view {
height: 100%;
}
.order-list {
padding: 20rpx 30rpx;
}
.order-item {
background-color: #fff;
border-radius: 20rpx;
padding: 30rpx;
margin-bottom: 20rpx;
.order-header {
display: flex;
align-items: center;
justify-content: space-between;
margin-bottom: 20rpx;
padding-bottom: 20rpx;
border-bottom: 1px solid #f5f5f5;
.order-no {
font-size: 24rpx;
color: #999;
}
.order-status {
font-size: 26rpx;
color: #FF4757;
}
}
.goods-info {
display: flex;
margin-bottom: 20rpx;
.goods-image {
width: 160rpx;
height: 160rpx;
border-radius: 8rpx;
margin-right: 20rpx;
background-color: #f5f5f5;
}
.goods-detail {
flex: 1;
display: flex;
flex-direction: column;
justify-content: space-between;
.goods-name {
font-size: 28rpx;
color: #333;
line-height: 1.4;
}
.goods-price {
font-size: 32rpx;
color: #FF4757;
font-weight: bold;
}
}
}
.order-time {
font-size: 24rpx;
color: #999;
}
}
.load-more {
padding: 30rpx;
text-align: center;
font-size: 26rpx;
color: #999;
}
.empty-state {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
padding: 200rpx 0;
.icon {
font-size: 120rpx;
margin-bottom: 20rpx;
}
.text {
font-size: 28rpx;
color: #999;
}
}
</style>