index.vue 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. <template>
  2. <view class="history">
  3. <view class="item" v-for="(item, i) in waybillDelivery">
  4. <text class="code" :style="{ color: item.status ? 'green' : '#666' }">
  5. {{ item.orderNum }}
  6. {{ item.type }}
  7. </text>
  8. <uni-icons v-if="item.status" type="checkmarkempty" class="status" size="16" color="green"></uni-icons>
  9. <text class="status fail" v-else>F</text>
  10. <text style="margin-left: 10rpx; font-weight: 300">
  11. {{ '\r\n' + item.createTime }}
  12. </text>
  13. </view>
  14. <view v-if="waybillDelivery.length === 0" class="is-empty">暂无派送单</view>
  15. <uni-popup ref="messageRef" type="message">
  16. <uni-popup-message :type="messageType" :message="messageText" :duration="2000"></uni-popup-message>
  17. </uni-popup>
  18. </view>
  19. </template>
  20. <script setup lang="ts">
  21. import { reactive, ref } from 'vue';
  22. import { onLoad } from '@dcloudio/uni-app';
  23. import { pickupWaybillDeliveryOrderURL } from '@/utils/api.js';
  24. const loading = ref(false);
  25. const token = ref();
  26. const waybillDelivery = ref([]);
  27. const messageType = ref();
  28. const messageText = ref();
  29. const messageRef = ref();
  30. const getHistory = () => {
  31. loading.value = true;
  32. uni.request({
  33. url: pickupWaybillDeliveryOrderURL + '/index',
  34. method: 'GET',
  35. header: {
  36. batoken: token.value
  37. },
  38. success: ({data} : any) => {
  39. loading.value = false;
  40. console.log(data);
  41. if (data.code == 1) {
  42. waybillDelivery.value = data.data.list;
  43. } else {
  44. messageType.value = 'error';
  45. messageText.value = data.msg;
  46. messageRef.value.open();
  47. }
  48. },
  49. fail: (err) => {
  50. loading.value = false;
  51. }
  52. });
  53. };
  54. onLoad(() => {
  55. token.value = uni.getStorageSync('token');
  56. getHistory();
  57. });
  58. </script>
  59. <style lang="scss" scoped>
  60. .history {
  61. display: flex;
  62. width: 100%;
  63. flex-direction: column;
  64. justify-items: start;
  65. .title {
  66. padding: 20rpx;
  67. font-size: 24rpx;
  68. font-weight: 600;
  69. }
  70. .type {
  71. padding-right: 20rpx;
  72. font-size: 24rpx;
  73. }
  74. .code {
  75. font-weight: 600;
  76. }
  77. .item {
  78. padding: 20rpx;
  79. font-size: 20rpx;
  80. color: #666;
  81. .status {
  82. padding-left: 20rpx;
  83. }
  84. .fail {
  85. font-weight: 600;
  86. color: #f00;
  87. }
  88. }
  89. .is-empty {
  90. text-align: center;
  91. margin: 40px 0;
  92. color: #999;
  93. }
  94. }
  95. </style>