index.vue 6.3 KB

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