equipmentList.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688
  1. <template>
  2. <view class="equipment-home">
  3. <view class="top-bg">
  4. <view class="status_bar">
  5. </view>
  6. <view class="title">
  7. <view class="arrow" @click="backPage()">
  8. <image src="../../static/image/white-left.png" mode=""></image>
  9. </view>
  10. 氢予健康
  11. </view>
  12. </view>
  13. <view class="top">
  14. <view class="name">
  15. <image src="../../static/image/name1.png" mode="" class="icon"></image>
  16. 站点名称:{{siteDetail.name}}
  17. </view>
  18. <view class="name">
  19. <image src="../../static/image/address1.png" mode="" class="icon"></image>
  20. 详细地址:{{siteDetail.address}}
  21. </view>
  22. <view class="name">
  23. <image src="../../static/image/guanliyuan.png" mode="" class="icon"></image>
  24. 站长:{{siteDetail.contact_name}}
  25. </view>
  26. <view class="name">
  27. <image src="../../static/image/phone1.png" mode="" class="icon"></image>
  28. 服务电话:{{siteDetail.contact_mobile}}
  29. </view>
  30. </view>
  31. <view class="residue-time" v-if="sytime!==0">
  32. 吸氢卡剩余时长<text class="surplus-time">{{sytime}}</text>分钟<text style="float: right;" @click="lookDetail">查看详情></text>
  33. </view>
  34. <view class="title1">
  35. <view class="title1-left" @click="changeTab(1)">
  36. <view :class="currentTab==1 ? 'title-active' : 'title-active1'">
  37. 设备列表
  38. </view>
  39. </view>
  40. <view class="title1-right" @click="changeTab(2)">
  41. <view :class="currentTab==2 ? 'title-active' : 'title-active1'">
  42. 优惠套餐
  43. </view>
  44. </view>
  45. </view>
  46. <!-- 设备列表 -->
  47. <view class="" v-if="currentTab==1">
  48. <view class="list" v-for="(item,index) in equipmentList" :key='index' @click="equipmentDetail(item.id)">
  49. <view class="list-title">
  50. 设备编号:<text style="color: #ff9c45;">{{item.no ? item.no : '--'}}</text>
  51. <text class="iconfont icon-iconfontjiantou2"></text>
  52. </view>
  53. <view class="list-text">
  54. <view class="left">
  55. <image src="../../static/image/name.png" mode=""></image>
  56. <!-- <view class="text">
  57. 水位:{{item.water_level_warning_text}}
  58. </view> -->
  59. </view>
  60. <view class="right" v-if="!item.type || item.type==0">
  61. <view class="right-text">
  62. <view class="name">
  63. 工作状态
  64. </view>
  65. <view class="status">
  66. {{item.a_test ? item.a_test : '--'}}
  67. </view>
  68. </view>
  69. <view class="right-text">
  70. <view class="name">
  71. 设备状态
  72. </view>
  73. <view class="status">
  74. {{item.is_line_text ? item.is_line_text : '--'}}
  75. </view>
  76. </view>
  77. </view>
  78. <view class="right" v-else>
  79. <view class="right-text">
  80. <view class="name">
  81. A端口
  82. </view>
  83. <view class="status">
  84. {{item.a_test ? item.a_test : '--'}}
  85. </view>
  86. </view>
  87. <view class="right-text">
  88. <view class="name">
  89. B端口
  90. </view>
  91. <view class="status">
  92. {{item.b_test ? item.b_test : '--'}}
  93. </view>
  94. </view>
  95. <view class="right-text">
  96. <view class="name">
  97. 状态
  98. </view>
  99. <view class="status">
  100. {{item.is_line_text ? item.is_line_text : '--'}}
  101. </view>
  102. </view>
  103. </view>
  104. </view>
  105. </view>
  106. <view class="none" v-if="equipmentList.length==0">
  107. <image src="../../static/image/null.png"></image>
  108. <text>暂无设备列表</text>
  109. </view>
  110. </view>
  111. <!-- 优惠套餐 -->
  112. <view class="" v-if="currentTab==2">
  113. <view class="box">
  114. <view class="card" v-for="(item,index) in cardList" :key='index'>
  115. <view :class="card_id==item.id ? 'active' : 'card-list-item'" @click="changeCard(item.id)">
  116. <view class="right-tips" v-if="item.discount!==0">限时{{item.discount/10}}折</view>
  117. <view class="card-title">
  118. <!-- <text>30次/5天</text> -->
  119. <!-- <text>7天不限次</text> -->
  120. <text>{{item.time}}分钟时长卡</text>
  121. </view>
  122. <view class="card-money">
  123. <text class="money-num">{{item.price}}</text>元
  124. <text class="yuanjia">{{item.money}}元</text>
  125. </view>
  126. </view>
  127. </view>
  128. <view class="buy-buttom" @click="buyButtom">购买</view>
  129. <view class="none" v-if="cardList.length==0">
  130. <image src="../../static/image/null.png"></image>
  131. <text>暂无优惠套餐</text>
  132. </view>
  133. </view>
  134. </view>
  135. </view>
  136. </template>
  137. <script>
  138. var app = getApp()
  139. export default {
  140. data() {
  141. return {
  142. shop_id: '',
  143. siteDetail: '',
  144. equipmentList: [1, 2, 1, 1, 1, 3],
  145. currentTab: 1,
  146. cardList: [], //卡券列表
  147. card_id: 1,
  148. sytime: 0
  149. }
  150. },
  151. onLoad(options) {
  152. uni.showLoading()
  153. console.log(options, '0-0-0-0-0-0-0-0-0-0-0-0-')
  154. let params = {
  155. id: options.id
  156. }
  157. this.shop_id = options.id
  158. this.getSiteDetail(params)
  159. this.getCardsList(params)
  160. this.getEquipmentList(options.id)
  161. this.getSurplusTime(options.id)
  162. },
  163. methods: {
  164. //站点详细信息
  165. getSiteDetail: function(params) {
  166. uni.showLoading()
  167. app.request('/shops/' + params.id, '', 'get').then(res => {
  168. console.log(res)
  169. this.siteDetail = res.data.data.data
  170. app.globalData.a_minute_money = res.data.data.data.a_minute_money
  171. app.globalData.b_minute_money = res.data.data.data.b_minute_money
  172. app.globalData.ab_minute_money = res.data.data.data.ab_minute_money
  173. uni.hideLoading()
  174. })
  175. },
  176. //卡券列表
  177. getCardsList: function(params) {
  178. let data = {
  179. shop_id: params.id
  180. }
  181. app.request('/shop/cards', data, 'get').then(res => {
  182. console.log(res, 'cardlist')
  183. this.cardList = res.data.data.data
  184. })
  185. },
  186. //剩余时长
  187. getSurplusTime: function(id) {
  188. app.request('/shop/me-card?shop_id=' + id, '', 'get').then(res => {
  189. console.log(res.data.data.time, 'shengyushichang ')
  190. this.sytime = res.data.data.time
  191. console.log(this.sytime, 'pppppp')
  192. })
  193. },
  194. //设备列表
  195. getEquipmentList: function(e) {
  196. uni.showLoading()
  197. let params = {
  198. shop_id: e
  199. }
  200. app.request('/devices', params, 'get').then(res => {
  201. this.equipmentList = res.data.data.data
  202. uni.hideLoading()
  203. console.log(this.equipmentList, '设备列表')
  204. })
  205. },
  206. //设备详情
  207. equipmentDetail: function(e) {
  208. uni.navigateTo({
  209. url: './service?id=' + e
  210. })
  211. },
  212. //tab切换
  213. changeTab: function(e) {
  214. this.currentTab = e
  215. },
  216. //选择优惠券
  217. changeCard: function(e) {
  218. console.log(e, '选择优惠券')
  219. this.card_id = e
  220. },
  221. //购买优惠券
  222. buyButtom: function(e) {
  223. let data = {
  224. shop_id: this.shop_id,
  225. card_id: this.card_id
  226. }
  227. app.request('/shop/card', data, 'post').then(res => {
  228. console.log(res.data.data, '下单')
  229. let data = res.data.data
  230. if (res.statusCode == 200) {
  231. uni.requestPayment({
  232. provider: data.provider,
  233. timeStamp: data.timeStamp,
  234. nonceStr: data.nonceStr,
  235. package: data.package,
  236. signType: 'MD5',
  237. paySign: data.paySign,
  238. success: function(res) {
  239. console.log('success:' + JSON.stringify(res));
  240. uni.reLaunch({
  241. url: '../mine/pay_success'
  242. })
  243. },
  244. fail: function(err) {
  245. console.log('fail:' + JSON.stringify(err));
  246. }
  247. })
  248. }
  249. })
  250. },
  251. //查看订单吸氢时长
  252. lookDetail: function() {
  253. uni.navigateTo({
  254. url: '../mine/card_use?shop_id=' + this.shop_id
  255. })
  256. },
  257. backPage: function() {
  258. uni.navigateBack()
  259. }
  260. }
  261. }
  262. </script>
  263. <style lang="scss" scoped>
  264. .equipment-home {
  265. width: 100%;
  266. .top-bg {
  267. // background-color: #ff964a;
  268. background-color: $mine-background-color;
  269. border-radius: 0 0 40upx 40upx;
  270. height: 350upx;
  271. .status_bar {
  272. height: var(--status-bar-height);
  273. width: 100%;
  274. }
  275. .title {
  276. text-align: center;
  277. line-height: 100upx;
  278. height: 100upx;
  279. font-size: 38upx;
  280. color: #FFFFFF;
  281. position: relative;
  282. .arrow {
  283. position: absolute;
  284. width: 100upx;
  285. height: 100upx;
  286. left: 10upx;
  287. top: 25upx;
  288. image {
  289. float: left;
  290. height: 50upx;
  291. width: 50upx;
  292. }
  293. }
  294. }
  295. }
  296. .top {
  297. margin: 30upx;
  298. margin-top: -130upx;
  299. padding: 30upx;
  300. background-color: #FFFFFF;
  301. border-radius: 12upx;
  302. .name {
  303. // height: 50upx;
  304. line-height: 50upx;
  305. font-size: 30upx;
  306. color: #555555;
  307. image {
  308. height: 30upx;
  309. width: 30upx;
  310. margin-right: 20upx;
  311. display: inline-block;
  312. vertical-align: top;
  313. margin-top: 10upx;
  314. }
  315. }
  316. }
  317. .residue-time {
  318. padding: 20rpx 30rpx;
  319. margin: 0 30rpx;
  320. color: #FFFFFF;
  321. font-size: 28rpx;
  322. // color: #f0d84d;
  323. background-image: linear-gradient(to right, #F0AD4E, #f0d84d);
  324. border-radius: 12rpx;
  325. }
  326. .surplus-time {
  327. font-size: 34rpx;
  328. font-weight: 600;
  329. display: inline-block;
  330. margin: 0 5rpx;
  331. }
  332. .title1 {
  333. height: 100upx;
  334. // line-height: 70upx;
  335. font-size: 30upx;
  336. font-weight: bold;
  337. color: #555555;
  338. margin: 50upx 30upx 30upx;
  339. padding-left: 20upx;
  340. background-color: #FFFFFF;
  341. text-align: center;
  342. display: flex;
  343. .title1-left {
  344. flex: 1;
  345. }
  346. .title-active {
  347. margin: 0 auto;
  348. margin-top: 10rpx;
  349. height: 80;
  350. line-height: 80rpx;
  351. width: 80%;
  352. background-color: #027675;
  353. border-radius: 50rpx;
  354. color: #FFFFFF;
  355. }
  356. .title-active1 {
  357. margin: 0 auto;
  358. margin-top: 20rpx;
  359. height: 60rpx;
  360. line-height: 60rpx;
  361. width: 70%;
  362. // background-color: #16DAD8;
  363. border-radius: 20rpx;
  364. }
  365. .title1-right {
  366. flex: 1;
  367. }
  368. }
  369. .list {
  370. margin: 30upx;
  371. background-color: #FFFFFF;
  372. padding: 30upx;
  373. border-radius: 12upx;
  374. .list-title {
  375. border-bottom: solid 1upx #F1F1F1;
  376. color: #555555;
  377. font-size: 26upx;
  378. font-weight: bold;
  379. height: 70upx;
  380. line-height: 70upx;
  381. .icon-iconfontjiantou2 {
  382. float: right;
  383. }
  384. }
  385. .list-text {
  386. display: flex;
  387. padding: 30upx 0;
  388. .left {
  389. flex: 0 0 150upx;
  390. text-align: center;
  391. margin-right: 30upx;
  392. .text {
  393. font-size: 24upx;
  394. text-align: center;
  395. height: 50upx;
  396. line-height: 50upx;
  397. }
  398. image {
  399. margin-top: 20upx;
  400. height: 100upx;
  401. width: 100upx;
  402. }
  403. }
  404. .right {
  405. flex: 1;
  406. display: flex;
  407. .right-text {
  408. flex: 1;
  409. vertical-align: top;
  410. text-align: center;
  411. .name {
  412. font-size: 30upx;
  413. color: #808080;
  414. height: 70upx;
  415. line-height: 70upx;
  416. }
  417. .status {
  418. height: 90upx;
  419. line-height: 90upx;
  420. font-size: 32upx;
  421. font-weight: bold;
  422. }
  423. }
  424. }
  425. }
  426. }
  427. // 优惠套餐
  428. .box {
  429. /* width: 100%; */
  430. /* height: 100%; */
  431. /* display: flex;
  432. flex-direction: column;
  433. align-items: center; */
  434. padding-bottom: 20upx;
  435. }
  436. .card {
  437. margin: 30upx;
  438. }
  439. .card-list1 {
  440. position: relative;
  441. border: solid 5upx #eceaea;
  442. background-color: #fff;
  443. padding: 30upx;
  444. /* background: #ffe98f;
  445. border: solid 5upx var(--globleColor); */
  446. border-radius: 20upx;
  447. }
  448. .active {
  449. position: relative;
  450. padding: 30upx;
  451. border-radius: 20upx;
  452. color: #FFFFFF;
  453. background-image: linear-gradient(to right, #3bba91, #027675);
  454. border: solid 5upx var(--globleColor);
  455. }
  456. .card-title {
  457. font-size: 30upx;
  458. font-weight: 500;
  459. }
  460. .card-tips {
  461. font-size: 26upx;
  462. margin-top: 10upx;
  463. }
  464. .card-money {
  465. font-size: 26upx;
  466. margin-top: 30upx;
  467. }
  468. .money-num {
  469. font-size: 50upx;
  470. font-weight: bold;
  471. }
  472. .yuanjia {
  473. color: #2c2c6c;
  474. display: inline-block;
  475. margin-left: 10upx;
  476. text-decoration: line-through;
  477. }
  478. .card-list {
  479. display: flex;
  480. flex-wrap: wrap;
  481. justify-content: space-between;
  482. flex-direction: row;
  483. }
  484. .card-content {
  485. margin: 30upx;
  486. }
  487. .card-list-item {
  488. position: relative;
  489. flex: 0 0 45%;
  490. border: solid 5upx #eceaea;
  491. padding: 20upx;
  492. border-radius: 30upx;
  493. background-color: #fff;
  494. margin-top: 30upx;
  495. }
  496. .active1 {
  497. position: relative;
  498. flex: 0 0 45%;
  499. padding: 20upx 0;
  500. border-radius: 30upx;
  501. margin-top: 30upx;
  502. background: #3bba91;
  503. border: solid 5upx $mine-background-color
  504. }
  505. .right-tips {
  506. position: absolute;
  507. height: 40upx;
  508. padding: 0 30upx;
  509. font-size: 22upx;
  510. line-height: 40upx;
  511. color: #ffffff;
  512. font-weight: bold;
  513. background-color: rgb(235, 58, 4);
  514. border-radius: 0 20upx;
  515. top: 0;
  516. right: 0;
  517. }
  518. .item-money {
  519. margin-top: 10upx;
  520. }
  521. .buy-buttom {
  522. height: 100upx;
  523. width: 80%;
  524. margin: 0 auto;
  525. margin-top: 50upx;
  526. background-color: #027675;
  527. color: #FFFFFF;
  528. text-align: center;
  529. border-radius: 50upx;
  530. line-height: 100upx;
  531. font-size: 32upx;
  532. font-weight: bold;
  533. }
  534. .box .hot {
  535. /* padding-top: ; */
  536. width: 690upx;
  537. padding: 30upx 0;
  538. /* height:296upx; */
  539. background: rgba(255, 255, 255, 1);
  540. border-radius: 20upx;
  541. background-size: 100% 100%;
  542. display: flex;
  543. flex-direction: column;
  544. justify-content: center;
  545. box-sizing: border-box;
  546. padding-left: 47upx;
  547. margin-top: 30upx;
  548. }
  549. .box .hot .title {
  550. font-size: 38upx;
  551. font-family: PingFang SC;
  552. font-weight: bold;
  553. color: rgba(42, 42, 42, 1);
  554. }
  555. .box .hot .frequency {
  556. font-size: 32upx;
  557. font-family: PingFang SC;
  558. color: rgba(153, 153, 153, 1);
  559. }
  560. .box .hot .info {
  561. display: flex;
  562. align-items: flex-end;
  563. padding: 19upx 0upx;
  564. }
  565. .box .hot .info text:nth-of-type(1) {
  566. font-size: 46upx;
  567. font-family: PingFang SC;
  568. font-weight: bold;
  569. color: rgba(42, 42, 42, 1);
  570. }
  571. .box .hot .info text:nth-of-type(2) {
  572. font-size: 26upx;
  573. font-family: PingFang SC;
  574. color: rgba(153, 153, 153, 1);
  575. padding-left: 19upx;
  576. padding-bottom: 6upx;
  577. text-decoration: line-through;
  578. }
  579. .box .hot .buy {
  580. width: 160upx;
  581. height: 70upx;
  582. margin-bottom: 20upx;
  583. background: #5E5D5D;
  584. /* background:var(--globleColor); */
  585. border-radius: 40upx;
  586. display: flex;
  587. /* margin-left: 20upx; */
  588. align-items: center;
  589. justify-content: center;
  590. font-size: 32upx;
  591. font-family: PingFang SC;
  592. color: rgba(255, 255, 255, 1);
  593. }
  594. .box .hot .info .buy text {
  595. font-size: 26upx;
  596. color: #ffffff;
  597. }
  598. .none {
  599. display: flex;
  600. flex-direction: column;
  601. align-items: center;
  602. justify-content: center;
  603. width: 100%;
  604. margin-top: 30%;
  605. height: 90%;
  606. }
  607. .none image {
  608. height: 200upx;
  609. width: 200upx;
  610. }
  611. .none text {
  612. /* padding-right: 70upx; */
  613. padding-top: 50upx;
  614. }
  615. }
  616. </style>