index.vue 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  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. type: '',
  32. user: {},
  33. info: {},
  34. is_check: '',
  35. no: '',
  36. list: []
  37. };
  38. },
  39. onLoad: function(e) {
  40. const that = this;
  41. that.$set(that, `id`, e.id || '');
  42. that.$set(that, `type`, e.type || '');
  43. that.watchLogin()
  44. },
  45. methods: {
  46. watchLogin() {
  47. const that = this;
  48. uni.getStorage({
  49. key: 'token',
  50. success: function(res) {
  51. let user = that.$jwt(res.data);
  52. if (user) that.$set(that, `user`, user);
  53. that.searchInfo();
  54. }
  55. })
  56. },
  57. async searchInfo() {
  58. const that = this;
  59. if (that.id) {
  60. let res;
  61. if (that.type == 'integral') {
  62. res = await that.$api(`/zrOrder/${that.id}`, `GET`, {}, `integral`)
  63. } else if (that.type == 'afterSale') {
  64. res = await that.$api(`/afterSale/${that.id}`, `GET`)
  65. } else {
  66. res = await that.$api(`/orderDetail/${that.id}`, 'GET')
  67. }
  68. if (res.errcode == '0') {
  69. that.$set(that, `info`, res.data);
  70. that.search();
  71. } else {
  72. uni.showToast({
  73. title: res.errmsg,
  74. icon: 'none'
  75. })
  76. }
  77. }
  78. },
  79. async search() {
  80. const that = this;
  81. let res;
  82. if (that.type == 'integral') {
  83. res = await that.$api(`/zrOrder/sot/${that.info._id}`, `GET`, {}, `integral`);
  84. } else if (that.type == 'afterSale') {
  85. res = await that.$api(`/afterSale/getTransportInfo/${that.id}`, `GET`)
  86. } else {
  87. res = await that.$api(`/orderDetail/sot/${that.info._id}`, `GET`);
  88. }
  89. if (res.errcode == '0') {
  90. that.$set(that, `is_check`, res.data.is_check);
  91. let list = res.data.list.map((i) => ({
  92. desc: i.time,
  93. title: i.context
  94. }))
  95. that.$set(that, `list`, list);
  96. that.$set(that, `no`, res.data.no);
  97. } else {
  98. uni.showToast({
  99. title: res.errmsg,
  100. icon: 'none'
  101. })
  102. }
  103. }
  104. }
  105. }
  106. </script>
  107. <style lang="scss">
  108. .main {
  109. display: flex;
  110. flex-direction: column;
  111. width: 100vw;
  112. height: 100vh;
  113. .one {
  114. position: relative;
  115. width: 100vw;
  116. height: 100vh;
  117. background-color: #ff0000;
  118. }
  119. .two {
  120. position: absolute;
  121. bottom: 0;
  122. width: 92vw;
  123. height: 60vh;
  124. overflow-y: auto;
  125. background: #fff;
  126. margin: 0 2vw;
  127. border-top-left-radius: 5px;
  128. border-top-right-radius: 5px;
  129. padding: 2vw;
  130. .two_1 {
  131. margin: 0 0 2vw 0;
  132. .two_1_1 {
  133. padding: 1vw 0;
  134. }
  135. }
  136. }
  137. }
  138. .uni-section .uni-section-header {
  139. padding: 1vw !important;
  140. }
  141. .uni-section .uni-section-content {
  142. padding: 0 !important;
  143. }
  144. </style>