order-timeline.vue 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225
  1. <template>
  2. <view class="timeline-section">
  3. <view class="time-info" @click="toggleExpand" v-if="!isExpanded">
  4. <text>下拉查看更多</text>
  5. <u-icon :name="isExpanded ? 'arrow-up' : 'arrow-down'" size="24" color="#333333"></u-icon>
  6. </view>
  7. <view class="time-info-expanded" v-else @click="toggleExpand">
  8. <u-icon name="arrow-up" size="36" color="#333333"></u-icon>
  9. </view>
  10. <view class="timeline-content" :class="{ 'collapsed': !isExpanded }">
  11. <view class="timeline-list">
  12. <view class="timeline-item" v-for="(item, index) in timelineData" :key="index">
  13. <view class="timeline-dot"></view>
  14. <view class="timeline-info">
  15. <view class="status">{{ item.status }}</view>
  16. <view class="time" v-if="item.time">{{ item.time }}</view>
  17. <view class="desc" v-if="item.desc">{{ item.desc }}</view>
  18. <!-- 快递单号 -->
  19. <view class="express-no" v-if="item.expressNo">
  20. <text>{{ item.expressNo }}</text>
  21. <image src="../static/copy.png" style="width: 42rpx;height:42rpx;margin-left: 20rpx;"
  22. @click.stop="copyExpressNo(item.expressNo)"></image>
  23. </view>
  24. <!-- 物流信息 -->
  25. <view class="express-info" v-if="item.expressInfo">
  26. {{ item.expressInfo }}
  27. </view>
  28. </view>
  29. </view>
  30. </view>
  31. </view>
  32. </view>
  33. </template>
  34. <script>
  35. export default {
  36. name: 'order-timeline',
  37. data() {
  38. return {
  39. isExpanded: false,
  40. timelineData: [
  41. {
  42. status: '已到款',
  43. time: '2024-10-25 12:00:15',
  44. desc: '品相审核不通过的书籍可以在审核后48小时之内申请退回,逾期不予退回。(寄单不含快递费可以免费申请退回,后续订单不含快递费需要支付运费退回。)'
  45. },
  46. {
  47. status: '审核成功',
  48. time: '2024-10-25 12:00:15'
  49. },
  50. {
  51. status: '待审核',
  52. desc: '毕业季订单繁忙,预计订单包裹签收15天完成书籍审核并支付书款,请您耐心等待~'
  53. },
  54. {
  55. status: '快递取件',
  56. expressNo: 'SF313996799456',
  57. expressInfo: '暂无物流信息'
  58. },
  59. {
  60. status: '待取件',
  61. desc: '书籍平台已为您安排【顺丰标快】,请您注意查看三方来电'
  62. },
  63. {
  64. status: '初审成功',
  65. time: '2024-10-25 12:00:15'
  66. },
  67. {
  68. status: '待初审',
  69. desc: '取件时间:2024-10-28 09:00-10:00\n预约取件时间前20分钟内将完成订单审核,请您留意初审结果。如初审通过请您准备好快件,并等待订单信息。感谢您的配合。'
  70. },
  71. {
  72. status: '回收订单提交',
  73. time: '2024-10-25 12:00:15'
  74. }
  75. ]
  76. }
  77. },
  78. computed: {
  79. currentStatus() {
  80. return this.timelineData[0]?.status || ''
  81. }
  82. },
  83. methods: {
  84. toggleExpand() {
  85. this.isExpanded = !this.isExpanded
  86. },
  87. copyExpressNo(no) {
  88. uni.setClipboardData({
  89. data: no,
  90. success: () => {
  91. uni.$u.toast('复制成功')
  92. }
  93. })
  94. }
  95. }
  96. }
  97. </script>
  98. <style lang="scss" scoped>
  99. .timeline-section {
  100. position: relative;
  101. .time-info {
  102. display: flex;
  103. align-items: center;
  104. font-size: 26rpx;
  105. color: #333333;
  106. position: absolute;
  107. top: 40rpx;
  108. right: 40rpx;
  109. z-index: 9;
  110. .u-icon {
  111. margin-left: 4rpx;
  112. }
  113. }
  114. .time-info-expanded {
  115. position: absolute;
  116. bottom: 40rpx;
  117. right: 40rpx;
  118. z-index: 9;
  119. }
  120. .timeline-content {
  121. position: relative;
  122. padding: 30rpx;
  123. &.collapsed {
  124. max-height: 180rpx;
  125. overflow: hidden;
  126. &::after {
  127. content: '';
  128. position: absolute;
  129. left: -30rpx;
  130. right: 0;
  131. bottom: 0;
  132. height: 80rpx;
  133. width: calc(100% + 60rpx);
  134. background: linear-gradient(180deg, rgba(255, 255, 255, 0.00) 0%, #FFF 100%);
  135. pointer-events: none;
  136. }
  137. }
  138. .timeline-list {
  139. position: relative;
  140. &::before {
  141. content: '';
  142. position: absolute;
  143. left: 6rpx;
  144. top: 0;
  145. bottom: 0;
  146. width: 2rpx;
  147. height: calc(100% - 60rpx);
  148. background: #38C148;
  149. }
  150. .timeline-item {
  151. display: flex;
  152. position: relative;
  153. padding-bottom: 40rpx;
  154. &:last-child {
  155. padding-bottom: 0;
  156. }
  157. .timeline-dot {
  158. width: 14rpx;
  159. height: 14rpx;
  160. border-radius: 50%;
  161. background: #38C148;
  162. margin-right: 20rpx;
  163. flex-shrink: 0;
  164. z-index: 1;
  165. }
  166. .timeline-info {
  167. flex: 1;
  168. margin-top: -10rpx;
  169. .status {
  170. font-size: 28rpx;
  171. color: #38C148;
  172. margin-bottom: 8rpx;
  173. }
  174. .time,
  175. .desc {
  176. font-family: PingFang SC;
  177. font-weight: 400;
  178. font-size: 24rpx;
  179. color: #999999;
  180. line-height: 36rpx;
  181. white-space: pre-wrap;
  182. }
  183. .express-no {
  184. display: flex;
  185. align-items: center;
  186. font-size: 26rpx;
  187. color: #666;
  188. margin: 8rpx 0;
  189. .u-icon {
  190. margin-left: 10rpx;
  191. }
  192. }
  193. .express-info {
  194. font-size: 24rpx;
  195. color: #999;
  196. padding: 20rpx;
  197. background: #dcdcdc;
  198. border-radius: 8rpx;
  199. }
  200. }
  201. }
  202. }
  203. }
  204. }
  205. </style>