index.vue 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297
  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. // 滚动监听
  121. onPageScroll(e) {
  122. // 传入scrollTop值并触发所有easy-loadimage组件下的滚动监听事件
  123. uni.$emit('scroll');
  124. },
  125. methods: {
  126. /**
  127. * 授权回调
  128. */
  129. onLoadFun: function() {
  130. this.getExpress();
  131. this.get_host_product();
  132. },
  133. copyOrderId: function() {
  134. uni.setClipboardData({
  135. data: this.orderInfo.delivery_id
  136. });
  137. },
  138. getExpress: function() {
  139. let that = this;
  140. express(that.orderId,that.type).then(function(res) {
  141. let result = res.data.express.result || {};
  142. that.$set(that, 'product', res.data.order.cartInfo || []);
  143. that.$set(that, 'orderInfo', res.data.order);
  144. that.$set(that, 'expressList', result.list || []);
  145. }).catch((error) => {
  146. this.$util.Tips({
  147. title: error
  148. });
  149. });
  150. },
  151. /**
  152. * 获取我的推荐
  153. */
  154. get_host_product: function() {
  155. let that = this;
  156. getProductHot().then(function(res) {
  157. that.$set(that, 'hostProduct', res.data);
  158. });
  159. },
  160. }
  161. }
  162. </script>
  163. <style scoped lang="scss">
  164. .logistics .header {
  165. padding: 23rpx 30rpx;
  166. background-color: #fff;
  167. height: 166rpx;
  168. box-sizing: border-box;
  169. }
  170. .logistics .header .pictrue {
  171. width: 120rpx;
  172. height: 120rpx;
  173. }
  174. .logistics .header .pictrue image {
  175. width: 100%;
  176. height: 100%;
  177. border-radius: 6rpx;
  178. }
  179. .logistics .header .text {
  180. width: 540rpx;
  181. font-size: 28rpx;
  182. color: #999;
  183. margin-top: 6rpx;
  184. }
  185. .logistics .header .text .name {
  186. width: 365rpx;
  187. color: #282828;
  188. }
  189. .logistics .header .text .money {
  190. text-align: right;
  191. }
  192. .logistics .logisticsCon {
  193. background-color: #fff;
  194. margin: 12rpx 0;
  195. }
  196. .logistics .logisticsCon .company {
  197. height: 120rpx;
  198. margin: 0 0 45rpx 30rpx;
  199. padding-right: 30rpx;
  200. border-bottom: 1rpx solid #f5f5f5;
  201. }
  202. .logistics .logisticsCon .company .picTxt {
  203. width: 520rpx;
  204. }
  205. .logistics .logisticsCon .company .picTxt .iconfont {
  206. width: 50rpx;
  207. height: 50rpx;
  208. background-color: #666;
  209. text-align: center;
  210. line-height: 50rpx;
  211. color: #fff;
  212. font-size: 35rpx;
  213. }
  214. .logistics .logisticsCon .company .picTxt .text {
  215. width: 450rpx;
  216. font-size: 26rpx;
  217. color: #282828;
  218. }
  219. .logistics .logisticsCon .company .picTxt .text .name {
  220. color: #999;
  221. }
  222. .logistics .logisticsCon .company .picTxt .text .express {
  223. margin-top: 5rpx;
  224. }
  225. .logistics .logisticsCon .company .copy {
  226. font-size: 20rpx;
  227. width: 106rpx;
  228. text-align: center;
  229. border-radius: 3rpx;
  230. border: 1px solid #999;
  231. padding: 3rpx 0;
  232. }
  233. .logistics .logisticsCon .item {
  234. padding: 0 40rpx;
  235. position: relative;
  236. }
  237. .logistics .logisticsCon .item .circular {
  238. width: 20rpx;
  239. height: 20rpx;
  240. border-radius: 50%;
  241. position: absolute;
  242. top: -1rpx;
  243. left: 31.5rpx;
  244. background-color: #ddd;
  245. }
  246. .logistics .logisticsCon .item .circular.on {
  247. background-color: var(--view-theme);
  248. }
  249. .logistics .logisticsCon .item .text.on-font {
  250. color: var(--view-theme);
  251. }
  252. .logistics .logisticsCon .item .text .data.on-font {
  253. color: var(--view-theme);
  254. }
  255. .logistics .logisticsCon .item .text {
  256. font-size: 26rpx;
  257. color: #666;
  258. width: 615rpx;
  259. border-left: 1rpx solid #e6e6e6;
  260. padding: 0 0 60rpx 38rpx;
  261. }
  262. .logistics .logisticsCon .item .text.on {
  263. border-left-color: var(--view-minorColor);
  264. }
  265. .logistics .logisticsCon .item .text .data {
  266. font-size: 24rpx;
  267. color: #999;
  268. margin-top: 10rpx;
  269. }
  270. .logistics .logisticsCon .item .text .data .time {
  271. margin-left: 15rpx;
  272. }
  273. </style>