order-express.vue 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160
  1. <template>
  2. <view class="bg-drak" :class="[empty ? '' : 'padding-tb']">
  3. <!-- 空白页 -->
  4. <use-empty v-if="empty" e-style="round" tip="无物流数据"></use-empty>
  5. <view v-if="expressData" class="padding-lr">
  6. <view class="border-radius padding margin-bottom-sm bg-main">
  7. <view class="fs-lg fwb">{{expressData.expressName}}</view>
  8. <view>物流单号:{{expressData.expressNo}}<text class="copy" @click="copy">复制</text></view>
  9. <!-- <view class="fs-lg fwb">{{expressData.detail}}</view> -->
  10. </view>
  11. </view>
  12. <view v-if="expressData" class="padding-lr">
  13. <view class="product border-radius padding margin-bottom-sm bg-main" style="padding-bottom: 15rpx;">
  14. <view :class="{ 'active': index == 0, 'fwb': index == 0 }" class="dflex item pos-r" v-for="(item, index) in detail" :key="index">
  15. <view :class="{ 'active': index == 0 }" class="circle"></view>
  16. <view :class="{ 'ft-dark': index > 0 }" class="margin-left-lg pos-r w-full margin-bottom">
  17. <view>{{item.context}}</view>
  18. <view class="margin-top-xs fs-xs">{{item.time}}</view>
  19. </view>
  20. </view>
  21. </view>
  22. </view>
  23. <!-- 置顶 -->
  24. <use-totop ref="usetop"></use-totop>
  25. </view>
  26. </template>
  27. <script>
  28. import {
  29. orderexpress
  30. } from '../../../utils/api_order.js'
  31. import useEmpty from '../../../components/use-empty/use-empty.vue'
  32. import useTotop from '../../../components/use-totop/use-totop.vue'
  33. export default {
  34. components:{
  35. useEmpty,
  36. useTotop,
  37. },
  38. data() {
  39. return {
  40. empty: false,
  41. order_id: '',
  42. expressData: {},
  43. detail:[],
  44. }
  45. },
  46. watch: {
  47. expressData(e) {
  48. let empty = !e;
  49. if (this.empty !== empty) {
  50. this.empty = empty;
  51. }
  52. }
  53. },
  54. onPageScroll(e) {
  55. //this.scrollTop = e.scrollTop;
  56. this.$refs.usetop.change(e.scrollTop);
  57. },
  58. onLoad(options) {
  59. this.order_id = options.order_id;
  60. if(!this.order_id) {
  61. this.$api.msg('订单号不存在');
  62. }
  63. this.loadData();
  64. },
  65. onShow() {
  66. },
  67. methods: {
  68. loadData() {
  69. var _self=this
  70. //根据订单id查物流信息
  71. var data=_self.order_id
  72. orderexpress(data).then((res) => {
  73. if(res.success){
  74. _self.expressData = res.data;
  75. return
  76. }
  77. _self.detail=JSON.parse(_self.expressData.detail)
  78. _self.$api.msg(res.message);
  79. })
  80. },
  81. // 点击复制
  82. copy() {
  83. uni.setClipboardData({
  84. data: this.expressData.expressNo,
  85. success: function(res) {
  86. uni.getClipboardData({
  87. success: function(res) {
  88. uni.showToast({
  89. title: '复制成功'
  90. });
  91. }
  92. });
  93. }
  94. });
  95. },
  96. }
  97. }
  98. </script>
  99. <style>
  100. .copy {
  101. margin-left: 30rpx;
  102. padding: 10rpx 40rpx;
  103. background-color: #f1f1f1;
  104. border-radius: 40rpx;
  105. font-size: 24rpx;
  106. }
  107. .item {
  108. align-items: baseline;
  109. }
  110. .item:not(:last-child)::before {
  111. content: ' ';
  112. border-left: 1px solid #d3d3d3;
  113. position: absolute;
  114. bottom: -14rpx;
  115. top: 14rpx;
  116. left: 10rpx;
  117. border-left-width: 1px;
  118. border-left-style: solid;
  119. border-left-color: rgb(211, 211, 211);
  120. }
  121. .item.active::before{
  122. border-left: 1px solid #ff6a6c;
  123. }
  124. .circle {
  125. width: 20rpx;
  126. height: 20rpx;
  127. position: absolute;
  128. background: #d3d3d3;
  129. border-radius: 50%;
  130. top: 14rpx;
  131. }
  132. .circle.active {
  133. background: #ff6a6c !important;
  134. transform: scale(1.1);
  135. }
  136. .circle.active::after {
  137. content: ' ';
  138. background: rgba(255, 106, 108, 0.5) !important;
  139. -webkit-transform: scale(1.6);
  140. transform: scale(1.6);
  141. width: 20rpx;
  142. height: 20rpx;
  143. position: absolute;
  144. border-radius: 50%;
  145. }
  146. </style>