index.vue 7.6 KB

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