index.vue 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369
  1. <template>
  2. <view class="logistics-container">
  3. <!-- 头部快递信息 -->
  4. <view class="logistics-header">
  5. <image class="logo" src="/static/img/icon-logo-jd.png"></image>
  6. <view class="company-info">
  7. <text class="company-name">京东物流</text>
  8. <view class="tracking-number">
  9. <text class="number">JDVA40141037033</text>
  10. <text class="copy-btn" @click="copyTrackingNumber">复制</text>
  11. </view>
  12. </view>
  13. </view>
  14. <!-- 物流轨迹时间轴 -->
  15. <view class="timeline-container">
  16. <TimelineItem v-for="(item, index) in trackList" :key="index" :title="item.title" :desc="item.desc"
  17. :time="item.time" :is-active="item.isActive" :show-line="index < trackList.length - 1"
  18. :show-dot-bg="index === 0" />
  19. </view>
  20. </view>
  21. </template>
  22. <script setup>
  23. import {
  24. ref,
  25. onMounted
  26. } from 'vue'
  27. import TimelineItem from '@/components/TimelineItem.vue'
  28. const scrollHeight = ref(400)
  29. // 模拟物流轨迹数据
  30. const trackList = ref([{
  31. title: '已代收',
  32. desc: '您的快件已由[门卫]代收,快递员:马新宽、联系...',
  33. time: '2026-01-11 17:32:32',
  34. isActive: true
  35. },
  36. {
  37. title: '派送中',
  38. desc: '快件已投递至【北京海淀区北京大学菜鸟驿站】...',
  39. time: '2026-01-11 17:32:32',
  40. isActive: false
  41. },
  42. {
  43. title: '运输中',
  44. desc: '快件已投递至【北京海淀区北京大学菜鸟驿站】...',
  45. time: '2026-01-11 17:32:32',
  46. isActive: false
  47. },
  48. {
  49. title: '运输中',
  50. desc: '快件已投递至【北京海淀区北京大学菜鸟驿站】...',
  51. time: '2026-01-11 17:32:32',
  52. isActive: false
  53. },
  54. {
  55. title: '运输中',
  56. desc: '快件已投递至【北京海淀区北京大学菜鸟驿站】...',
  57. time: '2026-01-11 17:32:32',
  58. isActive: false
  59. },
  60. {
  61. title: '已揽件',
  62. desc: '快件已投递至【北京海淀区北京大学菜鸟驿站】...',
  63. time: '2026-01-11 17:32:32',
  64. isActive: false
  65. },
  66. {
  67. title: '已揽件',
  68. desc: '快件已投递至【北京海淀区北京大学菜鸟驿站】...',
  69. time: '2026-01-11 17:32:32',
  70. isActive: false
  71. },
  72. {
  73. title: '已揽件',
  74. desc: '快件已投递至【北京海淀区北京大学菜鸟驿站】...',
  75. time: '2026-01-11 17:32:32',
  76. isActive: false
  77. },
  78. {
  79. title: '已揽件',
  80. desc: '快件已投递至【北京海淀区北京大学菜鸟驿站】...',
  81. time: '2026-01-11 17:32:32',
  82. isActive: false
  83. },
  84. {
  85. title: '已揽件',
  86. desc: '快件已投递至【北京海淀区北京大学菜鸟驿站】...',
  87. time: '2026-01-11 17:32:32',
  88. isActive: false
  89. },
  90. {
  91. title: '已揽件',
  92. desc: '快件已投递至【北京海淀区北京大学菜鸟驿站】...',
  93. time: '2026-01-11 17:32:32',
  94. isActive: false
  95. },
  96. {
  97. title: '已揽件',
  98. desc: '快件已投递至【北京海淀区北京大学菜鸟驿站】...',
  99. time: '2026-01-11 17:32:32',
  100. isActive: false
  101. },
  102. {
  103. title: '已揽件',
  104. desc: '快件已投递至【北京海淀区北京大学菜鸟驿站】...',
  105. time: '2026-01-11 17:32:32',
  106. isActive: false
  107. },
  108. {
  109. title: '已揽件',
  110. desc: '快件已投递至【北京海淀区北京大学菜鸟驿站】...',
  111. time: '2026-01-11 17:32:32',
  112. isActive: false
  113. },
  114. {
  115. title: '已揽件',
  116. desc: '快件已投递至【北京海淀区北京大学菜鸟驿站】...',
  117. time: '2026-01-11 17:32:32',
  118. isActive: false
  119. },
  120. {
  121. title: '已揽件',
  122. desc: '快件已投递至【北京海淀区北京大学菜鸟驿站】...',
  123. time: '2026-01-11 17:32:32',
  124. isActive: false
  125. },
  126. {
  127. title: '已揽件',
  128. desc: '快件已投递至【北京海淀区北京大学菜鸟驿站】...',
  129. time: '2026-01-11 17:32:32',
  130. isActive: false
  131. },
  132. {
  133. title: '已揽件',
  134. desc: '快件已投递至【北京海淀区北京大学菜鸟驿站】...',
  135. time: '2026-01-11 17:32:32',
  136. isActive: false
  137. },
  138. {
  139. title: '已揽件',
  140. desc: '快件已投递至【北京海淀区北京大学菜鸟驿站】...',
  141. time: '2026-01-11 17:32:32',
  142. isActive: false
  143. },
  144. {
  145. title: '已揽件',
  146. desc: '快件已投递至【北京海淀区北京大学菜鸟驿站】...',
  147. time: '2026-01-11 17:32:32',
  148. isActive: false
  149. },
  150. {
  151. title: '已揽件',
  152. desc: '快件已投递至【北京海淀区北京大学菜鸟驿站】...',
  153. time: '2026-01-11 17:32:32',
  154. isActive: false
  155. },
  156. {
  157. title: '已揽件',
  158. desc: '快件已投递至【北京海淀区北京大学菜鸟驿站】...',
  159. time: '2026-01-11 17:32:32',
  160. isActive: false
  161. }
  162. ])
  163. onMounted(() => {
  164. // 计算滚动区域高度
  165. uni.getSystemInfo({
  166. success: (res) => {
  167. scrollHeight.value = res.windowHeight - 420 // 减去头部、当前状态、底部等固定高度
  168. }
  169. })
  170. })
  171. const copyTrackingNumber = () => {
  172. uni.setClipboardData({
  173. data: 'JDVA40141037033',
  174. success: () => {
  175. uni.showToast({
  176. title: '已复制运单号',
  177. icon: 'success'
  178. })
  179. }
  180. })
  181. }
  182. const contactCourier = () => {
  183. uni.showModal({
  184. title: '联系快递员',
  185. content: '拨打快递员电话?',
  186. success: (res) => {
  187. if (res.confirm) {
  188. uni.makePhoneCall({
  189. phoneNumber: '请填写快递员电话'
  190. })
  191. }
  192. }
  193. })
  194. }
  195. const viewDetails = () => {
  196. uni.showToast({
  197. title: '查看详情',
  198. icon: 'none'
  199. })
  200. }
  201. const copyAllInfo = () => {
  202. const allInfo =
  203. `京东物流\n运单号:JDVA40141037033\n状态:已代收\n快递员:马新宽\n\n物流轨迹:\n2026-01-11 17:32:32 已代收\n2026-01-11 17:32:32 派送中\n2026-01-11 17:32:32 运输中\n2026-01-11 17:32:32 已揽件`
  204. uni.setClipboardData({
  205. data: allInfo,
  206. success: () => {
  207. uni.showToast({
  208. title: '已复制全部信息',
  209. icon: 'success'
  210. })
  211. }
  212. })
  213. }
  214. </script>
  215. <style lang="scss" scoped>
  216. .logistics-container {
  217. padding: 20rpx;
  218. background-color: #f5f5f5;
  219. min-height: 100vh;
  220. }
  221. // 头部样式
  222. .logistics-header {
  223. height: 140rpx;
  224. background: #FFFFFF;
  225. border-radius: 32rpx;
  226. padding: 20rpx;
  227. display: flex;
  228. .logo {
  229. width: 100rpx;
  230. height: 100rpx;
  231. }
  232. }
  233. .company-info {
  234. margin-left: 20rpx;
  235. .company-name {
  236. font-size: 32rpx;
  237. height: 48rpx;
  238. line-height: 48rpx;
  239. font-weight: bold;
  240. display: block;
  241. margin-bottom: 8rpx;
  242. }
  243. .tracking-number {
  244. height: 44rpx;
  245. display: flex;
  246. align-items: center;
  247. .number {
  248. height: 44rpx;
  249. font-weight: 400;
  250. line-height: 44rpx;
  251. font-size: 28rpx;
  252. color: #666;
  253. }
  254. .copy-btn {
  255. height: 44rpx;
  256. font-weight: 400;
  257. font-size: 28rpx;
  258. color: #1B64F0;
  259. margin-left: 8rpx;
  260. line-height: 44rpx;
  261. text-align: center;
  262. }
  263. }
  264. }
  265. // 当前状态样式
  266. .current-status {
  267. background-color: #fff;
  268. border-radius: 16rpx;
  269. padding: 30rpx;
  270. margin-bottom: 20rpx;
  271. display: flex;
  272. align-items: flex-start;
  273. box-shadow: 0 4rpx 12rpx rgba(0, 0, 0, 0.05);
  274. }
  275. .status-icon {
  276. width: 80rpx;
  277. height: 80rpx;
  278. background: #1aad19;
  279. border-radius: 50%;
  280. display: flex;
  281. align-items: center;
  282. justify-content: center;
  283. margin-right: 20rpx;
  284. .icon {
  285. color: #fff;
  286. font-size: 40rpx;
  287. font-weight: bold;
  288. }
  289. }
  290. .status-info {
  291. flex: 1;
  292. .status-text {
  293. font-size: 32rpx;
  294. font-weight: bold;
  295. color: #333;
  296. display: block;
  297. margin-bottom: 10rpx;
  298. }
  299. .status-desc {
  300. font-size: 26rpx;
  301. color: #666;
  302. display: block;
  303. margin-bottom: 15rpx;
  304. line-height: 1.4;
  305. }
  306. .courier-info {
  307. background: #f8f8f8;
  308. border-radius: 12rpx;
  309. padding: 15rpx;
  310. margin-bottom: 15rpx;
  311. .courier-text {
  312. font-size: 26rpx;
  313. color: #333;
  314. display: block;
  315. margin-bottom: 5rpx;
  316. }
  317. .contact-text {
  318. font-size: 24rpx;
  319. color: #1aad19;
  320. }
  321. }
  322. .status-time {
  323. font-size: 24rpx;
  324. color: #999;
  325. display: block;
  326. }
  327. }
  328. // 时间轴容器
  329. .timeline-container {
  330. margin-top: 20rpx;
  331. background-color: #fff;
  332. border-radius: 32rpx;
  333. margin-bottom: 20rpx;
  334. padding: 20rpx;
  335. }
  336. </style>