reshui.vue 39 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618
  1. <template>
  2. <view class="content">
  3. <view class="container">
  4. <view class="header">
  5. <view class="scan" @tap="scan()" hover-class="scan_hover">
  6. <text class="iconfont icon-saoma"></text>
  7. <text>扫码连接</text>
  8. </view>
  9. <view class="qinshihao">
  10. <text class="iconfont icon-zhuye"></text>
  11. <text class="dormtxt">{{dorm_number || '宿舍未知'}}</text>
  12. </view>
  13. </view>
  14. <view class="start_text">
  15. <view class="start_top">
  16. <view class="item_left">
  17. <text class="iconfont icon-shuibiao"></text>
  18. <text>开启设备</text>
  19. </view>
  20. <view>
  21. <switch :color="colorPrimary" :checked="isChecked" @change="switchChange" />
  22. </view>
  23. </view>
  24. <view class="start_mid">
  25. <view class="item_left">
  26. <text class="iconfont icon-qian"></text>
  27. <text class="start_mid_txt">¥{{amount}}</text>
  28. </view>
  29. <view class="start_payamount" @tap="chongzhi_yemian()" hover-class="scan_hover">
  30. <text>点击充值</text>
  31. <text class="iconfont icon-dayuhao"></text>
  32. </view>
  33. </view>
  34. <view class="start_bot">
  35. <button class="kongzhonglianjie" @click="open">空中连接</button>
  36. <text class="start_bot_txt">当前结算消费:¥{{use_amount}}</text>
  37. </view>
  38. </view>
  39. <view v-if="showRoom" style="width: 100%; height: 100%; ">
  40. <view style="display: flex; flex-wrap: wrap;">
  41. <button v-for="item in rooms" :key="item.id" @tap="clickRoom(item.id)"
  42. class="btn_room">{{item.room}}</button>
  43. </view>
  44. </view>
  45. <view class="start_up_process">
  46. <uni-steps :options="list1" :active-color="colorPrimary" :active="active" />
  47. </view>
  48. <view class="ad">
  49. <image src="../../static/image/ad_reshui.png" mode="aspectFit" class="ad_img" @tap="ad_redirect">
  50. </image>
  51. </view>
  52. <view class="title">
  53. 消费记录
  54. </view>
  55. <view class="record-item">
  56. <view class="uni-list-cell-db">
  57. <picker mode="date" :value="date" fields="month" :start="startDate" :end="endDate"
  58. @change="bindDateChange">
  59. <view class="uni-input">
  60. <text>{{date}}</text>
  61. <text class="iconfont icon-arrow-down"></text>
  62. </view>
  63. </picker>
  64. </view>
  65. <view class="item-list" v-for="(item, i) in xiaofei_items" :key="i">
  66. <text class="item-list-txt"><text class="iconfont icon-shijian"></text>{{item.begin_time}}</text>
  67. <text class="item-list-txt"><text
  68. class="iconfont icon-shuidi"></text>{{numFilter(item.use_size)}}t</text>
  69. <text class="item-list-txt">{{numFilter(item.use_amount)}}</text>
  70. </view>
  71. </view>
  72. </view>
  73. <instructions v-if="flag" @parent_cancel="cancel" @parent_noshow='noshow'></instructions>
  74. </view>
  75. </template>
  76. <script>
  77. import instructions from '../../components/instructions.vue'
  78. export default {
  79. /**
  80. * 声明组件
  81. */
  82. components: {
  83. instructions
  84. },
  85. data() {
  86. return {
  87. colorPrimary: getApp().globalData.primaryColor,
  88. date: this.$getDate({
  89. format: true
  90. }),
  91. startDate: this.$getDate('start_date'),
  92. endDate: this.$getDate('end_date'),
  93. flag: false, // 控制说明弹窗
  94. showRoom: false,
  95. isUserClose: false, // 是否是用户自己关闭
  96. isChecked: false,
  97. isConnected: false, // 是否连接上
  98. isScan: false,
  99. active: -1,
  100. list1: [{
  101. title: '连接设备'
  102. }, {
  103. title: '连设备服务'
  104. }, {
  105. title: '数据通讯'
  106. }, {
  107. title: '启动'
  108. }],
  109. devices: [], // 保存设备
  110. rooms: [], // 保存水表id及对应的宿舍号
  111. device_code: '', // 设备编号
  112. deviceId: '',
  113. serviceId: '',
  114. characteristicIdForWrite: '',
  115. characteristicIdForNotity: '',
  116. deviceIsNotify: false,
  117. deviceIsWrite: false,
  118. byte35: '', // 70 个字符
  119. byte35_tmp: '', // 70 个字符 临时变量
  120. start_code: '',
  121. // start_code: '3459A8C660F1C284E41003E80000120000',
  122. xiaofei_items: [], // 消费记录
  123. use_amount: 0.0.toFixed(2), // 结算金额
  124. amount: 0.0.toFixed(2), // 余额
  125. dorm_number: '', // 宿舍号
  126. stu_number: '', // 学号
  127. user_name: '',
  128. // compus: '', // 校区
  129. ceshi: 'code',
  130. changeDate: false, // 是否是手动选择日期
  131. get_Bluetooth_Bevice: false // 自动获取蓝牙设备,并列表
  132. }
  133. },
  134. onLoad(options) {
  135. // console.log(options);
  136. uni.authorize({
  137. scope: 'scope.userLocation',
  138. success(res) {
  139. uni.getLocation({
  140. success: (loc) => {
  141. // console.log(loc);
  142. // uni.showToast({
  143. // icon: 'none',
  144. // title: '纬度:' + loc.latitude + '\n' + '经度:' + loc
  145. // .longitude,
  146. // duration: 2000
  147. // })
  148. uni.showToast({
  149. icon: 'success',
  150. title: '已获定位信息'
  151. })
  152. },
  153. fail: (err) => {
  154. uni.showToast({
  155. icon: 'none',
  156. title: '获取定位失败,请手动开启定位!'
  157. })
  158. }
  159. })
  160. },
  161. fail: (err) => {
  162. // console.log(err);
  163. uni.showToast({
  164. icon: 'none',
  165. title: '请手动设置定位授权!'
  166. })
  167. }
  168. })
  169. if (typeof(options) != 'undefined' && typeof(options) != '' && JSON.stringify(options) == '{}') {
  170. // 获取基本信息
  171. this.get_base_info(options, 'onLoad')
  172. } else if (typeof(options.from) != 'undefined' && options.from != 0) {
  173. // 获取基本信息
  174. this.get_base_info(options, 'onLoad')
  175. // 获取设备码
  176. this.device_code = decodeURIComponent(options.q).split('=')[1]
  177. }
  178. const value = uni.getStorageSync('instruction_noshow');
  179. if (!(value == true)) {
  180. this.flag = true
  181. }
  182. // 获取蓝牙设备,并列表
  183. this.openBluetoothAdapter();
  184. },
  185. onShow() {
  186. // 充值后更新金额
  187. this.amount = this.$store.state.reshui_amount
  188. if (this.stu_number && typeof(this.stu_number) != 'undefined') {
  189. // 获取基本信息
  190. this.get_base_info('options', 'onShow')
  191. }
  192. },
  193. methods: {
  194. /**
  195. * 单击连接热水表
  196. */
  197. clickRoom(e) {
  198. if (this.judgeBalance() == false) {
  199. return
  200. }
  201. // console.log(e);
  202. this.device_code = 'K' + e
  203. for (var i = 0, len = this.devices.length; i < len; i++) {
  204. if (this.devices[i].dname == e) {
  205. this.deviceId = this.devices[i].did
  206. // console.log(this.deviceId)
  207. break
  208. }
  209. }
  210. this.process_control(0);
  211. // 开始连接匹配的蓝牙设备
  212. this.createBLEConnection()
  213. },
  214. /**
  215. * 空中连接热水表
  216. */
  217. open() {
  218. this.showRoom = !this.showRoom
  219. },
  220. /**
  221. * 跳转到广告ad页
  222. */
  223. ad_redirect() {
  224. uni.navigateTo({
  225. url: 'ad_reshui'
  226. })
  227. },
  228. /**
  229. * 保留小数点数值后两位,尾数四舍五入
  230. * @param {Object} value
  231. */
  232. numFilter(value) {
  233. // 截取当前数据到小数点后两位
  234. let realVal = parseFloat(value).toFixed(2)
  235. return realVal
  236. },
  237. /**
  238. * 获取基本信息
  239. */
  240. get_base_info(options, param) {
  241. // console.log(options);
  242. try {
  243. // 获取学号
  244. this.stu_number = this.$store.state.userInfo.card_number
  245. if (this.stu_number == '' || typeof(this.stu_number) == 'undefined') {
  246. const userinfo = uni.getStorageSync('userinfo_storage_key')
  247. if (userinfo) {
  248. this.stu_number = userinfo.card_number
  249. } else {
  250. uni.navigateTo({
  251. url: '../index/index?from=' + options.from
  252. })
  253. uni.showToast({
  254. icon: 'none',
  255. title: '学号为空,请进行授权',
  256. duration: 3000
  257. });
  258. return
  259. }
  260. }
  261. } catch (e) {
  262. // console.log(e);
  263. }
  264. if (param == 'onShow') {
  265. if (this.$store.state.payInfo.from == 'reshui_pay') {
  266. uni.showToast({
  267. title: this.$store.state.payInfo.resultMsg,
  268. icon: 'success',
  269. success: () => {
  270. this.$store.state.payInfo.resultMsg = ''
  271. this.$store.state.payInfo.from = ''
  272. }
  273. })
  274. }
  275. }
  276. // 获取code
  277. this.getCode(options, param)
  278. },
  279. /**
  280. * 获得code
  281. */
  282. getCode(options, param) {
  283. uni.login({
  284. success: (res) => {
  285. // console.log('getCode', res);
  286. if (res.code) {
  287. // 请求服务器,获得openid
  288. this.getOpenId(options, res.code, param)
  289. } else {
  290. uni.showToast({
  291. title: res.errMsg,
  292. icon: 'none'
  293. });
  294. }
  295. }
  296. })
  297. },
  298. /**
  299. * 请求服务器,获得openid
  300. */
  301. async getOpenId(options, param_code, param) {
  302. const res = await this.$myRequest({
  303. host: this.ceshi,
  304. url: '/HotWaters/wpget_stu.action',
  305. method: 'POST',
  306. header: {
  307. 'content-type': 'application/x-www-form-urlencoded'
  308. },
  309. data: {
  310. code: param_code
  311. }
  312. })
  313. // console.log(res);
  314. if (res.data.mess == '返回成功') {
  315. // stu_number是否存在
  316. let cardNumber = res.data.info[0].card_number
  317. if (typeof(cardNumber) != 'undefined' && cardNumber != '' && JSON.stringify(cardNumber) != '{}') {
  318. // 学号 和 姓名
  319. this.stu_number = res.data.info[0].stu_number
  320. this.user_name = res.data.info[0].user_name
  321. // 剩余金额
  322. this.amount = res.data.info[0].balance.toFixed(2)
  323. // if (this.amount > 0)
  324. this.$store.state.reshui_amount = this.amount
  325. // 组合楼栋宿舍号
  326. this.dorm_number = res.data.info[0].build + res.data.info[0].dom
  327. // 校区
  328. // this.compus = res.data.info[0].campus
  329. if (param == 'onLoad' && typeof(options.from) != 'undefined' && options.from != 0) {
  330. // 初始化蓝牙
  331. this.openBluetoothAdapter()
  332. }
  333. // 请求选定的月份消费记录
  334. this.request_consumption_records()
  335. } else {
  336. uni.showToast({
  337. title: '未获取到学号!',
  338. icon: 'success'
  339. });
  340. uni.navigateTo({
  341. url: '../index/index?from=' + options.from
  342. })
  343. }
  344. } else if (res.data.mess == '未查询到用户信息') {
  345. // 数据库中 未查询到用户信息,就清除本地存储
  346. uni.removeStorageSync('userinfo_storage_key');
  347. uni.showToast({
  348. title: '获取用户信息失败!'
  349. })
  350. if (options && typeof(options.from) != 'undefined' && typeof(options.from) != '') {
  351. uni.navigateTo({
  352. url: '../index/index?from=' + options.from
  353. })
  354. } else {
  355. uni.redirectTo({
  356. url: '../index/index?from=0'
  357. });
  358. }
  359. }
  360. },
  361. /**
  362. * 选择消费年月
  363. */
  364. bindDateChange(e) {
  365. this.date = e.detail.value
  366. this.changeDate = true
  367. // 请求选定的月份消费记录
  368. this.request_consumption_records()
  369. },
  370. /**
  371. * 使用说明组件取消
  372. */
  373. cancel(param) {
  374. this.flag = param
  375. },
  376. /**
  377. * 使用说明组件不再出现
  378. */
  379. noshow(param) {
  380. try {
  381. if (param) {
  382. uni.setStorageSync("instruction_noshow", true)
  383. } else {
  384. uni.removeStorageSync("instruction_noshow")
  385. }
  386. } catch (e) {
  387. // console.log(e);
  388. }
  389. },
  390. /**
  391. * 请求选定的月份消费记录
  392. */
  393. async request_consumption_records() {
  394. if (this.stu_number != '' && typeof(this.stu_number) != 'undefined') {
  395. const res = await this.$myRequest({
  396. host: this.ceshi,
  397. url: '/HotWaters/wpqueryConsume.action',
  398. method: 'POST',
  399. header: {
  400. 'content-type': 'application/x-www-form-urlencoded'
  401. },
  402. data: {
  403. stu_number: this.stu_number,
  404. begin_time: this.date
  405. }
  406. });
  407. // console.log(res);
  408. if (res.data.mess == '返回成功') {
  409. this.xiaofei_items = []
  410. // 消费记录
  411. let items = res.data.data
  412. for (var i = 0; i < items.length; i++) {
  413. this.xiaofei_items.push(items[i])
  414. }
  415. } else {
  416. if (this.changeDate) {
  417. uni.showToast({
  418. icon: 'success',
  419. title: res.data.mess,
  420. success: () => {
  421. this.changeDate = false
  422. }
  423. })
  424. if (res.data.mess == '本月无消费记录') {
  425. this.xiaofei_items = []
  426. }
  427. }
  428. }
  429. } else {
  430. uni.showToast({
  431. icon: 'success',
  432. title: '未获得学号'
  433. })
  434. }
  435. },
  436. /**
  437. * 控制进度条显示
  438. * @param {Object} active_value
  439. */
  440. process_control(active_value) {
  441. if (active_value <= this.list1.length - 1) {
  442. this.active = active_value
  443. }
  444. },
  445. /**
  446. * 开始或停止用水
  447. */
  448. switchChange(e) {
  449. this.isChecked = e.target.value
  450. if (this.isChecked) {
  451. if (this.deviceId && this.serviceId && this.devices.length != 0) {
  452. uni.showModal({
  453. title: '提示',
  454. content: '确定要启动设备?',
  455. success: (res) => {
  456. if (res.confirm) {
  457. this.isChecked = true
  458. // 开始连接匹配的蓝牙设备
  459. setTimeout(async () => {
  460. // 请求获取设备启动码
  461. this.request_device_start_code()
  462. }, 300)
  463. } else if (res.cancel) {
  464. setTimeout(() => {
  465. this.isChecked = false
  466. }, 300)
  467. }
  468. }
  469. })
  470. } else {
  471. uni.showToast({
  472. icon: 'none',
  473. title: '先【扫码连接】,后【开启设备】',
  474. duration: 1500
  475. })
  476. setTimeout(() => {
  477. this.isChecked = false
  478. }, 300)
  479. }
  480. } else {
  481. uni.showModal({
  482. title: '提示',
  483. content: '确定要关闭设备?',
  484. success: (res) => {
  485. if (res.confirm) {
  486. this.isChecked = false
  487. if (this.deviceId && this.serviceId) {
  488. this.send('stop')
  489. } else {
  490. uni.showToast({
  491. icon: 'none',
  492. title: '与设备连接中断!请在设备上手动停止即可!',
  493. duration: 5000
  494. })
  495. setTimeout(() => {
  496. this.isChecked = true
  497. }, 300)
  498. }
  499. } else if (res.cancel) {
  500. setTimeout(() => {
  501. this.isChecked = true
  502. }, 300)
  503. }
  504. }
  505. })
  506. }
  507. },
  508. /**
  509. * 跳转到充值页面
  510. */
  511. chongzhi_yemian() {
  512. //在起始页面跳转到recharge.vue页面并传递参数
  513. uni.navigateTo({
  514. url: '../recharge/recharge'
  515. });
  516. },
  517. /**
  518. * 判断余额是否充足
  519. */
  520. judgeBalance() {
  521. var limit_amount = parseFloat(this.$store.state.amount)
  522. var amount = parseFloat(this.amount);
  523. // 启动最低金额限制
  524. if (amount < limit_amount) {
  525. uni.showModal({
  526. title: '提示',
  527. content: '当前余额不足¥' + limit_amount + '元',
  528. cancelText: '我知道了',
  529. confirmText: '我要充值',
  530. success: (res) => {
  531. if (res.confirm) {
  532. // 跳转充值页面
  533. this.chongzhi_yemian()
  534. // return false
  535. // } else if (res.cancel) {
  536. // return false
  537. }
  538. }
  539. })
  540. return false
  541. } else {
  542. return true
  543. }
  544. },
  545. /**
  546. * 111111111111111111111111111111
  547. * 扫码连接设备
  548. */
  549. scan() {
  550. if (this.judgeBalance() == false) {
  551. return
  552. }
  553. // 已经启动扫描连接设备中
  554. if (this.isScan) {
  555. uni.showToast({
  556. icon: 'none',
  557. title: '正在扫描,请耐心等待',
  558. })
  559. return
  560. }
  561. // 已经启动设备,不启动扫描
  562. if (this.isChecked) {
  563. uni.showToast({
  564. icon: 'none',
  565. title: '设备已启动,无需重新扫码',
  566. })
  567. return
  568. }
  569. if (this.deviceId) {
  570. uni.showModal({
  571. title: '提示',
  572. content: '设备已经连接,需要重新连接吗?',
  573. success: res => {
  574. if (res.confirm) {
  575. this.closeBLEConnection()
  576. this.scan_qr()
  577. } else if (res.cancel) {
  578. return
  579. }
  580. }
  581. })
  582. } else {
  583. this.scan_qr()
  584. }
  585. },
  586. /**
  587. * 启动摄像头,扫描二维码
  588. */
  589. scan_qr() {
  590. uni.scanCode({
  591. onlyFromCamera: true,
  592. success: (res) => {
  593. this.isScan = true
  594. // console.log(res)
  595. // charSet: "utf-8"
  596. // codeVersion: 3
  597. // errMsg: "scanCode:ok"
  598. // rawData: "aHR0cDovL3Rvb2xzLjlrYnMuY29tLz93eG1pbmljb2RlPUtCNTgwMDAyNjUy"
  599. // result: "http://tools.9kbs.com/?wxminicode=KB580002652"
  600. // scanType: "QR_CODE"
  601. this.device_code = res.result.split('=')[1]
  602. if (this.device_code === '') {
  603. uni.showToast({
  604. icon: 'success',
  605. title: '获取设备码失败',
  606. duration: 3000
  607. })
  608. this.isScan = false
  609. } else {
  610. // 初始化蓝牙
  611. this.openBluetoothAdapter()
  612. }
  613. }
  614. })
  615. },
  616. /**
  617. * 22222222222222222222222222222
  618. * 初始化蓝牙
  619. */
  620. openBluetoothAdapter() {
  621. uni.openBluetoothAdapter({
  622. success: (res) => { // 已打开
  623. uni.getBluetoothAdapterState({ // 蓝牙的匹配状态
  624. success: (res1) => {
  625. // console.log(res1, '“本机设备的蓝牙已打开”');
  626. // 本机设备的蓝牙已打开
  627. // 开始搜索蓝牙设备
  628. if (this.deviceId == '' && this.serviceId == '')
  629. this.startBluetoothDeviceDiscovery()
  630. },
  631. fail: (error) => {
  632. // console.log(error)
  633. uni.showToast({
  634. title: "请开启手机蓝牙",
  635. icon: "none",
  636. duration: 3000
  637. })
  638. this.isScan = false
  639. }
  640. });
  641. },
  642. fail: (err) => { // 未打开
  643. // console.log(err)
  644. this.isScan = false
  645. if (err.errCode == 10001) {
  646. uni.showModal({
  647. content: '请开启手机蓝牙!',
  648. showCancel: false,
  649. })
  650. } else {
  651. uni.showToast({
  652. icon: 'none',
  653. title: err.errMsg,
  654. duration: 2000
  655. })
  656. }
  657. }
  658. });
  659. },
  660. /**
  661. * 333333333333333333333333333
  662. * 开始搜索蓝牙设备
  663. */
  664. startBluetoothDeviceDiscovery() {
  665. uni.startBluetoothDevicesDiscovery({ // 开始搜寻附近的蓝牙外围设备
  666. // services: ['FEE7'], // 要搜索但蓝牙设备主 service 的 uuid 列表
  667. allowDuplicatesKey: true,
  668. success: (res) => {
  669. if (this.get_Bluetooth_Bevice == true)
  670. this.process_control(0)
  671. this.onBluetoothDeviceFound() // 监听搜索到新设备 同时进行
  672. setTimeout(() => {
  673. if (this.isScan) {
  674. uni.showModal({
  675. title: '温馨提示',
  676. content: '请确认已开启【蓝牙授权】或【定位授权】!',
  677. confirmText: '我已开启',
  678. cancelText: '取消',
  679. success: (res) => {
  680. if (res.confirm) {
  681. // console.log(res)
  682. } else if (res.cancel) {
  683. switch (uni.getSystemInfoSync().platform) {
  684. case 'android':
  685. // 打开设置
  686. break;
  687. case 'ios':
  688. // 打开设置
  689. break;
  690. default:
  691. // console.log('运行在开发者工具上')
  692. break;
  693. }
  694. }
  695. }
  696. })
  697. }
  698. }, 5000)
  699. },
  700. fail: err => {
  701. // console.log(err, '错误信息');
  702. uni.showToast({
  703. icon: 'none',
  704. title: err.errMsg,
  705. duration: 2000
  706. })
  707. this.isScan = false
  708. }
  709. })
  710. },
  711. stopBluetoothDevicesDiscovery: function() { //停止搜索
  712. uni.stopBluetoothDevicesDiscovery({
  713. success: (res) => {
  714. // console.log(res, '停止蓝牙搜索')
  715. // uni.showToast({
  716. // title: '停止蓝牙搜索',
  717. // duration: 2000
  718. // })
  719. if (this.get_Bluetooth_Bevice == true) {
  720. this.process_control(0);
  721. // 开始连接匹配的蓝牙设备
  722. this.createBLEConnection()
  723. } else {
  724. this.get_Bluetooth_Bevice == true
  725. }
  726. this.get_room()
  727. },
  728. fail: e => {
  729. // console.log('停止搜索蓝牙设备失败,错误码:' + e.errCode);
  730. this.isScan = false
  731. uni.showToast({
  732. title: err.errCode,
  733. duration: 2000
  734. })
  735. }
  736. })
  737. },
  738. /**
  739. * 444444444444444444444444444444444
  740. * 发现外围设备
  741. */
  742. onBluetoothDeviceFound() {
  743. uni.onBluetoothDeviceFound((res) => {
  744. let dname = ''
  745. let i = 0
  746. res.devices.forEach(device => { // 筛选找到的蓝牙中对名称匹配
  747. // 过滤掉没有名字的设备
  748. if (!device.name && !device.localName) {
  749. return
  750. }
  751. // 把搜索到的设备存储起来,如有需要可以在页面上展示
  752. dname = device.name.substr(1)
  753. let d = {
  754. did: device.deviceId,
  755. dname: dname
  756. }
  757. if (dname.length == 10 && JSON.stringify(this.devices).indexOf(JSON.stringify(
  758. d)) === -1) {
  759. this.devices.push(d)
  760. i++
  761. }
  762. if (device.name == this.device_code) {
  763. this.process_control(0);
  764. //data里面建立一个deviceId、device_code,存储起来
  765. // this.device_code = device.name;
  766. this.deviceId = device.deviceId
  767. // 放此位置,苹果手机兼容
  768. this.stopBluetoothDevicesDiscovery()
  769. return
  770. }
  771. setTimeout(() => {
  772. // 放此位置,苹果手机兼容
  773. this.stopBluetoothDevicesDiscovery()
  774. }, 2000)
  775. })
  776. });
  777. },
  778. // 获取水表对应的宿舍号
  779. async get_room() {
  780. if (this.devices.length > 0) {
  781. let devices_str = []
  782. for (var i = 0, len = this.devices.length; i < len; i++) {
  783. devices_str.push(this.devices[i].dname)
  784. }
  785. const res = await this.$myRequest({
  786. host: this.ceshi,
  787. url: '/HotWaters/waterqueryDom.action',
  788. method: 'POST',
  789. header: {
  790. 'content-type': 'application/x-www-form-urlencoded'
  791. },
  792. data: {
  793. user_id: devices_str.join(',')
  794. }
  795. });
  796. // console.log(res);
  797. if (res.data.msg == '获取成功') {
  798. this.rooms = []
  799. // 消费记录
  800. let items = res.data.data
  801. if (items == 'undefined') {
  802. return
  803. }
  804. for (var i = 0; i < items.length; i++) {
  805. let item = {
  806. id: items[i].user_id,
  807. room: items[i].dom
  808. }
  809. if (JSON.stringify(this.rooms).indexOf(JSON.stringify(item)) === -1) {
  810. this.rooms.push(item); // 进行动态的操作
  811. }
  812. }
  813. } else {
  814. if (this.changeDate) {
  815. uni.showToast({
  816. icon: 'success',
  817. title: res.data.mess,
  818. success: () => {
  819. this.changeDate = false
  820. }
  821. })
  822. if (res.data.mess == '本月无消费记录') {
  823. this.xiaofei_items = []
  824. }
  825. }
  826. }
  827. }
  828. },
  829. /**
  830. * 555555555555555555555555555555555
  831. * 连接蓝牙设备
  832. */
  833. createBLEConnection() {
  834. //连接蓝牙
  835. uni.createBLEConnection({
  836. deviceId: this.deviceId,
  837. timeout: 5000,
  838. success: (res) => {
  839. // console.log(res)
  840. this.connect_BLE()
  841. },
  842. fail: (err) => {
  843. // console.log(err)
  844. this.isScan = false
  845. if (err.errMsg.indexOf('already connect') != -1) {
  846. this.connect_BLE()
  847. } else {
  848. uni.showToast({
  849. title: '建立连接失败',
  850. icon: 'none',
  851. duration: 3000,
  852. success: (res1) => {
  853. this.setInit()
  854. }
  855. })
  856. }
  857. }
  858. })
  859. },
  860. connect_BLE() {
  861. if (this.isConnected === false) {
  862. this.isConnected = true
  863. this.process_control(1);
  864. // 获取蓝牙设备所有服务(service)
  865. this.getBLEDeviceServices()
  866. }
  867. },
  868. /**
  869. * 6666666666666666666666666666666666
  870. * 获取蓝牙的所有服务
  871. */
  872. getBLEDeviceServices() {
  873. uni.getBLEDeviceServices({
  874. deviceId: this.deviceId,
  875. success: (res) => {
  876. // console.log(res)
  877. // res1.services.forEach((item) => {
  878. // this.getBLEDeviceCharacteristics()
  879. // })
  880. this.serviceId = res.services[1].uuid
  881. this.process_control(1);
  882. this.getBLEDeviceCharacteristics()
  883. },
  884. fail: (err) => {
  885. // console.log(err)
  886. this.isScan = false
  887. uni.showToast({
  888. title: '获取服务失败',
  889. icon: 'none',
  890. duration: 3000
  891. })
  892. return
  893. }
  894. });
  895. },
  896. /**
  897. * 777777777777777777777777777777777
  898. * 获取蓝牙特征
  899. */
  900. getBLEDeviceCharacteristics() {
  901. // 获取蓝牙设备某个服务中所有特征值(characteristic)
  902. uni.getBLEDeviceCharacteristics({
  903. deviceId: this.deviceId,
  904. // 这里的 serviceId 需要在 getBLEDeviceServices 接口中获取
  905. serviceId: this.serviceId,
  906. success: (res) => {
  907. this.process_control(2);
  908. // console.log(res)
  909. this.characteristicIdForWrite = res.characteristics[0].uuid
  910. this.characteristicIdForNotity = res.characteristics[1].uuid
  911. this.deviceIsWrite = res.characteristics[0].properties.write
  912. this.deviceIsNotify = res.characteristics[1].properties.notify
  913. // console.log(this.characteristicIdForWrite, this.characteristicIdForNotity)
  914. // 确保对应服务id下的特征值id具备监听数据变化的特性
  915. if (res.characteristics[1].properties.notify) {
  916. this.notifyBLECharacteristicValueChange()
  917. }
  918. },
  919. fail: (err) => {
  920. this.isScan = false
  921. // console.error('获取蓝牙设备特征值失败(getBLEDeviceCharacteristics)', err)
  922. }
  923. });
  924. },
  925. /**
  926. * 888888888888888888888888888888888888
  927. * 启用 notify 功能
  928. */
  929. notifyBLECharacteristicValueChange() {
  930. uni.notifyBLECharacteristicValueChange({
  931. state: true, // 启用 notify 功能
  932. deviceId: this.deviceId,
  933. // 这里的 serviceId 需要在 getBLEDeviceServices 接口中获取
  934. serviceId: this.serviceId,
  935. // 这里的 characteristicId 需要在 getBLEDeviceCharacteristics 接口中获取
  936. characteristicId: this.characteristicIdForNotity,
  937. success: (res) => {
  938. this.process_control(2)
  939. this.isScan = false
  940. // console.log('通知启用(notifyBLECharacteristicValueChange)',res);
  941. this.onBLECharacteristicValueChange()
  942. setTimeout(() => {
  943. // 发送 AAABAC,采集数据(会返回 35字节 的数据)
  944. this.send('')
  945. }, 800)
  946. // // 请求设备信息
  947. // this.request_device_info()
  948. // // 显示设备启动授权金额
  949. // this.display_device_startup_amount()
  950. },
  951. fail: (err) => {
  952. // console.log(err)
  953. this.isScan = false
  954. uni.showModal({
  955. content: err.errMsg,
  956. showCancel: false
  957. })
  958. // 初始化
  959. this.setInit()
  960. }
  961. })
  962. },
  963. /**
  964. * 999999999999999999999999999999999
  965. * 监听低功耗蓝牙设备的特征值变化
  966. */
  967. onBLECharacteristicValueChange() {
  968. uni.onBLECharacteristicValueChange((characteristic) => {
  969. let condition = this.ab2hex(characteristic.value)
  970. // console.log(condition)
  971. if (condition.length > 2) {
  972. this.byte35_tmp += condition
  973. if (this.byte35_tmp.length > 40) {
  974. this.byte35 = this.byte35_tmp
  975. this.byte35_tmp = ''
  976. if (this.byte35.startsWith('ad')) {
  977. // console.log(this.byte35, '结束用水成功')
  978. // 关闭蓝牙连接
  979. this.closeBLEConnection()
  980. // 请求结算
  981. this.request_pay()
  982. } else {
  983. // 发送 AAABAC,采集数据(会返回 35字节 的数据)
  984. // b58000265243eb3dd4bb3c5a2ab9042efcf0d2a30a000000000000000014392a0103bc
  985. // uni.showToast({
  986. // icon: 'success',
  987. // title: '采集数据成功!',
  988. // duration: 2000
  989. // })
  990. // console.log(this.byte35, '采集上一条消费数据')
  991. }
  992. }
  993. }
  994. switch (condition) {
  995. case 'bb':
  996. // uni.showToast({
  997. // title: '设备启动成功',
  998. // duration: 3000,
  999. // icon: 'none'
  1000. // })
  1001. this.process_control(3)
  1002. this.isChecked = true
  1003. break
  1004. case 'bc':
  1005. uni.showToast({
  1006. title: '启动失败,设备检验启动代码不通过',
  1007. duration: 3000,
  1008. icon: 'none'
  1009. })
  1010. break
  1011. case 'aa':
  1012. uni.showToast({
  1013. title: '设备正在使用',
  1014. duration: 3000,
  1015. icon: 'none'
  1016. })
  1017. break
  1018. case 'ab':
  1019. uni.showToast({
  1020. title: '结束失败,设备对结束代码检验失败',
  1021. duration: 3000,
  1022. icon: 'none'
  1023. })
  1024. break
  1025. default:
  1026. break
  1027. }
  1028. })
  1029. },
  1030. /**
  1031. * 关闭连接
  1032. */
  1033. closeBLEConnection() {
  1034. uni.closeBLEConnection({
  1035. deviceId: this.deviceId,
  1036. success: () => {
  1037. // 关闭蓝牙模块
  1038. this.closeBluetoothAdapter()
  1039. },
  1040. fail: () => {
  1041. uni.showToast({
  1042. icon: 'none',
  1043. title: '蓝牙连接断开失败',
  1044. duration: 3000,
  1045. success: (res1) => {
  1046. this.setInit()
  1047. }
  1048. })
  1049. }
  1050. })
  1051. },
  1052. closeBluetoothAdapter() {
  1053. // 关闭蓝牙模块
  1054. uni.closeBluetoothAdapter({
  1055. success: () => {
  1056. this.setInit()
  1057. if (this.isUserClose == false) { // 设备端结束用水
  1058. if (this.isChecked) {
  1059. // console.log('设备端已结束用水,蓝牙断开成功')
  1060. uni.showToast({
  1061. icon: 'none',
  1062. title: '设备端已结束用水,蓝牙断开成功',
  1063. duration: 3000
  1064. })
  1065. } else {
  1066. // console.log('用户重启扫描,蓝牙断开成功')
  1067. uni.showToast({
  1068. icon: 'none',
  1069. title: '用户重启扫描,蓝牙断开成功',
  1070. duration: 3000
  1071. })
  1072. }
  1073. } else { // 手机移动端结束用水
  1074. // console.log('APP端已结束用水,蓝牙断开成功')
  1075. uni.showToast({
  1076. icon: 'none',
  1077. title: 'APP端已结束用水,蓝牙断开成功',
  1078. duration: 3000
  1079. })
  1080. }
  1081. }
  1082. })
  1083. },
  1084. setInit() {
  1085. setTimeout(() => {
  1086. this.isUserClose = false
  1087. this.isChecked = false
  1088. this.isConnected = false
  1089. this.isScan = false
  1090. this.active = -1
  1091. this.devices = [] // 保存设备
  1092. this.device_code = '' // 设备编号
  1093. this.deviceId = ''
  1094. this.serviceId = ''
  1095. this.characteristicIdForWrite = ''
  1096. this.characteristicIdForNotity = ''
  1097. this.deviceIsNotify = false
  1098. this.deviceIsWrite = false
  1099. this.byte35 = '' // 70 个字符
  1100. this.byte35_tmp = '' // 70 个字符 临时变量
  1101. // this.start_code = ''
  1102. })
  1103. },
  1104. /**
  1105. * 10===========10==================10
  1106. * 发送数据到设备
  1107. */
  1108. send(val) {
  1109. let buffer
  1110. let dataView
  1111. let newArr
  1112. if (val == 'start') { // 启动设备
  1113. this.isUserClose = false
  1114. this.process_control(3)
  1115. // this.createBLEConnection()
  1116. // 发送 17字节 启动代码(会返回 35字节 的数据)
  1117. // b58000265243eb3dd4bb3c5a2ab9042efcf0d2a30a000000000000000014392a0103bc
  1118. newArr = this.str2StrArray(this.start_code)
  1119. } else if (val == 'stop') { // 结束当前使用,设备成功返回:AD+35字节 消费结算代码
  1120. this.isUserClose = true
  1121. // 发送 AAABAD+17字节 启动代码(会返回 ad+35字节 的数据)
  1122. // adb58000265243eb3dd4bb3c5a2ab9042efcf0d2a30a000000000000000014392a0104bc
  1123. newArr = ['AA', 'AB', 'AD'].concat(this.str2StrArray(this.start_code))
  1124. } else {
  1125. // 发送 AAABAC 采集数据(会返回 35字节 的数据)
  1126. // b58000265243eb3dd4bb3c5a2ab9042efcf0d2a30a000000000000000014392a0103bc
  1127. newArr = ['AA', 'AB', 'AC']
  1128. }
  1129. buffer = new ArrayBuffer(newArr.length)
  1130. dataView = new DataView(buffer)
  1131. newArr.forEach((item, i) => {
  1132. dataView.setUint8(i, this.sixteen_to_ten(item))
  1133. })
  1134. // 写特征值数据到设备
  1135. if (this.deviceIsWrite) {
  1136. // 写数据到设备
  1137. this.writeBLECharacteristicValue(val, buffer)
  1138. } else {
  1139. uni.showToast({
  1140. title: '设备不可写',
  1141. duration: 3000
  1142. })
  1143. }
  1144. },
  1145. /**
  1146. * 11====================11=====================11
  1147. * 写数据到设备
  1148. */
  1149. writeBLECharacteristicValue(val, buffer) {
  1150. uni.writeBLECharacteristicValue({
  1151. deviceId: this.deviceId,
  1152. // 这里的 serviceId 需要在 getBLEDeviceServices 接口中获取
  1153. serviceId: this.serviceId,
  1154. // 这里的 characteristicId 需要在 getBLEDeviceCharacteristics 接口中获取
  1155. characteristicId: this.characteristicIdForWrite,
  1156. // 这里的value是ArrayBuffer类型
  1157. value: buffer,
  1158. success: (res) => {
  1159. // console.log(res)
  1160. if (val == 'start') {
  1161. setTimeout(() => {
  1162. this.isChecked = true
  1163. this.isConnected = true
  1164. }, 300)
  1165. this.process_control(3)
  1166. } else if (val == 'stop') {
  1167. setTimeout(() => {
  1168. this.isChecked = false
  1169. }, 300)
  1170. }
  1171. },
  1172. fail: (err) => {
  1173. // console.log(err)
  1174. if (err.errCode == 10006) {
  1175. setTimeout(() => {
  1176. this.setInit()
  1177. }, 300)
  1178. if (this.isConnected) {
  1179. uni.showToast({
  1180. title: '设备连接已断开!请在水表上手动停止!',
  1181. icon: 'none'
  1182. })
  1183. } else {
  1184. uni.showToast({
  1185. title: '设备连接失败!请重试扫描连接!',
  1186. icon: 'none'
  1187. })
  1188. }
  1189. }
  1190. }
  1191. })
  1192. },
  1193. /**
  1194. * 请求获取设备启动码
  1195. */
  1196. async request_device_start_code() {
  1197. if (this.byte35 != '' && this.stu_number != '') {
  1198. const res = await this.$myRequest({
  1199. host: this.ceshi,
  1200. url: '/HotWaters/wpstart.action',
  1201. data: {
  1202. collect_code: this.byte35,
  1203. stu_number: this.stu_number
  1204. }
  1205. })
  1206. // console.log(res)
  1207. let sc = res.data.start_code
  1208. if (typeof(sc) != 'undefined' && sc != '') {
  1209. this.start_code = sc
  1210. setTimeout(() => {
  1211. this.send('start')
  1212. }, 100)
  1213. // 刷新选定的月份消费记录
  1214. this.request_consumption_records()
  1215. } else {
  1216. this.isChecked = false
  1217. uni.showToast({
  1218. icon: 'none',
  1219. title: res.data.mess,
  1220. duration: 3000,
  1221. })
  1222. }
  1223. } else {
  1224. uni.showToast({
  1225. icon: 'none',
  1226. title: '字节码或学号为空!'
  1227. });
  1228. // 初始化
  1229. this.setInit()
  1230. }
  1231. },
  1232. /**
  1233. * 请求结算
  1234. */
  1235. async request_pay() {
  1236. if (this.byte35 != '') {
  1237. const res = await this.$myRequest({
  1238. host: this.ceshi,
  1239. url: '/HotWaters/wpconsume.action',
  1240. data: {
  1241. stu_number: this.stu_number,
  1242. user_name: this.user_name,
  1243. collect_code: this.byte35.substring(2)
  1244. }
  1245. })
  1246. // console.log(res)
  1247. if (res.data.mess == "支付成功") {
  1248. uni.showToast({
  1249. icon: 'success',
  1250. title: '结算成功!',
  1251. success: (res1) => {
  1252. this.use_amount = res.data.use_amount.toFixed(2)
  1253. this.amount = (this.amount - this.use_amount).toFixed(2)
  1254. this.$store.state.reshui_amount = this.amount
  1255. // 刷新选定的月份消费记录
  1256. this.request_consumption_records()
  1257. }
  1258. })
  1259. } else {
  1260. uni.showToast({
  1261. icon: 'none',
  1262. title: res.data.mess,
  1263. duration: 3000
  1264. })
  1265. }
  1266. } else {
  1267. uni.showToast({
  1268. icon: 'success',
  1269. title: '字节码为空!'
  1270. });
  1271. // 初始化
  1272. this.setInit()
  1273. }
  1274. },
  1275. /**
  1276. * 返回字符处理
  1277. */
  1278. str2StrArray(start_code) {
  1279. if (typeof(start_code) == 'undefined' || start_code == '') {
  1280. uni.showToast({
  1281. icon: 'none',
  1282. title: '设备码获取失败'
  1283. })
  1284. this.setInit()
  1285. return
  1286. }
  1287. if (start_code.length != 34) {
  1288. // console.log('启动码长度错误')
  1289. throw new Error("启动码长度错误");
  1290. return
  1291. }
  1292. var resultArray = new Array()
  1293. for (var i = 0; i < start_code.length; i += 2) {
  1294. resultArray.push(start_code.substr(i, 2));
  1295. }
  1296. return resultArray;
  1297. },
  1298. /**
  1299. * ArrayBuffer转16进度字符串
  1300. */
  1301. ab2hex(buffer) {
  1302. const hexArr = Array.prototype.map.call(
  1303. new Uint8Array(buffer),
  1304. function(bit) {
  1305. // console.log('====================' + bit + '==========================')
  1306. return ('00' + bit.toString(16)).slice(-2)
  1307. }
  1308. )
  1309. return hexArr.join('');
  1310. },
  1311. /**
  1312. * 16进制转10进制
  1313. */
  1314. sixteen_to_ten(str) {
  1315. return parseInt(str, 16);
  1316. }
  1317. }
  1318. }
  1319. </script>
  1320. <style scoped lang="scss">
  1321. .content {
  1322. width: 100%;
  1323. height: 100%;
  1324. .container {
  1325. width: 100%;
  1326. padding: 20rpx 40rpx;
  1327. box-sizing: border-box;
  1328. .header {
  1329. display: flex;
  1330. justify-content: center;
  1331. position: relative;
  1332. height: 200rpx;
  1333. .scan {
  1334. display: flex;
  1335. flex-direction: column;
  1336. justify-content: center;
  1337. align-items: center;
  1338. height: 200rpx;
  1339. width: 30%;
  1340. .iconfont {
  1341. margin-bottom: 10rpx;
  1342. font-size: 100rpx;
  1343. color: $my-color-primary;
  1344. }
  1345. }
  1346. .scan_hover {
  1347. border-radius: 15rpx;
  1348. background-color: $my-color-btn-background;
  1349. }
  1350. .qinshihao {
  1351. display: flex;
  1352. align-items: center;
  1353. position: fixed;
  1354. top: 20rpx;
  1355. right: 30rpx;
  1356. font-size: 28rpx;
  1357. .icon-zhuye {
  1358. margin-right: 10rpx;
  1359. font-family: Microsoft YaHei-3970(82674968);
  1360. color: $my-color-primary;
  1361. }
  1362. .compustxt {
  1363. font-size: 18rpx;
  1364. }
  1365. }
  1366. }
  1367. .start_text {
  1368. .start_top,
  1369. .start_mid {
  1370. display: flex;
  1371. justify-content: space-between;
  1372. height: 100rpx;
  1373. align-items: center;
  1374. border-bottom: 2rpx #ccc solid;
  1375. .item_left {
  1376. display: flex;
  1377. align-items: center;
  1378. }
  1379. .start_mid_txt {
  1380. color: #333;
  1381. font-size: 30rpx;
  1382. }
  1383. .iconfont {
  1384. font-size: 50rpx;
  1385. color: $my-color-primary;
  1386. margin-right: 20rpx;
  1387. }
  1388. .start_payamount {
  1389. display: flex;
  1390. justify-content: flex-end;
  1391. align-items: center;
  1392. font-size: 38rpx;
  1393. padding: 10rpx;
  1394. font-family: Microsoft YaHei-3970(82674968);
  1395. color: #B2B2B2;
  1396. border-radius: 10rpx;
  1397. .icon-dayuhao {
  1398. margin: 0 0 0 20rpx;
  1399. font-size: 38rpx;
  1400. color: #B2B2B2;
  1401. }
  1402. }
  1403. }
  1404. .start_bot {
  1405. display: flex;
  1406. justify-content: space-between;
  1407. height: 100rpx;
  1408. align-items: center;
  1409. .kongzhonglianjie {
  1410. margin: 0;
  1411. height: 60rpx;
  1412. line-height: 60rpx;
  1413. font-size: 28rpx;
  1414. background-color: #1296DB;
  1415. color: #FFFFFF;
  1416. }
  1417. .start_bot_txt {
  1418. margin-left: 20rpx;
  1419. color: #333;
  1420. font-size: 28rpx;
  1421. }
  1422. }
  1423. }
  1424. .btn_room {
  1425. font-size: 28rpx;
  1426. background-color: #41c560;
  1427. margin: 10rpx auto;
  1428. }
  1429. .start_up_process {
  1430. padding: 20rpx 0;
  1431. color: #007AFF;
  1432. }
  1433. .ad {
  1434. margin: 0 -40rpx;
  1435. width: 750rpx;
  1436. height: 216rpx;
  1437. .ad_img {
  1438. height: 100%;
  1439. width: 100%;
  1440. }
  1441. }
  1442. .title {
  1443. height: 100rpx;
  1444. margin: 0 -40rpx;
  1445. padding: 0 40rpx;
  1446. line-height: 100rpx;
  1447. color: #808080;
  1448. font-size: 32rpx;
  1449. background: #f2f2f2;
  1450. }
  1451. .record-item {
  1452. width: 100%;
  1453. .uni-list-cell-db {
  1454. height: 100rpx;
  1455. line-height: 100rpx;
  1456. font-weight: bold;
  1457. .uni-input {
  1458. display: flex;
  1459. align-items: center;
  1460. text:nth-child(1) {
  1461. margin-right: 10rpx;
  1462. }
  1463. }
  1464. }
  1465. .item-list {
  1466. height: 80rpx;
  1467. display: flex;
  1468. align-items: center;
  1469. justify-content: space-between;
  1470. border-top: 2rpx #ccc solid;
  1471. .icon-shijian {
  1472. margin-right: 8rpx;
  1473. }
  1474. .icon-shuidi {
  1475. margin-right: 3rpx;
  1476. }
  1477. .item-list-txt {
  1478. font-size: 28rpx;
  1479. &:nth-of-type(2) {
  1480. color: #515151;
  1481. }
  1482. &:nth-of-type(3) {
  1483. color: #f76200;
  1484. font-size: 32rpx;
  1485. }
  1486. }
  1487. }
  1488. }
  1489. }
  1490. }
  1491. </style>