reshui.vue 40 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673
  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>