index.vue 6.3 KB

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