lookLogistics.vue 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259
  1. <!-- 查看物流页面 -->
  2. <template>
  3. <view class="look_logistics">
  4. <!-- 物流公司,及商品 start-->
  5. <view class="logistics_des">
  6. <view class="goods_image">
  7. <image :src="logisticsInfo.goodsImage" mode="aspectFill"></image>
  8. </view>
  9. <view class="logistics_desc" v-if="logisticsInfo.type!='1'">
  10. <view class="logistics_type">{{$L('承运公司')}}:<text>{{logisticsInfo.expressName ? logisticsInfo.expressName : '--'}}</text></view>
  11. <!-- <view class="logistics_type">物流状态:<text>{{logisticsInfo.type ? logisticsInfo.type : '--'}}</text></view> -->
  12. <view class="logistics_type">{{$L('物流单号')}}:<text>{{logisticsInfo.expressNumber ? logisticsInfo.expressNumber : '--'}}</text></view>
  13. </view>
  14. <view class="logistics_desc" v-if="logisticsInfo.type=='1'">
  15. <view class="logistics_type">{{$L('联系人')}}:<text>{{logisticsInfo.expressName ? logisticsInfo.expressName : '--'}}</text></view>
  16. <!-- <view class="logistics_type">物流状态:<text>{{logisticsInfo.type ? logisticsInfo.type : '--'}}</text></view> -->
  17. <view class="logistics_type">{{$L('联系电话')}}:<text>{{logisticsInfo.expressNumber ? logisticsInfo.expressNumber : '--'}}</text></view>
  18. </view>
  19. </view>
  20. <!-- 物流公司,及商品 end-->
  21. <!-- 物流轨迹 start -->
  22. <view class="lofistics_info" v-if="logisticsRouteList.length > 0">
  23. <!-- 纵向排列 -->
  24. <uni-steps :options=logisticsRouteList direction="column" :active="logisticsRouteList.length - 1"></uni-steps>
  25. </view>
  26. <view class="no_data" v-if="logisticsRouteList.length ==0&&logisticsInfo.type!='1'">
  27. <image :src="imgUrl+'order-detail/no_logistics.png'" mode=""></image>
  28. <text>{{$L('暂无物流信息,请耐心等待哦')}}~</text>
  29. </view>
  30. <!-- 物流轨迹 end -->
  31. <!-- 推荐商品 start-->
  32. <recommendList ref="recommendList"></recommendList>
  33. <!-- 推荐商品 end-->
  34. </view>
  35. </template>
  36. <script>
  37. import {
  38. mapState
  39. } from 'vuex';
  40. import recommendGoods from "@/components/recommend-goods.vue";
  41. import uniPopup from '@/components/uni-popup/uni-popup.vue';
  42. import uniPopupMessage from '@/components/uni-popup/uni-popup-message.vue';
  43. import uniPopupDialog from '@/components/uni-popup/uni-popup-dialog.vue';
  44. import uniSteps from '@/components/uni-steps/uni-steps.vue'; //步骤条
  45. import recommendList from '../components/recommend_list.vue';
  46. let startY = 0,
  47. moveY = 0,
  48. pageAtTop = true;
  49. export default {
  50. components: {
  51. recommendGoods,
  52. uniPopup,
  53. uniPopupMessage,
  54. uniPopupDialog,
  55. uniSteps,
  56. recommendList
  57. },
  58. data() {
  59. return {
  60. imgUrl: getApp().globalData.imgUrl,
  61. coverTransform: 'translateY(0px)',
  62. coverTransition: '0s',
  63. moving: false,
  64. logisticsInfo:{}, //物流信息
  65. logisticsRouteList:[], //物流轨迹信息
  66. }
  67. },
  68. async onLoad(option) {
  69. //退款单号
  70. this.orderSn = option.orderSn;
  71. this.productLeadLittle = option.productLeadLittle; //商品图片
  72. this.initData();
  73. this.getLogisticsTrajectory();
  74. },
  75. // #ifndef MP
  76. onNavigationBarButtonTap(e) {
  77. const index = e.index;
  78. if (index === 0) {
  79. this.navTo('/pages/set/set');
  80. } else if (index === 1) {
  81. // #ifdef APP-PLUS
  82. const pages = getCurrentPages();
  83. const page = pages[pages.length - 1];
  84. const currentWebview = page.$getAppWebview();
  85. currentWebview.hideTitleNViewButtonRedDot({
  86. index
  87. });
  88. // #endif
  89. uni.navigateTo({
  90. url: '/pages/notice/notice'
  91. })
  92. }
  93. },
  94. // #endif
  95. computed: {
  96. ...mapState(['hasLogin', 'userInfo', 'userCenterData'])
  97. },
  98. onReachBottom(){
  99. this.$refs.recommendList.getMoreData();
  100. },
  101. methods: {
  102. initData() {
  103. },
  104. /**
  105. * 统一跳转接口,拦截未登录路由
  106. * navigator标签现在默认没有转场动画,所以用view
  107. */
  108. navTo(url) {
  109. if (!this.hasLogin) {
  110. url = '/pages/public/login';
  111. }
  112. uni.navigateTo({
  113. url
  114. })
  115. },
  116. /**
  117. * 会员卡下拉和回弹
  118. * 1.关闭bounce避免ios端下拉冲突
  119. * 2.由于touchmove事件的缺陷(以前做小程序就遇到,比如20跳到40,h5反而好很多),下拉的时候会有掉帧的感觉
  120. * transition设置0.1秒延迟,让css来过渡这段空窗期
  121. * 3.回弹效果可修改曲线值来调整效果,推荐一个好用的bezier生成工具 http://cubic-bezier.com/
  122. */
  123. coverTouchstart(e) {
  124. if (pageAtTop === false) {
  125. return;
  126. }
  127. this.coverTransition = 'transform .1s linear';
  128. startY = e.touches[0].clientY;
  129. },
  130. coverTouchmove(e) {
  131. moveY = e.touches[0].clientY;
  132. let moveDistance = moveY - startY;
  133. if (moveDistance < 0) {
  134. this.moving = false;
  135. return;
  136. }
  137. this.moving = true;
  138. if (moveDistance >= 80 && moveDistance < 100) {
  139. moveDistance = 80;
  140. }
  141. if (moveDistance > 0 && moveDistance <= 80) {
  142. this.coverTransform = `translateY(${moveDistance}px)`;
  143. }
  144. },
  145. coverTouchend() {
  146. if (this.moving === false) {
  147. return;
  148. }
  149. this.moving = false;
  150. this.coverTransition = 'transform 0.3s cubic-bezier(.21,1.93,.53,.64)';
  151. this.coverTransform = 'translateY(0px)';
  152. },
  153. //获取物流轨迹接口
  154. getLogisticsTrajectory(){
  155. let that = this;
  156. let param = {};
  157. param.url = 'v3/integral/front/integral/order/getTrace';
  158. param.method = 'GET';
  159. param.data = {};
  160. param.data.orderSn = that.orderSn; //订单号
  161. that.$request(param).then(res => {
  162. if (res.state == 200) {
  163. let result = res.data;
  164. that.logisticsInfo = result || {}; //物流信息
  165. that.logisticsRouteList = result.routeList || []; //物流轨迹信息
  166. that.logisticsRouteList = that.logisticsRouteList.map(function(item){
  167. return{
  168. "title":item.acceptTime,
  169. "desc":item.acceptStation
  170. }
  171. })
  172. that.loadFlag = true;
  173. } else {
  174. this.$api.msg(res.msg);
  175. }
  176. }).catch((e) => {
  177. //异常处理
  178. })
  179. },
  180. }
  181. }
  182. </script>
  183. <style lang='scss'>
  184. page {
  185. background: $bg-color-split;
  186. width: 750rpx;
  187. margin: 0 auto;
  188. }
  189. .look_logistics{
  190. width: 100%;
  191. background: #F5F5F5;
  192. .logistics_des{
  193. border-top: 20rpx solid #F5F5F5;
  194. background-color: #FFFFFF;
  195. display: flex;
  196. padding: 20rpx;
  197. box-sizing: border-box;
  198. .goods_image{
  199. width: 200rpx;
  200. height: 200rpx;
  201. background: #F3F3F3;
  202. border-radius: 14rpx;
  203. image{
  204. width: 200rpx;
  205. height: 200rpx;
  206. border-radius: 14rpx;
  207. }
  208. }
  209. .logistics_desc{
  210. display: flex;
  211. flex-direction: column;
  212. justify-content: center;
  213. margin-left: 16rpx;
  214. .logistics_type{
  215. font-size: 28rpx;
  216. font-family: PingFang SC;
  217. font-weight: 500;
  218. color: #949494;
  219. line-height: 32rpx;
  220. margin: 20rpx 0;
  221. }
  222. }
  223. }
  224. .lofistics_info{
  225. width: 710rpx;
  226. background: #FFFFFF;
  227. border-radius: 15rpx;
  228. margin: 20rpx;
  229. }
  230. .no_data{
  231. width: 100%;
  232. display: flex;
  233. flex-direction: column;
  234. align-items: center;
  235. image{
  236. width: 210rpx;
  237. height: 210rpx;
  238. margin: 81rpx 0 43rpx;
  239. }
  240. text{
  241. font-size: 26rpx;
  242. font-family: Source Han Sans CN;
  243. font-weight: 400;
  244. color: #9A9A9A;
  245. }
  246. }
  247. .recomment{
  248. margin-top: 60rpx;
  249. }
  250. }
  251. </style>