listLock.vue 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304
  1. <template>
  2. <view>
  3. <u-navbar title="地锁列表" ></u-navbar>
  4. <view class="main">
  5. <view class="tabs" v-if="0">
  6. <u-picker v-model="tabsFrom.show1"
  7. :default-selector="[tabsFrom.show1Index]"
  8. mode="selector" :range="tabsFrom.selector1" range-key="label" @confirm="selector1confirm" ></u-picker>
  9. <u-picker-select title="日期选择" v-model="tabsFrom.show2"
  10. :defaultTime="tabsFrom.show2Index" :endYear="endYear"
  11. mode="time" :params="params" @confirm="selector2confirm" @reset="selector2reset" ></u-picker-select>
  12. <view class="tabsItem" @click="tabsFrom.show1=!tabsFrom.show1">{{tabsFrom.show1Text}} <u-icon name="arrow-up"
  13. v-if="tabsFrom.show1"></u-icon><u-icon v-else name="arrow-down"></u-icon></view>
  14. <view class="tabsItem" @click="tabsFrom.show2=!tabsFrom.show2">{{tabsFrom.show2Text}} <u-icon name="arrow-up"
  15. v-if="tabsFrom.show2"></u-icon><u-icon v-else name="arrow-down"></u-icon></view>
  16. <view class="tabsItem" @click="tabsFrom.show3=!tabsFrom.show3">{{tabsFrom.show3Text}} <u-icon name="arrow-up"
  17. v-if="tabsFrom.show3"></u-icon><u-icon v-else name="arrow-down"></u-icon></view>
  18. </view>
  19. <view class="list">
  20. <view class="line" v-for="(item,i) in list" :key="i"
  21. @click="gotoUrl('/pages/lockTab/dataLock?id='+item.id)" >
  22. <view class="body">
  23. <view class="imgclass">
  24. <image class="img" src="@/assets/img/deviceTab/index2-1.svg" mode=""></image>
  25. </view>
  26. <view class="item">
  27. <view class="name">
  28. <view class="text">{{item.name}}</view>
  29. <view class="tag" :class="'type'+item.type">{{item.typeN}}</view>
  30. </view>
  31. <view class="value">
  32. {{item.parkingName}}
  33. </view>
  34. </view>
  35. </view>
  36. <view class="goto">
  37. <view class="dian" :class="'status'+item.status"></view>
  38. <view class="text" :class="'statusText'+item.status" >{{item.status==1?'在线':'离线'}}</view>
  39. <u-icon name="arrow-right" size="24" color="#BBBBBB"></u-icon>
  40. </view>
  41. </view>
  42. </view>
  43. <view class="floating-button"
  44. @click="gotoBind" v-if="0" >
  45. <view class="button">
  46. <img class="img" src="@/assets/img/deviceTab/index2-2.svg" alt="">
  47. 绑定新地锁
  48. </view>
  49. </view>
  50. </view>
  51. <u-divider :isnone="list.length==0" nonetext="没有找到相关内容" border-color="#CFD2D5">已经到底了</u-divider>
  52. </view>
  53. </template>
  54. <script>
  55. import * as API from '@/apis/pagejs/deviceTab.js'
  56. export default {
  57. data() {
  58. return {
  59. list:[],
  60. listForm:{
  61. pageIndex: 1,
  62. pageSize: 20,
  63. recordsTotal: 1,
  64. },
  65. title:"场站列表",
  66. tabsFrom: {
  67. show1: false,
  68. show1Index:0,
  69. show2Index:'',
  70. show2: false,
  71. show1Text: "全部场站",
  72. show2Text: "全部类型",
  73. show3Text: "全部状态",
  74. selector1:[
  75. {
  76. label: '全部类型',
  77. value: '',
  78. },
  79. {
  80. label: '线上充值',
  81. value: '1',
  82. },
  83. {
  84. label: '线下充值',
  85. value: '2',
  86. },
  87. ]
  88. },
  89. };
  90. },
  91. onLoad(op) {
  92. if(op.companyId){
  93. this.listForm.companyId=op.companyId
  94. }
  95. if(op.parkingId){
  96. this.listForm.parkingId=op.parkingId
  97. }
  98. this.getList()
  99. },
  100. onReachBottom() {
  101. if (this.list.length < this.listForm.recordsTotal) {
  102. this.myLoadmore();
  103. }
  104. },
  105. methods: {
  106. gotoBind(){
  107. uni.navigateTo({
  108. url: '/pages/deviceTab/bindLock?parkingId='+this.listForm.parkingId,
  109. events: {
  110. // 为指定事件添加一个监听器,获取被打开页面传送到当前页面的数据
  111. acceptDataFromOpenerPage: (item)=>{
  112. this.getList(1)
  113. },
  114. }
  115. // ,
  116. // success: function(res) {
  117. // // 通过eventChannel向被打开页面传送数据
  118. //
  119. // }
  120. })
  121. },
  122. myLoadmore(){
  123. this.listForm.pageIndex += 1;
  124. this.getList()
  125. },
  126. getList(bl) {
  127. if(bl){
  128. this.listForm.pageIndex = 1
  129. }
  130. uni.showLoading({
  131. title: "加载中",
  132. mask: true,
  133. })
  134. API.findFloorLock(this.listForm).then((res) => {
  135. var list=[]
  136. if (this.listForm.pageIndex == 1) {
  137. list = res.data.data;
  138. } else {
  139. list = [
  140. ...list,
  141. ...res.data.floorlockInfoList
  142. ];
  143. }
  144. this.list = res.data.floorlockInfoList
  145. uni.hideLoading();
  146. }).catch(error => {
  147. uni.hideLoading();
  148. uni.showToast({
  149. title: error,
  150. icon: "none"
  151. })
  152. })
  153. },
  154. }
  155. }
  156. </script>
  157. <style scoped lang="scss">
  158. .main{
  159. background-color: #fff;
  160. .line{
  161. display: flex;
  162. justify-content: space-between;
  163. align-items: center;
  164. padding: 32rpx;
  165. border-bottom: 1px solid rgba(245,245,245,1);
  166. .goto{
  167. display: flex;
  168. align-items: center;
  169. .dian{
  170. width: 16rpx;
  171. height: 16rpx;
  172. border-radius: 50px;
  173. background-color: rgba(184,184,184,1);
  174. margin-right: 16rpx;
  175. }
  176. .status1{
  177. background-color: #4CAF50;
  178. color:#4CAF50;
  179. }
  180. .statusText1{
  181. color:#4CAF50;
  182. }
  183. .text{
  184. margin-right: 16rpx;
  185. font-size: 24rpx;
  186. }
  187. }
  188. .body{
  189. display: flex;
  190. align-items: center;
  191. .imgclass{
  192. display: flex;
  193. align-items: center;
  194. justify-content: center;
  195. width: 72rpx;
  196. height: 72rpx;
  197. border-radius: 4px;
  198. background-color: rgba(219,234,255,1);
  199. }
  200. .item{
  201. margin-left: 16rpx;
  202. .name{
  203. color: rgba(51,51,51,1);
  204. font-size: 28rpx;
  205. display: flex;
  206. align-items: center;
  207. .tag{
  208. border-radius: 4px;
  209. background-color: rgba(22,119,255,1);
  210. color: rgba(255,255,255,1);
  211. font-size: 22rpx;
  212. padding:1px 8rpx;
  213. margin-left: 8rpx;
  214. }
  215. .type2{
  216. background-color: #8161ff;
  217. }
  218. }
  219. .value{
  220. color: rgba(119,119,119,1);
  221. font-size: 24rpx;
  222. }
  223. }
  224. }
  225. }
  226. .img{
  227. width: 48rpx;
  228. height: 48rpx;
  229. }
  230. }
  231. .tabs{
  232. border-bottom: 1px solid rgba(232,232,232,1);
  233. height: 96rpx;
  234. line-height: 96rpx;
  235. background-color: #fff;
  236. border-top: 1px solid rgba(241,241,241,1);
  237. display: flex;
  238. justify-content: space-around;
  239. .tabsItem{
  240. color: rgba(51,51,51,1);
  241. font-size: 14px;
  242. }
  243. }
  244. .floating-button {
  245. position: fixed;
  246. bottom: 120rpx;
  247. width: 100%;
  248. display: flex;
  249. justify-content: center;
  250. .button {
  251. border-radius: 50px;
  252. background-color: rgba(49, 51, 52, 1);
  253. color: rgba(255, 255, 255, 1);
  254. font-size: 28rpx;
  255. width: 240rpx;
  256. display: flex;
  257. align-items: center;
  258. justify-content: center;
  259. padding: 12rpx;
  260. .img {
  261. width: 40rpx;
  262. height: 40rpx;
  263. margin-right: 8rpx;
  264. }
  265. }
  266. }
  267. </style>