inout-record.vue 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303
  1. <template>
  2. <view>
  3. <view class="box">
  4. <view class="top">
  5. <text class="title">出入记录</text>
  6. </view>
  7. <u-search placeholder="输入车牌号查询" shape="square" v-model="carNo" @search="searchFn"
  8. :height="80" style="margin: 30rpx;">
  9. </u-search>
  10. </view>
  11. <!-- <u-sticky offset-top="0">
  12. <u-tabs :list="tabs" @change="change" :current="current" :is-scroll="false"></u-tabs>
  13. </u-sticky> -->
  14. <view class="card-box">
  15. <view class="card" v-for="(recordItem,index) in recordItemList" :key="index">
  16. <!-- <view class="t">
  17. <image class="icon" src="../../static/home-icon-01.png"></image>
  18. <text class="title">{{recordItem.customerName}}</text>
  19. </view> -->
  20. <view class="c">
  21. <view class="item car-num-item">
  22. <text class="car-num">{{ recordItem.carNo }}</text>
  23. </view>
  24. <!-- <view class="item">
  25. <text class="p1">联系人:</text>
  26. <text class="p2">{{recordItem.driverName}}</text>
  27. </view> -->
  28. <!-- <view class="item">
  29. <text class="p1">联系电话:</text>
  30. <text class="p2">{{recordItem.driverPhone}}</text>
  31. </view> -->
  32. <view class="item">
  33. <text class="p1">入场时间:</text>
  34. <text class="p2">{{ recordItem.realInTime }}</text>
  35. </view>
  36. <view class="item">
  37. <text class="p1">出场时间:</text>
  38. <text class="p2">{{ recordItem.realOutTime }}</text>
  39. </view>
  40. <view class="item">
  41. <text class="p1">状态:</text>
  42. <text class="p2">
  43. <text v-if="recordItem.realInTime==null && recordItem.realOutTime==null">未进场</text>
  44. <text v-if="recordItem.realInTime!=null && recordItem.realOutTime==null">已进场</text>
  45. <text v-if="recordItem.realInTime!=null && recordItem.realOutTime!=null">已出场</text>
  46. </text>
  47. </view>
  48. </view>
  49. </view>
  50. </view>
  51. <!-- 没有数据时显示noData -->
  52. <noData v-if="recordItemList.length==0"></noData>
  53. <u-loadmore style="margin: 30rpx;" :status="status"/>
  54. <!-- <uni-popup ref="shpopup" type="dialog">
  55. <uni-popup-dialog type="success" title="确定审核吗?" :duration="2000" @confirm="shconfirm"></uni-popup-dialog>
  56. </uni-popup> -->
  57. </view>
  58. </template>
  59. <script>
  60. export default {
  61. data() {
  62. return {
  63. carNo: '',
  64. current: 0,
  65. pageNo: 1,
  66. pageSize: 4,
  67. dataCount: 0,
  68. status: 'loadmore',
  69. page: 0,
  70. tabs: [
  71. {
  72. name: '全部',
  73. },
  74. {
  75. name: '未入场',
  76. },
  77. {
  78. name: '已入场',
  79. },
  80. {
  81. name: '已出场',
  82. }
  83. ],
  84. recordItemList: [
  85. {
  86. carNo: '',
  87. driverName: '',
  88. driverPhone: '',
  89. realInTime: '',
  90. realOutTime: '',
  91. },
  92. ],
  93. //recordList: [],
  94. }
  95. },
  96. methods: {
  97. getRecordList() {
  98. this.$api.getInOutRecord({
  99. current: this.current,
  100. pageNo: this.pageNo,
  101. pageSize: this.pageSize,
  102. dataCount: this.dataCount,
  103. }).then(resp => {
  104. this.status = 'loadmore';
  105. let recordList = resp.data;
  106. this.dataCount = resp.dataCount;
  107. this.pageNo = resp.pageNo;
  108. this.recordItemList = recordList;
  109. if (this.dataCount < this.pageSize * this.pageNo) this.status = 'nomore';
  110. })
  111. },
  112. //点击上方切换栏,根据点击项重新加载数据
  113. change(obj) {
  114. let index = obj.index;
  115. this.current = index;
  116. if (index == 0) {
  117. //加载全部
  118. this.getRecordList();
  119. }
  120. if (index == 1) {
  121. //加载未入场
  122. this.getRecordList();
  123. }
  124. if (index == 2) {
  125. //只加载已入场
  126. this.getRecordList();
  127. }
  128. if (index == 3) {
  129. //只加载已出场
  130. this.getRecordList();
  131. }
  132. },
  133. //------------------------------------------
  134. //上拉加载更多,分页模拟数据
  135. onReachBottom() {
  136. this.status = 'loading';
  137. if (this.dataCount > this.pageSize * this.pageNo) {
  138. this.pageSize = parseInt(this.pageSize) + 3;
  139. this.getRecordList();
  140. } else {
  141. this.status = 'nomore';
  142. }
  143. },
  144. searchFn() {
  145. console.log(123);
  146. this.$api.getInOutRecord({
  147. carNo: this.carNo,
  148. current: this.current,
  149. pageNo: this.pageNo,
  150. pageSize: this.pageSize,
  151. dataCount: this.dataCount,
  152. }).then(resp => {
  153. this.status = 'loadmore';
  154. let recordList = resp.data;
  155. this.dataCount = resp.dataCount;
  156. this.pageNo = resp.pageNo;
  157. this.recordItemList = recordList;
  158. if (this.dataCount < this.pageSize * this.pageNo) this.status = 'nomore';
  159. })
  160. }
  161. },
  162. onShow() {
  163. this.getRecordList();
  164. },
  165. }
  166. </script>
  167. <style lang="scss">
  168. .card-box {
  169. display: flex;
  170. width: 100%;
  171. flex-direction: column;
  172. .card {
  173. background-color: #fff;
  174. border-radius: 20rpx;
  175. margin: 20rpx 20rpx 0 20rpx;
  176. padding: 30rpx;
  177. box-sizing: border-box;
  178. display: flex;
  179. flex-direction: column;
  180. .t {
  181. width: 100%;
  182. display: flex;
  183. align-items: center;
  184. padding-bottom: 30rpx;
  185. border-bottom: 1rpx solid #f5f5f5;
  186. .icon {
  187. width: 40rpx;
  188. height: 40rpx;
  189. }
  190. .title {
  191. font-size: 30rpx;
  192. font-weight: bold;
  193. margin-left: 20rpx;
  194. }
  195. }
  196. .c {
  197. padding: 15rpx 0 0 0;
  198. display: flex;
  199. flex-wrap: wrap;
  200. //border-bottom: 1rpx solid #f5f5f5;
  201. .item {
  202. width: 50%;
  203. padding: 20rpx 0;
  204. display: flex;
  205. .car-num {
  206. background-color: #edf6ff;
  207. color: #0080ff;
  208. font-size: 44rpx;
  209. padding: 15rpx 0;
  210. text-align: center;
  211. width: 100%;
  212. border-radius: 10rpx;
  213. font-weight: bold;
  214. letter-spacing: 20rpx;
  215. }
  216. .p1 {
  217. font-size: 28rpx;
  218. color: #999;
  219. flex: 5;
  220. }
  221. .p2 {
  222. font-size: 28rpx;
  223. color: #191919;
  224. font-weight: bold;
  225. margin-left: 20rpx;
  226. flex: 7;
  227. }
  228. }
  229. .car-num-item {
  230. width: 100%;
  231. display: flex;
  232. align-items: center;
  233. justify-content: center;
  234. }
  235. }
  236. .b {
  237. display: flex;
  238. width: 100%;
  239. align-items: center;
  240. justify-content: space-between;
  241. .btn {
  242. height: 70rpx;
  243. display: flex;
  244. align-items: center;
  245. justify-content: center;
  246. //width: calc(50% - 15rpx);
  247. width: 100%;
  248. margin: 30rpx 0 0 0;
  249. border-radius: 10rpx;
  250. border-width: 1rpx;
  251. box-sizing: border-box;
  252. }
  253. .b1 {
  254. background-color: #0080ff;
  255. color: #fff;
  256. }
  257. .b2 {
  258. background-color: #f7f7f7;
  259. color: #191919;
  260. }
  261. .b3 {
  262. background-color: #fff;
  263. color: #0080ff;
  264. border: 1rpx solid #0080ff;
  265. }
  266. }
  267. }
  268. }
  269. .t-btn {
  270. width: 400rpx;
  271. margin: 0 auto 80rpx auto;
  272. height: 88rpx;
  273. font-weight: bold;
  274. display: flex;
  275. align-items: center;
  276. justify-content: center;
  277. border-radius: 10rpx;
  278. color: #191919;
  279. font-size: 28rpx;
  280. background-color: #fff;
  281. border: 1px solid #eee;
  282. }
  283. @import '@/common/common.scss'
  284. </style>