lee-logistics.vue 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213
  1. <template>
  2. <block v-if="init">
  3. <scroll-view class="lee-logistics-scroll" :style="{ height }" scroll-y="true" v-if="result">
  4. <view class="lee-logistics">
  5. <!-- 物流公司与送达状态面板 -->
  6. <view class="lee-logistics-caption">
  7. <!-- <image class="lee-logistics-caption-logo" :src="result.img" mode="widthFix" /> -->
  8. <view class="lee-logistics-caption-info">
  9. <!-- <view class="lee-logistics-caption-status">{{ result.status }}</view> -->
  10. <view class="lee-logistics-caption-nu">
  11. <text>{{ result.company }}:</text>
  12. <text>{{ expresssn }}</text>
  13. </view>
  14. </view>
  15. </view>
  16. <!-- 物流公司与送达状态面板END -->
  17. <!-- 物流信息列表 -->
  18. <view class="lee-logistics-list">
  19. <view class="lee-logistics-msg" v-for="(v, k) of result.message" :key="k">
  20. <view class="lee-logistics-msg-time">
  21. <view>{{ v.time.split(' ')[1] }}</view>
  22. <view>{{ v.time.split(' ')[0] }}</view>
  23. </view>
  24. <view class="lee-logistics-msg-context">
  25. <rich-text :nodes="v.step | contextFormatter"></rich-text>
  26. </view>
  27. </view>
  28. </view>
  29. <!-- 物流信息列表END -->
  30. </view>
  31. </scroll-view>
  32. <view class="lee-logistics-defults" :style="{ height }" v-else>
  33. <view class="lee-logistics-defults-icon leeIcon-empty"></view>
  34. <view class="lee-logistics-defults-title">暂无查询结果</view>
  35. <view class="lee-logistics-defults-intro">单号输入错误或暂未寄出</view>
  36. </view>
  37. </block>
  38. </template>
  39. <script>
  40. export default {
  41. props: {
  42. expresssn: {
  43. type: String,
  44. required: true
  45. },
  46. height: {
  47. type: String,
  48. default: '100%'
  49. }
  50. },
  51. data() {
  52. return {
  53. init: false,
  54. result: null
  55. }
  56. },
  57. filters: {
  58. // 格式化物流信息
  59. contextFormatter(v) {
  60. return v.replace(/\d{11}/, re => `<span class="phoneText">${re}</span>`)
  61. }
  62. },
  63. created() {
  64. // this.search()
  65. },
  66. methods: {
  67. // 查询快递信息
  68. async search(express, expresssn) {
  69. let list = await this.$api.request('/order/express', 'POST', {
  70. express: express,
  71. expresssn: expresssn
  72. });
  73. if (list) {
  74. this.init = true
  75. this.result = list;
  76. }
  77. },
  78. // 查询到数据后的处理函数
  79. dataHandler(res) {
  80. this.init = true
  81. this.result = res.status === 1 && res.data.status ? res.data : null
  82. }
  83. }
  84. }
  85. </script>
  86. <style lang="scss">
  87. @import './icon.scss';
  88. .lee-logistics-defults {
  89. height: 100%;
  90. display: flex;
  91. align-items: center;
  92. justify-content: center;
  93. flex-direction: column;
  94. color: $uni-text-color-grey;
  95. &-icon {
  96. font-size: 200rpx;
  97. font-weight: 600;
  98. }
  99. &-title {
  100. font-size: 40rpx;
  101. margin-bottom: 10rpx;
  102. }
  103. &-intro {
  104. font-size: 32rpx;
  105. }
  106. }
  107. .lee-logistics {
  108. padding: 30rpx;
  109. &-list {
  110. padding: 30rpx;
  111. background-color: $uni-bg-color;
  112. border-radius: 8rpx;
  113. box-shadow: 0 0 2rpx rgba(0, 0, 0, .15);
  114. padding-top: 50rpx;
  115. }
  116. }
  117. .lee-logistics-caption {
  118. padding: 30rpx;
  119. background-color: $uni-bg-color;
  120. border-radius: 8rpx;
  121. box-shadow: 0 0 2rpx rgba(0, 0, 0, .15);
  122. display: flex;
  123. align-items: center;
  124. margin-bottom: 30rpx;
  125. &-logo {
  126. $size: 120rpx;
  127. width: $size;
  128. height: $size;
  129. }
  130. &-info {
  131. flex: 1;
  132. width: 0;
  133. margin-left: 30rpx;
  134. }
  135. &-status {
  136. font-size: 36rpx;
  137. font-weight: 400;
  138. margin-bottom: 10rpx;
  139. }
  140. &-nu {
  141. font-size: 32rpx;
  142. }
  143. }
  144. .lee-logistics-msg {
  145. display: flex;
  146. &-time {
  147. width: 162rpx;
  148. display: flex;
  149. flex-direction: column;
  150. align-items: flex-end;
  151. padding-right: 30rpx;
  152. font-size: 24rpx;
  153. }
  154. &-context {
  155. flex: 1;
  156. width: 0;
  157. padding-left: 30rpx;
  158. padding-bottom: 50rpx;
  159. border-left: 2rpx solid $uni-border-color;
  160. position: relative;
  161. font-size: 32rpx;
  162. &::before {
  163. --size: 20rpx;
  164. content: '';
  165. position: absolute;
  166. width: var(--size);
  167. height: var(--size);
  168. top: calc(-1 * var(--size) / 2);
  169. left: calc(-1 * var(--size) / 2);
  170. background-color: $uni-border-color;
  171. border-radius: 50%;
  172. }
  173. }
  174. &:last-child > &-context {
  175. border: none;
  176. }
  177. &:first-child > &-context {
  178. border-color: $uni-color-primary;
  179. border-left-style: dashed;
  180. &::before {
  181. --size: 30rpx;
  182. background-color: $uni-color-primary;
  183. }
  184. }
  185. }
  186. .phoneText {
  187. color: $uni-color-primary;
  188. font-weight: 600;
  189. }
  190. </style>