index.vue 6.7 KB

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