reshui.vue 39 KB

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