index.vue 6.8 KB

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