stationList.vue 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397
  1. <template>
  2. <view>
  3. <u-navbar title="地锁列表"></u-navbar>
  4. <view class="main">
  5. <view class="top">
  6. <view class="search">
  7. <view class="searchBox">
  8. <u-search shape="square" placeholder="使用停车场名称/地锁编号搜索" maxlength="12" v-model="testName"
  9. :show-action="false" :animation="true"></u-search>
  10. <u-button type="primary" size="mini" @click="testBtn">搜素</u-button>
  11. </view>
  12. </view>
  13. </view>
  14. <view class="tabs" v-if="0">
  15. <u-picker v-model="tabsFrom.show1" :default-selector="[tabsFrom.show1Index]" mode="selector"
  16. :range="tabsFrom.selector1" range-key="label" @confirm="selector1confirm"></u-picker>
  17. <u-picker-select title="日期选择" v-model="tabsFrom.show2" :defaultTime="tabsFrom.show2Index"
  18. :endYear="endYear" mode="time" :params="params" @confirm="selector2confirm"
  19. @reset="selector2reset"></u-picker-select>
  20. <view class="tabsItem" @click="tabsFrom.show1=!tabsFrom.show1">{{tabsFrom.show1Text}} <u-icon
  21. name="arrow-up" v-if="tabsFrom.show1"></u-icon><u-icon v-else name="arrow-down"></u-icon></view>
  22. <view class="tabsItem" @click="tabsFrom.show2=!tabsFrom.show2">{{tabsFrom.show2Text}} <u-icon
  23. name="arrow-up" v-if="tabsFrom.show2"></u-icon><u-icon v-else name="arrow-down"></u-icon></view>
  24. <view class="tabsItem" @click="tabsFrom.show3=!tabsFrom.show3">{{tabsFrom.show3Text}} <u-icon
  25. name="arrow-up" v-if="tabsFrom.show3"></u-icon><u-icon v-else name="arrow-down"></u-icon></view>
  26. </view>
  27. <view class="tabsclass">
  28. <u-tabs :list="tabslist" active-color="#333" inactive-color="#777" :current="current"
  29. @change="change"></u-tabs>
  30. </view>
  31. <view class="list">
  32. <view class="line" v-for="(item,i) in list" :key="i"
  33. @click="gotoUrl('/pages/station/stationInfo?id='+item.id)">
  34. <view class="body">
  35. <view class="imgclass">
  36. <image class="img" src="@/assets/img/station/index0.svg" mode=""></image>
  37. </view>
  38. <view class="item">
  39. <view class="name">
  40. <view class="text"></view>
  41. {{item.parkingName}}
  42. </view>
  43. <view class="value">
  44. <span class="span span1">在用8</span> /
  45. <span class="span span2">空闲18</span>/
  46. <span class="span span3">故障8</span>/
  47. <span class="span span4">离线8</span>/
  48. <span class="span span5">共9台</span>
  49. </view>
  50. </view>
  51. </view>
  52. <view class="goto">
  53. <u-icon name="arrow-right" size="24" color="#BBBBBB"></u-icon>
  54. </view>
  55. </view>
  56. </view>
  57. <view class="floating-button" @click="gotoBind" v-if="0">
  58. <view class="button">
  59. <img class="img" src="@/assets/img/deviceTab/index2-2.svg" alt="">
  60. 绑定新地锁
  61. </view>
  62. </view>
  63. </view>
  64. <u-divider :isnone="list.length==0" nonetext="没有找到相关内容" border-color="#CFD2D5">已经到底了</u-divider>
  65. </view>
  66. </template>
  67. <script>
  68. import * as API from '@/apis/pagejs/pagesStation.js'
  69. export default {
  70. data() {
  71. return {
  72. testName: "",
  73. queryName: "",
  74. list: [],
  75. listForm: {
  76. pageIndex: 1,
  77. pageSize: 20,
  78. recordsTotal: 1,
  79. },
  80. title: "场站列表",
  81. tabslist: [{
  82. name: '待处理',
  83. code: "geterrList0"
  84. }, {
  85. name: '已处理',
  86. code: "geterrList1"
  87. }],
  88. current: 0,
  89. tabsFrom: {
  90. show1: false,
  91. show1Index: 0,
  92. show2Index: '',
  93. show2: false,
  94. show1Text: "全部场站",
  95. show2Text: "全部类型",
  96. show3Text: "全部状态",
  97. selector1: [{
  98. label: '全部类型',
  99. value: '',
  100. },
  101. {
  102. label: '线上充值',
  103. value: '1',
  104. },
  105. {
  106. label: '线下充值',
  107. value: '2',
  108. },
  109. ]
  110. },
  111. };
  112. },
  113. onLoad(op) {
  114. if (op.companyId) {
  115. this.listForm.companyId = op.companyId
  116. }
  117. if (op.parkingId) {
  118. this.listForm.parkingId = op.parkingId
  119. }
  120. this.getList()
  121. },
  122. onReachBottom() {
  123. if (this.list.length < this.listForm.recordsTotal) {
  124. this.myLoadmore();
  125. }
  126. },
  127. methods: {
  128. change(e) {
  129. this.current = e
  130. },
  131. testBtn() {
  132. this.list = []
  133. //this.listForm.pageIndex=1
  134. this.getList()
  135. },
  136. gotoBind() {
  137. uni.navigateTo({
  138. url: '/pages/deviceTab/bindLock?parkingId=' + this.listForm.parkingId,
  139. events: {
  140. // 为指定事件添加一个监听器,获取被打开页面传送到当前页面的数据
  141. acceptDataFromOpenerPage: (item) => {
  142. this.getList(1)
  143. },
  144. }
  145. // ,
  146. // success: function(res) {
  147. // // 通过eventChannel向被打开页面传送数据
  148. //
  149. // }
  150. })
  151. },
  152. myLoadmore() {
  153. this.listForm.pageIndex += 1;
  154. this.getList()
  155. },
  156. getList(bl) {
  157. if (bl) {
  158. this.listForm.pageIndex = 1
  159. }
  160. uni.showLoading({
  161. title: "加载中",
  162. mask: true,
  163. })
  164. API.userStationList(this.listForm).then((res) => {
  165. var list = []
  166. if (this.listForm.pageIndex == 1) {
  167. list = res.data.data;
  168. } else {
  169. list = [
  170. ...list,
  171. ...res.data.floorlockInfoList
  172. ];
  173. }
  174. this.list = res.data.floorlockInfoList
  175. uni.hideLoading();
  176. }).catch(error => {
  177. uni.hideLoading();
  178. uni.showToast({
  179. title: error,
  180. icon: "none"
  181. })
  182. })
  183. },
  184. }
  185. }
  186. </script>
  187. <style scoped lang="scss">
  188. .search {
  189. padding: 16rpx 32rpx;
  190. background: #fff;
  191. .searchBox {
  192. display: flex;
  193. align-items: center;
  194. background: #F2F2F2;
  195. padding: 2rpx 16rpx;
  196. border-radius: 8px;
  197. justify-content: space-between;
  198. }
  199. }
  200. .main {
  201. background-color: #fff;
  202. .line {
  203. display: flex;
  204. justify-content: space-between;
  205. align-items: center;
  206. padding: 32rpx;
  207. border-bottom: 2rpx solid rgba(245, 245, 245, 1);
  208. .goto {
  209. display: flex;
  210. align-items: center;
  211. .dian {
  212. width: 16rpx;
  213. height: 16rpx;
  214. border-radius: 50px;
  215. background-color: rgba(184, 184, 184, 1);
  216. margin-right: 16rpx;
  217. }
  218. .status1 {
  219. background-color: #4CAF50;
  220. color: #4CAF50;
  221. }
  222. .statusText1 {
  223. color: #4CAF50;
  224. }
  225. .text {
  226. margin-right: 16rpx;
  227. font-size: 24rpx;
  228. }
  229. }
  230. .body {
  231. display: flex;
  232. align-items: center;
  233. .imgclass {
  234. display: flex;
  235. align-items: center;
  236. justify-content: center;
  237. width: 72rpx;
  238. height: 72rpx;
  239. border-radius: 4px;
  240. background-color: rgba(219, 234, 255, 1);
  241. }
  242. .item {
  243. margin-left: 16rpx;
  244. .name {
  245. color: rgba(51, 51, 51, 1);
  246. font-size: 28rpx;
  247. display: flex;
  248. align-items: center;
  249. font-weight: bold;
  250. .tag {
  251. border-radius: 4px;
  252. background-color: rgba(22, 119, 255, 1);
  253. color: rgba(255, 255, 255, 1);
  254. font-size: 22rpx;
  255. padding: 2rpx 8rpx;
  256. margin-left: 8rpx;
  257. }
  258. .type2 {
  259. background-color: #8161ff;
  260. }
  261. }
  262. .value {
  263. color: #777777;
  264. font-size: 24rpx;
  265. .span {
  266. margin: 0 8rpx;
  267. }
  268. .span1 {
  269. color: #00B962;
  270. margin-left: 0px;
  271. }
  272. .span2 {
  273. color: #777777
  274. }
  275. .span3 {
  276. color: #FF3D00
  277. }
  278. .span4 {
  279. color: #FF9600
  280. }
  281. .span5 {}
  282. }
  283. }
  284. }
  285. }
  286. .img {
  287. width: 48rpx;
  288. height: 48rpx;
  289. }
  290. }
  291. .tabs {
  292. border-bottom: 2rpx solid rgba(232, 232, 232, 1);
  293. height: 96rpx;
  294. line-height: 96rpx;
  295. background-color: #fff;
  296. border-top: 2rpx solid rgba(241, 241, 241, 1);
  297. display: flex;
  298. justify-content: space-around;
  299. .tabsItem {
  300. color: rgba(51, 51, 51, 1);
  301. font-size: 14px;
  302. }
  303. }
  304. .floating-button {
  305. z-index: 999;
  306. position: fixed;
  307. bottom: 120rpx;
  308. width: 100%;
  309. display: flex;
  310. justify-content: center;
  311. .button {
  312. border-radius: 50px;
  313. background-color: rgba(49, 51, 52, 1);
  314. color: rgba(255, 255, 255, 1);
  315. font-size: 28rpx;
  316. width: 240rpx;
  317. display: flex;
  318. align-items: center;
  319. justify-content: center;
  320. padding: 12rpx;
  321. .img {
  322. width: 40rpx;
  323. height: 40rpx;
  324. margin-right: 8rpx;
  325. }
  326. }
  327. }
  328. .tabsclass {
  329. border-bottom: 2rpx solid rgba(232, 232, 232, 1);
  330. }
  331. </style>