index.vue 9.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402
  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'" style="width: 100%;height: 100%;display: flex;flex-direction: column;overflow: hidden;">
  12. <view class="dom-top">
  13. <view class="dom-item" v-for="(item, index) in domTopData" :key="index" @tap="statusClick(item.id)">
  14. <text :class="item.id === riderStatus ? 'active-dom-top' : ''">{{item.name}}</text>
  15. </view>
  16. </view>
  17. <scroll-view scroll-y style="overflow: hidden;">
  18. <view v-for="item in riderData" :key="item.id" style="margin: 10rpx 0;">
  19. <rider-order :orderInfo="item" @orderCilck="goOrderClick"></rider-order>
  20. </view>
  21. </scroll-view>
  22. </view>
  23. <view v-if="activeRole == '1'" style="position: relative;flex: 1;width: 100%;">
  24. <view class="item-me-bg"></view>
  25. <view class="item-me">
  26. <view class="item-row">
  27. <view>
  28. <view class="row-je">2031.7</view>
  29. <view class="row-jf">累计小费</view>
  30. </view>
  31. <view style="width: 2rpx;height: 96rpx;border: 2rpx solid #D6D7DC;margin: 0 80rpx"></view>
  32. <view>
  33. <view class="row-je">68</view>
  34. <view class="row-jf">跑腿订单</view>
  35. </view>
  36. </view>
  37. <view class="item-column">
  38. <view v-for="(item, index) in riderInfo" :key="index" class="column-box" :style="{paddingTop: index !== 0 ? '27rpx' : ''}"
  39. @tap="onRiderClick(item.id)">
  40. <view class="column-name">
  41. <image :src="item.img"></image>{{item.name}}
  42. </view>
  43. <view class='iconfont icon-jiantou ' style="font-size: 30rpx;"></view>
  44. </view>
  45. </view>
  46. </view>
  47. </view>
  48. <!-- </view> -->
  49. <!-- 底部导航 -->
  50. <view class="page-footer">
  51. <view class="foot-item" :class="item.pagePath == activeRouter?'active':''" v-for="(item,index) in footerList" :key="index"
  52. @click="goRouter(item)">
  53. <block v-if="item.pagePath == activeRouter">
  54. <image :src="item.selectedIconPath"></image>
  55. <view class="txt">{{item.text}}</view>
  56. </block>
  57. <block v-else>
  58. <image :src="item.iconPath"></image>
  59. <view class="txt">{{item.text}}</view>
  60. </block>
  61. </view>
  62. </view>
  63. </view>
  64. </template>
  65. <script>
  66. import {
  67. registerVerify,
  68. } from '@/api/api.js';
  69. import {
  70. getRiderList
  71. } from '@/api/rider.js';
  72. import {
  73. Debounce
  74. } from '@/utils/validate.js'
  75. import riderOrder from "@/components/riderOrder/index.vue";
  76. var statusBarHeight = uni.getSystemInfoSync().statusBarHeight + 'px';
  77. let app = getApp();
  78. export default {
  79. components: {
  80. riderOrder,
  81. },
  82. data() {
  83. return {
  84. winHeight: 0,
  85. activeRouter: '/pages/rider/rider_shipping/index',
  86. activeRole: '0',
  87. riderStatus: 1,
  88. isReceiveId: null,
  89. domTopData: [{
  90. id: 1,
  91. name: '待接单'
  92. },
  93. {
  94. id: 4,
  95. name: '配送中'
  96. },
  97. {
  98. id: 5,
  99. name: '已完成'
  100. }
  101. ],
  102. riderInfo: [{
  103. id: 1,
  104. name: '跑腿记录',
  105. img: require('./static/run-errands.png'),
  106. pagePath: ''
  107. }, {
  108. id: 2,
  109. name: '提现',
  110. img: require('./static/withdrawal.png'),
  111. pagePath: ''
  112. }, {
  113. id: 3,
  114. name: '返回用户端',
  115. img: require('./static/run-errands.png'),
  116. pagePath: ''
  117. }],
  118. footerList: [{
  119. pagePath: "/pages/rider/rider_shipping/index",
  120. iconPath: require("./static/ddh.png"),
  121. selectedIconPath: require("./static/ddl.png"),
  122. text: "订单",
  123. role: '0'
  124. },
  125. {
  126. pagePath: "/pages/rider/rider_me/index",
  127. iconPath: require("./static/wdh.png"),
  128. selectedIconPath: require("./static/wdl.png"),
  129. text: "我的",
  130. role: '1'
  131. }
  132. ],
  133. statusBarHeight: app.globalData.statusBarHeight,
  134. navigationBarHeight: 112,
  135. riderData: [], // 订单数组
  136. loading: false, //是否加载中
  137. loadend: false, //是否加载完毕
  138. loadTitle: '加载更多', //提示语
  139. page: 1,
  140. limit: 20
  141. }
  142. },
  143. methods: {
  144. goRouter(item) {
  145. if (this.activeRouter == item.pagePath) return
  146. this.activeRouter = item.pagePath
  147. this.activeRole = item.role
  148. // uni.redirectTo({
  149. // url: item.pagePath,
  150. // animationType: 'none' // 关闭默认的滑动效果
  151. // });
  152. },
  153. /**
  154. * 获取订单列表
  155. */
  156. getRiderDataList: function() {
  157. let that = this;
  158. if (that.loadend) return;
  159. if (that.loading) return;
  160. that.loading = true;
  161. that.loadTitle = "加载更多";
  162. getRiderList({
  163. status: that.riderStatus,
  164. page: that.page,
  165. limit: that.limit
  166. }).then(res => {
  167. let list = res.data.list || [];
  168. let loadend = list.length < that.limit;
  169. that.riderData = that.$util.SplitArray(list, that.riderData);
  170. that.$set(that, 'riderData', that.riderData);
  171. that.loadend = loadend;
  172. that.loading = false;
  173. that.loadTitle = loadend ? "我也是有底线的" : '加载更多';
  174. that.page = that.page + 1;
  175. }).catch(err => {
  176. that.loading = false;
  177. that.loadTitle = "加载更多";
  178. })
  179. },
  180. /**
  181. * 切换类型
  182. */
  183. statusClick: function(status) {
  184. if (status == this.riderStatus) return;
  185. this.page = 1;
  186. this.riderStatus = status;
  187. this.loadend = false;
  188. this.getRiderDataList();
  189. },
  190. onRiderClick(id) {
  191. if (id === 3) {
  192. uni.switchTab({
  193. url: '/pages/user/index'
  194. });
  195. }
  196. },
  197. goOrderClick(id) {
  198. this.isReceiveId = id
  199. console.log(id)
  200. }
  201. },
  202. onLoad(options) {
  203. let that = this
  204. // 隐藏TabBar
  205. uni.hideTabBar({});
  206. uni.getSystemInfo({
  207. success: function(res) {
  208. that.winHeight = res.windowHeight
  209. },
  210. });
  211. this.getRiderDataList()
  212. },
  213. mounted() {
  214. },
  215. }
  216. </script>
  217. <style scoped lang="scss">
  218. .container {
  219. display: flex;
  220. align-items: center;
  221. flex-direction: column;
  222. justify-content: space-between;
  223. overflow: hidden;
  224. position: relative;
  225. }
  226. .content-dom {
  227. width: 100%;
  228. flex: 1;
  229. }
  230. .dom-top {
  231. width: 100%;
  232. height: 96rpx;
  233. font-weight: 400;
  234. font-size: 27rpx;
  235. color: #141414;
  236. background-color: #fff;
  237. // padding: 19rpx 115rpx 38rpx 115rpx;
  238. display: flex;
  239. align-items: center;
  240. justify-content: space-between;
  241. .dom-item {
  242. flex: 1;
  243. text-align: center;
  244. height: 96rpx;
  245. display: flex;
  246. align-items: center;
  247. justify-content: center;
  248. }
  249. }
  250. .active-dom-top {
  251. color: $bg-color-primary;
  252. border-bottom: 9rpx solid $bg-color-primary;
  253. border-bottom-top-radius: 6rpx;
  254. border-bottom-bottom-radius: 6rpx;
  255. border-bottom-left-radius: 6rpx;
  256. border-bottom-right-radius: 6rpx;
  257. }
  258. .order-nav {
  259. width: 100%;
  260. font-weight: 500;
  261. font-size: 35rpx;
  262. margin-top: -2rpx;
  263. color: #FFFFFF;
  264. position: relative;
  265. background-color: #FF6702;
  266. display: flex;
  267. align-items: center;
  268. justify-content: center;
  269. .back-button {
  270. position: absolute;
  271. left: 20rpx;
  272. }
  273. }
  274. .page-footer {
  275. // position: fixed;
  276. // bottom: 0;
  277. // z-index: 9;
  278. display: flex;
  279. align-items: center;
  280. justify-content: space-around;
  281. width: 100%;
  282. height: calc(100rpx+ constant(safe-area-inset-bottom)); ///兼容 IOS<11.2/
  283. height: calc(100rpx + env(safe-area-inset-bottom)); ///兼容 IOS>11.2/
  284. box-sizing: border-box;
  285. border-top: solid 1rpx #F3F3F3;
  286. background-color: #fff;
  287. // box-shadow: 0px 0px 17rpx 1rpx rgba(206, 206, 206, 0.32);
  288. padding-bottom: constant(safe-area-inset-bottom); ///兼容 IOS<11.2/
  289. padding-bottom: env(safe-area-inset-bottom); ///兼容 IOS>11.2/
  290. .foot-item {
  291. display: flex;
  292. width: max-content;
  293. align-items: center;
  294. justify-content: center;
  295. flex-direction: column;
  296. position: relative;
  297. padding: 0 20rpx;
  298. margin-top: 18rpx;
  299. &.active {
  300. color: $bg-color-primary
  301. }
  302. }
  303. .foot-item image {
  304. height: 50rpx;
  305. width: 50rpx;
  306. text-align: center;
  307. margin: 0 auto;
  308. }
  309. .foot-item .txt {
  310. font-size: 27rpx;
  311. margin-top: 8rpx;
  312. }
  313. }
  314. .item-me-bg {
  315. position: absolute;
  316. top: 0;
  317. width: 100%;
  318. height: 80rpx;
  319. background-color: $bg-color-primary;
  320. z-index: 1;
  321. }
  322. .item-me {
  323. position: relative;
  324. top: 0;
  325. z-index: 9999;
  326. padding: 0 19rpx;
  327. .item-row {
  328. width: 100%;
  329. height: 304rpx;
  330. text-align: center;
  331. background-color: #fff;
  332. border-radius: 23rpx;
  333. display: flex;
  334. align-items: center;
  335. justify-content: center;
  336. margin-bottom: 20rpx;
  337. .row-je {
  338. font-weight: 500;
  339. font-size: 46rpx;
  340. color: #141414;
  341. }
  342. .row-jf {
  343. font-weight: 400;
  344. font-size: 27rpx;
  345. color: #999999;
  346. }
  347. }
  348. .item-column {
  349. width: 100%;
  350. background-color: #fff;
  351. border-radius: 23rpx;
  352. padding: 20rpx 0 96rpx 39rpx;
  353. display: flex;
  354. flex-direction: column;
  355. align-items: center;
  356. .column-box {
  357. width: 100%;
  358. padding: 0 39rpx 27rpx 0;
  359. border-bottom: 2rpx solid #D6D7DC;
  360. display: flex;
  361. align-items: center;
  362. justify-content: space-between;
  363. }
  364. .column-name {
  365. display: flex;
  366. align-items: center;
  367. font-weight: 500;
  368. font-size: 27rpx;
  369. color: #141414;
  370. image {
  371. width: 38.5rpx;
  372. height: 38.5rpx;
  373. margin-right: 20rpx;
  374. }
  375. }
  376. }
  377. }
  378. </style>