infoLock.vue 14 KB

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