order-timeline.vue 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248
  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 logVoList" :key="index">
  13. <view class="timeline-dot"></view>
  14. <view class="timeline-info">
  15. <view class="status">{{ item.statusName }}</view>
  16. <view class="time" v-if="item.createTime">{{ item.createTime }}</view>
  17. <view class="desc" v-if="item.description">
  18. {{ item.description }}
  19. <image
  20. v-if="item.status == 5"
  21. src="../static/copy.png"
  22. style="width: 42rpx; height: 42rpx; margin-left: 20rpx; position: relative; top: 6rpx"
  23. @click.stop="copyExpressNo(item.description)"
  24. ></image>
  25. </view>
  26. <!-- 快递单号 -->
  27. <view class="express-no" v-if="item.status == 5 && trackingVoList.length == 0"> 暂无物流信息 </view>
  28. <!-- 物流信息 -->
  29. <view class="express-info" v-if="item.status == 5 && trackingVoList.length > 0">
  30. <view class="timeline-list">
  31. <view class="timeline-item" v-for="(track, index) in trackingVoList" :key="index">
  32. <view class="timeline-dot"></view>
  33. <view class="timeline-info">
  34. <view class="status">{{ track.title }}</view>
  35. <view class="time" v-if="track.time">{{ track.time }}</view>
  36. <view class="desc" v-if="track.description">
  37. {{ track.description }}
  38. </view>
  39. </view>
  40. </view>
  41. </view>
  42. </view>
  43. </view>
  44. </view>
  45. </view>
  46. </view>
  47. </view>
  48. </template>
  49. <script>
  50. export default {
  51. name: "order-timeline",
  52. props: {
  53. logVoList: {
  54. type: Array,
  55. default: () => [],
  56. },
  57. isReturn: {
  58. type: Boolean,
  59. default: false,
  60. },
  61. trackingVoList: {
  62. type: Array,
  63. default: () => [],
  64. },
  65. },
  66. data() {
  67. return {
  68. isExpanded: false,
  69. statusTextMap: {
  70. 0: "待提交",
  71. 1: "已删除",
  72. 2: "待初审",
  73. 3: "待取件",
  74. 4: "初审未通过",
  75. 5: "已揽件",
  76. 6: "已签收",
  77. 7: "物流签收",
  78. 8: "待审核",
  79. 9: "审核中",
  80. 10: "待到款",
  81. 11: "已完成",
  82. },
  83. statusTextMap2: {
  84. 0: "待付款",
  85. 1: "待发货",
  86. 2: "已推送",
  87. 3: "已发货",
  88. 4: "已签收",
  89. 5: "已完成",
  90. 6: "已取消",
  91. 7: "超时取消",
  92. },
  93. };
  94. },
  95. methods: {
  96. toggleExpand() {
  97. this.isExpanded = !this.isExpanded;
  98. },
  99. copyExpressNo(no) {
  100. uni.setClipboardData({
  101. data: no,
  102. success: () => {
  103. uni.$u.toast("复制成功");
  104. },
  105. });
  106. },
  107. },
  108. };
  109. </script>
  110. <style lang="scss" scoped>
  111. .timeline-section {
  112. position: relative;
  113. .time-info {
  114. display: flex;
  115. align-items: center;
  116. font-size: 26rpx;
  117. color: #333333;
  118. position: absolute;
  119. top: 40rpx;
  120. right: 40rpx;
  121. z-index: 9;
  122. .u-icon {
  123. margin-left: 4rpx;
  124. }
  125. }
  126. .time-info-expanded {
  127. position: absolute;
  128. bottom: 40rpx;
  129. right: 40rpx;
  130. z-index: 9;
  131. }
  132. .timeline-content {
  133. position: relative;
  134. padding: 30rpx;
  135. &.collapsed {
  136. max-height: 180rpx;
  137. overflow: hidden;
  138. &::after {
  139. content: "";
  140. position: absolute;
  141. left: -30rpx;
  142. right: 0;
  143. bottom: 0;
  144. height: 80rpx;
  145. width: calc(100% + 60rpx);
  146. background: linear-gradient(180deg, rgba(255, 255, 255, 0) 0%, #fff 100%);
  147. pointer-events: none;
  148. }
  149. }
  150. .timeline-list {
  151. position: relative;
  152. &::before {
  153. content: "";
  154. position: absolute;
  155. left: 6rpx;
  156. top: 0;
  157. bottom: 0;
  158. width: 2rpx;
  159. height: calc(100% - 60rpx);
  160. background: #38c148;
  161. }
  162. .timeline-item {
  163. display: flex;
  164. position: relative;
  165. padding-bottom: 40rpx;
  166. &:last-child {
  167. padding-bottom: 0;
  168. }
  169. .timeline-dot {
  170. width: 14rpx;
  171. height: 14rpx;
  172. border-radius: 50%;
  173. background: #38c148;
  174. margin-right: 20rpx;
  175. flex-shrink: 0;
  176. z-index: 1;
  177. }
  178. .timeline-info {
  179. flex: 1;
  180. margin-top: -10rpx;
  181. .status {
  182. font-size: 28rpx;
  183. color: #38c148;
  184. margin-bottom: 8rpx;
  185. }
  186. .time,
  187. .desc {
  188. font-family: PingFang SC;
  189. font-weight: 400;
  190. font-size: 24rpx;
  191. color: #999999;
  192. line-height: 36rpx;
  193. white-space: pre-wrap;
  194. }
  195. .express-no {
  196. display: flex;
  197. align-items: center;
  198. font-size: 26rpx;
  199. color: #888888;
  200. margin: 8rpx 0;
  201. width: 100%;
  202. height: 88rpx;
  203. line-height: 88rpx;
  204. background: #cdcdcd;
  205. border-radius: 10rpx;
  206. padding-left: 30rpx;
  207. .u-icon {
  208. margin-left: 10rpx;
  209. }
  210. }
  211. .express-info {
  212. font-size: 24rpx;
  213. color: #999;
  214. padding: 20rpx;
  215. background: #dcdcdc;
  216. border-radius: 8rpx;
  217. margin-top: 12rpx;
  218. }
  219. }
  220. }
  221. }
  222. }
  223. }
  224. </style>