line.vue 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. <template>
  2. <view class="content">
  3. <view class="topbar" v-show="isIphone">
  4. </view>
  5. <view class="status_bar">
  6. <view class="left" @click="goBack"><u-icon name="arrow-left"></u-icon>返回</view>
  7. <span style="font-size: 36rpx;">转运线路</span>
  8. <view class="right">
  9. </view>
  10. </view>
  11. <view class="mainCont">
  12. <view class="title">转运线路</view>
  13. <view class="timeLine">
  14. <u-time-line>
  15. <u-time-line-item nodeTop="2" v-for="(item, index) in lines" :key="index">
  16. <template v-slot:node>
  17. <view class="u-node" style="background: #blue;" v-show="item.passState == 1">
  18. </view>
  19. <view class="u-node" style="background: #ff0000" v-show="item.passState == 2">
  20. </view>
  21. <view class="u-node" style="background: #BCBCBC;" v-show="item.passState == 3">
  22. </view>
  23. </template>
  24. <!-- 此处自定义了左边内容,用一个图标替代 -->
  25. <template v-slot:content>
  26. <view>
  27. <view class="u-order-title" :style="{color: item.passState == 3 ? '#BCBCBC' : ''}">
  28. {{ item.positionName }}
  29. <span style="float: right" v-show="item.passState == 1">{{ item.createTime }}</span>
  30. <span style="float: right; color: #ff0000" v-show="item.passState == 2">未扫码</span>
  31. </view>
  32. </view>
  33. </template>
  34. </u-time-line-item>
  35. </u-time-line>
  36. </view>
  37. </view>
  38. <u-toast ref="uToast" />
  39. </view>
  40. </template>
  41. <script>
  42. const NET = require('@/utils/request')
  43. const API = require('@/config/api')
  44. export default {
  45. data() {
  46. return {
  47. lines: [],
  48. isIphone: false,
  49. }
  50. },
  51. onLoad(params) {
  52. uni.getSystemInfo({
  53. success: (res) => {
  54. console.log(res)
  55. if (res.model == 'iPhone') {
  56. this.isIphone = true;
  57. }
  58. },
  59. fail: (err) => {
  60. console.log(err)
  61. }
  62. })
  63. NET.request(API.checkoutBatchPath, {}).then(res => {
  64. this.lines = res.data
  65. }).catch(error => {
  66. this.$refs.uToast.show({
  67. title: error.msg,
  68. type: 'warning',
  69. })
  70. })
  71. },
  72. onReady() {
  73. if (this.isIphone) {
  74. document.getElementsByClassName('mainCont')[0].style.height = document.getElementsByClassName('mainCont')[
  75. 0].clientHeight - 25 + 'px'
  76. }
  77. },
  78. onShow() {},
  79. methods: {
  80. goBack() {
  81. uni.navigateBack({
  82. delta: 1
  83. });
  84. },
  85. }
  86. }
  87. </script>
  88. <style lang="scss">
  89. .mainCont {
  90. height: calc(100% - 80rpx);
  91. overflow-y: auto;
  92. background: #fff;
  93. .timeLine {
  94. width: calc(100% - 30px);
  95. margin: 0 auto;
  96. padding: 10px;
  97. }
  98. }
  99. .title {
  100. height: 40px;
  101. line-height: 40px;
  102. padding: 0 20px;
  103. font-weight: bold;
  104. border-bottom: 1px solid #f2f2f2;
  105. }
  106. .u-node {
  107. width: 12px;
  108. height: 12px;
  109. border-radius: 22px;
  110. display: flex;
  111. justify-content: center;
  112. align-items: center;
  113. background: #6aa0f7;
  114. }
  115. .u-order-title {
  116. margin-bottom: 20px;
  117. }
  118. </style>