index.vue 4.6 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 style="flex: 1;width: 100%;overflow: hidden;" v-if="activeRole == '0'">
  12. <rider-shipping></rider-shipping>
  13. </view>
  14. <view style="flex: 1;width: 100%;overflow: hidden;" 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. }
  69. },
  70. methods: {
  71. goRouter(item) {
  72. if (this.activeRouter == item.pagePath) return
  73. this.activeRouter = item.pagePath
  74. this.activeRole = item.role
  75. // uni.redirectTo({
  76. // url: item.pagePath,
  77. // animationType: 'none' // 关闭默认的滑动效果
  78. // });
  79. },
  80. getUserInfo() {
  81. this.$store.dispatch('USERINFO').then(res => {
  82. this.userInfo = res;
  83. console.log(this.userInfo)
  84. if(!this.userInfo.isRider){
  85. this.$util.navigateTo("/pages/users/user_rider/index");
  86. this.$util.Tips({
  87. title: "您未注册,请先注册成为骑手"
  88. });
  89. }
  90. });
  91. },
  92. },
  93. onLoad(options) {
  94. let that = this
  95. this.getUserInfo();
  96. // 隐藏TabBar
  97. uni.hideTabBar({});
  98. uni.getSystemInfo({
  99. success: function(res) {
  100. that.winHeight = res.windowHeight
  101. },
  102. });
  103. },
  104. mounted() {
  105. },
  106. }
  107. </script>
  108. <style scoped lang="scss">
  109. .container {
  110. display: flex;
  111. align-items: center;
  112. flex-direction: column;
  113. justify-content: space-between;
  114. overflow: hidden;
  115. position: relative;
  116. }
  117. .content-dom {
  118. width: 100%;
  119. flex: 1;
  120. }
  121. .order-nav {
  122. width: 100%;
  123. font-weight: 500;
  124. font-size: 35rpx;
  125. margin-top: -2rpx;
  126. color: #FFFFFF;
  127. position: relative;
  128. background-color: #FF6702;
  129. display: flex;
  130. align-items: center;
  131. justify-content: center;
  132. .back-button {
  133. position: absolute;
  134. left: 20rpx;
  135. }
  136. }
  137. .page-footer {
  138. // position: fixed;
  139. // bottom: 0;
  140. // z-index: 9;
  141. display: flex;
  142. align-items: center;
  143. justify-content: space-around;
  144. width: 100%;
  145. height: calc(100rpx+ constant(safe-area-inset-bottom)); ///兼容 IOS<11.2/
  146. height: calc(100rpx + env(safe-area-inset-bottom)); ///兼容 IOS>11.2/
  147. box-sizing: border-box;
  148. border-top: solid 1rpx #F3F3F3;
  149. background-color: #fff;
  150. // box-shadow: 0px 0px 17rpx 1rpx rgba(206, 206, 206, 0.32);
  151. padding-bottom: constant(safe-area-inset-bottom); ///兼容 IOS<11.2/
  152. padding-bottom: env(safe-area-inset-bottom); ///兼容 IOS>11.2/
  153. .foot-item {
  154. display: flex;
  155. width: max-content;
  156. align-items: center;
  157. justify-content: center;
  158. flex-direction: column;
  159. position: relative;
  160. padding: 0 20rpx;
  161. margin-top: 18rpx;
  162. &.active {
  163. color: $bg-color-primary
  164. }
  165. }
  166. .foot-item image {
  167. height: 50rpx;
  168. width: 50rpx;
  169. text-align: center;
  170. margin: 0 auto;
  171. }
  172. .foot-item .txt {
  173. font-size: 27rpx;
  174. margin-top: 8rpx;
  175. }
  176. }
  177. </style>