index.vue 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284
  1. <template>
  2. <view class="flex-col" :style="{height: winHeight + 'px'}">
  3. <!-- #ifdef MP -->
  4. <view class="cart_nav">
  5. <nav-bar iconColor='#fff' ref="navBarRef" navTitle="代取快递" backgroundColor="#FF6702" :isBackgroundColor="false">
  6. </nav-bar>
  7. </view>
  8. <!-- #endif -->
  9. <view class='newsList tui-skeleton flex-col' style="background-color: #fff;flex: 1;">
  10. <view class='nav'>
  11. <scroll-view class="scroll-view_x" scroll-x scroll-with-animation :scroll-left="scrollLeft" style="width:auto;overflow:hidden;">
  12. <block v-for="(item,index) in navList" :key="index">
  13. <view class='item borRadius14 tui-skeleton-rect' :class='active==item.id?"on":""' @click='tabSelect(item.id, index)'>
  14. <view class="line1">{{item.name}}</view>
  15. <view class='line bg_color' v-if="active==item.id"></view>
  16. </view>
  17. </block>
  18. </scroll-view>
  19. </view>
  20. <view class='list' style="flex: 1;">
  21. <template v-if="active == 1">
  22. <take-fast-mail ref="takeFastMailRef" :addressObj="addressItem"></take-fast-mail>
  23. </template>
  24. <template v-if="active == 2">
  25. <send-fast-mail></send-fast-mail>
  26. </template>
  27. </view>
  28. <!-- 购物车栏 begin -->
  29. <view class="cart-box">
  30. <view class="mark-box">
  31. <view class="mark">应付 ¥ <text style="font-size: 31rpx;">8.00</text></view>
  32. <view class="tips">普通用户 | 查看明细 》</view>
  33. </view>
  34. <button type="primary" class="pay-btn" @tap="toPay">
  35. 提交订单
  36. </button>
  37. </view>
  38. </view>
  39. <fast-mail-order v-if="isOrder" @onCancel="onCanCel"></fast-mail-order>
  40. </view>
  41. </template>
  42. <script>
  43. // +----------------------------------------------------------------------
  44. // | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
  45. // +----------------------------------------------------------------------
  46. // | Copyright (c) 2016~2025 https://www.crmeb.com All rights reserved.
  47. // +----------------------------------------------------------------------
  48. // | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
  49. // +----------------------------------------------------------------------
  50. // | Author: CRMEB Team <admin@crmeb.com>
  51. // +----------------------------------------------------------------------
  52. import navBar from '@/components/navBar';
  53. import animationType from '@/utils/animationType.js'
  54. import tuiSkeleton from '@/components/base/tui-skeleton.vue';
  55. import sendFastMail from '../components/send_fast_mail/index.vue'
  56. import takeFastMail from '../components/take_fast_mail/index.vue'
  57. import fastMailOrder from '../components/fast_mail_order/index.vue'
  58. import {
  59. getAddressList
  60. } from '@/api/user.js';
  61. let app = getApp();
  62. export default {
  63. components: {
  64. tuiSkeleton,
  65. navBar,
  66. sendFastMail,
  67. takeFastMail,
  68. fastMailOrder
  69. },
  70. data() {
  71. return {
  72. isOrder: false,
  73. winHeight: 0,
  74. isNodes: 0, //控制什么时候开始抓取元素节点,只要数值改变就重新抓取
  75. autoplay: true,
  76. navList: [{
  77. id: 1,
  78. name: '取快递'
  79. }, {
  80. id: 2,
  81. name: '寄快递'
  82. }],
  83. active: 1,
  84. scrollLeft: 0,
  85. addressItem: {}
  86. };
  87. },
  88. onLoad() {
  89. let that = this;
  90. uni.getSystemInfo({
  91. success: function(res) {
  92. that.winHeight = res.windowHeight
  93. },
  94. });
  95. this.getaddressInfo()
  96. },
  97. /**
  98. * 生命周期函数--监听页面显示
  99. */
  100. onShow: function() {
  101. let that = this;
  102. uni.$on('addressItem', function(res) {
  103. that.$set(that, 'addressItem', res);
  104. })
  105. },
  106. methods: {
  107. tabSelect(active, e) {
  108. this.active = active;
  109. this.scrollLeft = e * 60;
  110. },
  111. /*
  112. * 获取默认收货地址或者获取某条地址信息
  113. */
  114. getaddressInfo: function() {
  115. getAddressList().then(res => {
  116. console.log('地址', res)
  117. if (res.code = 200) {
  118. if (res.data.length !== 0) {
  119. this.addressItem = res.data.find(item => item.isDefault === true) || {} // this.addressItem = res.data[0];
  120. } else {
  121. this.addressItem = {}
  122. }
  123. console.log('默认地址', this.addressItem)
  124. }
  125. })
  126. },
  127. toPay() {
  128. this.isOrder = true
  129. console.log(this.$refs.takeFastMailRef, 'refffffffffffffffffffffffff')
  130. },
  131. onCanCel(val) {
  132. this.isOrder = val
  133. },
  134. }
  135. }
  136. </script>
  137. <style lang="scss">
  138. .courie {
  139. padding: 14rpx 24rpx 0 24rpx;
  140. font-weight: 500;
  141. font-size: 23rpx;
  142. color: $bg-color-primary;
  143. background-color: #fff;
  144. image {
  145. width: 46rpx;
  146. height: 46rpx;
  147. margin-right: 15rpx;
  148. }
  149. }
  150. .newsList .swiper {
  151. width: 100%;
  152. position: relative;
  153. box-sizing: border-box;
  154. padding: 0 30rpx;
  155. }
  156. .newsList .swiper swiper {
  157. width: 100%;
  158. height: 365rpx;
  159. position: relative;
  160. }
  161. .newsList .swiper .slide-image {
  162. width: 100%;
  163. height: 335rpx;
  164. border-radius: 14rpx;
  165. }
  166. // #ifdef MP-WEIXIN
  167. .newsList .swiper .wx-swiper-dot {
  168. width: 12rpx !important;
  169. height: 12rpx !important;
  170. border-radius: 0;
  171. transform: rotate(-45deg);
  172. transform-origin: 0 100%;
  173. }
  174. .newsList .swiper .wx-swiper-dot~.wx-swiper-dot {
  175. margin-left: 5rpx;
  176. }
  177. .newsList .swiper .wx-swiper-dots.wx-swiper-dots-horizontal {
  178. margin-bottom: -15rpx;
  179. }
  180. // #endif
  181. // #ifdef APP-PLUS || H5
  182. .newsList .swiper .uni-swiper-dot {
  183. width: 12rpx !important;
  184. height: 12rpx !important;
  185. border-radius: 0;
  186. transform: rotate(-45deg);
  187. transform-origin: 0 100%;
  188. }
  189. .newsList .swiper .uni-swiper-dot~.uni-swiper-dot {
  190. margin-left: 5rpx;
  191. }
  192. .newsList .swiper .uni-swiper-dots.uni-swiper-dots-horizontal {
  193. margin-bottom: -15rpx;
  194. }
  195. // #endif
  196. .newsList .nav {
  197. padding: 0 24rpx;
  198. width: 100%;
  199. white-space: nowrap;
  200. box-sizing: border-box;
  201. padding-top: 43rpx;
  202. border-top-right-radius: 23rpx;
  203. }
  204. .newsList .nav .item {
  205. // max-width: 156rpx;
  206. display: inline-block;
  207. font-size: 32rpx;
  208. color: #999;
  209. }
  210. .newsList .nav .item.on {
  211. color: #282828;
  212. }
  213. .newsList .nav .item~.item {
  214. margin-left: 46rpx;
  215. }
  216. .newsList .nav .item .line {
  217. // width: 24rpx;
  218. height: 10rpx;
  219. border-radius: 6rpx;
  220. margin: 10rpx auto 0 auto;
  221. background-color: $bg-color-primary;
  222. }
  223. .newsList .nav .item .line1 {
  224. color: $bg-color-primary;
  225. }
  226. .cart-box {
  227. height: 96rpx;
  228. border-radius: 48rpx;
  229. box-shadow: 0 0 20rpx rgba(0, 0, 0, 0.2);
  230. background-color: #000;
  231. display: flex;
  232. align-items: center;
  233. justify-content: space-between;
  234. z-index: 9999;
  235. .pay-btn {
  236. height: 100%;
  237. padding: 0 30rpx;
  238. color: #FFFFFF;
  239. border-radius: 0 50rpx 50rpx 0;
  240. display: flex;
  241. align-items: center;
  242. font-size: $font-size-base;
  243. background-color: $bg-color-primary;
  244. }
  245. .mark-box {
  246. padding-left: 46rpx;
  247. margin-right: 30rpx;
  248. position: relative;
  249. .mark {
  250. font-weight: 500;
  251. font-size: 23rpx;
  252. color: #FFFFFF;
  253. }
  254. .tips {
  255. font-weight: 500;
  256. font-size: 27rpx;
  257. color: #999999;
  258. }
  259. }
  260. }
  261. </style>