stationsList.vue 8.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440
  1. <template>
  2. <view>
  3. <ujp-navbar title="我的充电桩">
  4. <view slot="right" >
  5. <view @click="popupShow=true"
  6. style="margin-right: 10px;" >
  7. 筛选<u-icon name="plus"></u-icon>
  8. </view>
  9. </view>
  10. </ujp-navbar>
  11. <u-popup v-model="popupShow" mode="bottom" border-radius="20" >
  12. <view class="popup-screen">
  13. <view class="screen">
  14. <view class="screen-item">
  15. <view class="screen-head">站点名称</view>
  16. <view class="screen-main">
  17. <u-search v-model="nameTemp"
  18. @custom="form.name=nameTemp,getList(true)"
  19. @search="form.name=nameTemp,getList(true)" placeholder="按站点名称搜索" />
  20. </view>
  21. </view>
  22. <view class="screen-item">
  23. <view class="screen-head">站点类型</view>
  24. <view class="screen-main">
  25. <view class="screen-entry "
  26. @click="form.no='',getList(true)"
  27. :class="{
  28. active:form.no==''
  29. }"
  30. >全部</view>
  31. <view class="screen-entry "
  32. v-for="(item,i) in ['A','B','C','D','E']"
  33. @click="form.no=item,getList(true)"
  34. :class="{
  35. active:form.no==item
  36. }"
  37. >{{item}}类</view>
  38. </view>
  39. </view>
  40. </view>
  41. <view class="screen-foot">
  42. <view class="screen-btn-l" @click="resetBtn" v-if="0" >重置</view>
  43. <view class="screen-btn-r" @click="popupShow=false" >关闭</view>
  44. </view>
  45. </view>
  46. </u-popup>
  47. <view class="deviceList" >
  48. <view style="text-align: center;margin-top: 100px" v-if="!list.length">
  49. <img src="@/assets/img/blankpage.png">
  50. <view>查询为空</view>
  51. </view>
  52. <view v-for="(item ,index) in list" :key="item.id"
  53. @click="gotoItem(item)"
  54. class="deviceList-item deviceList-bg1 "
  55. :class="{
  56. 'deviceList-bg-none':item.totalNum==0&&item.stationType==50
  57. }"
  58. >
  59. <view class="deviceList-main">
  60. <template v-if="item.category=='超充'"> <span class="btn12 btn3" >超充</span></template>
  61. <template v-else >
  62. <span class="btn12 " v-if="item.type=='1,2'" >快/慢</span>
  63. <span class="btn12 btn2" v-if="item.type=='1'" >快充</span>
  64. <span class="btn12 btn1" v-if="item.type=='2'" >慢充</span>
  65. </template>
  66. {{item.name}}
  67. </view>
  68. <view class="deviceList-head">{{item.address}}<span style="float: right;" class="iconfont more">&#xe600;</span></view>
  69. <view class="deviceList-foot" v-if="item.totalNum==0&&item.stationType==50" >
  70. <view class="deviceList-label" style="color: #5cbe7d;" >前往绑定充电桩</view>
  71. </view>
  72. <view class="deviceList-foot" v-else >
  73. <view class="deviceList-label" style="color: #333333;" >总数<b>{{item.totalNum}}</b></view>
  74. <view class="deviceList-label" style="color: #7a68f6;" v-if="item.superNum" >/直流超充<b>{{item.superNum}}</b></view>
  75. <view class="deviceList-label" style="color: #185AC6;" v-if="item.fastNum" >/直流快充<b>{{item.fastNum-item.superNum}}</b></view>
  76. <view class="deviceList-label" style="color: #5cbe7d;" v-if="item.slowNum" >/交流慢充<b>{{item.slowNum}}</b></view>
  77. <!-- <view class="deviceList-label">{{item.roleName}}</view> -->
  78. </view>
  79. </view>
  80. <u-divider v-if="list.length&&list.length==recordsTotal" color="#B6BDC3" style="margin-top:20px;" bg-color="#f7f7f7">已经到底了</u-divider>
  81. </view>
  82. </view>
  83. </template>
  84. <script>
  85. import * as API from '@/apis/finance.js'
  86. export default {
  87. data() {
  88. return {
  89. popupShow:false,
  90. name:"",
  91. nameTemp:"",
  92. no:"",
  93. form: {
  94. name:"",
  95. no:"",
  96. },
  97. startDate:'',
  98. endDate:'',
  99. pageIndex: 1,
  100. recordsTotal: 0,
  101. list: [],
  102. value1: -1,
  103. value2: -1,
  104. value3: -1,
  105. stationList:[],
  106. options0: [
  107. {
  108. label: '全部',
  109. value: -1,
  110. },
  111. {
  112. label: '自行车充电',
  113. value: 0,
  114. },
  115. {
  116. label: '交流慢充',
  117. value: 2,
  118. },
  119. {
  120. label: '直流快充',
  121. value: 1,
  122. }
  123. ],
  124. options1: [{
  125. label: '全部',
  126. value: '-1',
  127. },
  128. {
  129. label: '自行车充电',
  130. value: 0,
  131. },
  132. {
  133. label: '交流慢充',
  134. value: 2,
  135. },
  136. {
  137. label: '直流快充',
  138. value: 1,
  139. }
  140. ],
  141. options2: [
  142. ],
  143. options3: [
  144. {
  145. label: '全部',
  146. value: -1,
  147. },
  148. {
  149. label: '在线',
  150. value: 1,
  151. },
  152. {
  153. label: '离线',
  154. value: 0,
  155. },
  156. ],
  157. }
  158. },
  159. onReachBottom() {
  160. if (this.list.length < this.recordsTotal) {
  161. this.myLoadmore();
  162. }
  163. },
  164. methods: {
  165. gotoItem(item){
  166. if(item.totalNum==0&&item.stationType==50){
  167. this.adddevice(item.id,item.name)
  168. }else{
  169. this.gotoUrl('pagesFinance/user/'+(item.type!=0?'pileManagement':'deviceList')+'?id='+item.id)
  170. }
  171. },
  172. adddevice(id,name){
  173. uni.navigateTo({
  174. url:'/pagesFinance/user/activatedChargingPile?id='+id+"&name="+name
  175. })
  176. },
  177. change1(e){
  178. this.form.type=e
  179. if(e==-1){
  180. this.form.type=""
  181. }
  182. this.getList(true)
  183. },
  184. change2(e){
  185. this.form.stationId=e
  186. if(e==-1){
  187. this.form.stationId=""
  188. }
  189. this.getList(true)
  190. },
  191. change3(e){
  192. this.form.onlineStatus=e
  193. if(e==-1){
  194. this.form.onlineStatus=""
  195. }
  196. this.getList(true)
  197. },
  198. getStation() {
  199. API.stationList().then((res) => {
  200. this.options2.push({
  201. label: '全部',
  202. value:-1,
  203. })
  204. this.stationList = res.data.stationList
  205. this.stationList.forEach(item=>{
  206. this.options2.push({
  207. label: item.name,
  208. value: item.id,
  209. })
  210. })
  211. }).catch(error => {
  212. uni.showToast({
  213. title: error
  214. })
  215. })
  216. },
  217. myLoadmore() {
  218. this.pageIndex += 1;
  219. this.getList()
  220. },
  221. getList(bl) {
  222. uni.showLoading({
  223. title: "加载中",
  224. mask: true,
  225. })
  226. if (bl) {
  227. this.list = [];
  228. this.pageIndex = 1;
  229. }
  230. this.form.pageIndex= this.pageIndex
  231. API.stationsList(this.form).then((res) => {
  232. this.recordsTotal=res.data.recordsTotal
  233. this.list = [
  234. ...this.list,
  235. ...res.data.data
  236. ];
  237. // if(this.list.length==1){
  238. // uni.redirectTo({
  239. // url:"pagesFinance/user/pileManagement?id="+this.list[0].id
  240. // })
  241. // }
  242. uni.hideLoading()
  243. }).catch(error => {
  244. uni.showToast({
  245. title: error
  246. })
  247. })
  248. },
  249. onShow() {
  250. //this.getStation()
  251. this.getList(true)
  252. }
  253. }
  254. }
  255. </script>
  256. <style>
  257. page{
  258. background-color: #F7F7F7;
  259. }
  260. </style>
  261. <style lang="scss" scoped>
  262. .btn12{
  263. color: #fff;
  264. background-color: #449ca8;
  265. font-size: 16px;
  266. border-radius: 50px;
  267. padding: 1px 5px;
  268. }
  269. .btn1{
  270. background-color: #5cbe7d;
  271. }
  272. .btn3{
  273. background-color: #7a68f6;
  274. }
  275. .btn2{
  276. background-color: #185AC6;
  277. }
  278. .deviceDropdown{
  279. background-color: #fff;
  280. }
  281. .deviceList-item{
  282. margin: 16px;
  283. border-radius: 8px;
  284. .deviceList-head{
  285. color: #9e9e9e;
  286. font-size: 16px;
  287. padding: 8px 16px;
  288. }
  289. .deviceList-main{
  290. font-size: 20px/* */;
  291. padding:5px 16px 0px 16px;
  292. font-weight: bold;
  293. }
  294. .deviceList-foot{
  295. display: flex;
  296. align-items: center;
  297. flex-wrap: wrap;
  298. padding: 0 16px 16px;
  299. .deviceList-label{
  300. // background-color: #F0F2F4 ;
  301. // padding: 4px 10px;
  302. margin: 1px;
  303. border-radius: 4px;
  304. }
  305. }
  306. }
  307. .deviceList-bg1{
  308. //background:url(../../assets/img/charging_type_fast.png) no-repeat #fff;
  309. background-size:100%;
  310. background-color: #ffffff ;
  311. }
  312. .deviceList-bg-none{
  313. background:url(../../assets/img/nobood.svg) no-repeat #fff;
  314. background-size:45px;
  315. background-position-x: right;
  316. background-color: #ffffff ;
  317. }
  318. .deviceList-bg2{
  319. background:url(../../assets/img/charging_type_slow.png) no-repeat #fff;
  320. background-size:100%;
  321. }
  322. .deviceList-bg3{
  323. background:url(../../assets/img/charging_type_bike.png) no-repeat #fff;
  324. background-size:100%;
  325. }
  326. .popup-screen{
  327. padding: 20px;
  328. position: relative;
  329. .screen{
  330. padding-bottom: 60px;
  331. }
  332. .screen-item{
  333. margin-bottom: 20px;
  334. .screen-head{
  335. margin-bottom: 8px;
  336. font-size: 16px;
  337. }
  338. .screen-main{
  339. display: flex;
  340. // display: -webkit-box;
  341. flex-wrap: wrap;
  342. }
  343. .screen-entry{
  344. width: 29%;
  345. padding:6px 0;
  346. display: flex;
  347. align-items: center;
  348. justify-content: center;
  349. background-color: #F2F5FA ;
  350. text-align: center;
  351. margin-bottom: 10px;
  352. border-radius: 3px;
  353. margin-right: 6px;
  354. }
  355. .screen-entry.active{
  356. background-color: #185AC6;
  357. color:#fff;
  358. }
  359. }
  360. .screen-foot{
  361. position: fixed;
  362. left: 0;
  363. right: 0;
  364. bottom: 0;
  365. display: flex;
  366. height:50px;
  367. border-top: 1px solid #ededed;
  368. justify-content: space-around;
  369. .screen-btn-l{
  370. background-color: #fff;
  371. flex: 0.2;
  372. text-align: center;
  373. line-height: 50px;
  374. }
  375. .screen-btn-r{
  376. flex: 0.8;
  377. text-align: center;
  378. line-height: 50px;
  379. background-color: #185AC6;
  380. color:#fff;
  381. }
  382. }
  383. }
  384. </style>