logistics_details.vue 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293
  1. <template>
  2. <view :style="colorStyle">
  3. <view class='logistics'>
  4. <view class='header acea-row row-between row-top'>
  5. <view class='pictrue'>
  6. <image :src='orderInfo.image'></image>
  7. </view>
  8. <view class='text acea-row row-between'>
  9. <view class='name line2'>{{orderInfo.store_name}}</view>
  10. <view class='money'>
  11. <view>{{orderInfo.total_price}}{{$t(`积分`)}}</view>
  12. <view>x{{orderInfo.total_num}}</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'>{{$t(`物流公司`)}}:</text> {{orderInfo.delivery_name}}</view>
  22. <view class='express line1'><text class='name'>{{$t(`快递单号`)}}:</text> {{orderInfo.delivery_id}}</view>
  23. </view>
  24. </view>
  25. <!-- #ifndef H5 -->
  26. <view class='copy' @tap='copyOrderId'>{{$t(`复制单号`)}}</view>
  27. <!-- #endif -->
  28. <!-- #ifdef H5 -->
  29. <view class='copy copy-data' :data-clipboard-text="orderInfo.delivery_id">{{$t(`复制单号`)}}</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 :hostProduct='hostProduct'></recommend>
  41. </view>
  42. <!-- #ifdef MP -->
  43. <!-- <authorize :isAuto="isAuto" :isShowAuth="isShowAuth" @authColse="authColse"></authorize> -->
  44. <!-- #endif -->
  45. </view>
  46. </template>
  47. <script>
  48. import {
  49. getProductHot
  50. } from '@/api/store.js';
  51. import {
  52. getLogisticsDetails
  53. } from '@/api/activity.js'
  54. import ClipboardJS from "@/plugin/clipboard/clipboard.js";
  55. import {
  56. toLogin
  57. } from '@/libs/login.js';
  58. import {
  59. mapGetters
  60. } from "vuex";
  61. import recommend from '@/components/recommend';
  62. // #ifdef MP
  63. import authorize from '@/components/Authorize';
  64. // #endif
  65. import colors from '@/mixins/color.js';
  66. export default {
  67. components: {
  68. recommend,
  69. // #ifdef MP
  70. authorize
  71. // #endif
  72. },
  73. mixins:[colors],
  74. data() {
  75. return {
  76. orderId: '',
  77. product: {
  78. productInfo: {}
  79. },
  80. orderInfo: {},
  81. expressList: [],
  82. hostProduct: []
  83. };
  84. },
  85. computed: mapGetters(['isLogin']),
  86. watch: {
  87. isLogin: {
  88. handler: function(newV, oldV) {
  89. if (newV) {
  90. this.getExpress();
  91. this.get_host_product();
  92. }
  93. },
  94. deep: true
  95. }
  96. },
  97. onLoad: function(options) {
  98. if (!options.order_id) return this.$util.Tips({
  99. title: this.$t(`缺少订单号`)
  100. });
  101. this.orderId = options.order_id;
  102. if (this.isLogin) {
  103. this.getExpress();
  104. this.get_host_product();
  105. } else {
  106. toLogin();
  107. }
  108. },
  109. onReady: function() {
  110. // #ifdef H5
  111. this.$nextTick(function() {
  112. const clipboard = new ClipboardJS(".copy-data");
  113. clipboard.on("success", () => {
  114. this.$util.Tips({
  115. title: this.$t(`复制成功`)
  116. });
  117. });
  118. });
  119. // #endif
  120. },
  121. methods: {
  122. /**
  123. * 授权回调
  124. */
  125. onLoadFun: function() {
  126. this.getExpress();
  127. this.get_host_product();
  128. },
  129. copyOrderId: function() {
  130. uni.setClipboardData({
  131. data: this.orderInfo.delivery_id
  132. });
  133. },
  134. getExpress: function() {
  135. let that = this;
  136. getLogisticsDetails(that.orderId).then(function(res) {
  137. let result = res.data.express.result || {};
  138. // that.$set(that, 'product', res.data.order.cartInfo[0] || {});
  139. that.$set(that, 'orderInfo', res.data.order);
  140. that.$set(that, 'expressList', result.list || []);
  141. }).catch((error) => {
  142. this.$util.Tips({
  143. title: error
  144. });
  145. });
  146. },
  147. /**
  148. * 获取我的推荐
  149. */
  150. get_host_product: function() {
  151. let that = this;
  152. getProductHot().then(function(res) {
  153. that.$set(that, 'hostProduct', res.data);
  154. });
  155. },
  156. }
  157. }
  158. </script>
  159. <style scoped lang="scss">
  160. .logistics .header {
  161. padding: 23rpx 30rpx;
  162. background-color: #fff;
  163. height: 166rpx;
  164. box-sizing: border-box;
  165. }
  166. .logistics .header .pictrue {
  167. width: 120rpx;
  168. height: 120rpx;
  169. }
  170. .logistics .header .pictrue image {
  171. width: 100%;
  172. height: 100%;
  173. border-radius: 6rpx;
  174. }
  175. .logistics .header .text {
  176. width: 540rpx;
  177. font-size: 28rpx;
  178. color: #999;
  179. margin-top: 6rpx;
  180. }
  181. .logistics .header .text .name {
  182. width: 365rpx;
  183. color: #282828;
  184. }
  185. .logistics .header .text .money {
  186. text-align: right;
  187. }
  188. .logistics .logisticsCon {
  189. background-color: #fff;
  190. margin: 12rpx 0;
  191. }
  192. .logistics .logisticsCon .company {
  193. height: 120rpx;
  194. margin: 0 0 45rpx 30rpx;
  195. padding-right: 30rpx;
  196. border-bottom: 1rpx solid #f5f5f5;
  197. }
  198. .logistics .logisticsCon .company .picTxt {
  199. width: 520rpx;
  200. }
  201. .logistics .logisticsCon .company .picTxt .iconfont {
  202. width: 50rpx;
  203. height: 50rpx;
  204. background-color: #666;
  205. text-align: center;
  206. line-height: 50rpx;
  207. color: #fff;
  208. font-size: 35rpx;
  209. }
  210. .logistics .logisticsCon .company .picTxt .text {
  211. width: 450rpx;
  212. font-size: 26rpx;
  213. color: #282828;
  214. }
  215. .logistics .logisticsCon .company .picTxt .text .name {
  216. color: #999;
  217. }
  218. .logistics .logisticsCon .company .picTxt .text .express {
  219. margin-top: 5rpx;
  220. }
  221. .logistics .logisticsCon .company .copy {
  222. font-size: 20rpx;
  223. width: 106rpx;
  224. text-align: center;
  225. border-radius: 3rpx;
  226. border: 1px solid #999;
  227. padding: 3rpx 0;
  228. }
  229. .logistics .logisticsCon .item {
  230. padding: 0 40rpx;
  231. position: relative;
  232. }
  233. .logistics .logisticsCon .item .circular {
  234. width: 20rpx;
  235. height: 20rpx;
  236. border-radius: 50%;
  237. position: absolute;
  238. top: -1rpx;
  239. left: 31.5rpx;
  240. background-color: #ddd;
  241. }
  242. .logistics .logisticsCon .item .circular.on {
  243. background-color: var(--view-theme);
  244. }
  245. .logistics .logisticsCon .item .text.on-font {
  246. color: var(--view-theme);
  247. }
  248. .logistics .logisticsCon .item .text .data.on-font {
  249. color: var(--view-theme);
  250. }
  251. .logistics .logisticsCon .item .text {
  252. font-size: 26rpx;
  253. color: #666;
  254. width: 615rpx;
  255. border-left: 1rpx solid #e6e6e6;
  256. padding: 0 0 60rpx 38rpx;
  257. }
  258. .logistics .logisticsCon .item .text.on {
  259. border-left-color: var(--view-minorColor);
  260. }
  261. .logistics .logisticsCon .item .text .data {
  262. font-size: 24rpx;
  263. color: #999;
  264. margin-top: 10rpx;
  265. }
  266. .logistics .logisticsCon .item .text .data .time {
  267. margin-left: 15rpx;
  268. }
  269. </style>