index.vue 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300
  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.productImg'></image>
  7. </view>
  8. <view class='text acea-row row-between'>
  9. <view class='name line2'>{{product.productName}}</view>
  10. <view class='money'>
  11. <view>¥{{product.price}}</view>
  12. <view>x{{product.payNum}}</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.deliveryName}}</view>
  22. <view class='express line1'><text class='name'>快递单号:</text> {{orderInfo.deliveryId}}</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.deliveryId">复制单号</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' v-if="hostProduct.length"></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. loading: false,
  82. goodScroll: true,
  83. params: { //精品推荐分页
  84. page: 1,
  85. limit: 10,
  86. },
  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({title:'缺少订单号'});
  103. this.orderId = options.orderId;
  104. if (this.isLogin) {
  105. this.getExpress();
  106. this.get_host_product();
  107. } else {
  108. toLogin();
  109. }
  110. },
  111. onReady: function() {
  112. // #ifdef H5
  113. this.$nextTick(function() {
  114. const clipboard = new ClipboardJS(".copy-data");
  115. clipboard.on("success", () => {
  116. this.$util.Tips({
  117. title: '复制成功'
  118. });
  119. });
  120. });
  121. // #endif
  122. },
  123. methods: {
  124. /**
  125. * 授权回调
  126. */
  127. onLoadFun: function() {
  128. this.getExpress();
  129. this.get_host_product();
  130. },
  131. copyOrderId:function(){
  132. uni.setClipboardData({ data: this.orderInfo.deliveryId });
  133. },
  134. getExpress:function(){
  135. let that=this;
  136. express(that.orderId).then(function(res){
  137. let result = res.data.express|| {};
  138. that.$set(that,'product',res.data.order.info[0] || {});
  139. that.$set(that,'orderInfo',res.data.order);
  140. that.$set(that,'expressList',result.list || []);
  141. });
  142. },
  143. get_host_product: function () {
  144. this.loading = true
  145. if (!this.goodScroll) return
  146. let that = this;
  147. getProductHot(that.params.page,that.params.limit).then(function (res) {
  148. //this.iSshowH = false
  149. that.loading = false
  150. that.goodScroll = res.data.list.length >= that.params.limit
  151. that.params.page++
  152. that.hostProduct = that.hostProduct.concat(res.data.list)
  153. });
  154. },
  155. },
  156. // 滚动到底部
  157. onReachBottom() {
  158. if (this.params.page != 1) {
  159. this.get_host_product();
  160. }
  161. },
  162. }
  163. </script>
  164. <style scoped lang="scss">
  165. .logistics .header {
  166. padding: 23rpx 30rpx;
  167. background-color: #fff;
  168. height: 166rpx;
  169. box-sizing: border-box;
  170. }
  171. .logistics .header .pictrue {
  172. width: 120rpx;
  173. height: 120rpx;
  174. }
  175. .logistics .header .pictrue image {
  176. width: 100%;
  177. height: 100%;
  178. border-radius: 6rpx;
  179. }
  180. .logistics .header .text {
  181. width: 540rpx;
  182. font-size: 28rpx;
  183. color: #999;
  184. margin-top: 6rpx;
  185. }
  186. .logistics .header .text .name {
  187. width: 365rpx;
  188. color: #282828;
  189. }
  190. .logistics .header .text .money {
  191. text-align: right;
  192. }
  193. .logistics .logisticsCon {
  194. background-color: #fff;
  195. margin: 12rpx 0;
  196. }
  197. .logistics .logisticsCon .company {
  198. height: 120rpx;
  199. margin: 0 0 45rpx 30rpx;
  200. padding-right: 30rpx;
  201. border-bottom: 1rpx solid #f5f5f5;
  202. }
  203. .logistics .logisticsCon .company .picTxt {
  204. width: 520rpx;
  205. }
  206. .logistics .logisticsCon .company .picTxt .iconfont {
  207. width: 50rpx;
  208. height: 50rpx;
  209. background-color: #666;
  210. text-align: center;
  211. line-height: 50rpx;
  212. color: #fff;
  213. font-size: 35rpx;
  214. }
  215. .logistics .logisticsCon .company .picTxt .text {
  216. width: 450rpx;
  217. font-size: 26rpx;
  218. color: #282828;
  219. }
  220. .logistics .logisticsCon .company .picTxt .text .name {
  221. color: #999;
  222. }
  223. .logistics .logisticsCon .company .picTxt .text .express {
  224. margin-top: 5rpx;
  225. }
  226. .logistics .logisticsCon .company .copy {
  227. font-size: 20rpx;
  228. width: 106rpx;
  229. height: 40rpx;
  230. text-align: center;
  231. line-height: 40rpx;
  232. border-radius: 20rpx;
  233. border: 1rpx solid #999;
  234. }
  235. .logistics .logisticsCon .item {
  236. padding: 0 40rpx;
  237. position: relative;
  238. }
  239. .logistics .logisticsCon .item .circular {
  240. width: 20rpx;
  241. height: 20rpx;
  242. border-radius: 50%;
  243. position: absolute;
  244. top: -1rpx;
  245. left: 31.5rpx;
  246. background-color: #ddd;
  247. }
  248. .logistics .logisticsCon .item .circular.on {
  249. background-color: $theme-color;
  250. }
  251. .logistics .logisticsCon .item .text.on-font {
  252. color: $theme-color;
  253. }
  254. .logistics .logisticsCon .item .text .data.on-font {
  255. color: $theme-color;
  256. }
  257. .logistics .logisticsCon .item .text {
  258. font-size: 26rpx;
  259. color: #666;
  260. width: 615rpx;
  261. border-left: 1rpx solid #e6e6e6;
  262. padding: 0 0 60rpx 38rpx;
  263. }
  264. .logistics .logisticsCon .item .text.on {
  265. border-left-color: #f8c1bd;
  266. }
  267. .logistics .logisticsCon .item .text .data {
  268. font-size: 24rpx;
  269. color: #999;
  270. margin-top: 10rpx;
  271. }
  272. .logistics .logisticsCon .item .text .data .time {
  273. margin-left: 15rpx;
  274. }
  275. </style>