infoLock.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676
  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. <!---->
  11. <view class="text2" @click="gotoUrl('pages/mylock/editLock?id='+id)" >{{
  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-down" size="32" color="#AAAAAA"></u-icon>
  22. </view>
  23. <view class="pack-up" v-if="!listShow" @click="listShow=true">
  24. 收起<u-icon name="arrow-up" 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" v-if="floorlockInfo.tariffStandard">
  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" v-if="floorlockInfo.shelfLife">
  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" v-if="floorlockInfo.tariffStandard">
  106. <u-icon style=" margin-top: 2px;" size="30" name="info-circle"></u-icon>
  107. <view>
  108. 地锁内含物联网卡,此卡随地锁出厂时赠送三年免费使用时长,三年后将按{{floorlockInfo.tariffStandard}}元/月资费标准收取费用。
  109. </view>
  110. </view>
  111. </view>
  112. </view>
  113. <view class="page">
  114. <view class="info-title">
  115. <view class="name">车位白名单<span class="span" v-if="0">({{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 table_td1">姓名</view>
  124. <view class="table_td table_td2">手机号</view>
  125. <view class="table_td table_td3">车牌号</view>
  126. <view class="table_td table_td4">操作</view>
  127. </view>
  128. <view class="table_tr" v-for="(item,i) in whiteList" :key="i">
  129. <view class="table_td table_td1">{{item.nickName}}</view>
  130. <view class="table_td table_td2">{{item.phone}}</view>
  131. <view class="table_td table_td3">{{item.carNumber?item.carNumber:''}}</view>
  132. <view class="table_td table_td4" 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" maxlength="8" v-model="vipUser.nickName" placeholder="白名单车主姓名(必填)"></u-input>
  146. <view style="padding: 4px;">白名单车主手机号码<span style="color: red;">*</span></view>
  147. <u-input :customStyle="customStyle" maxlength="13" 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/business/lockInfo?id='+id)" >
  173. 查看地锁
  174. </view>
  175. </view>
  176. </view>
  177. </template>
  178. <script>
  179. import * as API from '@/apis/pagejs/mylock.js'
  180. export default {
  181. components: {
  182. //'u-button': () => import('@/uni_modules/uview-ui/components/u-button/u-button'),
  183. //'u-keyboard': () => import('@/uni_modules/uview-ui/components/u-keyboard/u-keyboard'),
  184. //'u-popup': () => import('@/uni_modules/uview-ui/components/u-popup/u-popup'),
  185. //'u-modal': () => import('@/uni_modules/uview-ui/components/u-modal/u-modal'),
  186. //'u-input': () => import('@/uni_modules/uview-ui/components/u-input/u-input'),
  187. },
  188. data() {
  189. return {
  190. id: "",
  191. floorlockInfo: {},
  192. listShow: true,
  193. popupShow: false,
  194. customStyle: {
  195. "border-radius": "50px",
  196. "background-color": 'rgba(242, 244, 246, 1)',
  197. padding: "5px 20px",
  198. margin: "5px 0 ",
  199. },
  200. abc:false,
  201. whiteList: [],
  202. vipUser: {},
  203. delShow: false,
  204. obj: {},
  205. carshow: false,
  206. };
  207. },
  208. onLoad(op) {
  209. this.id = op.id
  210. },
  211. onShow(){
  212. this.getFloorlockDetails()
  213. },
  214. methods: {
  215. valInit(bl){
  216. if(bl){
  217. this.abc=this.vipUser.carNumber.length>0
  218. }else{
  219. if(this.vipUser.carNumber.length==1&&this.abc==false){
  220. this.abc=true
  221. }
  222. if(this.vipUser.carNumber.length==0&&this.abc==true){
  223. this.abc=false
  224. }
  225. }
  226. },
  227. valChange(val){
  228. if(this.vipUser.carNumber.length>=8){
  229. return
  230. }
  231. this.vipUser.carNumber+=val
  232. this.valInit()
  233. this.$forceUpdate()
  234. },
  235. backspace(){
  236. //
  237. var value=this.vipUser.carNumber
  238. if(value.length){
  239. value = value.substr(0, value.length - 1);
  240. }
  241. this.vipUser.carNumber=value
  242. this.valInit()
  243. },
  244. getFloorlockDetails() {
  245. uni.showLoading({
  246. title: "加载中",
  247. mask: true,
  248. })
  249. var obj = {
  250. id: this.id
  251. }
  252. API.floorlockDetails(obj).then((res) => {
  253. this.floorlockInfo = res.data.floorlockInfo
  254. uni.hideLoading();
  255. this.getWhiteList()
  256. }).catch(error => {
  257. uni.hideLoading();
  258. uni.showToast({
  259. title: error,
  260. icon: "none"
  261. })
  262. })
  263. },
  264. getWhiteList(bl) {
  265. if (bl) {
  266. uni.showLoading({
  267. title: "加载中",
  268. mask: true,
  269. })
  270. }
  271. API.whiteList({
  272. floorlockId: this.id
  273. }).then((res) => {
  274. this.whiteList = res.data.whiteList
  275. if (bl) {
  276. uni.hideLoading()
  277. uni.showToast({
  278. title: "操作成功"
  279. })
  280. }
  281. }).catch(error => {
  282. uni.showToast({
  283. title: error
  284. })
  285. })
  286. },
  287. submitUser() {
  288. if (!this.vipUser.nickName) {
  289. uni.showToast({
  290. title: "请填写白名单车主姓名"
  291. })
  292. return
  293. }
  294. if (!this.vipUser.phone) {
  295. uni.showToast({
  296. title: "请填写白名单车主手机号码"
  297. })
  298. return
  299. }
  300. uni.showLoading({
  301. title: "加载中",
  302. mask: true,
  303. })
  304. this.vipUser.name = this.vipUser.nickName
  305. API.addWhite(this.vipUser).then((res) => {
  306. //this.obj = res.data
  307. uni.hideLoading()
  308. this.delShow = false
  309. this.popupShow = false
  310. this.getWhiteList(1)
  311. }).catch(error => {
  312. uni.showToast({
  313. title: error
  314. })
  315. })
  316. },
  317. confirmDelete() {
  318. uni.showLoading({
  319. title: "加载中",
  320. mask: true,
  321. })
  322. API.deleteWhite({
  323. id: this.vipUser.id
  324. }).then((res) => {
  325. //this.obj = res.data
  326. uni.hideLoading()
  327. this.delShow = false
  328. this.popupShow = false
  329. uni.showToast({
  330. title: "操作成功"
  331. })
  332. this.getWhiteList(1)
  333. }).catch(error => {
  334. uni.showToast({
  335. title: error
  336. })
  337. })
  338. },
  339. delUser() {
  340. this.delShow = true;
  341. },
  342. editUser(item) {
  343. this.popupShow = true;
  344. this.vipUser = item;
  345. this.vipUser.nickName = item.nickName
  346. this.vipUser.floorlockId = this.id
  347. if (this.vipUser.carNumber == 0) {
  348. this.vipUser.carNumber = ''
  349. }
  350. },
  351. addUser() {
  352. // if (this.whiteList.length >= 3) {
  353. // uni.showToast({
  354. // title: "添加白名单用户已达到上限"
  355. // })
  356. // return
  357. // }
  358. this.popupShow = true;
  359. this.vipUser = {
  360. carNumber:""
  361. }
  362. this.vipUser.floorlockId = this.id
  363. },
  364. }
  365. }
  366. </script>
  367. <style>
  368. page {
  369. background-color: rgba(242, 244, 246, 1);
  370. }
  371. </style>
  372. <style lang="scss" scoped>
  373. .gradient-header {
  374. height: 0px;
  375. }
  376. .jpback {
  377. height: 360rpx;
  378. background: linear-gradient(180deg, rgba(22, 119, 255, 1) 11%, rgba(242, 244, 246, 1) 100%);
  379. }
  380. .body {
  381. padding: 32rpx 32rpx 120rpx 32rpx;
  382. //padding-bottom: ;
  383. }
  384. .page-top {
  385. color: rgba(255, 255, 255, 1);
  386. margin: 48rpx 0;
  387. .text1 {
  388. font-size: 36rpx;
  389. margin-bottom: 12rpx;
  390. }
  391. .text2 {
  392. font-size: 40rpx;
  393. }
  394. }
  395. .page {
  396. border-radius: 16rpx;
  397. background-color: rgba(255, 255, 255, 1);
  398. color: rgba(16, 16, 16, 1);
  399. padding: 32rpx;
  400. margin-bottom: 32rpx;
  401. font-size: 32rpx;
  402. color: rgb(16, 16, 16);
  403. .info-title {
  404. display: flex;
  405. justify-content: space-between;
  406. padding-bottom: 24rpx;
  407. .name {
  408. font-size: 36rpx;
  409. color: rgba(51, 51, 51, 1);
  410. font-weight: bold;
  411. .span {
  412. font-weight: 400;
  413. font-size: 28rpx;
  414. color: rgba(119, 119, 119, 1);
  415. }
  416. }
  417. .value {
  418. font-size: 28rpx;
  419. color: rgba(119, 119, 119, 1);
  420. }
  421. }
  422. .pack-up {
  423. color: rgba(119, 119, 119, 100);
  424. }
  425. .tips {
  426. margin-top: 12rpx;
  427. display: flex;
  428. align-items: flex-start;
  429. font-size: 24rpx;
  430. }
  431. .table {
  432. .table_v {
  433. width: 100%;
  434. }
  435. .table_tr {
  436. display: flex;
  437. justify-content: space-between;
  438. }
  439. .row {
  440. display: flex;
  441. align-items: center;
  442. height: 72rpx;
  443. font-size: 28rpx;
  444. padding: 0 24rpx;
  445. .name {
  446. width: 240rpx;
  447. }
  448. }
  449. .table_td {
  450. height: 72rpx;
  451. font-size: 28rpx;
  452. display: flex;
  453. align-items: center;
  454. }
  455. .table_td1{
  456. width: 30%;
  457. }
  458. .table_td2{
  459. width: 30%;
  460. }
  461. .table_td3{
  462. width: 30%;
  463. }
  464. .table_td4{
  465. width: 10%;
  466. }
  467. /* 隔行变色: 偶数行设置背景色 */
  468. .row:nth-child(odd) {
  469. background-color: #f9f9f9;
  470. /* 偶数行 */
  471. }
  472. .table_tr:nth-child(odd) {
  473. background-color: #f9f9f9;
  474. /* 偶数行 */
  475. }
  476. .row:nth-child(even) {
  477. background-color: #ffffff;
  478. /* 奇数行 */
  479. }
  480. .table_tr:nth-child(even) {
  481. background-color: #ffffff;
  482. /* 奇数行 */
  483. }
  484. }
  485. }
  486. ::v-deep.u-keyboard-grids-btn:nth-child(15){
  487. background-color: red;
  488. }
  489. .popup-screen {
  490. padding: 40rpx 40rpx 60rpx 40rpx;
  491. .carNumber {
  492. background-color: #F2F4F6;
  493. padding: 5px 20px;
  494. margin: 5px 0 15px 0;
  495. height: 90rpx;
  496. display: flex;
  497. align-items: center;
  498. border-radius: 50px;
  499. }
  500. .carNumber1{
  501. color: #bcbcbc;
  502. }
  503. .popup-title {
  504. font-size: 36rpx;
  505. color: rgba(51, 51, 51, 1);
  506. font-weight: bold;
  507. padding-bottom: 10px;
  508. }
  509. .cardList {
  510. display: flex;
  511. justify-content: space-evenly;
  512. .cardInfo {
  513. display: flex;
  514. flex-direction: column;
  515. justify-content: center;
  516. width: 160rpx;
  517. height: 160rpx;
  518. border-radius: 8px;
  519. background-color: rgba(255, 255, 255, 1);
  520. text-align: center;
  521. border: 1px solid rgba(187, 187, 187, 1);
  522. .name {
  523. color: rgba(16, 16, 16, 1);
  524. font-size: 28rpx;
  525. }
  526. .price {
  527. color: rgba(16, 16, 16, 1);
  528. font-size: 48rpx;
  529. font-weight: bold;
  530. }
  531. }
  532. .cardInfoCk {
  533. background-color: rgba(225, 247, 237, 1);
  534. border: 1px solid rgba(0, 185, 98, 1);
  535. .price {
  536. color: rgba(0, 161, 85, 1);
  537. }
  538. }
  539. }
  540. }
  541. .floating-button {
  542. position: fixed;
  543. bottom: 0;
  544. /* 距离底部 20px */
  545. width: 100%;
  546. display: flex;
  547. height: 120rpx;
  548. justify-content: center;
  549. background-color: rgba(255, 255, 255, 1);
  550. .button {
  551. margin-top: 24rpx;
  552. border-radius: 50px;
  553. height: 80rpx;
  554. width: 80%;
  555. display: flex;
  556. align-items: center;
  557. justify-content: center;
  558. padding: 12rpx;
  559. background-color: rgba(22, 119, 255, 1);
  560. color: rgba(255, 255, 255, 1);
  561. font-size: 36rpx;
  562. }
  563. }
  564. </style>