3
tj
2025-05-22 14764dd7679369a650ad1d60be62aacc863755a1
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
109
110
111
112
113
114
<template>
  <view class="timeline">
    <view class="timeline-item" v-for="(item, index) in timeList" :key="index">
      <!-- 左边时间点 -->
      <view class="timeline-left">
        <view class="dot"></view>
        <!-- 连线,最后一个不显示 -->
        <view class="line" v-if="index !== timeList.length - 1"></view>
      </view>
 
      <!-- 右边内容区域 -->
      <view class="timeline-content">
        <!-- 你可以在这里自定义内容 -->
        <view class="title">
          <text>{{ item.title }}</text>
          <text class="time">{{ item.time }}</text>
        </view>
        <view class="desc">
          {{ item.description }}
        </view>
        <view class="extra" v-if="item.button">
          <u-button type="primary" size="mini" @click="onAction(item)">处理</u-button>
        </view>
      </view>
    </view>
  </view>
</template>
 
<script>
export default {
  data() {
    return {
      timeList: [
        {
          time: '2025-05-01',
          title: '创建订单',
          description: '用户提交订单信息,等待支付。',
          button: true,
        },
        {
          time: '2025-05-02',
          title: '订单支付',
          description: '订单已支付,准备发货。',
        },
        {
          time: '2025-05-03',
          title: '发货完成',
          description: '物流:顺丰快递,单号 12345678',
        },
      ]
    }
  },
  methods: {
    onAction(item) {
      console.log('点击处理', item);
    }
  }
}
</script>
 
<style scoped>
.timeline {
  padding: 30rpx;
  position: relative;
}
.timeline-item {
  display: flex;
  position: relative;
  padding-bottom: 40rpx;
}
.timeline-left {
  width: 40rpx;
  position: relative;
  display: flex;
  justify-content: center;
}
.dot {
  width: 16rpx;
  height: 16rpx;
  background-color: #2979ff;
  border-radius: 50%;
  margin-top: 4rpx;
}
.line {
  position: absolute;
  top: 24rpx;
  width: 2rpx;
  height: calc(100% - 24rpx);
  background-color: #dcdfe6;
}
.timeline-content {
  flex: 1;
  padding-left: 20rpx;
}
.title {
  font-weight: bold;
  font-size: 28rpx;
  color: #333;
  display: flex;
  justify-content: space-between;
}
.time {
  font-size: 24rpx;
  color: #999;
}
.desc {
  margin-top: 10rpx;
  font-size: 26rpx;
  color: #666;
}
.extra {
  margin-top: 10rpx;
}
</style>