logisticsdetail.vue 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184
  1. <template>
  2. <view v-show="!is_loading">
  3. <!-- 胶囊 -->
  4. <mvBar :mysNavConfig="mysNavConfig"></mvBar>
  5. <view :style="{paddingTop:navH}" style="background-color: #fff;"></view>
  6. <view class="logistics1">
  7. <view>
  8. <p style="margin-bottom: 10rpx;">物流公司:{{logistics_company}}</p>
  9. <p>物流单号:{{logistics_number}}
  10. <image :src="picture.icon_copy" mode="" class="copy-img" @click="handleCopy(logistics_number)" />
  11. </p>
  12. </view>
  13. </view>
  14. <view class="logistics-detail" v-for="item in logisticsData">
  15. <view class="logistics-item">
  16. <p>{{ item.context }}</p>
  17. <p>{{ item.time }}</p>
  18. </view>
  19. </view>
  20. <view style="height: 100rpx;"></view>
  21. </view>
  22. </template>
  23. <script>
  24. import region from '@/components/pca-code.json';
  25. import mvBar from "@/components/mys_navBar/mysNavBar";
  26. export default {
  27. components: {
  28. mvBar,
  29. },
  30. data() {
  31. return {
  32. navH: getApp().globalData.navHeight,
  33. picture: getApp().globalData.picture,
  34. mysNavConfig: {
  35. /* 开启单页显示首页图标 */
  36. isHome: true,
  37. /* 固定导航 */
  38. navFixed: true,
  39. /* 标题 (屏幕中心居中 两边图标中心居中使用slot center1) */
  40. navTitle: {
  41. text: "物流信息",
  42. color: "",
  43. fontSize: "32rpx", // px upx rpx
  44. fontWeight: "normal", // 100 - 700
  45. },
  46. btnType: "type2",
  47. onLeftClick: '',
  48. /* type2 按钮 */
  49. type2Config: {
  50. // 左图标
  51. leftPath: "/static/img/png2.png",
  52. // 右图标
  53. rightPath: "/static/img/png4.png",
  54. // 圆角
  55. radius: "40rpx",
  56. },
  57. },
  58. task_id: "",
  59. logistics_number: "",
  60. logistics_company: "",
  61. logisticsData: [{
  62. context: "",
  63. time: ""
  64. }],
  65. address: {},
  66. is_loading: true,
  67. }
  68. },
  69. async onLoad(options) {
  70. try {
  71. const dataStr = options.textObj.replace(/""/g, "");
  72. const data = JSON.parse(decodeURIComponent(dataStr));
  73. this.task_id = data.taskId;
  74. uni.showLoading({ title: '加载中' });
  75. this.is_loading = true;
  76. await this.getLogisticsDetail(this.task_id);
  77. } catch (error) {
  78. console.error('加载物流信息失败:', error);
  79. } finally {
  80. this.is_loading = false;
  81. uni.hideLoading();
  82. }
  83. },
  84. methods: {
  85. getLogisticsDetail(secTaskId) {
  86. // 获取物流信息
  87. return this.$https.get('/youngee/c/api/t/secTask/logistics/detail?task_id=' + secTaskId).then(res => {
  88. console.log(res)
  89. let resData = res.data.data
  90. this.logistics_number = resData.logistics_number
  91. this.logistics_company = resData.logistics_company
  92. this.logisticsData = resData.logistics_context.data
  93. // 地址解析
  94. this.address = JSON.parse(resData.address_snap);
  95. let a = this.address.region_code.toString().slice(0, 2)
  96. let b = this.address.region_code.toString().slice(0, 4)
  97. let c = 0
  98. for (var i = 0; i < region.length; i++) {
  99. if (region[i].code == a) {
  100. a = region[i].name
  101. for (var j = 0; j < region[i].children.length; j++) {
  102. if (region[i].children[j].code == b) {
  103. b = region[i].children[j].name
  104. for (var o = 0; o < region[i].children[j].children.length; o++) {
  105. if (region[i].children[j].children[o].code == this.address
  106. .region_code) {
  107. c = region[i].children[j].children[o].name
  108. }
  109. }
  110. }
  111. }
  112. }
  113. }
  114. this.address.full_detail_addr = a + b + c + this.address.detail_addr
  115. })
  116. }
  117. }
  118. }
  119. </script>
  120. <style lang="scss" scoped>
  121. p {
  122. font-size: 30rpx;
  123. }
  124. .address {
  125. display: flex;
  126. margin: 20rpx 0;
  127. // padding: 20rpx 20rpx;
  128. background-color: #FFFFFF;
  129. justify-content: flex-start;
  130. align-items: center;
  131. .address_icon {
  132. width: 15%;
  133. vertical-align: middle;
  134. display: flex;
  135. justify-content: center;
  136. }
  137. .address_edit {
  138. width: 15%;
  139. }
  140. .address_edit image {
  141. vertical-align: middle;
  142. width: 50rpx;
  143. height: 50rpx;
  144. display: inline-block;
  145. padding-right: 14rpx;
  146. }
  147. .ipon {
  148. color: #333333;
  149. font-size: 30rpx;
  150. font-weight: 500;
  151. margin-bottom: 10rpx;
  152. }
  153. }
  154. .logistics1 {
  155. margin: 50rpx;
  156. display: flex;
  157. flex-flow: column;
  158. align-items: flex-start;
  159. justify-content: center;
  160. }
  161. .logistics-detail {
  162. padding: 20rpx 30rpx;
  163. }
  164. .logistics-item {
  165. background-color: #f1f1f1;
  166. padding: 10rpx 30rpx;
  167. }
  168. </style>