order-timeline.vue 8.1 KB

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