infoLock.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545
  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">({{vipUserList.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 vipUserList" :key="i">
  125. <td>{{item.userName}}</td>
  126. <td>{{item.phone}}</td>
  127. <td>{{item.carNum==0?'':item.carNum}}</td>
  128. <td class="" style="color:#1677FF" @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. <view class="popup-title">{{vipUser.id?'修改':'添加'}}白名单信息</view>
  137. <view style="padding: 4px;">白名单车主姓名<span style="color: red;">*</span></view>
  138. <u-input :customStyle="customStyle" v-model="vipUser.name" placeholder="白名单车主姓名(必填)"></u-input>
  139. <view style="padding: 4px;">白名单车主手机号码<span style="color: red;">*</span></view>
  140. <u-input :customStyle="customStyle" type="number" v-model="vipUser.phone"
  141. placeholder="白名单车主手机号码(必填)"></u-input>
  142. <view style="padding: 4px;">白名单车主车牌号</view>
  143. <u-input :customStyle="customStyle" v-model="vipUser.carNum" placeholder="白名单车主车牌号"></u-input>
  144. <view v-if="vipUser.id" style="display: flex;">
  145. <u-button type="info" style="margin-top: 10px;width: 49%;" shape="circle"
  146. @click="delUser()">删除</u-button>
  147. <u-button type="success" style="margin-top: 10px;width: 49%;" shape="circle"
  148. @click="submitUser()">保存</u-button>
  149. </view>
  150. <view v-else>
  151. <u-button type="success" style="margin-top: 10px;" shape="circle"
  152. @click="submitUser()">保存</u-button>
  153. </view>
  154. </view>
  155. </u-popup>
  156. <u-modal v-model="delShow" @confirm="confirmDelete" confirm-color="#fa3534" :show-cancel-button="true"
  157. ref="uModal" title="删除白名单用户" content="是否删除当前白名单用户?" confirm-text="删除"></u-modal>
  158. <view class="floating-button">
  159. <view class="button">
  160. 保存
  161. </view>
  162. </view>
  163. </view>
  164. </template>
  165. <script>
  166. import * as API from '@/apis/pagejs/mylock.js'
  167. export default {
  168. data() {
  169. return {
  170. listShow: true,
  171. popupShow: false,
  172. customStyle: {
  173. "border-radius": "50px",
  174. "background-color": 'rgba(242, 244, 246, 1)',
  175. padding: "5px 20px",
  176. margin: "5px 0 "
  177. },
  178. applyList: [],
  179. vipUserList: [],
  180. vipUser: {},
  181. delShow: false,
  182. obj: {},
  183. };
  184. },
  185. onLoad(op) {
  186. //this.myApplyList()
  187. },
  188. methods: {
  189. submitUser() {
  190. if (!this.vipUser.name) {
  191. uni.showToast({
  192. title: "请填写白名单车主姓名"
  193. })
  194. return
  195. }
  196. if (!this.vipUser.phone) {
  197. uni.showToast({
  198. title: "请填写白名单车主手机号码"
  199. })
  200. return
  201. }
  202. uni.showLoading({
  203. title: "加载中",
  204. mask: true,
  205. })
  206. API_apply.saveVipUser(this.vipUser).then((res) => {
  207. //this.obj = res.data
  208. uni.hideLoading()
  209. this.delShow = false
  210. this.popupShow = false
  211. this.findVipUser(1)
  212. }).catch(error => {
  213. uni.showToast({
  214. title: error
  215. })
  216. })
  217. },
  218. confirmDelete() {
  219. uni.showLoading({
  220. title: "加载中",
  221. mask: true,
  222. })
  223. API_apply.deleteVipUser({
  224. id: this.vipUser.id
  225. }).then((res) => {
  226. //this.obj = res.data
  227. uni.hideLoading()
  228. this.delShow = false
  229. this.popupShow = false
  230. uni.showToast({
  231. title: "操作成功"
  232. })
  233. this.findVipUser(1)
  234. }).catch(error => {
  235. uni.showToast({
  236. title: error
  237. })
  238. })
  239. },
  240. delUser() {
  241. this.delShow = true;
  242. },
  243. editUser(item) {
  244. this.popupShow = true;
  245. this.vipUser = item;
  246. this.vipUser.name = item.userName
  247. var item = this.applyList[0]
  248. this.vipUser.stationId = item.stationId
  249. if (this.vipUser.carNum == 0) {
  250. this.vipUser.carNum = ''
  251. }
  252. },
  253. addUser() {
  254. if (this.vipUserList.length >= 3) {
  255. uni.showToast({
  256. title: "添加白名单用户已达到上限"
  257. })
  258. return
  259. }
  260. this.popupShow = true;
  261. this.vipUser = {}
  262. var item = this.applyList[0]
  263. this.vipUser.stationId = item.stationId
  264. },
  265. findDeviceByNo() {
  266. var item = this.applyList[0]
  267. API_apply.findDeviceByNoD({
  268. deviceNo: item.deviceNo
  269. }).then((res) => {
  270. this.obj = res.data.chargingDevice
  271. uni.hideLoading()
  272. }).catch(error => {
  273. uni.showToast({
  274. title: error
  275. })
  276. })
  277. },
  278. findVipUser(bl) {
  279. if (bl) {
  280. uni.showLoading({
  281. title: "加载中",
  282. mask: true,
  283. })
  284. }
  285. var item = this.applyList[0]
  286. this.vipUserList = []
  287. API_apply.findVipUser({
  288. stationId: item.stationId
  289. }).then((res) => {
  290. if (bl) {
  291. uni.hideLoading()
  292. uni.showToast({
  293. title: "操作成功"
  294. })
  295. }
  296. this.vipUserList = res.data.vipUserList
  297. }).catch(error => {
  298. uni.showToast({
  299. title: error
  300. })
  301. })
  302. },
  303. myApplyList() {
  304. uni.showLoading({
  305. title: "加载中",
  306. mask: true,
  307. })
  308. API_apply.myApplyList({
  309. }).then((res) => {
  310. //this.obj = res.data
  311. this.applyList = res.data.applyList;
  312. this.findVipUser()
  313. this.findDeviceByNo()
  314. }).catch(error => {
  315. uni.showToast({
  316. title: error
  317. })
  318. })
  319. },
  320. }
  321. }
  322. </script>
  323. <style>
  324. page {
  325. background-color: rgba(242, 244, 246, 1);
  326. }
  327. </style>
  328. <style lang="scss" scoped>
  329. .gradient-header {
  330. height: 0px;
  331. }
  332. .jpback {
  333. height: 360rpx;
  334. background: linear-gradient(180deg, rgba(22,119,255,1) 11%,rgba(242,244,246,1) 100%); }
  335. .body {
  336. padding: 32rpx;
  337. }
  338. .page-top{
  339. color: rgba(255,255,255,1);
  340. margin: 48rpx 0;
  341. .text1{
  342. font-size: 36rpx;
  343. margin-bottom: 12rpx;
  344. }
  345. .text2{
  346. font-size: 40rpx;
  347. }
  348. }
  349. .page {
  350. border-radius: 16rpx;
  351. background-color: rgba(255, 255, 255, 1);
  352. color: rgba(16, 16, 16, 1);
  353. padding: 32rpx;
  354. margin-bottom: 32rpx;
  355. font-size: 32rpx;
  356. color: rgb(16, 16, 16);
  357. .info-title{
  358. display: flex;
  359. justify-content: space-between;
  360. padding-bottom: 24rpx ;
  361. .name{
  362. font-size: 36rpx;
  363. color: rgba(51, 51, 51, 1);
  364. font-weight: bold;
  365. .span{
  366. font-weight: 400;
  367. font-size: 28rpx;
  368. color: rgba(119, 119, 119, 1);
  369. }
  370. }
  371. .value{
  372. font-size: 28rpx;
  373. color: rgba(119, 119, 119, 1);
  374. }
  375. }
  376. .pack-up {
  377. color: rgba(119, 119, 119, 100);
  378. }
  379. .tips{
  380. margin-top: 12rpx;
  381. display: flex;
  382. align-items: flex-start;
  383. font-size: 24rpx;
  384. }
  385. .table{
  386. table{
  387. width: 100%;
  388. }
  389. .row{
  390. display: flex;
  391. align-items: center;
  392. height: 72rpx;
  393. font-size: 28rpx;
  394. padding: 0 24rpx;
  395. .name{
  396. width: 240rpx;
  397. }
  398. }
  399. td{
  400. height: 72rpx;
  401. font-size: 28rpx;
  402. padding: 0 24rpx;
  403. }
  404. /* 隔行变色: 偶数行设置背景色 */
  405. .row:nth-child(odd) {
  406. background-color: #f9f9f9; /* 偶数行 */
  407. }
  408. tr:nth-child(odd) {
  409. background-color: #f9f9f9; /* 偶数行 */
  410. }
  411. .row:nth-child(even) {
  412. background-color: #ffffff; /* 奇数行 */
  413. }
  414. tr:nth-child(even) {
  415. background-color: #ffffff; /* 奇数行 */
  416. }
  417. }
  418. }
  419. .popup-screen{
  420. padding: 40rpx;
  421. .popup-title{
  422. font-size: 36rpx;
  423. color: rgba(51, 51, 51, 1);
  424. font-weight: bold;
  425. padding-bottom: 10px;
  426. }
  427. .cardList{
  428. display: flex;
  429. justify-content: space-evenly;
  430. .cardInfo{
  431. display: flex;
  432. flex-direction: column;
  433. justify-content: center;
  434. width: 160rpx;
  435. height: 160rpx;
  436. border-radius: 8px;
  437. background-color: rgba(255, 255, 255, 1);
  438. text-align: center;
  439. border: 1px solid rgba(187, 187, 187, 1);
  440. .name{
  441. color: rgba(16, 16, 16, 1);
  442. font-size: 28rpx;
  443. }
  444. .price{
  445. color: rgba(16, 16, 16, 1);
  446. font-size: 48rpx;
  447. font-weight: bold;
  448. }
  449. }
  450. .cardInfoCk{
  451. background-color: rgba(225, 247, 237, 1);
  452. border: 1px solid rgba(0, 185, 98, 1);
  453. .price{
  454. color: rgba(0, 161, 85, 1);
  455. }
  456. }
  457. }
  458. }
  459. .floating-button {
  460. position: fixed;
  461. bottom: 0;
  462. /* 距离底部 20px */
  463. width: 100%;
  464. display: flex;
  465. height: 120rpx;
  466. justify-content: center;
  467. background-color: rgba(255, 255, 255, 1);
  468. .button {
  469. margin-top: 24rpx;
  470. border-radius: 50px;
  471. height: 80rpx;
  472. width: 80%;
  473. display: flex;
  474. align-items: center;
  475. justify-content: center;
  476. padding: 12rpx;
  477. background-color: rgba(22, 119, 255, 1);
  478. color: rgba(255, 255, 255, 1);
  479. font-size: 36rpx;
  480. }
  481. }
  482. </style>