bindAliDev.vue 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215
  1. <template>
  2. <view class="container">
  3. <u-navbar leftIconColor="#fff" titleStyle="color:#fff;fontSize:36rpx;" :autoBack="true" bgColor="#2C6FF3"
  4. :placeholder="true" title="设备激活">
  5. </u-navbar>
  6. <view class="device-img flex flex-direction">
  7. <view class="tips flex justify-between align-center" v-if="!isBindAli">
  8. <view class="bind-tip">
  9. 您还没绑定支付宝
  10. </view>
  11. <xbutton round="50rpx" width="160rpx" @click="bindAliAcc">立即绑定</xbutton>
  12. </view>
  13. <view class="img">
  14. <u-image width="147rpx" src="https://cdn.ossfile.mxrvending.com/assets/xy_merc_mini/images/device.png"
  15. mode="widthFix" :lazy-load="true">
  16. </u-image>
  17. </view>
  18. </view>
  19. <view class="device-msg">
  20. <view class="msg-item">
  21. <view class="">
  22. 激活状态
  23. </view>
  24. <view class="">
  25. {{device.activeState==1?'已激活':'未激活'}}
  26. </view>
  27. </view>
  28. <view class="msg-item">
  29. <view class="">
  30. 工控SN
  31. </view>
  32. <view class="">
  33. {{device.deviceSn}}
  34. </view>
  35. </view>
  36. <view class="msg-item">
  37. <view class="">
  38. 商户前缀
  39. </view>
  40. <view class="">
  41. {{device.mercPrefix}}
  42. </view>
  43. </view>
  44. <view class="msg-item">
  45. <view class="">
  46. 设备编号
  47. </view>
  48. <view class="">
  49. {{device.deviceId}}
  50. </view>
  51. </view>
  52. </view>
  53. <view class="btn flex justify-between safe-bottom">
  54. <view style="width:48%">
  55. <xbutton size="large" round="82rpx" @click="refesh">刷新状态</xbutton>
  56. </view>
  57. <view style="width:48%">
  58. <xbutton size="large" round="82rpx" @click="help">激活帮助</xbutton>
  59. </view>
  60. </view>
  61. </view>
  62. </template>
  63. <script>
  64. import {
  65. userInfoBySelf,
  66. aliDeviceObj
  67. } from "@/api/device/device.js"
  68. export default {
  69. data() {
  70. return {
  71. isBindAli: true,
  72. deviceId: null,
  73. device: {
  74. }
  75. }
  76. },
  77. onLoad(o) {
  78. this.deviceId = o.id;
  79. },
  80. onShow() {
  81. this.getUserMsg()
  82. this.getDeviceMsg()
  83. },
  84. methods: {
  85. getDeviceMsg() {
  86. aliDeviceObj({
  87. deviceId: this.deviceId
  88. }).then(res => {
  89. this.device = res.data
  90. }).catch(err => {
  91. })
  92. },
  93. getUserMsg() {
  94. userInfoBySelf().then(res => {
  95. let data = res.data
  96. this.isBindAli = data.aliUserId ? true : false;
  97. })
  98. },
  99. refesh() {
  100. this.getDeviceMsg()
  101. },
  102. help() {
  103. },
  104. bindAliAcc() {
  105. this.$tab.navigateTo('/pages/activeDevice/bindAliAcc')
  106. },
  107. }
  108. }
  109. </script>
  110. <style lang="scss" scoped>
  111. .container {
  112. position: relative;
  113. text-align: center;
  114. .device-img {
  115. width: 724rpx;
  116. margin-left: 13rpx;
  117. background-color: #F5F5F5;
  118. border-radius: 14rpx;
  119. margin-top: 20rpx;
  120. padding-bottom: 40rpx;
  121. .tips {
  122. border-top-left-radius: 14rpx;
  123. border-top-right-radius: 14rpx;
  124. line-height: 80rpx;
  125. font-size: 26rpx;
  126. height: 80rpx;
  127. padding: 0 40rpx;
  128. background: linear-gradient(180deg, #DEE9FF, rgba(217,231,255,1));
  129. }
  130. .img {
  131. width: 147rpx;
  132. height: 281rpx;
  133. margin-top: 75rpx;
  134. margin-left: 292rpx;
  135. }
  136. }
  137. .device-msg {
  138. width: 724rpx;
  139. margin-left: 13rpx;
  140. margin-top: 20rpx;
  141. background-color: #F5F5F5;
  142. border-radius: 14rpx;
  143. padding: 0 37rpx;
  144. .msg-item {
  145. line-height: 92rpx;
  146. font-size: 28rpx;
  147. color: #333;
  148. display: flex;
  149. justify-content: space-between;
  150. &+.msg-item {
  151. border-top: 1rpx solid #E2E2E2;
  152. }
  153. >view:nth-child(1) {}
  154. >view:nth-child(2) {
  155. color: #777777;
  156. }
  157. }
  158. }
  159. .device-code {
  160. font-size: 54rpx;
  161. font-weight: bold;
  162. margin-top: 46%;
  163. color: #333;
  164. }
  165. .device-tips {
  166. font-size: 28rpx;
  167. margin-top: 30rpx;
  168. }
  169. .device-err {
  170. font-size: 22rpx;
  171. color: red;
  172. margin-top: 40rpx;
  173. }
  174. .scan {
  175. margin-top: 36rpx;
  176. }
  177. .btn {
  178. width: 100%;
  179. position: fixed;
  180. left: 0;
  181. bottom: 24rpx;
  182. padding: 0 24rpx;
  183. }
  184. }
  185. </style>