index.vue 9.3 KB

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