infoLock.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651
  1. <template>
  2. <view class="jpmain ">
  3. <view class="gradient-header">
  4. <view class="jpback">
  5. </view>
  6. </view>
  7. <view class="body">
  8. <view class="page-top">
  9. <!-- <view class="text1">地锁名称</view> -->
  10. <!-- @click="gotoUrl('pages/mylock/editLock?id='+id)" -->
  11. <view class="text2" >{{
  12. floorlockInfo.name
  13. }}<!-- <u-icon name="edit-pen" size="32" color="#FFFFFF"></u-icon> -->
  14. </view>
  15. </view>
  16. <view class="page">
  17. <view class="info-title">
  18. <view class="name">设备信息</view>
  19. <view class="value">
  20. <view class="pack-up" v-show="listShow" @click="listShow=false">
  21. 收起<u-icon name="arrow-up" size="32" color="#AAAAAA"></u-icon>
  22. </view>
  23. <view class="pack-up" v-if="!listShow" @click="listShow=true">
  24. 展开<u-icon name="arrow-down" size="32" color="#AAAAAA"></u-icon>
  25. </view>
  26. </view>
  27. </view>
  28. <view class="table">
  29. <view class="row">
  30. <view class="name">设备型号</view>
  31. <view class="value">{{floorlockInfo.model}}</view>
  32. </view>
  33. <view class="row">
  34. <view class="name">出厂编号</view>
  35. <view class="value">{{floorlockInfo.factoryNumber}}</view>
  36. </view>
  37. <template v-if="!listShow">
  38. <view class="row">
  39. <view class="name">固件版号</view>
  40. <view class="value">{{floorlockInfo.solidVersion}}</view>
  41. </view>
  42. <view class="row">
  43. <view class="name">防护等级</view>
  44. <view class="value">{{floorlockInfo.protectionGrade}}</view>
  45. </view>
  46. <view class="row" v-if="0">
  47. <view class="name">输入电压</view>
  48. <view class="value">{{floorlockInfo.inputVoltage}}</view>
  49. </view>
  50. <view class="row" v-if="0">
  51. <view class="name">输出电压</view>
  52. <view class="value">{{floorlockInfo.outputVoltage}}</view>
  53. </view>
  54. <view class="row" v-if="0">
  55. <view class="name">输出电流</view>
  56. <view class="value">{{floorlockInfo.outputCurrent}}</view>
  57. </view>
  58. <view class="row" v-if="0">
  59. <view class="name">输出功率</view>
  60. <view class="value">{{floorlockInfo.outputPower}}</view>
  61. </view>
  62. <view class="row">
  63. <view class="name">生产日期</view>
  64. <view class="value">{{floorlockInfo.manufactureDate}}</view>
  65. </view>
  66. <view class="row">
  67. <view class="name">标准依据</view>
  68. <view class="value">{{floorlockInfo.standardBasis}}</view>
  69. </view>
  70. <view class="row">
  71. <view class="name">联网卡号</view>
  72. <view class="value">{{floorlockInfo.internetCard}}</view>
  73. </view>
  74. <view class="row">
  75. <view class="name">资费标准</view>
  76. <view class="value">{{floorlockInfo.tariffStandard}}</view>
  77. </view>
  78. <view class="row">
  79. <view class="name">设备启动时间</view>
  80. <view class="value">{{floorlockInfo.activationTime}}</view>
  81. </view>
  82. <view class="row">
  83. <view class="name">设备质保期</view>
  84. <view class="value">{{floorlockInfo.shelfLife}}</view>
  85. </view>
  86. </template>
  87. </view>
  88. </view>
  89. <view class="page">
  90. <view class="info-title">
  91. <view class="name">联网信息</view>
  92. <view class="value">
  93. </view>
  94. </view>
  95. <view class="table">
  96. <view class="row">
  97. <view class="name">联网卡号</view>
  98. <view class="value">{{floorlockInfo.internetCard}}</view>
  99. </view>
  100. <view class="row">
  101. <view class="name">有效期至</view>
  102. <view class="value">{{floorlockInfo.cardExpirationDate?floorlockInfo.cardExpirationDate.split(' ')[0]:''}}
  103. </view>
  104. </view>
  105. <view class="tips">
  106. <u-icon style=" margin-top: 2px;" size="30" name="info-circle"></u-icon>
  107. <view>
  108. 地锁内含物联网卡,此卡随设备出厂时赠送三年免费使用时长,三年后将按5元/月资费标准收取费用。
  109. </view>
  110. </view>
  111. </view>
  112. </view>
  113. <view class="page">
  114. <view class="info-title">
  115. <view class="name">充电白名单<span class="span">({{whiteList.length}}/3)</span></view>
  116. <view class="value" @click="addUser()">
  117. <u-icon style=" margin-top: 2px;" size="30" name="plus"></u-icon> 添加
  118. </view>
  119. </view>
  120. <view class="table">
  121. <view class="table_v">
  122. <view class="table_tr">
  123. <view class="table_td">姓名</view>
  124. <view class="table_td">手机号</view>
  125. <view class="table_td">车牌号</view>
  126. <view class="table_td">操作</view>
  127. </view>
  128. <view class="table_tr" v-for="(item,i) in whiteList" :key="i">
  129. <view class="table_td">{{item.nickName}}</view>
  130. <view class="table_td">{{item.phone}}</view>
  131. <view class="table_td">{{item.carNumber==0?'':item.carNumber}}</view>
  132. <view class="table_td" style="color:#1677FF;white-space: pre;" @click="editUser(item)">修改</view>
  133. </view>
  134. </view>
  135. </view>
  136. </view>
  137. </view>
  138. <u-popup v-model="popupShow" mode="bottom" :closeable="true" border-radius="30">
  139. <view class="popup-screen">
  140. <u-keyboard ref="uKeyboard" @change="valChange" @backspace="backspace"
  141. :tips="vipUser.carNumber?vipUser.carNumber:'请输入车牌号'"
  142. mode="car" v-model="carshow" :abc="abc" ></u-keyboard>
  143. <view class="popup-title">{{vipUser.id?'修改':'添加'}}白名单信息</view>
  144. <view style="padding: 4px;">白名单车主姓名<span style="color: red;">*</span></view>
  145. <u-input :customStyle="customStyle" v-model="vipUser.nickName" placeholder="白名单车主姓名(必填)"></u-input>
  146. <view style="padding: 4px;">白名单车主手机号码<span style="color: red;">*</span></view>
  147. <u-input :customStyle="customStyle" type="number" v-model="vipUser.phone"
  148. placeholder="白名单车主手机号码(必填)"></u-input>
  149. <view style="padding: 4px;">白名单车主车牌号</view>
  150. <!-- <u-input :customStyle="customStyle" v-model="vipUser.carNumber" placeholder="白名单车主车牌号"></u-input> -->
  151. <view class="carNumber" @click="carshow=true,valInit(1)"
  152. :class="{
  153. 'carNumber1':!vipUser.carNumber
  154. }">
  155. {{vipUser.carNumber?vipUser.carNumber:'白名单车主车牌号'}}
  156. </view>
  157. <view v-if="vipUser.id" style="display: flex;">
  158. <u-button type="info" style="margin-top: 10px;width: 49%;" shape="circle"
  159. @click="delUser()">删除</u-button>
  160. <u-button type="success" style="margin-top: 10px;width: 49%;" shape="circle"
  161. @click="submitUser()">保存</u-button>
  162. </view>
  163. <view v-else>
  164. <u-button type="success" style="margin-top: 10px;" shape="circle"
  165. @click="submitUser()">保存</u-button>
  166. </view>
  167. </view>
  168. </u-popup>
  169. <u-modal v-model="delShow" @confirm="confirmDelete" confirm-color="#fa3534" :show-cancel-button="true"
  170. ref="uModal" title="删除白名单用户" content="是否删除当前白名单用户?" confirm-text="删除"></u-modal>
  171. <view class="floating-button">
  172. <view class="button" @click="gotoUrl('/pages/deviceTab/dataLock?id='+id)" >
  173. 查看地锁
  174. </view>
  175. </view>
  176. </view>
  177. </template>
  178. <script>
  179. import * as API from '@/apis/pagejs/index.js'
  180. export default {
  181. data() {
  182. return {
  183. id: "",
  184. floorlockInfo: {},
  185. listShow: true,
  186. popupShow: false,
  187. customStyle: {
  188. "border-radius": "50px",
  189. "background-color": 'rgba(242, 244, 246, 1)',
  190. padding: "5px 20px",
  191. margin: "5px 0 ",
  192. },
  193. abc:false,
  194. whiteList: [],
  195. vipUser: {},
  196. delShow: false,
  197. obj: {},
  198. carshow: false,
  199. };
  200. },
  201. onLoad(op) {
  202. this.id = op.id
  203. this.getFloorlockDetails()
  204. },
  205. methods: {
  206. valInit(bl){
  207. if(bl){
  208. this.abc=this.vipUser.carNumber.length>0
  209. }else{
  210. if(this.vipUser.carNumber.length==1&&this.abc==false){
  211. this.abc=true
  212. }
  213. if(this.vipUser.carNumber.length==0&&this.abc==true){
  214. this.abc=false
  215. }
  216. }
  217. },
  218. valChange(val){
  219. if(this.vipUser.carNumber.length>=8){
  220. return
  221. }
  222. this.vipUser.carNumber+=val
  223. this.valInit()
  224. this.$forceUpdate()
  225. },
  226. backspace(){
  227. //
  228. var value=this.vipUser.carNumber
  229. if(value.length){
  230. value = value.substr(0, value.length - 1);
  231. }
  232. this.vipUser.carNumber=value
  233. this.valInit()
  234. },
  235. getFloorlockDetails() {
  236. uni.showLoading({
  237. title: "加载中",
  238. mask: true,
  239. })
  240. var obj = {
  241. id: this.id
  242. }
  243. API.floorlockDetails(obj).then((res) => {
  244. this.floorlockInfo = res.data.floorlockInfo
  245. uni.hideLoading();
  246. this.getWhiteList()
  247. }).catch(error => {
  248. uni.hideLoading();
  249. uni.showToast({
  250. title: error,
  251. icon: "none"
  252. })
  253. })
  254. },
  255. getWhiteList(bl) {
  256. if (bl) {
  257. uni.showLoading({
  258. title: "加载中",
  259. mask: true,
  260. })
  261. }
  262. API.whiteList({
  263. floorlockId: this.id
  264. }).then((res) => {
  265. this.whiteList = res.data.whiteList
  266. if (bl) {
  267. uni.hideLoading()
  268. uni.showToast({
  269. title: "操作成功"
  270. })
  271. }
  272. }).catch(error => {
  273. uni.showToast({
  274. title: error
  275. })
  276. })
  277. },
  278. submitUser() {
  279. if (!this.vipUser.nickName) {
  280. uni.showToast({
  281. title: "请填写白名单车主姓名"
  282. })
  283. return
  284. }
  285. if (!this.vipUser.phone) {
  286. uni.showToast({
  287. title: "请填写白名单车主手机号码"
  288. })
  289. return
  290. }
  291. uni.showLoading({
  292. title: "加载中",
  293. mask: true,
  294. })
  295. this.vipUser.name = this.vipUser.nickName
  296. API.addWhite(this.vipUser).then((res) => {
  297. //this.obj = res.data
  298. uni.hideLoading()
  299. this.delShow = false
  300. this.popupShow = false
  301. this.getWhiteList(1)
  302. }).catch(error => {
  303. uni.showToast({
  304. title: error
  305. })
  306. })
  307. },
  308. confirmDelete() {
  309. uni.showLoading({
  310. title: "加载中",
  311. mask: true,
  312. })
  313. API.deleteWhite({
  314. id: this.vipUser.id
  315. }).then((res) => {
  316. //this.obj = res.data
  317. uni.hideLoading()
  318. this.delShow = false
  319. this.popupShow = false
  320. uni.showToast({
  321. title: "操作成功"
  322. })
  323. this.getWhiteList(1)
  324. }).catch(error => {
  325. uni.showToast({
  326. title: error
  327. })
  328. })
  329. },
  330. delUser() {
  331. this.delShow = true;
  332. },
  333. editUser(item) {
  334. this.popupShow = true;
  335. this.vipUser = item;
  336. this.vipUser.nickName = item.nickName
  337. this.vipUser.floorlockId = this.id
  338. if (this.vipUser.carNumber == 0) {
  339. this.vipUser.carNumber = ''
  340. }
  341. },
  342. addUser() {
  343. if (this.whiteList.length >= 3) {
  344. uni.showToast({
  345. title: "添加白名单用户已达到上限"
  346. })
  347. return
  348. }
  349. this.popupShow = true;
  350. this.vipUser = {
  351. carNumber:""
  352. }
  353. this.vipUser.floorlockId = this.id
  354. },
  355. }
  356. }
  357. </script>
  358. <style>
  359. page {
  360. background-color: rgba(242, 244, 246, 1);
  361. }
  362. </style>
  363. <style lang="scss" scoped>
  364. .gradient-header {
  365. height: 0px;
  366. }
  367. .jpback {
  368. height: 360rpx;
  369. background: linear-gradient(180deg, rgba(22, 119, 255, 1) 11%, rgba(242, 244, 246, 1) 100%);
  370. }
  371. .body {
  372. padding: 32rpx 32rpx 120rpx 32px;
  373. //padding-bottom: ;
  374. }
  375. .page-top {
  376. color: rgba(255, 255, 255, 1);
  377. margin: 48rpx 0;
  378. .text1 {
  379. font-size: 36rpx;
  380. margin-bottom: 12rpx;
  381. }
  382. .text2 {
  383. font-size: 40rpx;
  384. }
  385. }
  386. .page {
  387. border-radius: 16rpx;
  388. background-color: rgba(255, 255, 255, 1);
  389. color: rgba(16, 16, 16, 1);
  390. padding: 32rpx;
  391. margin-bottom: 32rpx;
  392. font-size: 32rpx;
  393. color: rgb(16, 16, 16);
  394. .info-title {
  395. display: flex;
  396. justify-content: space-between;
  397. padding-bottom: 24rpx;
  398. .name {
  399. font-size: 36rpx;
  400. color: rgba(51, 51, 51, 1);
  401. font-weight: bold;
  402. .span {
  403. font-weight: 400;
  404. font-size: 28rpx;
  405. color: rgba(119, 119, 119, 1);
  406. }
  407. }
  408. .value {
  409. font-size: 28rpx;
  410. color: rgba(119, 119, 119, 1);
  411. }
  412. }
  413. .pack-up {
  414. color: rgba(119, 119, 119, 100);
  415. }
  416. .tips {
  417. margin-top: 12rpx;
  418. display: flex;
  419. align-items: flex-start;
  420. font-size: 24rpx;
  421. }
  422. .table {
  423. .table_v {
  424. width: 100%;
  425. }
  426. .table_tr {
  427. display: flex;
  428. justify-content: space-between;
  429. }
  430. .row {
  431. display: flex;
  432. align-items: center;
  433. height: 72rpx;
  434. font-size: 28rpx;
  435. padding: 0 24rpx;
  436. .name {
  437. width: 240rpx;
  438. }
  439. }
  440. .table_td {
  441. height: 72rpx;
  442. font-size: 28rpx;
  443. display: flex;
  444. align-items: center;
  445. }
  446. /* 隔行变色: 偶数行设置背景色 */
  447. .row:nth-child(odd) {
  448. background-color: #f9f9f9;
  449. /* 偶数行 */
  450. }
  451. .table_tr:nth-child(odd) {
  452. background-color: #f9f9f9;
  453. /* 偶数行 */
  454. }
  455. .row:nth-child(even) {
  456. background-color: #ffffff;
  457. /* 奇数行 */
  458. }
  459. .table_tr:nth-child(even) {
  460. background-color: #ffffff;
  461. /* 奇数行 */
  462. }
  463. }
  464. }
  465. /deep/.u-keyboard-grids-btn:nth-child(15){
  466. background-color: red;
  467. }
  468. .popup-screen {
  469. padding: 40rpx 40rpx 60rpx 40rpx;
  470. .carNumber {
  471. background-color: #F2F4F6;
  472. padding: 5px 20px;
  473. margin: 5px 0 15px 0;
  474. height: 90rpx;
  475. display: flex;
  476. align-items: center;
  477. border-radius: 50px;
  478. }
  479. .carNumber1{
  480. color: #bcbcbc;
  481. }
  482. .popup-title {
  483. font-size: 36rpx;
  484. color: rgba(51, 51, 51, 1);
  485. font-weight: bold;
  486. padding-bottom: 10px;
  487. }
  488. .cardList {
  489. display: flex;
  490. justify-content: space-evenly;
  491. .cardInfo {
  492. display: flex;
  493. flex-direction: column;
  494. justify-content: center;
  495. width: 160rpx;
  496. height: 160rpx;
  497. border-radius: 8px;
  498. background-color: rgba(255, 255, 255, 1);
  499. text-align: center;
  500. border: 1px solid rgba(187, 187, 187, 1);
  501. .name {
  502. color: rgba(16, 16, 16, 1);
  503. font-size: 28rpx;
  504. }
  505. .price {
  506. color: rgba(16, 16, 16, 1);
  507. font-size: 48rpx;
  508. font-weight: bold;
  509. }
  510. }
  511. .cardInfoCk {
  512. background-color: rgba(225, 247, 237, 1);
  513. border: 1px solid rgba(0, 185, 98, 1);
  514. .price {
  515. color: rgba(0, 161, 85, 1);
  516. }
  517. }
  518. }
  519. }
  520. .floating-button {
  521. position: fixed;
  522. bottom: 0;
  523. /* 距离底部 20px */
  524. width: 100%;
  525. display: flex;
  526. height: 120rpx;
  527. justify-content: center;
  528. background-color: rgba(255, 255, 255, 1);
  529. .button {
  530. margin-top: 24rpx;
  531. border-radius: 50px;
  532. height: 80rpx;
  533. width: 80%;
  534. display: flex;
  535. align-items: center;
  536. justify-content: center;
  537. padding: 12rpx;
  538. background-color: rgba(22, 119, 255, 1);
  539. color: rgba(255, 255, 255, 1);
  540. font-size: 36rpx;
  541. }
  542. }
  543. </style>