house.vue 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191
  1. <template>
  2. <view class="car">
  3. <view class="cartop">
  4. <view class="topa flexc">
  5. <!-- <image :src="reset" class="resetimg" @click="getReset"></image>
  6. <picker mode="date" @change='bindDateChangea'>
  7. <view class="chekt flexc">
  8. <view>{{cxrq|| "选择日期"}}</view>
  9. <image :src="up"></image>
  10. </view>
  11. </picker> -->
  12. <view class="search flexc">
  13. <image :src="search"></image>
  14. <!-- confirm-type="search" @confirm="getConfirm" -->
  15. <input placeholder="请输入车牌号进行搜索" v-model="text"/>
  16. <view class="btn" @click="getConfirm">搜索</view>
  17. </view>
  18. </view>
  19. <view class="tabtop flexc">
  20. <view class="tabt" :class="tabval==ite.val?'act':''" v-for="(ite,idx) in tablist" :key="idx" @click="getTabFn(ite.val)">{{ite.tit}}</view>
  21. </view>
  22. </view>
  23. <!-- 列表 -->
  24. <view class="carlists">
  25. <car-list :datainfo="list" :topval="tabval" :wtdt="wtdt" type='comehouse'></car-list>
  26. </view>
  27. <view class="cdbtns">
  28. <view class="btna" @click="getAddFn">单个添加</view>
  29. <view class="btnb" @click="getReplyFn">一键导入</view>
  30. </view>
  31. <loading></loading>
  32. </view>
  33. </template>
  34. <script>
  35. import config from '@/config'
  36. const baseUrl = config.baseUrl
  37. import carList from "@/work/components/car/list.vue"
  38. import {houseInfoList} from "@/api/work/work.js"
  39. import {getDictionaryFn} from "@/api/system/user.js"
  40. import { checkPermi, checkRole } from "@/utils/permission"; // 权限判断函数
  41. export default{
  42. components:{carList},
  43. data(){
  44. return{
  45. reset:require('@/car/static/car/reset.png'),
  46. search:require('@/car/static/car/search.png'),
  47. up:require('@/car/static/car/up.png'),
  48. cxrq:"",
  49. text:'',
  50. list:[{tit:'皖A IC520',type:1},{tit:'晋E KD783',type:2},],
  51. pageSize: 10,
  52. pageNum: 1,
  53. reachflag: true,
  54. wtdt:'',
  55. tabval:'',
  56. tablist:[{tit:"全部",val:'-1'},],
  57. fwztList:[],
  58. }
  59. },
  60. onUnload() {
  61. uni.$off('refHouseList')
  62. },
  63. onLoad: function() {
  64. uni.$on('refHouseList',(res)=>{
  65. this.getrefreshData()
  66. })
  67. this.int()
  68. this.getDataFn();
  69. },
  70. // 上拉触底加载更多触发事件
  71. onReachBottom() {
  72. if (this.reachflag) {
  73. this.pageNum++
  74. this.getDataFn()
  75. }
  76. },
  77. methods:{
  78. checkPermi, checkRole,
  79. init(){
  80. // 房屋状态
  81. getDictionaryFn('house_status').then(res=>{
  82. if(res.code==200){
  83. this.fwztList = res.data.map(v => {
  84. var obj={
  85. tit: v.dictLabel,
  86. val: v.dictValue
  87. }
  88. this.tablist.push(obj)
  89. return {
  90. dictLabel: v.dictLabel,
  91. dictValue: v.dictValue
  92. }
  93. })
  94. }
  95. })
  96. },
  97. getAddFn(){
  98. this.$tab.navigateTo("/work/pages/manage/houseadd")
  99. },
  100. getTabFn(val){
  101. this.tabval=val
  102. },
  103. getConfirm(){
  104. this.getrefreshData()
  105. },
  106. getReset(){
  107. this.cxrq='';
  108. this.text='';
  109. this.getrefreshData()
  110. },
  111. getrefreshData(){
  112. this.pageNum=1;
  113. this.list=[];
  114. this.reachflag=true;
  115. this.getDataFn()
  116. },
  117. bindDateChangea(e){
  118. var val=e.detail.value;
  119. this.cxrq=val;
  120. },
  121. getDataFn(){
  122. var params={
  123. pageSize:this.pageSize,
  124. pageNum: this.pageNum,
  125. }
  126. houseInfoList(params).then(res=>{
  127. if(res.code==200){
  128. if (res.rows.length < this.pageSize) {
  129. this.reachflag = false
  130. this.wtdt = '到底了~';
  131. } else {
  132. var num = parseInt(res.rows.length) + parseInt(this.pageSize) * parseInt(this.pageNum - 1)
  133. if (num < res.total) {
  134. this.reachflag = true
  135. this.wtdt = ''
  136. } else {
  137. this.reachflag = false
  138. this.wtdt = '到底了~';
  139. }
  140. }
  141. if (this.pageNum == 1) {
  142. this.list = res.rows;
  143. } else {
  144. this.list = this.list.concat(res.rows)
  145. }
  146. }else{
  147. this.$toast(res.msg)
  148. }
  149. })
  150. },
  151. }
  152. }
  153. </script>
  154. <style>
  155. page{background: #F3F3F0;}
  156. </style>
  157. <style lang="scss" scoped>
  158. .car{padding: 224rpx 0 110rpx;}
  159. .cartop{position: fixed;left: 0;right: 0;top: 0;background-color: #ffffff;z-index: 2;
  160. .topa{padding: 20rpx ;
  161. .resetimg{width: 36rpx;height: 36rpx;margin-right: 24rpx;flex: 0 0 auto;}
  162. .chekt{min-width: 180rpx;
  163. view{font-weight: 500;font-size: 26rpx;color: #272727;flex: 1;}
  164. image{width: 24rpx;height: 16rpx;margin-left: 18rpx;flex: 0 0 auto;}
  165. }
  166. .search{flex: 1;margin-left: 16rpx;height: 64rpx;background: #EEEEEE;border-radius: 32rpx;border: 2rpx solid #E6E6E6;padding-left: 24rpx;box-sizing: border-box;
  167. image{width: 32rpx;height: 34rpx;margin-right: 22rpx;flex: 0 0 auto;}
  168. input{flex: 1;font-size: 26rpx;color: #272727;}
  169. .btn{width: 100rpx;height: 64rpx;background: #3565ED;border-radius: 32rpx;flex: 0 0 auto;font-weight: bold;text-align: center;line-height: 64rpx;
  170. font-size: 26rpx;
  171. color: #FFFFFF;}
  172. }
  173. }
  174. .tabtop{padding-bottom: 40rpx;
  175. .tabt{font-weight: 500;font-size: 32rpx;color: #666666;position: relative;line-height: 56rpx;padding: 0 40rpx;margin-right: 6rpx;
  176. &.act{font-weight: bold;font-size: 32rpx;color: #272727;
  177. &::after{content: '';width: 40rpx;height: 10rpx;background: #0156FE;border-radius: 6rpx;position: absolute;left: 50%;margin-left: -20rpx;bottom: -10rpx;}
  178. }
  179. }
  180. }
  181. }
  182. .cdbtns{position: fixed;left: 0;right: 0;height: 98rpx;z-index: 2;display: flex;align-items: center;bottom: 0;
  183. view{flex: 1;display: flex;align-items: center;justify-content: center;font-weight: bold;font-size: 26rpx;height: 98rpx;
  184. &.btna{background: #FFFFFF;color: #0156FE;}
  185. &.btnb{background: #0156FE;color: #FFFFFF;}
  186. }
  187. }
  188. .carlists{padding: 0 18rpx;}
  189. </style>