readme.vue 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808
  1. <template>
  2. <view>
  3. <componentLogin ref="refLogin" :check="0"
  4. @findByOpenId="findByOpenId"></componentLogin>
  5. <u-popup v-model="showMessage" mode="bottom" border-radius="30">
  6. <view class="showMessage">
  7. <view class="title">降锁成功</view>
  8. <view class="body">
  9. 车位锁已经降锁,请尽快驶入车位充电!<br />
  10. 若超过3分钟未停车,车位锁将自动升起上锁,如需继续使用请重新扫码降锁。
  11. </view>
  12. <view class="botton">
  13. <u-button @click="showMessage=false" type="primary" shape="square">知道了</u-button>
  14. </view>
  15. </view>
  16. </u-popup>
  17. <view class="jpmain " v-if="loading" >
  18. <view class="gradient-header">
  19. <view class="jpback">
  20. </view>
  21. </view>
  22. <view class="body" v-if="id" >
  23. <view class="page" v-if="floorlockInfo.id" >
  24. <view class="page-main">
  25. <view class="name">
  26. <view class="name-info">
  27. {{floorlockInfo.name}}
  28. </view>
  29. <view class="code-info">
  30. 编号:{{floorlockInfo.lockNo}}
  31. </view>
  32. </view>
  33. <view class=" tags" >
  34. <span class="tag typeN" :class="'typeN'+floorlockInfo.type">{{floorlockInfo.typeN}}</span>
  35. <span class="tag" :class="'status'+floorlockInfo.status">{{floorlockInfo.status==1?'在线':'离线'}}</span>
  36. </view>
  37. </view>
  38. <view class="page-info">
  39. <view class="info-span" v-if="floorlockInfo.lastOnlineTime">
  40. 更新时间:{{floorlockInfo.lastOnlineTime}}
  41. </view>
  42. <view class="info-span" v-if="floorlockInfo.batteryLevel" >
  43. 电压:{{floorlockInfo.batteryLevel}}V
  44. </view>
  45. </view>
  46. </view>
  47. </view>
  48. <view class="page-top" v-if="id">
  49. <template v-if="floorlockInfo.status==0" >
  50. <view class="name">
  51. <img class="img" src="@/assets/img/lockstatus/index4.png" alt="">
  52. </view>
  53. </template>
  54. <template v-else>
  55. <view class="name" v-if="floorlockInfo.parkingStatus==1">
  56. <img class="img" src="@/assets/img/lockstatus/index3.png" alt="">
  57. </view>
  58. <view class="name" v-else-if="floorlockInfo.lockStatus==1">
  59. <img class="img" src="@/assets/img/lockstatus/index1.png" alt="">
  60. </view>
  61. <view class="name" v-else-if="floorlockInfo.lockStatus==3">
  62. <img class="img" src="@/assets/img/lockstatus/index2.png" alt="">
  63. </view>
  64. <view class="name" v-else-if="floorlockInfo.lockStatus==2">
  65. <img class="img" src="@/assets/img/lockstatus/index2.png" alt="">
  66. </view>
  67. <view class="name" v-else-if="floorlockInfo.lockStatus==4||floorlockInfo.lockStatus==0">
  68. <img class="img" src="@/assets/img/lockstatus/index4.png" alt="">
  69. </view>
  70. </template>
  71. <view class=" value" style="color:red;text-align: center;font-size: 28rpx;" v-if="floorlockInfo.lockStatus==2&&floorlockInfo.parkingStatus==0">
  72. 3分钟后自动抬锁,请尽快驶入车位
  73. </view>
  74. <view class=" valuestatus">
  75. <view class="bo1">
  76. <img src="@/assets/img/lockstatus/status2.svg"> <span>雷达</span> <span :style="floorlockInfo.parkingStatus==1?'color:#FF7B00':'color:#00B962'">{{floorlockInfo.parkingStatus==1?'有车':'无车'}}</span>
  77. </view>
  78. <view class="bo2">
  79. </view>
  80. <view class="bo1">
  81. <img src="@/assets/img/lockstatus/status1.svg"> <span>地锁</span>
  82. <span v-if="floorlockInfo.lockStatus==1||floorlockInfo.lockStatus==2">
  83. <u-icon color="#00B962" v-if="floorlockInfo.lockStatus==1" name="arrow-upward"></u-icon>
  84. <u-icon color="#8161FF" v-if="floorlockInfo.lockStatus==2" name="arrow-downward"></u-icon>
  85. </span>
  86. <span v-else>
  87. <u-icon name="more-dot-fill"></u-icon>
  88. </span>
  89. </view>
  90. </view>
  91. <view class="valuebutton" @click="operateBtn">
  92. <template v-if="floorlockInfo.status==0" >
  93. <view class="jpbutton jpbutton5">
  94. <u-icon name="phone-fill" label="电话报修"
  95. color="#fff" label-color="#fff" label-size="36"></u-icon>
  96. </view>
  97. </template>
  98. <template v-else >
  99. <view class="jpbutton jpbutton6" v-if="floorlockInfo.parkingStatus==1">
  100. 该车位已被占用
  101. </view>
  102. <view class="jpbutton jpbutton1" v-else-if="floorlockInfo.lockStatus==1">
  103. <img class="img" src="@/assets/img/button/lock.svg" alt="">
  104. 降锁
  105. </view>
  106. <!-- <view class="jpbutton jpbutton6" v-else-if="floorlockInfo.lockStatus==2">
  107. 地锁降
  108. </view> -->
  109. <view class="jpbutton jpbutton4" v-else-if="floorlockInfo.lockStatus==3">
  110. 降锁中
  111. </view>
  112. <view class="jpbutton jpbutton5" v-else-if="floorlockInfo.lockStatus==4||floorlockInfo.lockStatus==0">
  113. <u-icon name="phone-fill" label="电话报修"
  114. color="#fff" label-color="#fff" label-size="36"></u-icon>
  115. </view>
  116. </template>
  117. </view>
  118. </view>
  119. <view class="body">
  120. <view class="page">
  121. <view class="page-content">
  122. <view class="tip1">
  123. <view class="step">1、从微信小程序入口进入停车场页面,或通过微信扫描位于充电桩或地锁上的二维码进入车位详情页面;</view>
  124. <view class="step">2、选择需要降锁的车位,点击“降锁”按钮,等待地锁降下后系统会提示降锁成功,此时即可将车辆驶入指定车位。</view>
  125. </view>
  126. <view class="tip2">
  127. <view class="tip-title">温馨提示</view>
  128. <view class="step">1、成功降锁后请于三分钟内将车辆驶入指定车位;超时地锁会自动升起,需重新扫码降锁;</view>
  129. <view class="step">2、请按降锁流程说明停车,严禁使用外力降锁;</view>
  130. <view class="step">3、地锁服务热线 400-8899-619。</view>
  131. </view>
  132. </view>
  133. </view>
  134. </view>
  135. <u-modal v-model="openLockBl" @confirm="lockStatus1" confirm-color="#00B962" :show-cancel-button="true"
  136. ref="uModal" title="提示" content="是否下降当前地锁?" confirm-text="开启"></u-modal>
  137. <u-modal v-model="closeLockBl" @confirm="lockStatus2" confirm-color="#fa3534" :show-cancel-button="true"
  138. ref="uModal" title="提示" content="是否结束使用当前地锁?" confirm-text="结束"></u-modal>
  139. <u-modal v-model="loginBl" @confirm="loginconfirm" :show-cancel-button="true"
  140. ref="uModal" title="提示" content="当前用户未登录,是否前往登录" confirm-text="登录"></u-modal>
  141. <u-modal v-model="openModalBl" @confirm="confirmPhone" confirm-text="拨打电话" confirm-color="#606266"
  142. :show-cancel-button="true" ref="uModal" :asyncClose="true" title="客服电话" :content="content"
  143. :content-style="{fontSize: '24px',color: '#101010'}"></u-modal>
  144. </view>
  145. <view class="page-role" v-else>
  146. <img class="img" src="@/assets/img/nonwhitelist/info.png" alt="">
  147. <view class="text1">{{permission?'暂无权限':'加载中...'}}</view>
  148. <view class="text2" v-if="permission">此车位仅限车主及白名单用户使用</view>
  149. <view class="botton" @click="gotoIndex" v-if="permission">返回首页</view>
  150. </view>
  151. </view>
  152. </template>
  153. <script>
  154. import * as API from '@/apis/pagejs/index.js'
  155. import componentLogin from '@/pages/business/as-components/componentLogin.vue';
  156. export default {
  157. components: {
  158. componentLogin,
  159. 'u-modal': () => import('@/uni_modules/uview-ui/components/u-modal/u-modal'),
  160. 'u-popup': () => import('@/uni_modules/uview-ui/components/u-popup/u-popup'),
  161. 'u-button': () => import('@/uni_modules/uview-ui/components/u-button/u-button'),
  162. },
  163. data() {
  164. return {
  165. id: "",
  166. loading: true,
  167. usable:false,
  168. permission: false,
  169. loginBl:false,
  170. floorlockInfo: {
  171. lockStatusN:""
  172. },
  173. setIntervalId: "",
  174. showMessage: 0,
  175. content: "400-8899-619",
  176. openLockBl:false,
  177. closeLockBl:false,
  178. openModalBl: false,
  179. }
  180. },
  181. onLoad(op) {
  182. if(op.q){
  183. var val =decodeURIComponent(op.q);
  184. if(val&&val.indexOf("?id=")>-1){
  185. val=val.split("?id=")[1]
  186. if(val.indexOf("&")>-1){
  187. val=val.split("&")[0]
  188. }
  189. this.id = val
  190. }
  191. }
  192. if (op.id) {
  193. this.id = op.id
  194. uni.setNavigationBarTitle({
  195. title: "加载中..."
  196. })
  197. // this.$refs.refLogin.findByOpenId()
  198. } else {
  199. this.loading = true
  200. uni.setNavigationBarTitle({
  201. title: "降锁说明"
  202. })
  203. }
  204. },
  205. onShareTimeline(){
  206. if(this.id){
  207. return {
  208. title: '智泊e家-'+this.floorlockInfo.name,
  209. path: '/pages/business/lockInfo?id='+this.id ,
  210. }
  211. }else{
  212. return {
  213. title: '智泊e家',
  214. path: '/pages/index/index' ,
  215. }
  216. }
  217. },
  218. onShareAppMessage(res) {
  219. if (res.from === 'button') { // 来自页面内分享按钮
  220. //.log(res.target)
  221. }
  222. if(this.id){
  223. return {
  224. title: '智泊e家-'+this.floorlockInfo.name,
  225. path: '/pages/business/lockInfo?id='+this.id ,
  226. }
  227. }else{
  228. return {
  229. title: '智泊e家',
  230. path: '/pages/index/index' ,
  231. }
  232. }
  233. },
  234. onReady() {
  235. this.$refs.refLogin.findByOpenId()
  236. this.setIntervalId = setInterval(() => {
  237. this.getFloorlockDetails(1)
  238. }, 1000 * 3)
  239. this.jphelp.setInterval("lockInfo",this.setIntervalId)
  240. this.getFloorlockDetails()
  241. },
  242. onUnload() {
  243. //setInterval
  244. if (this.setIntervalId) {
  245. clearInterval(this.setIntervalId)
  246. }
  247. },
  248. methods: {
  249. findByOpenId(res) {
  250. },
  251. confirmPhone() {
  252. this.openModalBl = false;
  253. uni.makePhoneCall({
  254. phoneNumber: this.content //仅为示例
  255. });
  256. },
  257. gotoIndex() {
  258. uni.switchTab({
  259. url: "/pages/index/index"
  260. })
  261. },
  262. lockStatus1(){
  263. uni.showLoading({
  264. title: "加载中",
  265. mask: true,
  266. })
  267. var obj = {
  268. id: this.id,
  269. lockStatus:2
  270. }
  271. API.operateFloorlock(obj).then((res) => {
  272. uni.hideLoading();
  273. this.showMessage = true;
  274. this.getFloorlockDetails()
  275. setTimeout(() => {
  276. this.getFloorlockDetails(1)
  277. }, 1000 * 1)
  278. setTimeout(() => {
  279. this.getFloorlockDetails(1)
  280. }, 1000 * 2.5)
  281. }).catch(error => {
  282. uni.hideLoading();
  283. uni.showToast({
  284. title: error,
  285. icon: "none"
  286. })
  287. })
  288. },
  289. lockStatus2(){
  290. // uni.showToast({
  291. // title: "该车位已被占用...",
  292. // icon: "none"
  293. // })
  294. uni.showLoading({
  295. title: "加载中",
  296. mask: true,
  297. })
  298. var obj = {
  299. id: this.id,
  300. lockStatus:1
  301. }
  302. API.operateFloorlock(obj).then((res) => {
  303. uni.hideLoading();
  304. //this.showMessage = true;
  305. this.getFloorlockDetails()
  306. setTimeout(() => {
  307. this.getFloorlockDetails(1)
  308. }, 1000 * 1)
  309. setTimeout(() => {
  310. this.getFloorlockDetails(1)
  311. }, 1000 * 2.5)
  312. }).catch(error => {
  313. uni.hideLoading();
  314. uni.showToast({
  315. title: error,
  316. icon: "none"
  317. })
  318. })
  319. // #ifdef H5
  320. // #endif
  321. },
  322. lockStatus3(){
  323. uni.showToast({
  324. title: "下降中...",
  325. icon: "none"
  326. })
  327. },
  328. lockStatus0(){
  329. this.openModalBl=true;
  330. },
  331. loginconfirm(){
  332. this.$refs.refLogin.ashow()
  333. },
  334. operateBtn() {
  335. if(!this.jphelp.getPersonInfo().id){
  336. this.loginBl=true;
  337. }else if(this.floorlockInfo.status==0){
  338. this.lockStatus0()
  339. }else{
  340. if(this.floorlockInfo.lockStatus==4){
  341. this.lockStatus0() //异常
  342. }else if(this.floorlockInfo.lockStatus==1){
  343. //this.lockStatus1() //未使用
  344. this.openLockBl=true;
  345. }else if(this.floorlockInfo.lockStatus==2){
  346. //this.lockStatus2()
  347. //this.closeLockBl=true;
  348. //使用
  349. }else if(this.floorlockInfo.lockStatus==3){
  350. this.lockStatus3() //过程
  351. }
  352. }
  353. },
  354. getFloorlockDetails(bl) {
  355. if (!this.id) {
  356. return
  357. }
  358. if (!bl) {
  359. uni.showLoading({
  360. title: "加载中",
  361. mask: true,
  362. })
  363. }
  364. var obj = {
  365. id: this.id
  366. }
  367. API.floorlockDetails(obj).then((res) => {
  368. this.floorlockInfo = res.data.floorlockInfo
  369. // this.floorlockInfo.status=1;
  370. // this.floorlockInfo.lockStatus=1
  371. if(this.floorlockInfo.parkingPhone){
  372. this.content=this.floorlockInfo.parkingPhone
  373. }
  374. if (res.data.usable) {
  375. uni.setNavigationBarTitle({
  376. title: this.floorlockInfo.parkingName
  377. })
  378. this.loading = true
  379. } else {
  380. this.loading = false
  381. this.permission = true
  382. // #ifdef MP-WEIXIN
  383. uni.setBackgroundColor({
  384. backgroundColor: '#ffffff',
  385. })
  386. // #endif
  387. }
  388. if (!bl) {
  389. uni.hideLoading();
  390. }
  391. }).catch(error => {
  392. uni.hideLoading();
  393. uni.showToast({
  394. title: error,
  395. icon: "none"
  396. })
  397. })
  398. }
  399. },
  400. }
  401. </script>
  402. <style>
  403. page {
  404. background-color: rgba(242, 244, 246, 1);
  405. }
  406. </style>
  407. <style scoped lang="scss">
  408. /* styles.css */
  409. .page-role {
  410. padding-top: 120rpx;
  411. display: flex;
  412. flex-direction: column;
  413. align-items: center;
  414. .img {
  415. width: 500rpx;
  416. height: 500rpx;
  417. }
  418. .text1 {
  419. color: rgba(51, 51, 51, 1);
  420. font-weight: bold;
  421. font-size: 48rpx;
  422. margin-bottom: 16rpx;
  423. }
  424. .text2 {
  425. color: rgba(51, 51, 51, 1);
  426. font-size: 36rpx;
  427. margin-bottom: 200rpx;
  428. }
  429. .botton {
  430. border-radius: 100rpx;
  431. width: 360rpx;
  432. text-align: center;
  433. border: 1px solid rgba(187, 187, 187, 1);
  434. color: rgba(22, 119, 255, 1);
  435. padding: 16rpx;
  436. }
  437. }
  438. .body {
  439. padding: 32rpx;
  440. }
  441. .gradient-header {
  442. height: 0px;
  443. }
  444. .jpback {
  445. height: 400rpx;
  446. background: linear-gradient(180deg, rgba(203, 234, 255, 1) 0%, rgba(203, 234, 255, 0) 100%);
  447. }
  448. .page-top {
  449. padding: 40rpx;
  450. padding-top: 0rpx;
  451. display: flex;
  452. flex-direction: column;
  453. align-items: center;
  454. .name {
  455. width: 320rpx;
  456. height: 320rpx;
  457. display: flex;
  458. align-items: flex-end;
  459. .img {
  460. width: 320rpx;
  461. height: 320rpx;
  462. }
  463. .img2 {
  464. width: 320rpx;
  465. height: 140rpx;
  466. }
  467. }
  468. .value {
  469. //margin-top: 24rpx;
  470. font-size: 40rpx;
  471. font-weight: bold;
  472. color: #333333;
  473. }
  474. }
  475. .page {
  476. border-radius: 16rpx;
  477. background-color: rgba(255, 255, 255, 1);
  478. color: rgba(16, 16, 16, 1);
  479. padding: 32rpx;
  480. margin-bottom: 32rpx;
  481. font-size: 32rpx;
  482. color: rgb(16, 16, 16);
  483. .page-main {
  484. display: flex;
  485. justify-content: space-between;
  486. align-items: center;
  487. .name {
  488. color: rgba(51, 51, 51, 1);
  489. font-size: 36rpx;
  490. display: flex;
  491. flex-direction: column;
  492. .name-info{
  493. font-size: 36rpx;
  494. font-weight: bold;
  495. }
  496. .code-info{
  497. font-size: 24rpx;
  498. color: rgba(119,119,119,1);
  499. }
  500. }
  501. .tags{
  502. .tag {
  503. font-size: 24rpx;
  504. border: 1px solid rgba(187, 187, 187, 1);
  505. border-radius: 4px;
  506. background-color: rgba(22,119,255,1);
  507. color: rgba(255,255,255,1);
  508. padding: 1px 8rpx;
  509. margin-left: 8rpx;
  510. }
  511. .typeN1{
  512. background-color:#1677FF ;
  513. border: 1px solid #1677FF ;
  514. }
  515. .typeN2{
  516. background-color:#8161FF;
  517. border: 1px solid #8161FF;
  518. }
  519. .status1{
  520. background-color:#00B962;
  521. border: 1px solid #00B962;
  522. }
  523. .status0{
  524. background-color:#A7A2A2;
  525. border: 1px solid #A7A2A2;
  526. }
  527. }
  528. }
  529. .page-info{
  530. font-size: 24rpx;
  531. color: #777777;
  532. display: flex;
  533. justify-content: space-between;
  534. }
  535. .page-content {
  536. .step {
  537. margin-bottom: 16rpx;
  538. }
  539. .tip-title {
  540. color: #101010;
  541. font-size: 36rpx;
  542. font-weight: bold;
  543. margin-bottom: 24rpx;
  544. }
  545. .tip1 {
  546. .step {
  547. color: #101010
  548. }
  549. border-bottom: 1px solid rgba(241, 241, 241, 1);
  550. margin-bottom: 24rpx;
  551. padding-bottom: 8rpx;
  552. }
  553. .tip2 {
  554. .step {
  555. color: #333333
  556. }
  557. }
  558. }
  559. }
  560. .jpbutton {
  561. margin-top: 60rpx;
  562. border-radius: 100rpx;
  563. width: 400rpx;
  564. height: 84rpx;
  565. color: #fff;
  566. padding: 8rpx;
  567. display: flex;
  568. align-items: center;
  569. justify-content: center;
  570. font-size: 36rpx;
  571. .img {
  572. margin-right: 8rpx;
  573. width: 36rpx;
  574. height: 32rpx;
  575. }
  576. }
  577. .jpbutton1 {
  578. background-color: #2979FF;
  579. .img {
  580. width: 32rpx;
  581. height: 32rpx;
  582. }
  583. }
  584. .jpbutton2 {
  585. background-color: #2979FF;
  586. .img {
  587. width: 40rpx;
  588. height: 40rpx;
  589. animation: spin 2s linear infinite;
  590. /* 添加无限旋转动画 */
  591. }
  592. /* 定义旋转动画 */
  593. @keyframes spin {
  594. from {
  595. transform: rotate(0deg);
  596. /* 起始角度 */
  597. }
  598. to {
  599. transform: rotate(360deg);
  600. /* 结束角度 */
  601. }
  602. }
  603. }
  604. .jpbutton3 {
  605. background-color: #00B962;
  606. }
  607. .jpbutton4 {
  608. background-color: #A7A2A2;
  609. }
  610. .jpbutton6 {
  611. background-color: #FF7B00;
  612. }
  613. .jpbutton5 {
  614. background-color: #1677FF;
  615. }
  616. .showMessage {
  617. //padding: 24rpx 56rpx;
  618. padding: 40rpx 40rpx 60rpx 40rpx;
  619. .title {
  620. color: rgba(16, 16, 16, 1);
  621. font-size: 36rpx;
  622. margin-top: 32rpx;
  623. text-align: center;
  624. font-weight: bold;
  625. }
  626. .body {
  627. color: rgba(16, 16, 16, 1);
  628. font-size: 32rpx;
  629. padding-bottom: 66rpx;
  630. }
  631. }
  632. .valuestatus{
  633. display: flex;
  634. align-items: center;
  635. justify-content: space-around;
  636. border-radius: 8px;
  637. background: linear-gradient(180deg, rgba(229,240,255,1) 0%,rgba(255,255,255,1) 100%);
  638. color: rgba(16,16,16,1);
  639. font-size: 36rpx;
  640. text-align: center;
  641. box-shadow: 0px 2px 10px 0px rgba(110,170,255,0.5);
  642. border: 1px solid rgba(255,255,255,1);
  643. width: 686rpx;
  644. height: 120rpx;
  645. .bo1{
  646. width: 230rpx;
  647. display: flex;
  648. align-items: center;
  649. img{
  650. height: 48rpx;
  651. width: 48rpx;
  652. }
  653. }
  654. .bo2{
  655. height: 40rpx;
  656. border-left: 1px solid #9DA2A9 ;
  657. }
  658. span{
  659. margin-left: 16rpx;
  660. }
  661. }
  662. </style>