You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

269 lines
5.9 KiB

3 months ago
  1. <template>
  2. <view>
  3. <view class='logistics'>
  4. <view class='header acea-row row-between row-top'>
  5. <view class='pictrue'>
  6. <image :src='product.productImg'></image>
  7. </view>
  8. <view class='text acea-row row-between'>
  9. <view class='name line2'>{{product.productName}}</view>
  10. <view class='money'>
  11. <view>{{product.price}}</view>
  12. <view>x{{product.payNum}}</view>
  13. </view>
  14. </view>
  15. </view>
  16. <view class='logisticsCon'>
  17. <view class='company acea-row row-between-wrapper'>
  18. <view class='picTxt acea-row row-between-wrapper'>
  19. <view class='iconfont icon-wuliu'></view>
  20. <view class='text'>
  21. <view><text class='name line1'>物流公司</text> {{orderInfo.deliveryName}}</view>
  22. <view class='express line1'><text class='name'>快递单号</text> {{orderInfo.deliveryId}}</view>
  23. </view>
  24. </view>
  25. <!-- #ifndef H5 -->
  26. <view class='copy' @tap='copyOrderId'>复制单号</view>
  27. <!-- #endif -->
  28. <!-- #ifdef H5 -->
  29. <view class='copy copy-data' :data-clipboard-text="orderInfo.deliveryId">复制单号</view>
  30. <!-- #endif -->
  31. </view>
  32. <view class='item' v-for="(item,index) in expressList" :key="index">
  33. <view class='circular' :class='index === 0 ? "on":""'></view>
  34. <view class='text' :class='index===0 ? "on-font on":""'>
  35. <view>{{item.status}}</view>
  36. <view class='data' :class='index===0 ? "on-font on":""'>{{item.time}}</view>
  37. </view>
  38. </view>
  39. </view>
  40. <recommend ref="recommendIndex" v-if="expressList.length== 0 && isloading"></recommend>
  41. </view>
  42. </view>
  43. </template>
  44. <script>
  45. import {
  46. express
  47. } from '@/api/order.js';
  48. import ClipboardJS from "@/plugin/clipboard/clipboard.js";
  49. import {
  50. toLogin
  51. } from '@/libs/login.js';
  52. import {
  53. mapGetters
  54. } from "vuex";
  55. import recommend from '@/components/recommend';
  56. export default {
  57. components: {
  58. recommend
  59. },
  60. data() {
  61. return {
  62. orderId: '',
  63. product: {
  64. productInfo: {}
  65. },
  66. orderInfo: {},
  67. expressList: [],
  68. loading: false,
  69. isloading: false, //接口是否请求完毕
  70. };
  71. },
  72. computed: mapGetters(['isLogin']),
  73. watch:{
  74. isLogin:{
  75. handler:function(newV,oldV){
  76. if(newV){
  77. this.getExpress();
  78. }
  79. },
  80. deep:true
  81. }
  82. },
  83. onLoad: function (options) {
  84. if (!options.orderId) return this.$util.Tips({title:'缺少订单号'});
  85. this.orderId = options.orderId;
  86. if (this.isLogin) {
  87. this.getExpress();
  88. } else {
  89. toLogin();
  90. }
  91. },
  92. onReady: function() {
  93. // #ifdef H5
  94. this.$nextTick(function() {
  95. const clipboard = new ClipboardJS(".copy-data");
  96. clipboard.on("success", () => {
  97. this.$util.Tips({
  98. title: '复制成功'
  99. });
  100. });
  101. });
  102. // #endif
  103. },
  104. methods: {
  105. copyOrderId:function(){
  106. uni.setClipboardData({ data: this.orderInfo.deliveryId });
  107. },
  108. getExpress:function(){
  109. let that=this;
  110. that.isloading = false;
  111. express(that.orderId).then(function(res){
  112. let result = res.data.express|| {};
  113. that.$set(that,'product',res.data.order.info[0] || {});
  114. that.$set(that,'orderInfo',res.data.order);
  115. that.$set(that,'expressList',result.list || []);
  116. that.isloading = true;
  117. }).catch(e => {
  118. that.isloading = false;
  119. return this.$util.Tips({
  120. title: e
  121. });
  122. });
  123. }
  124. },
  125. // 滚动到底部
  126. onReachBottom() {
  127. if (this.params.page != 1) {
  128. this.$refs.recommendIndex.get_host_product();
  129. }
  130. },
  131. }
  132. </script>
  133. <style scoped lang="scss">
  134. .logistics .header {
  135. padding: 23rpx 30rpx;
  136. background-color: #fff;
  137. height: 166rpx;
  138. box-sizing: border-box;
  139. }
  140. .logistics .header .pictrue {
  141. width: 120rpx;
  142. height: 120rpx;
  143. }
  144. .logistics .header .pictrue image {
  145. width: 100%;
  146. height: 100%;
  147. border-radius: 6rpx;
  148. }
  149. .logistics .header .text {
  150. width: 540rpx;
  151. font-size: 28rpx;
  152. color: #999;
  153. margin-top: 6rpx;
  154. }
  155. .logistics .header .text .name {
  156. width: 365rpx;
  157. color: #282828;
  158. }
  159. .logistics .header .text .money {
  160. text-align: right;
  161. }
  162. .logistics .logisticsCon {
  163. background-color: #fff;
  164. margin: 12rpx 0;
  165. }
  166. .logistics .logisticsCon .company {
  167. height: 120rpx;
  168. margin: 0 0 45rpx 30rpx;
  169. padding-right: 30rpx;
  170. border-bottom: 1rpx solid #f5f5f5;
  171. }
  172. .logistics .logisticsCon .company .picTxt {
  173. width: 520rpx;
  174. }
  175. .logistics .logisticsCon .company .picTxt .iconfont {
  176. width: 50rpx;
  177. height: 50rpx;
  178. background-color: #666;
  179. text-align: center;
  180. line-height: 50rpx;
  181. color: #fff;
  182. font-size: 35rpx;
  183. }
  184. .logistics .logisticsCon .company .picTxt .text {
  185. width: 450rpx;
  186. font-size: 26rpx;
  187. color: #282828;
  188. }
  189. .logistics .logisticsCon .company .picTxt .text .name {
  190. color: #999;
  191. }
  192. .logistics .logisticsCon .company .picTxt .text .express {
  193. margin-top: 5rpx;
  194. }
  195. .logistics .logisticsCon .company .copy {
  196. font-size: 20rpx;
  197. width: 106rpx;
  198. height: 40rpx;
  199. text-align: center;
  200. line-height: 40rpx;
  201. border-radius: 20rpx;
  202. border: 1rpx solid #999;
  203. }
  204. .logistics .logisticsCon .item {
  205. padding: 0 40rpx;
  206. position: relative;
  207. }
  208. .logistics .logisticsCon .item .circular {
  209. width: 20rpx;
  210. height: 20rpx;
  211. border-radius: 50%;
  212. position: absolute;
  213. top: -1rpx;
  214. left: 31.5rpx;
  215. background-color: #ddd;
  216. }
  217. .logistics .logisticsCon .item .circular.on {
  218. background-color: $theme-color;
  219. }
  220. .logistics .logisticsCon .item .text.on-font {
  221. color: $theme-color;
  222. }
  223. .logistics .logisticsCon .item .text .data.on-font {
  224. color: $theme-color;
  225. }
  226. .logistics .logisticsCon .item .text {
  227. font-size: 26rpx;
  228. color: #666;
  229. width: 615rpx;
  230. border-left: 1rpx solid #e6e6e6;
  231. padding: 0 0 60rpx 38rpx;
  232. }
  233. .logistics .logisticsCon .item .text.on {
  234. border-left-color: #f8c1bd;
  235. }
  236. .logistics .logisticsCon .item .text .data {
  237. font-size: 24rpx;
  238. color: #999;
  239. margin-top: 10rpx;
  240. }
  241. .logistics .logisticsCon .item .text .data .time {
  242. margin-left: 15rpx;
  243. }
  244. </style>