lookLogistics.vue 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262
  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. <scroll-view class="recomment" scroll-y @scrolltolower='getData'>
  33. <recommendGoods ref='recomment_goods' />
  34. </scroll-view>
  35. <!-- 推荐商品 end-->
  36. </view>
  37. </template>
  38. <script>
  39. import {
  40. mapState
  41. } from 'vuex';
  42. import recommendGoods from "@/components/recommend-goods.vue";
  43. import uniPopup from '@/components/uni-popup/uni-popup.vue';
  44. import uniPopupMessage from '@/components/uni-popup/uni-popup-message.vue';
  45. import uniPopupDialog from '@/components/uni-popup/uni-popup-dialog.vue';
  46. import uniSteps from '@/components/uni-steps/uni-steps.vue'; //步骤条
  47. let startY = 0,
  48. moveY = 0,
  49. pageAtTop = true;
  50. export default {
  51. components: {
  52. recommendGoods,
  53. uniPopup,
  54. uniPopupMessage,
  55. uniPopupDialog,
  56. uniSteps
  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. methods: {
  99. initData() {
  100. },
  101. /**
  102. * 统一跳转接口,拦截未登录路由
  103. * navigator标签现在默认没有转场动画,所以用view
  104. */
  105. navTo(url) {
  106. if (!this.hasLogin) {
  107. url = '/pages/public/login';
  108. }
  109. uni.navigateTo({
  110. url
  111. })
  112. },
  113. /**
  114. * 会员卡下拉和回弹
  115. * 1.关闭bounce避免ios端下拉冲突
  116. * 2.由于touchmove事件的缺陷(以前做小程序就遇到,比如20跳到40,h5反而好很多),下拉的时候会有掉帧的感觉
  117. * transition设置0.1秒延迟,让css来过渡这段空窗期
  118. * 3.回弹效果可修改曲线值来调整效果,推荐一个好用的bezier生成工具 http://cubic-bezier.com/
  119. */
  120. coverTouchstart(e) {
  121. if (pageAtTop === false) {
  122. return;
  123. }
  124. this.coverTransition = 'transform .1s linear';
  125. startY = e.touches[0].clientY;
  126. },
  127. coverTouchmove(e) {
  128. moveY = e.touches[0].clientY;
  129. let moveDistance = moveY - startY;
  130. if (moveDistance < 0) {
  131. this.moving = false;
  132. return;
  133. }
  134. this.moving = true;
  135. if (moveDistance >= 80 && moveDistance < 100) {
  136. moveDistance = 80;
  137. }
  138. if (moveDistance > 0 && moveDistance <= 80) {
  139. this.coverTransform = `translateY(${moveDistance}px)`;
  140. }
  141. },
  142. coverTouchend() {
  143. if (this.moving === false) {
  144. return;
  145. }
  146. this.moving = false;
  147. this.coverTransition = 'transform 0.3s cubic-bezier(.21,1.93,.53,.64)';
  148. this.coverTransform = 'translateY(0px)';
  149. },
  150. //获取物流轨迹接口
  151. getLogisticsTrajectory(){
  152. let that = this;
  153. let param = {};
  154. param.url = 'v3/business/front/logistics/order/getTrace';
  155. param.method = 'GET';
  156. param.data = {};
  157. param.data.orderSn = that.orderSn; //订单号
  158. that.$request(param).then(res => {
  159. if (res.state == 200) {
  160. let result = res.data;
  161. that.logisticsInfo = result || {}; //物流信息
  162. that.logisticsRouteList = result.routeList || []; //物流轨迹信息
  163. that.logisticsRouteList = that.logisticsRouteList.map(function(item){
  164. return{
  165. "title":item.acceptTime,
  166. "desc":item.acceptStation
  167. }
  168. })
  169. that.loadFlag = true;
  170. } else {
  171. this.$api.msg(res.msg);
  172. }
  173. }).catch((e) => {
  174. //异常处理
  175. })
  176. },
  177. //获取推荐商品
  178. getData() {
  179. this.$refs.recomment_goods.getMoreData();
  180. },
  181. }
  182. }
  183. </script>
  184. <style lang='scss'>
  185. page {
  186. background: $bg-color-split;
  187. width: 750rpx;
  188. margin: 0 auto;
  189. }
  190. .look_logistics{
  191. width: 100%;
  192. background: #F5F5F5;
  193. .logistics_des{
  194. border-top: 20rpx solid #F5F5F5;
  195. background-color: #FFFFFF;
  196. display: flex;
  197. padding: 20rpx;
  198. box-sizing: border-box;
  199. .goods_image{
  200. width: 200rpx;
  201. height: 200rpx;
  202. background: #F3F3F3;
  203. border-radius: 14rpx;
  204. image{
  205. width: 200rpx;
  206. height: 200rpx;
  207. border-radius: 14rpx;
  208. }
  209. }
  210. .logistics_desc{
  211. display: flex;
  212. flex-direction: column;
  213. justify-content: center;
  214. margin-left: 16rpx;
  215. .logistics_type{
  216. font-size: 28rpx;
  217. font-family: PingFang SC;
  218. font-weight: 500;
  219. color: #949494;
  220. line-height: 32rpx;
  221. margin: 20rpx 0;
  222. }
  223. }
  224. }
  225. .lofistics_info{
  226. width: 710rpx;
  227. background: #FFFFFF;
  228. border-radius: 15rpx;
  229. margin: 20rpx;
  230. }
  231. .no_data{
  232. width: 100%;
  233. display: flex;
  234. flex-direction: column;
  235. align-items: center;
  236. image{
  237. width: 210rpx;
  238. height: 210rpx;
  239. margin: 81rpx 0 43rpx;
  240. }
  241. text{
  242. font-size: 26rpx;
  243. font-family: Source Han Sans CN;
  244. font-weight: 400;
  245. color: #9A9A9A;
  246. }
  247. }
  248. .recomment{
  249. margin-top: 60rpx;
  250. }
  251. }
  252. </style>