order-express.vue 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161
  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. @import url('/packageShang/components/iconfont/iconfont.css');
  101. @import url('/packageShang/common/common.scss');
  102. .copy {
  103. margin-left: 30rpx;
  104. padding: 10rpx 40rpx;
  105. background-color: #f1f1f1;
  106. border-radius: 40rpx;
  107. font-size: 24rpx;
  108. }
  109. .item {
  110. align-items: baseline;
  111. }
  112. .item:not(:last-child)::before {
  113. content: ' ';
  114. border-left: 1px solid #d3d3d3;
  115. position: absolute;
  116. bottom: -14rpx;
  117. top: 14rpx;
  118. left: 10rpx;
  119. border-left-width: 1px;
  120. border-left-style: solid;
  121. border-left-color: rgb(211, 211, 211);
  122. }
  123. .item.active::before{
  124. border-left: 1px solid #ff6a6c;
  125. }
  126. .circle {
  127. width: 20rpx;
  128. height: 20rpx;
  129. position: absolute;
  130. background: #d3d3d3;
  131. border-radius: 50%;
  132. top: 14rpx;
  133. }
  134. .circle.active {
  135. background: #ff6a6c !important;
  136. transform: scale(1.1);
  137. }
  138. .circle.active::after {
  139. content: ' ';
  140. background: rgba(255, 106, 108, 0.5) !important;
  141. -webkit-transform: scale(1.6);
  142. transform: scale(1.6);
  143. width: 20rpx;
  144. height: 20rpx;
  145. position: absolute;
  146. border-radius: 50%;
  147. }
  148. </style>