index.vue 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348
  1. <template>
  2. <view>
  3. <view class="w-full header_bg" :style="{'height': (174 + sysHeight) * 2 + 'rpx'}">
  4. <!-- <view class="w-full fixed-lt z-99" :style="{'padding-top': sysHeight * 2 + 'rpx'}" :class="pageScrollStatus ? 'bg--w111-fff' : ''">
  5. <view class="h-80 px-20 flex-between-center">
  6. <text class="iconfont icon-ic_leftarrow fs-40" :class="pageScrollStatus ? 'text--w111-333' : 'text--w111-fff'" @click="goPage(3)"></text>
  7. <text class="fs-34 fw-500" :class="pageScrollStatus ? 'text--w111-333' : 'text--w111-fff'">物流查询</text>
  8. <text></text>
  9. </view>
  10. </view> -->
  11. <view class="w-full abs-lb white_jianbian"></view>
  12. </view>
  13. <!-- #ifdef MP -->
  14. <NavBar titleText="物流查询" :iconColor="iconColor" :textColor="iconColor" :isScrolling="isScrolling" showBack></NavBar>
  15. <!-- #endif -->
  16. <view class="relative px-20 z-20 express_box">
  17. <view class="h-66 rd-t-24rpx light px-24 flex-between-center fs-20">
  18. <text>{{orderInfo.delivery_name}} {{orderInfo.delivery_id}}</text>
  19. <text class="inline-block copy_btn fs-22 text--w111-333" @tap="copyOrderId">复制单号</text>
  20. </view>
  21. <view class="rd-b-24rpx bg--w111-fff flex-between-center">
  22. <view class="w-316 h-142 flex-col flex-center">
  23. <text class="fs-32 fw-500 lh-44rpx">{{orderInfo.user_name}}</text>
  24. <text class="fs-22 text--w111-999 lh-30rpx mt-8">{{orderInfo.user_phone}}</text>
  25. </view>
  26. <view class="flex-1 h-142 flex-center fs-28 fw-500 lh-40rpx relative city-box">
  27. <text>{{orderInfo.user_city}}</text>
  28. <text class="iconfont icon-a-jiantou11 mx-32"></text>
  29. <text>{{orderInfo.send_city}}</text>
  30. </view>
  31. </view>
  32. </view>
  33. <view class="px-20 mt-20 relative">
  34. <view class="bg--w111-fff rd-16rpx pt-32 pr-24 pl-24 pb-32">
  35. <view class="flex-between-center">
  36. <view class="fs-32 fw-500 text--w111-333">
  37. <text>物流详情</text>
  38. </view>
  39. </view>
  40. <view class="logisticsCon mt-50 relative" v-if="expressList.length">
  41. <view class='item' v-for="(item,index) in logisticList" :key="index">
  42. <view class='circular' :class='index === 0 ? "on text-center":""'>
  43. <text class="iconfont icon-ic_complete text--w111-fff fs-24" v-if="index == 0"></text>
  44. </view>
  45. <view class='text' :class='index===0 ? "on-font on":""'>
  46. <view>{{item.status}}</view>
  47. <view class='data' :class='index===0 ? "on-font on":""'>{{item.time}}</view>
  48. </view>
  49. </view>
  50. <view class="more-text fs-24" @tap="checkShowMore">
  51. <text>{{showMore ? '收起' : '查看更多物流信息'}}</text>
  52. <text class="iconfont fs-24 pl-8" :class="showMore ? 'icon-ic_uparrow' : 'icon-ic_downarrow'"></text>
  53. </view>
  54. </view>
  55. <emptyPage title="暂无物流信息" src="/statics/images/noExpress.gif" v-else></emptyPage>
  56. </view>
  57. <view class="safe-area-inset-bottom"></view>
  58. </view>
  59. </view>
  60. </template>
  61. <script>
  62. let sysHeight = uni.getSystemInfoSync().statusBarHeight;
  63. import {
  64. express
  65. } from '@/api/order.js';
  66. import ClipboardJS from "@/plugin/clipboard/clipboard.js";
  67. import {
  68. toLogin
  69. } from '@/libs/login.js';
  70. import {
  71. mapGetters
  72. } from "vuex";
  73. import {
  74. HTTP_REQUEST_URL
  75. } from '@/config/app';
  76. // #ifdef MP
  77. import NavBar from '@/components/NavBar.vue'
  78. // #endif
  79. import emptyPage from '@/components/emptyPage.vue'
  80. export default {
  81. components: {
  82. // #ifdef MP
  83. NavBar,
  84. // #endif
  85. emptyPage,
  86. },
  87. data() {
  88. return {
  89. sysHeight: sysHeight,
  90. imgHost: HTTP_REQUEST_URL,
  91. orderId: '',
  92. type: '',
  93. product: [],
  94. orderInfo: {},
  95. expressList: [],
  96. isShowAuth: false,
  97. pageScrollStatus: false,
  98. showMore: true,
  99. // #ifdef MP
  100. iconColor: '#FFFFFF',
  101. isScrolling: false,
  102. // #endif
  103. };
  104. },
  105. computed: {
  106. ...mapGetters(['isLogin']),
  107. logisticList() {
  108. if (this.showMore) {
  109. return this.expressList
  110. } else {
  111. return this.expressList.slice(0, 1)
  112. }
  113. }
  114. },
  115. watch: {
  116. isLogin: {
  117. handler: function(newV, oldV) {
  118. if (newV) {
  119. //#ifndef MP
  120. this.getExpress();
  121. //#endif
  122. }
  123. },
  124. deep: true
  125. }
  126. },
  127. onLoad: function(options) {
  128. if (!options.orderId) return this.$util.Tips({
  129. title: '缺少订单号'
  130. });
  131. if (typeof(options.type) == 'undefined') {
  132. this.type = ''
  133. } else {
  134. this.type = options.type
  135. }
  136. this.orderId = options.orderId;
  137. if (this.isLogin) {
  138. this.getExpress();
  139. }
  140. },
  141. onReady: function() {
  142. // #ifdef H5
  143. this.$nextTick(function() {
  144. const clipboard = new ClipboardJS(".copy-data");
  145. clipboard.on("success", () => {
  146. this.$util.Tips({
  147. title: '复制成功'
  148. });
  149. });
  150. });
  151. // #endif
  152. },
  153. onPageScroll(object) {
  154. if (object.scrollTop > 100) {
  155. this.pageScrollStatus = true;
  156. } else if (object.scrollTop < 100) {
  157. this.pageScrollStatus = false;
  158. }
  159. // #ifdef MP
  160. if (object.scrollTop > 50) {
  161. this.isScrolling = true;
  162. this.iconColor = '#333333';
  163. } else if (object.scrollTop < 50) {
  164. this.isScrolling = false;
  165. this.iconColor = '#FFFFFF';
  166. }
  167. // #endif
  168. uni.$emit('scroll');
  169. },
  170. onShow() {
  171. uni.removeStorageSync('form_type_cart');
  172. if (!this.isLogin) {
  173. toLogin()
  174. }
  175. },
  176. methods: {
  177. // 授权关闭
  178. authColse: function(e) {
  179. this.isShowAuth = e
  180. },
  181. /**
  182. * 授权回调
  183. */
  184. onLoadFun: function() {
  185. this.getExpress();
  186. this.isShowAuth = false;
  187. },
  188. copyOrderId: function() {
  189. uni.setClipboardData({
  190. data: this.orderInfo.delivery_id
  191. });
  192. },
  193. getExpress: function() {
  194. let that = this;
  195. express(that.orderId, this.type).then(function(res) {
  196. that.$set(that, 'product', res.data.order.cartInfo || []);
  197. that.$set(that, 'orderInfo', res.data.order);
  198. that.$set(that, 'expressList', res.data.express || []);
  199. }).catch((error) => {
  200. this.$util.Tips({
  201. title: error
  202. });
  203. });
  204. },
  205. checkShowMore() {
  206. this.showMore = !this.showMore
  207. },
  208. goPage(type, url) {
  209. if (type == 1) {
  210. uni.navigateTo({
  211. url
  212. })
  213. } else if (type == 2) {
  214. uni.switchTab({
  215. url
  216. })
  217. } else if (type == 3) {
  218. uni.navigateBack();
  219. }
  220. },
  221. }
  222. }
  223. </script>
  224. <style scoped lang="scss">
  225. .safe-area-inset-bottom {
  226. height: 0;
  227. height: constant(safe-area-inset-bottom);
  228. height: env(safe-area-inset-bottom);
  229. }
  230. .header_bg {
  231. position: absolute;
  232. top: 0;
  233. left: 0;
  234. width: 100%;
  235. height: 369rpx;
  236. background: linear-gradient(270deg, #01ABF8 0%, #2A7EFB 100%);
  237. }
  238. .white_jianbian {
  239. height: 180rpx;
  240. background: linear-gradient(0deg, #F5F5F5 0%, rgba(245, 245, 245, 0) 100%);
  241. }
  242. .light {
  243. background: rgba(255, 255, 255, 0.9);
  244. }
  245. .express_box {
  246. padding-top: 30rpx;
  247. }
  248. .copy_btn {
  249. width: 112rpx;
  250. height: 34rpx;
  251. background: #F5F5F5;
  252. border-radius: 20rpx;
  253. text-align: center;
  254. line-height: 34rpx;
  255. }
  256. .city-box {
  257. &:before {
  258. content: '';
  259. width: 1px;
  260. height: 64rpx;
  261. background-color: #eee;
  262. position: absolute;
  263. top: 40rpx;
  264. left: 0;
  265. }
  266. }
  267. .more-text {
  268. position: absolute;
  269. left: 40rpx;
  270. bottom: -12rpx;
  271. &:before {
  272. content: '';
  273. width: 14rpx;
  274. height: 14rpx;
  275. border-radius: 50%;
  276. background-color: #ddd;
  277. position: absolute;
  278. left: -26rpx;
  279. top: 8rpx;
  280. }
  281. }
  282. .logisticsCon .item {
  283. padding: 0 20rpx;
  284. position: relative;
  285. }
  286. .logisticsCon .item .circular {
  287. width: 14rpx;
  288. height: 14rpx;
  289. border-radius: 50%;
  290. position: absolute;
  291. left: 14rpx;
  292. background-color: #ddd;
  293. }
  294. .logisticsCon .item .circular.on {
  295. width: 40rpx;
  296. height: 40rpx;
  297. background-color: var(--view-theme);
  298. left: 0;
  299. }
  300. .logisticsCon .item .text.on-font {
  301. color: var(--view-theme);
  302. }
  303. .logisticsCon .item .text .data.on-font {
  304. color: var(--view-theme);
  305. }
  306. .logisticsCon .item .text {
  307. font-size: 26rpx;
  308. color: #666;
  309. width: 615rpx;
  310. border-left: 1rpx solid #e6e6e6;
  311. padding: 0 0 40rpx 38rpx;
  312. }
  313. .logisticsCon .item .text .data {
  314. font-size: 24rpx;
  315. color: #999;
  316. margin-top: 10rpx;
  317. }
  318. .logisticsCon .item .text .data .time {
  319. margin-left: 15rpx;
  320. }
  321. .z-99 {
  322. z-index: 99;
  323. }
  324. .product~.product {
  325. margin-top: 20rpx;
  326. }
  327. </style>