index.vue 6.4 KB

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