order-timeline.vue 6.4 KB

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