logistics.vue 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188
  1. <template>
  2. <view class="container">
  3. <navbar :config="config" backColor="#666"></navbar>
  4. <!--商品信息-->
  5. <view class="u-bg-fff u-plr30 borderBottom">
  6. <view class="u-ptb30 u-flex">
  7. <image class="u-goods120" :src="goodsimg"></image>
  8. <view class="u-1A1A1A u-ml30">
  9. <view class="u-font28">商品已揽件 <span class="u-font24 u-999 u-ml20">共{{num}}件商品</span> </view>
  10. <view class="u-font24 u-mt5">订单编码: <span class="u-999">{{code}}</span> </view>
  11. </view>
  12. </view>
  13. </view>
  14. <!--物流信息-->
  15. <view class="u-mt30">
  16. <view class="shipping u-bg-fff">
  17. <view class="linehh" :style="'height:'+xiantiaoHeight+'px;top:'+xiantiaoTop+'px;left:'+xiantiaoLeft+'px'"></view>
  18. <view class="ul u-plr30" v-for="(item,index) in shiplist" :key="index">
  19. <view class="li">
  20. <!-- <view class="state u-font26 u-flex" :class="{act:index==0}">
  21. {{item.state}}
  22. </view> -->
  23. <view class="mmmm">
  24. <view class="yuan " :class="{act:index==0,first:index==0,end:index==shiplist.length-1}">
  25. </view>
  26. </view>
  27. <view class="desc">
  28. <view class="u-font26 u-1A1A1A">{{item.acceptStation}}</view>
  29. <view class="u-999 u-font24 u-mt10">{{item.acceptTime}}</view>
  30. </view>
  31. </view>
  32. </view>
  33. <nodata v-if="noData" :config="{top:20,content:'暂无物流数据~'}"></nodata>
  34. </view>
  35. </view>
  36. </view>
  37. </view>
  38. </template>
  39. <script>
  40. export default {
  41. data() {
  42. return {
  43. config: {
  44. back: true, //false是tolbar页面 是则不写
  45. title: '物流信息',
  46. color: '#1a1a1a',
  47. //背景颜色;参数一:透明度(0-1);参数二:背景颜色(array则为线性渐变,string为单色背景)
  48. backgroundColor: [1, "#fff"],
  49. statusBarFontColor: '#1A1A1A'
  50. },
  51. xiantiaoHeight: 0,
  52. xiantiaoLeft: 0,
  53. xiantiaoTop: 0,
  54. goodsimg:'',
  55. num:0,
  56. code:'',
  57. shiplist: [],
  58. noData:false,
  59. }
  60. },
  61. onLoad(options) {
  62. if(options.id){
  63. this.num = options.num
  64. this.goodsimg = options.img
  65. if(options.type==1){
  66. this.getLogistiscs(options.id)
  67. }else{
  68. this.getLogistiscsBlack(options.id)
  69. }
  70. }
  71. },
  72. methods: {
  73. getLogistiscs(id){
  74. this.$http.get('/order/express/select/'+id)
  75. .then(res => {
  76. if(res&&res.code==200){
  77. this.shiplist = res.data.traces.reverse()
  78. this.code = res.data.logisticCode
  79. if(res.data.traces.length==0){
  80. this.noData=true
  81. }
  82. }
  83. })
  84. },
  85. getLogistiscsBlack(id){
  86. this.$http.get('/rights/express/select/'+id)
  87. .then(res => {
  88. if(res&&res.code==200){
  89. this.shiplist = res.data.traces.reverse()
  90. this.code = res.data.logisticCode
  91. if(res.data.traces.length==0){
  92. this.noData=true
  93. }
  94. }
  95. })
  96. },
  97. getHeight() {
  98. const query = uni.createSelectorQuery();
  99. query.select('.first').boundingClientRect()
  100. query.select('.end').boundingClientRect()
  101. var that = this;
  102. query.exec(function(res) {
  103. console.log(res);
  104. var xiantiaoHeight = 0;
  105. if (res[1] !== null) {
  106. xiantiaoHeight = (res[1].top - res[0].top);
  107. }
  108. that.xiantiaoHeight = xiantiaoHeight;
  109. that.xiantiaoLeft = res[0].left + 4;
  110. that.xiantiaoTop = res[0].top;
  111. })
  112. }
  113. }
  114. }
  115. </script>
  116. <style lang="scss">
  117. .borderBottom{
  118. border-bottom: 20rpx solid #eee;
  119. }
  120. .shipping {
  121. width: 100%;
  122. margin: 0 auto;
  123. background-color: #ffffff;
  124. .linehh {
  125. position: absolute;
  126. width: 2rpx;
  127. margin-left: 16rpx;
  128. border-left: 2rpx dotted #BEC2CB;
  129. }
  130. .ul {
  131. .li {
  132. width: 100%;
  133. display: flex;
  134. height: auto;
  135. margin-top: 2rpx;
  136. .state {
  137. padding: 20rpx 0rpx;
  138. &.act{
  139. color:#3775F6;
  140. }
  141. .timeday {
  142. font-size:28upx;
  143. }
  144. .timeh {
  145. font-size: 24upx;
  146. }
  147. }
  148. .mmmm {
  149. position: relative;
  150. display: flex;
  151. padding: 0rpx 32rpx 0rpx 36rpx;
  152. margin-top: 22rpx;
  153. .yuan {
  154. position: absolute;
  155. left: 26rpx;
  156. width: 25rpx;
  157. height: 25rpx;
  158. background: #dedede;
  159. border-radius: 50%;
  160. border: 3rpx solid #f2f2f2;
  161. &.act{
  162. background-color: #FA6138;
  163. width: 44rpx;
  164. height: 44rpx;
  165. margin-left: -10rpx;
  166. }
  167. }
  168. }
  169. .desc {
  170. width: 74%;
  171. padding: 20rpx 0rpx;
  172. margin-left: 22rpx;
  173. }
  174. }
  175. }
  176. }
  177. </style>