reshui.vue 40 KB

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