wangzhibo
2026-08-16 10595d8632f959d0954d1939243196f4eed02372
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
<template>
    <cl-page>
        <view class="page">
            <!-- 收货地址 -->
            <address-select disabled />
 
            <!-- 物流列表 -->
            <view class="card">
                <template v-if="logistics">
                    <cl-row type="flex" justify="space-between" :margin="[10, 0, 20, 0]">
                        <cl-text :size="24" color="info">
                            {{ logistics.expName }} {{ logistics.number }}
                        </cl-text>
                        <cl-text :size="24" color="info" @tap="toCopy">复制</cl-text>
                    </cl-row>
 
                    <!-- 运送记录 -->
                    <view class="record">
                        <cl-timeline>
                            <cl-timeline-item
                                v-for="(item, index) in logistics.list"
                                :key="index"
                                :timestamp="item.time"
                                :content="item.status"
                            />
                        </cl-timeline>
                    </view>
                </template>
 
                <cl-empty :fixed="false" :height="600" text="暂无物流信息" v-else />
            </view>
        </view>
    </cl-page>
</template>
 
<script lang="ts" setup>
import { onPullDownRefresh, onReady } from "@dcloudio/uni-app";
import { useCool } from "/@/cool";
import { ref } from "vue";
import { useUi } from "/$/cool-ui";
import AddressSelect from "/@/components/address/select.vue";
 
const { router, service } = useCool();
const ui = useUi();
 
// 订单详情
const info = ref<OrderInfo>();
 
// 物流信息
const logistics = ref();
 
// 获取订单详情
async function refresh() {
    const { orderId } = router.query;
 
    ui.showLoading();
 
    try {
        service.order.info
            .info({
                id: orderId,
            })
            .then((res) => {
                info.value = res;
            });
 
        await service.order.info
            .logistics({
                orderId,
            })
            .then((res) => {
                logistics.value = res;
            });
    } catch (err: any) {
        ui.showTips(err.message, () => {
            router.back();
        });
    }
 
    ui.hideLoading();
}
 
// 复制物流单号
function toCopy() {
    uni.setClipboardData({
        data: info.value?.logistics.num!,
    });
}
 
onPullDownRefresh(async () => {
    await refresh();
    uni.stopPullDownRefresh();
});
 
onReady(() => {
    refresh();
});
</script>
 
<style lang="scss" scoped>
.page {
    padding: 24rpx;
 
    .record {
        margin-top: 6rpx;
    }
}
</style>