2025-05-28 15:00:31 +08:00
|
|
|
|
<script setup>
|
2025-07-01 00:25:17 +08:00
|
|
|
|
import { ref } from "vue";
|
2025-05-28 15:00:31 +08:00
|
|
|
|
import Container from "@/components/Container.vue";
|
2025-07-01 00:25:17 +08:00
|
|
|
|
import ScrollList from "@/components/ScrollList.vue";
|
|
|
|
|
|
import { getOrderListAPI } from "@/apis";
|
|
|
|
|
|
import useStore from "@/store";
|
2025-07-14 16:44:26 +08:00
|
|
|
|
import { orderStatusNames, getStatusColor } from "@/constants";
|
2025-07-01 00:25:17 +08:00
|
|
|
|
import { storeToRefs } from "pinia";
|
|
|
|
|
|
const store = useStore();
|
|
|
|
|
|
const { user, config } = storeToRefs(store);
|
2025-05-28 15:00:31 +08:00
|
|
|
|
|
2025-07-01 00:25:17 +08:00
|
|
|
|
const toDetailPage = (detail) => {
|
|
|
|
|
|
uni.setStorageSync("order", detail);
|
2025-05-28 15:00:31 +08:00
|
|
|
|
uni.navigateTo({
|
2025-07-01 00:25:17 +08:00
|
|
|
|
url: `/pages/order-detail`,
|
2025-05-28 15:00:31 +08:00
|
|
|
|
});
|
|
|
|
|
|
};
|
2025-07-01 00:25:17 +08:00
|
|
|
|
|
|
|
|
|
|
const list = ref([]);
|
|
|
|
|
|
|
|
|
|
|
|
const onLoading = async (page) => {
|
|
|
|
|
|
const result = await getOrderListAPI(page);
|
|
|
|
|
|
if (page === 1) {
|
|
|
|
|
|
list.value = result;
|
|
|
|
|
|
} else {
|
|
|
|
|
|
list.value = list.value.concat(result);
|
|
|
|
|
|
}
|
|
|
|
|
|
return result.length;
|
|
|
|
|
|
};
|
2025-05-28 15:00:31 +08:00
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
|
|
<template>
|
|
|
|
|
|
<Container title="订单">
|
|
|
|
|
|
<view class="container">
|
2025-07-01 00:25:17 +08:00
|
|
|
|
<ScrollList :onLoading="onLoading">
|
|
|
|
|
|
<view
|
|
|
|
|
|
v-for="(item, index) in list"
|
|
|
|
|
|
:key="index"
|
|
|
|
|
|
class="order-item"
|
|
|
|
|
|
@click="() => toDetailPage(item)"
|
|
|
|
|
|
>
|
|
|
|
|
|
<view
|
|
|
|
|
|
:style="{ backgroundColor: getStatusColor(item.orderStatus) }"
|
|
|
|
|
|
>{{ orderStatusNames[item.orderStatus] }}</view
|
|
|
|
|
|
>
|
|
|
|
|
|
<text>{{ item.vipName }}</text>
|
|
|
|
|
|
<!-- <text>订单号:{{ item.orderId }}</text> -->
|
|
|
|
|
|
<!-- <text>创建时间:{{ item.vipCreateAt }}</text> -->
|
2025-07-13 11:21:30 +08:00
|
|
|
|
<text
|
|
|
|
|
|
>支付时间:{{
|
|
|
|
|
|
item.orderStatus === 4 ? item.paymentTime : ""
|
|
|
|
|
|
}}</text
|
|
|
|
|
|
>
|
|
|
|
|
|
<text>金额:{{ item.total }} 元</text>
|
2025-07-01 00:25:17 +08:00
|
|
|
|
<text>支付方式:微信</text>
|
|
|
|
|
|
</view>
|
|
|
|
|
|
</ScrollList>
|
2025-05-28 15:00:31 +08:00
|
|
|
|
</view>
|
|
|
|
|
|
</Container>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
|
|
<style scoped>
|
|
|
|
|
|
.container {
|
|
|
|
|
|
width: 100%;
|
|
|
|
|
|
height: 100%;
|
2025-07-14 16:40:20 +08:00
|
|
|
|
background-color: #f5f5f5;
|
2025-05-28 15:00:31 +08:00
|
|
|
|
padding-top: 10px;
|
|
|
|
|
|
}
|
|
|
|
|
|
.order-item {
|
|
|
|
|
|
position: relative;
|
|
|
|
|
|
background-color: #fff;
|
|
|
|
|
|
margin-bottom: 10px;
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
flex-direction: column;
|
|
|
|
|
|
padding: 15px;
|
|
|
|
|
|
}
|
|
|
|
|
|
.order-item > view:first-child {
|
|
|
|
|
|
position: absolute;
|
|
|
|
|
|
top: 0;
|
|
|
|
|
|
right: 0;
|
|
|
|
|
|
width: 50px;
|
|
|
|
|
|
color: #fff;
|
|
|
|
|
|
text-align: center;
|
|
|
|
|
|
font-size: 11px;
|
|
|
|
|
|
}
|
|
|
|
|
|
.order-item > text:nth-child(2) {
|
|
|
|
|
|
color: #000;
|
|
|
|
|
|
font-size: 16px;
|
|
|
|
|
|
}
|
|
|
|
|
|
.order-item > text {
|
|
|
|
|
|
color: #666666;
|
|
|
|
|
|
font-size: 13px;
|
|
|
|
|
|
margin-top: 5px;
|
|
|
|
|
|
}
|
|
|
|
|
|
</style>
|