logistics-detail.vue 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. <template>
  2. <view class="container">
  3. <!-- 物流公司信息 -->
  4. <u-sticky>
  5. <u-alert :title="`物流公司:京东快递`" type="warning"></u-alert>
  6. </u-sticky>
  7. <!-- 自定义物流轨迹时间轴 -->
  8. <scroll-view scroll-y class="timeline-container">
  9. <view v-for="(item, index) in logisticsInfo" :key="index" class="timeline-item">
  10. <view class="timeline-icon">
  11. <u-icon name="map-fill" color="#19be6b" size="16" />
  12. </view>
  13. <view class="timeline-content">
  14. <text class="title">{{ item.title }}</text>
  15. <text class="desc">{{ item.description }}</text>
  16. <text class="time">{{ item.time }}</text>
  17. </view>
  18. <view v-if="index < logisticsInfo.length - 1" class="timeline-line"></view>
  19. </view>
  20. </scroll-view>
  21. <!-- 底部操作按钮 -->
  22. <view class="fixed-bottom" v-if="checkStatus==1">
  23. <reject-button size="large" @reject="(reason) => handleButtonClick(3, reason)" />
  24. <approve-button size="large" @approve="handleButtonClick(2)" />
  25. </view>
  26. </view>
  27. </template>
  28. <script setup>
  29. import { ref } from 'vue';
  30. import { onLoad } from '@dcloudio/uni-app';
  31. import ApproveButton from './components/ApproveButton.vue';
  32. import RejectButton from './components/RejectButton.vue';
  33. // 物流信息数据
  34. const logisticsInfo = ref([]);
  35. //获取物流详情 /app/orderinfo/getOrderExpressList
  36. function getLogisticsDetail(orderId) {
  37. uni.$u.http.get(`/app/orderinfo/getOrderExpressList?orderId=${orderId}`).then(res => {
  38. if (res.code == 200) {
  39. logisticsInfo.value = res.data
  40. }
  41. })
  42. }
  43. // 操作按钮
  44. function handleButtonClick(status, reason) {
  45. uni.$u.http.post('/app/orderexception/update', {
  46. id: id.value,
  47. checkStatus: status,
  48. refusalReason: reason
  49. }).then(res => {
  50. if (res.code == 200) {
  51. checkStatus.value = status
  52. uni.$u.toast('操作成功');
  53. emit('refresh');
  54. } else {
  55. uni.$u.toast(res.msg);
  56. }
  57. })
  58. }
  59. const checkStatus = ref(0)
  60. const id = ref(0)
  61. onLoad((e) => {
  62. checkStatus.value = e.status
  63. id.value = e.id
  64. getLogisticsDetail(e.orderId)
  65. })
  66. </script>
  67. <style lang="scss" scoped>
  68. .timeline-container {
  69. flex: 1;
  70. padding: 12px;
  71. background-color: #fff;
  72. }
  73. .timeline-item {
  74. display: flex;
  75. position: relative;
  76. padding: 20rpx 0;
  77. }
  78. .timeline-icon {
  79. width: 24px;
  80. height: 24px;
  81. background-color: #fff;
  82. border-radius: 50%;
  83. display: flex;
  84. align-items: center;
  85. justify-content: center;
  86. margin-right: 12px;
  87. flex-shrink: 0;
  88. }
  89. .timeline-content {
  90. flex: 1;
  91. .title {
  92. font-weight: bold;
  93. font-size: 14px;
  94. }
  95. .desc {
  96. font-size: 14px;
  97. color: #333;
  98. display: block;
  99. margin-bottom: 4px;
  100. }
  101. .time {
  102. font-size: 12px;
  103. color: #999;
  104. }
  105. }
  106. .timeline-line {
  107. position: absolute;
  108. width: 2px;
  109. height: 100%;
  110. background-color: #19be6b;
  111. top: 32px;
  112. bottom: 0;
  113. left: 11px;
  114. }
  115. </style>