演示项目-图书馆
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

235 lines
6.4 KiB

  1. <template>
  2. <div class="main">
  3. <div class="order-detail-header">
  4. <span class="back" @click="toBack"></span>
  5. </div>
  6. <div class="logistics-main">
  7. <div class="logistics-tab">
  8. <span :class="tabActive === 0 ? 'active':''" @click="tabActive=0">订单1</span>
  9. <span :class="tabActive === 1 ? 'active':''" @click="tabActive=1">订单2</span>
  10. </div>
  11. <div class="logistics-detail">
  12. <div class="logistics-top">
  13. <p>顺丰速运 SF1629871960733</p>
  14. <div class="logistics-handle">
  15. <span @click="copyLogisticsInfo">复制</span>
  16. <span @click="makePhoneCall">打电话</span>
  17. </div>
  18. </div>
  19. <div class="log-step">
  20. <div class="log-step-new">
  21. <div class="step-new-info">
  22. <p>运输中 11-21 16:57</p>
  23. <span>查看详情</span>
  24. </div>
  25. <div class="step-new-detail">
  26. [鄂州市]快件离开 湖北武昌转运中心已发往 湖北武汉洪山广场公司
  27. </div>
  28. </div>
  29. <div class="send-to-location">
  30. <div class="location-info">送至 中南路8号石化大院4栋3单元201</div>
  31. <div class="location-detail">
  32. <p>张三 86-130****0000</p>
  33. <span>取件可出示虚拟号 156232142001-4596</span>
  34. </div>
  35. </div>
  36. </div>
  37. </div>
  38. </div>
  39. </div>
  40. </template>
  41. <script>
  42. import { Toast } from 'vant'
  43. import { reactive, computed, onMounted, getCurrentInstance, toRefs } from 'vue'
  44. export default {
  45. name: 'LogisticsInfo',
  46. components:{ Toast },
  47. setup() {
  48. const { proxy } = getCurrentInstance()
  49. let data = reactive({
  50. tabActive: 0,
  51. orderType: null
  52. })
  53. onMounted(() => {
  54. if(proxy.$route.query.tabActive !== undefined){
  55. data.orderType = JSON.parse(proxy.$route.query.tabActive)
  56. }else{
  57. data.orderType = null
  58. }
  59. })
  60. let toBack = () => {
  61. if(data.orderType){
  62. proxy.$router.push({
  63. path: '/Order',
  64. query: {
  65. tabActive: data.orderType
  66. }
  67. })
  68. }else{
  69. proxy.$router.go(-1)
  70. }
  71. }
  72. let copyLogisticsInfo = () => {
  73. const logisticsInfo = 'SF1629871960733';
  74. if (navigator.clipboard) {
  75. navigator.clipboard.writeText(logisticsInfo)
  76. .then(() => {
  77. Toast('物流单号已复制');
  78. })
  79. .catch(err => {
  80. console.error('复制失败:', err);
  81. });
  82. } else {
  83. const input = document.createElement('textarea');
  84. input.style.position = 'fixed';
  85. input.style.opacity = 0;
  86. input.value = logisticsInfo;
  87. document.body.appendChild(input);
  88. input.select();
  89. document.execCommand('copy');
  90. document.body.removeChild(input);
  91. Toast('物流单号已复制');
  92. }
  93. }
  94. let makePhoneCall = () => {
  95. const phoneNumber = '95338';
  96. const telLink = `tel:${phoneNumber}`;
  97. window.open(telLink, '_self');
  98. }
  99. return {
  100. ...toRefs(data),
  101. toBack,
  102. copyLogisticsInfo,
  103. makePhoneCall
  104. }
  105. }
  106. }
  107. </script>
  108. <style scoped lang="scss">
  109. .order-detail-header{
  110. height: 6.8rem;
  111. background: url('@assets/images/log-img1.png') no-repeat left top;
  112. background-size: contain;
  113. .back{
  114. background: url('@assets/images/back.png') no-repeat transparent;
  115. background-size: .5rem .5rem;
  116. }
  117. }
  118. .logistics-main{
  119. position: relative;
  120. margin-top: -3rem;
  121. .logistics-tab{
  122. position: absolute;
  123. right: 0;
  124. top: -3.5rem;
  125. display: flex;
  126. justify-content: center;
  127. margin: 0 .32rem .2rem .32rem;
  128. padding: 0 .2rem;
  129. background: #fff;
  130. box-shadow: 0px 0.03rem 0.6rem 1px rgba(0, 0, 0, 0.08);
  131. border-radius: 0.08rem;
  132. span{
  133. display: block;
  134. padding: 0 .2rem;
  135. height: .6rem;
  136. line-height: .6rem;
  137. font-size: .28rem;
  138. color: #666;
  139. &.active{
  140. font-weight: bold;
  141. color: #000;
  142. }
  143. }
  144. }
  145. .logistics-detail{
  146. padding: 0 .32rem .32rem .32rem;
  147. background-color: #fff;
  148. border-radius: .32rem .32rem 0 0;
  149. .logistics-top{
  150. display: flex;
  151. justify-content: space-between;
  152. align-items: center;
  153. font-size: .28rem;
  154. padding: .3rem 0 .36rem 0;
  155. p{
  156. padding-left: .5rem;
  157. background: url('@assets/images/log-img2.png') no-repeat left center;
  158. background-size: .36rem .36rem;
  159. }
  160. .logistics-handle{
  161. opacity: .4;
  162. span{
  163. display: inline-block;
  164. padding: 0 .2rem;
  165. height: .24rem;
  166. line-height: .24rem;
  167. &:first-child{
  168. border-right: 1px solid #000;
  169. }
  170. }
  171. }
  172. }
  173. .log-step{
  174. .log-step-new{
  175. position: relative;
  176. &::before{
  177. position: absolute;
  178. left: .16rem;
  179. top: .46rem;
  180. content: "";
  181. width: 0.01rem;
  182. height: 100%;
  183. border-left: 1px solid #ddd;
  184. }
  185. .step-new-info{
  186. display: flex;
  187. justify-content: space-between;
  188. align-items: center;
  189. font-size: .24rem;
  190. color: #FE6902;
  191. p{
  192. background: url('@assets/images/log-img5.png') no-repeat left center;
  193. background-size: .32rem .32rem;
  194. }
  195. span{
  196. padding-right: .22rem;
  197. background: url('@assets/images/log-img3.png') no-repeat right center;
  198. background-size: .16rem .16rem;
  199. }
  200. }
  201. }
  202. .send-to-location{
  203. .location-info{
  204. background: url('@assets/images/log-img4.png') no-repeat left center;
  205. background-size: .32rem .32rem;
  206. }
  207. .location-detail{
  208. span{
  209. opacity: .6;
  210. }
  211. }
  212. }
  213. .step-new-info p,
  214. .location-info{
  215. padding-left: .5rem;
  216. font-size: .32rem;
  217. font-weight: bold;
  218. }
  219. .step-new-detail,
  220. .location-detail{
  221. margin: .16rem 0 .48rem .5rem;
  222. padding: .18rem .18rem .18rem .24rem;
  223. font-size: .28rem;
  224. line-height: .42rem;
  225. background: #F6F6FB;
  226. border-radius: 0.08rem;
  227. }
  228. }
  229. }
  230. }
  231. </style>