index.vue 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  1. <template>
  2. <mobile-frame>
  3. <view class="main">
  4. <view class="one"></view>
  5. <view class="two">
  6. <view class="two_1">
  7. <view class="two_1_1">
  8. <text>订单状态:</text>
  9. <text>{{is_check}}</text>
  10. </view>
  11. <view class="two_1_1">
  12. <text>物流单号:</text>
  13. <text>{{no}}</text>
  14. </view>
  15. </view>
  16. <view class="two_2">
  17. <uni-section title="物流记录" type="line" padding>
  18. <uni-steps :options="list" active-color="#007AFF" :active="active" direction="column" />
  19. </uni-section>
  20. </view>
  21. </view>
  22. </view>
  23. </view>
  24. </mobile-frame>
  25. </template>
  26. <script>
  27. export default {
  28. data() {
  29. return {
  30. id: '',
  31. user: {},
  32. info: {},
  33. is_check: '',
  34. no: '',
  35. list: []
  36. };
  37. },
  38. onLoad: function(e) {
  39. const that = this;
  40. that.$set(that, `id`, e.id || '');
  41. that.watchLogin()
  42. },
  43. methods: {
  44. watchLogin() {
  45. const that = this;
  46. uni.getStorage({
  47. key: 'token',
  48. success: function(res) {
  49. let user = that.$jwt(res.data);
  50. if (user) that.$set(that, `user`, user);
  51. that.searchInfo();
  52. }
  53. })
  54. },
  55. async searchInfo() {
  56. const that = this;
  57. if (that.id) {
  58. let res = await that.$api(`/orderDetail/${that.id}`, 'GET')
  59. if (res.errcode == '0') {
  60. that.$set(that, `info`, res.data);
  61. that.search();
  62. } else {
  63. uni.showToast({
  64. title: res.errmsg,
  65. icon: 'none'
  66. })
  67. }
  68. }
  69. },
  70. async search() {
  71. const that = this;
  72. let res = await that.$api(`/orderDetail/sot/${that.info._id}`);
  73. if (res.errcode == '0') {
  74. that.$set(that, `is_check`, res.data.is_check);
  75. let list = res.data.list.map((i) => ({
  76. desc: i.time,
  77. title: i.context
  78. }))
  79. console.log(list);
  80. that.$set(that, `list`, list);
  81. that.$set(that, `no`, res.data.no);
  82. } else {
  83. uni.showToast({
  84. title: res.errmsg,
  85. icon: 'none'
  86. })
  87. }
  88. }
  89. }
  90. }
  91. </script>
  92. <style lang="scss">
  93. .main {
  94. display: flex;
  95. flex-direction: column;
  96. width: 100vw;
  97. height: 100vh;
  98. .one {
  99. position: relative;
  100. width: 100vw;
  101. height: 100vh;
  102. background-color: #ff0000;
  103. }
  104. .two {
  105. position: absolute;
  106. bottom: 0;
  107. width: 92vw;
  108. height: 60vh;
  109. overflow-y: auto;
  110. background: #fff;
  111. margin: 0 2vw;
  112. border-top-left-radius: 5px;
  113. border-top-right-radius: 5px;
  114. padding: 2vw;
  115. .two_1 {
  116. margin: 0 0 2vw 0;
  117. .two_1_1 {
  118. padding: 1vw 0;
  119. }
  120. }
  121. }
  122. }
  123. .uni-section .uni-section-header {
  124. padding: 1vw !important;
  125. }
  126. .uni-section .uni-section-content {
  127. padding: 0 !important;
  128. }
  129. </style>