index.vue 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189
  1. <template>
  2. <view class="container" :style="{height: winHeight + 'px'}">
  3. <!-- 状态栏高度 -->
  4. <view :style="{ height: `${statusBarHeight}px`, width: '100%', backgroundColor: '#FF6702' }"></view>
  5. <!-- 导航栏 -->
  6. <view :style="{ height: `${navigationBarHeight}rpx`,lineHeight: `${navigationBarHeight}rpx`}" class="order-nav">
  7. <!-- <view class="back-button" @tap="handBack()"></view> -->
  8. {{activeRole == '0' ? '接单' : '我的' }}
  9. </view>
  10. <!-- <view class="content-dom"> -->
  11. <view v-if="activeRole == '0'">
  12. <rider-shipping></rider-shipping>
  13. </view>
  14. <view v-if="activeRole == '1'">
  15. <rider-me></rider-me>
  16. </view>
  17. <!-- </view> -->
  18. <!-- 底部导航 -->
  19. <view class="page-footer">
  20. <view class="foot-item" :class="item.pagePath == activeRouter?'active':''" v-for="(item,index) in footerList" :key="index"
  21. @click="goRouter(item)">
  22. <block v-if="item.pagePath == activeRouter">
  23. <image :src="item.selectedIconPath"></image>
  24. <view class="txt">{{item.text}}</view>
  25. </block>
  26. <block v-else>
  27. <image :src="item.iconPath"></image>
  28. <view class="txt">{{item.text}}</view>
  29. </block>
  30. </view>
  31. </view>
  32. </view>
  33. </template>
  34. <script>
  35. import riderOrder from "@/components/riderOrder/index.vue";
  36. import riderShipping from "./components/rider_shipping/index.vue";
  37. import riderMe from "./components/rider_me/index.vue";
  38. var statusBarHeight = uni.getSystemInfoSync().statusBarHeight + 'px';
  39. let app = getApp();
  40. export default {
  41. components: {
  42. riderOrder,
  43. riderShipping,
  44. riderMe
  45. },
  46. data() {
  47. return {
  48. winHeight: 0,
  49. activeRouter: '/pages/rider/rider_shipping/index',
  50. activeRole: '0',
  51. footerList: [{
  52. pagePath: "/pages/rider/rider_shipping/index",
  53. iconPath: require("./static/ddh.png"),
  54. selectedIconPath: require("./static/ddl.png"),
  55. text: "订单",
  56. role: '0'
  57. },
  58. {
  59. pagePath: "/pages/rider/rider_me/index",
  60. iconPath: require("./static/wdh.png"),
  61. selectedIconPath: require("./static/wdl.png"),
  62. text: "我的",
  63. role: '1'
  64. }
  65. ],
  66. statusBarHeight: app.globalData.statusBarHeight,
  67. navigationBarHeight: 112,
  68. riderData: [], // 订单数组
  69. loading: false, //是否加载中
  70. loadend: false, //是否加载完毕
  71. loadTitle: '加载更多', //提示语
  72. page: 1,
  73. limit: 20
  74. }
  75. },
  76. methods: {
  77. goRouter(item) {
  78. if (this.activeRouter == item.pagePath) return
  79. this.activeRouter = item.pagePath
  80. this.activeRole = item.role
  81. // uni.redirectTo({
  82. // url: item.pagePath,
  83. // animationType: 'none' // 关闭默认的滑动效果
  84. // });
  85. },
  86. onRiderClick(id) {
  87. if (id === 3) {
  88. uni.switchTab({
  89. url: '/pages/user/index'
  90. });
  91. }
  92. },
  93. },
  94. onLoad(options) {
  95. let that = this
  96. // 隐藏TabBar
  97. uni.hideTabBar({});
  98. uni.getSystemInfo({
  99. success: function(res) {
  100. that.winHeight = res.windowHeight
  101. },
  102. });
  103. this.getRiderDataList()
  104. },
  105. mounted() {
  106. },
  107. }
  108. </script>
  109. <style scoped lang="scss">
  110. .container {
  111. display: flex;
  112. align-items: center;
  113. flex-direction: column;
  114. justify-content: space-between;
  115. overflow: hidden;
  116. position: relative;
  117. }
  118. .content-dom {
  119. width: 100%;
  120. flex: 1;
  121. }
  122. .order-nav {
  123. width: 100%;
  124. font-weight: 500;
  125. font-size: 35rpx;
  126. margin-top: -2rpx;
  127. color: #FFFFFF;
  128. position: relative;
  129. background-color: #FF6702;
  130. display: flex;
  131. align-items: center;
  132. justify-content: center;
  133. .back-button {
  134. position: absolute;
  135. left: 20rpx;
  136. }
  137. }
  138. .page-footer {
  139. // position: fixed;
  140. // bottom: 0;
  141. // z-index: 9;
  142. display: flex;
  143. align-items: center;
  144. justify-content: space-around;
  145. width: 100%;
  146. height: calc(100rpx+ constant(safe-area-inset-bottom)); ///兼容 IOS<11.2/
  147. height: calc(100rpx + env(safe-area-inset-bottom)); ///兼容 IOS>11.2/
  148. box-sizing: border-box;
  149. border-top: solid 1rpx #F3F3F3;
  150. background-color: #fff;
  151. // box-shadow: 0px 0px 17rpx 1rpx rgba(206, 206, 206, 0.32);
  152. padding-bottom: constant(safe-area-inset-bottom); ///兼容 IOS<11.2/
  153. padding-bottom: env(safe-area-inset-bottom); ///兼容 IOS>11.2/
  154. .foot-item {
  155. display: flex;
  156. width: max-content;
  157. align-items: center;
  158. justify-content: center;
  159. flex-direction: column;
  160. position: relative;
  161. padding: 0 20rpx;
  162. margin-top: 18rpx;
  163. &.active {
  164. color: $bg-color-primary
  165. }
  166. }
  167. .foot-item image {
  168. height: 50rpx;
  169. width: 50rpx;
  170. text-align: center;
  171. margin: 0 auto;
  172. }
  173. .foot-item .txt {
  174. font-size: 27rpx;
  175. margin-top: 8rpx;
  176. }
  177. }
  178. </style>