reshui.vue 40 KB

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