混凝土运输管理微信小程序、替班
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

278 lines
5.9 KiB

2 weeks ago
  1. <template>
  2. <view class="content">
  3. <!-- 顶部搜索和状态切换 -->
  4. <view class="head flex-sb sticky box-shadow-light">
  5. <view class="flex" @click="showFilter">
  6. <view class="mr5">
  7. <uv-icon v-if="showFilterIcon" name="funnel" size="24" color="#666"></uv-icon>
  8. </view>
  9. <view v-if="showFilterText" style="font-size:28rpx">筛选</view>
  10. <input
  11. :class="['search-input', searchActive && 'active']"
  12. maxlength="10"
  13. type="text"
  14. confirm-type="search"
  15. @confirm="onSearch"
  16. v-model="searchValue"
  17. @input="onInput"
  18. placeholder="搜索订单"
  19. />
  20. </view>
  21. <!-- 在线状态切换 -->
  22. <view v-if="showOnlineStatus" class="flex" @click="switchToOffline">
  23. <view style="font-size:28rpx;color:#F40000;font-weight:bolder"> · 在线 </view>
  24. <uv-icon v-if="showOnlineIcon" name="arrow-down" size="16" color="#F40000"></uv-icon>
  25. </view>
  26. <view v-if="showOfflineStatus" class="flex" @click="switchToOnline">
  27. <view style="font-size:28rpx;color:#555555;font-weight:bolder"> · 离线 </view>
  28. <uv-icon v-if="showOfflineIcon" name="arrow-down" size="16" color="#555"></uv-icon>
  29. </view>
  30. </view>
  31. <!-- 订单列表 -->
  32. <view class="m20">
  33. <view v-if="isEmpty" class="re-empty">
  34. <view>暂无数据</view>
  35. </view>
  36. <view v-for="(item, index) in orderList" :key="index" class="b-relative item-card mb20">
  37. <view class="m10 flex-sb">
  38. <view class="ellipsis">{{ item.title }}</view>
  39. <view class="item-time">{{ item.time }}</view>
  40. </view>
  41. <view>到场时间{{ item.arrivalTime }}</view>
  42. <view>计划数量{{ item.quantity }}m³/</view>
  43. <view class="item-button" @click="grabOrder(item)">去接单</view>
  44. </view>
  45. </view>
  46. </view>
  47. </template>
  48. <script>
  49. import navbar from '@/components/base/navbar.vue'
  50. export default {
  51. name: 'UserHall',
  52. components: {
  53. navbar
  54. },
  55. data() {
  56. return {
  57. showFilterIcon: true,
  58. showFilterText: true,
  59. searchActive: false,
  60. searchValue: '',
  61. showOnlineStatus: true,
  62. showOfflineStatus: false,
  63. showOnlineIcon: true,
  64. showOfflineIcon: true,
  65. isEmpty: false,
  66. orderList: [
  67. {
  68. id: 1,
  69. title: '长沙市雨花区建设项目',
  70. time: '2024-01-15 08:00',
  71. arrivalTime: '2024-01-15 09:00',
  72. quantity: '50'
  73. },
  74. {
  75. id: 2,
  76. title: '长沙市岳麓区商业中心',
  77. time: '2024-01-15 10:00',
  78. arrivalTime: '2024-01-15 11:00',
  79. quantity: '30'
  80. },
  81. {
  82. id: 3,
  83. title: '长沙市开福区住宅项目',
  84. time: '2024-01-15 14:00',
  85. arrivalTime: '2024-01-15 15:00',
  86. quantity: '40'
  87. }
  88. ]
  89. }
  90. },
  91. methods: {
  92. showFilter() {
  93. console.log('显示筛选');
  94. uni.showActionSheet({
  95. itemList: ['全部订单', '泵车订单', '搅拌车订单', '车载泵订单'],
  96. success: (res) => {
  97. const filters = ['全部订单', '泵车订单', '搅拌车订单', '车载泵订单'];
  98. uni.showToast({
  99. title: `已选择:${filters[res.tapIndex]}`,
  100. icon: 'none'
  101. });
  102. }
  103. });
  104. },
  105. onSearch() {
  106. console.log('搜索:', this.searchValue);
  107. uni.showToast({
  108. title: `搜索:${this.searchValue}`,
  109. icon: 'none'
  110. });
  111. },
  112. onInput() {
  113. this.searchActive = this.searchValue.length > 0;
  114. },
  115. switchToOffline() {
  116. this.showOnlineStatus = false;
  117. this.showOfflineStatus = true;
  118. uni.showToast({
  119. title: '已切换到离线状态',
  120. icon: 'none'
  121. });
  122. },
  123. switchToOnline() {
  124. this.showOnlineStatus = true;
  125. this.showOfflineStatus = false;
  126. uni.showToast({
  127. title: '已切换到在线状态',
  128. icon: 'success'
  129. });
  130. },
  131. grabOrder(item) {
  132. uni.showModal({
  133. title: '确认接单',
  134. content: `确定要接取订单:${item.title} 吗?`,
  135. success: (res) => {
  136. if (res.confirm) {
  137. uni.showToast({
  138. title: '接单成功',
  139. icon: 'success'
  140. });
  141. // 跳转到订单详情页
  142. setTimeout(() => {
  143. uni.navigateTo({
  144. url: `/pages_order/order/orderDetail?id=${item.id}`
  145. });
  146. }, 1000);
  147. }
  148. }
  149. });
  150. },
  151. // 供外部调用的方法
  152. loadPage() {
  153. console.log('用户抢单大厅页面刷新');
  154. // 重新加载订单数据
  155. this.loadOrderData();
  156. },
  157. loadOrderData() {
  158. // 模拟加载订单数据
  159. console.log('加载订单数据');
  160. }
  161. }
  162. }
  163. </script>
  164. <style scoped lang="scss">
  165. .content {
  166. padding: 20rpx;
  167. min-height: 100vh;
  168. background-color: #f5f5f5;
  169. }
  170. .head {
  171. background-color: #fff;
  172. padding: 20rpx;
  173. border-radius: 10rpx;
  174. margin-bottom: 20rpx;
  175. }
  176. .sticky {
  177. position: sticky;
  178. top: 0;
  179. z-index: 999;
  180. }
  181. .box-shadow-light {
  182. box-shadow: 0 2rpx 10rpx rgba(0, 0, 0, 0.1);
  183. }
  184. .flex {
  185. display: flex;
  186. align-items: center;
  187. }
  188. .flex-sb {
  189. display: flex;
  190. justify-content: space-between;
  191. align-items: center;
  192. }
  193. .mr5 {
  194. margin-right: 5rpx;
  195. }
  196. .search-input {
  197. flex: 1;
  198. height: 60rpx;
  199. padding: 0 20rpx;
  200. border: 1rpx solid #e0e0e0;
  201. border-radius: 30rpx;
  202. margin-left: 20rpx;
  203. font-size: 28rpx;
  204. &.active {
  205. border-color: #007AFF;
  206. }
  207. }
  208. .m20 {
  209. margin: 20rpx 0;
  210. }
  211. .m10 {
  212. margin: 10rpx 0;
  213. }
  214. .mb20 {
  215. margin-bottom: 20rpx;
  216. }
  217. .b-relative {
  218. position: relative;
  219. }
  220. .item-card {
  221. background-color: #fff;
  222. border-radius: 10rpx;
  223. padding: 30rpx;
  224. box-shadow: 0 2rpx 10rpx rgba(0, 0, 0, 0.1);
  225. font-size: 28rpx;
  226. line-height: 1.6;
  227. }
  228. .ellipsis {
  229. overflow: hidden;
  230. white-space: nowrap;
  231. text-overflow: ellipsis;
  232. flex: 1;
  233. font-weight: bold;
  234. color: #333;
  235. }
  236. .item-time {
  237. font-size: 24rpx;
  238. color: #999;
  239. }
  240. .item-button {
  241. position: absolute;
  242. right: 30rpx;
  243. bottom: 30rpx;
  244. background-color: #ff6b35;
  245. color: #fff;
  246. padding: 15rpx 25rpx;
  247. border-radius: 25rpx;
  248. font-size: 26rpx;
  249. font-weight: bold;
  250. }
  251. .re-empty {
  252. text-align: center;
  253. padding: 100rpx 0;
  254. color: #999;
  255. font-size: 28rpx;
  256. }
  257. </style>