reshui.vue 40 KB

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