混凝土运输管理微信小程序、替班
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.

167 lines
3.8 KiB

1 week ago
  1. <template>
  2. <view class="content">
  3. <view class="head flex-sb sticky box-shadow-light">
  4. <view class="flex" @click="seacher">
  5. <view class="mr5"><uni-icons type="search" size="18"/></view>
  6. <view v-if="+seacht===0" style="font-size: 28rpx;">筛选</view>
  7. <input v-model="input" :class="{'active':+seacht===1}" maxlength="10"
  8. class="search-input" type="text" confirm-type="search" @confirm="loadPage"/>
  9. </view>
  10. <view class="flex" @click="selectOnline" v-if="status===0" >
  11. <view style="font-size: 28rpx;color: #F40000;font-weight: bolder;">
  12. · 在线
  13. </view>
  14. <uni-icons type="down" size="12" color="#F40000"/>
  15. </view>
  16. <view class="flex" @click="selectOnline" v-if="status===1" >
  17. <view style="font-size: 28rpx;color: #555555;font-weight: bolder;">
  18. · 离线
  19. </view>
  20. <uni-icons type="down" size="12" color="#555555"/>
  21. </view>
  22. </view>
  23. <view class="m20">
  24. <view class="re-empty" v-if="waits.length<1">
  25. <view>暂无数据</view>
  26. </view>
  27. <view v-for="e in waits" class="b-relative item-card mb20">
  28. <view class="m10 flex-sb">
  29. <view class="ellipsis">{{e.address}}</view>
  30. <view class="item-time">{{ $timeUtils.formatTime(e.create_time) }}</view>
  31. </view>
  32. <view>到场时间{{$timeUtils.formatTime2Day(e.in_time)}}</view>
  33. <view>计划数量{{e.mi}}m³/</view>
  34. <view class="item-button" @click="clickDetail(e.id)">去接单</view>
  35. </view>
  36. </view>
  37. </view>
  38. </template>
  39. <script>
  40. export default {
  41. data() {
  42. return {
  43. status: 0,
  44. seacht: 0,
  45. waits: [],
  46. input: ''
  47. }
  48. },
  49. mounted() {
  50. this.seacht = 0
  51. this.loadOnline()
  52. this.loadPage()
  53. },
  54. methods: {
  55. clickDetail(id){ uni.navigateTo({ url: `/pages/user/orderd?id=${id}` }) },
  56. seacher() { this.seacht = 1 },
  57. loadPage(){
  58. this.seacht = 0
  59. uni.showLoading({})
  60. this.$httpGet("/api/order/user", { seo: this.input }, (res) => {
  61. console.log('[/order/user]', res);
  62. uni.hideLoading({})
  63. this.waits = []
  64. if(res.data){
  65. this.waits = this.$utils.toArray(res.data)
  66. }
  67. })
  68. },
  69. loadOnline(){
  70. this.$httpGet("/api/online/get", {}, (res) => {
  71. console.log('[/online/get]', res);
  72. if(res.data){
  73. this.status= +res.data
  74. }
  75. })
  76. },
  77. selectOnline(){
  78. uni.showActionSheet({
  79. itemList: ["在线", "离线"],
  80. success: (res) => {
  81. this.status = res.tapIndex
  82. this.$httpGet("/api/online/set", {online: res.tapIndex}, (res) => {
  83. console.log('[/online/set]', res);
  84. if(res.data || res.data == 0){
  85. // TODO
  86. }
  87. })
  88. uni.showToast({ icon: "loading", title: "正在更改设置" })
  89. setTimeout(() => {
  90. uni.hideToast()
  91. if(res.tapIndex>0){
  92. uni.showToast({ icon: "none", title:"离线状态不可接单" })
  93. } else {
  94. uni.showToast({ icon: "none", title:"您已上线" })
  95. }
  96. }, 1000)
  97. }
  98. })
  99. },
  100. }
  101. }
  102. </script>
  103. <style>
  104. page {
  105. background-color: #f5f5f5;
  106. }
  107. .search-input{
  108. font-size: 28rpx;
  109. margin-top: 10rpx;
  110. border-bottom: 2rpx solid #999;
  111. line-height: 32rpx;
  112. width: 0;
  113. transition: .3s ease-in-out;
  114. }
  115. .active{
  116. width: 70%;
  117. padding-left: 10rpx;
  118. }
  119. .head{
  120. height: 60rpx;
  121. line-height: 60rpx;
  122. padding: 0 40rpx;
  123. background-color: #fff;
  124. }
  125. .item-card{
  126. width: calc(100vw - 60rpx);
  127. height: calc(236rpx - 60rpx);
  128. background: #ffffff;
  129. padding: 30rpx;
  130. font-size: 24rpx;
  131. line-height: 42rpx;
  132. color: #333333;
  133. }
  134. .item-button{
  135. position: absolute;
  136. left: 533rpx;
  137. top: 134.42rpx;
  138. width: 182rpx;
  139. height: 52rpx;
  140. line-height: 52rpx;
  141. border-radius: 8rpx;
  142. opacity: 1;
  143. box-sizing: border-box;
  144. border: 2rpx solid #F70303;
  145. font-size: 28rpx;
  146. font-weight: normal;
  147. text-align: center;
  148. letter-spacing: 0px;
  149. color: #F70303;
  150. }
  151. .item-time{
  152. color: #aaa;
  153. width: 160rpx;
  154. text-align: right;
  155. }
  156. </style>