gasListBinding.vue 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212
  1. <!--气瓶列表-->
  2. <template>
  3. <view id="gasRecycle">
  4. <view class="title">{{item.airName}}-{{item.configName}}</view>
  5. <view class="register_li">
  6. <view class="register_li_min">
  7. <view>*</view>
  8. <view>电子标签:</view>
  9. <input v-model="form.electronicTag" type="text" placeholder="请输入电子标签ID">
  10. <img @click.stop="saoCode" class="code_img" src="@/images/Version2.2/icon_aqjc_sm.png">
  11. </view>
  12. </view>
  13. <view class="sub_btn" @click="getBinding()">确认绑定</view>
  14. </view>
  15. </template>
  16. <script>
  17. import { gasTagBinding } from '@/api/index.js'
  18. export default {
  19. name: "gasRecycle",
  20. data() {
  21. return {
  22. pageType:0,
  23. form:{
  24. id:'',
  25. electronicTag:'',
  26. },
  27. item:{},
  28. }
  29. },
  30. onLoad(option) {
  31. this.item=JSON.parse(decodeURIComponent(option.item));
  32. this.form.id=this.item.bottleStorageId;
  33. },
  34. onShow() {
  35. },
  36. mounted(){
  37. },
  38. methods: {
  39. async getBinding(){
  40. let _this=this;
  41. if(!_this.form.electronicTag){
  42. uni.showToast({
  43. title: '请录入电子标签码!',
  44. icon:"none",
  45. mask:true,
  46. duration: 2000
  47. });
  48. return
  49. }
  50. const {data} = await gasTagBinding(this.form);
  51. if(data.code==200){
  52. let res = data.data;
  53. if(data.code==200){
  54. uni.showToast({
  55. title: '绑定成功!',
  56. icon:"none",
  57. mask:true,
  58. duration: 2000
  59. });
  60. uni.redirectTo({
  61. url: '/pages_manage/gasList/gasListDetail?item='+encodeURIComponent(JSON.stringify(this.item))
  62. });
  63. }else{
  64. _this.form.electronicTag='';
  65. uni.showModal({
  66. showCancel:false,
  67. confirmColor:'#0183FA',
  68. content: '该RFID已被绑定,请重新选择 RFID标签',
  69. success: function (res) {
  70. if (res.confirm) {
  71. console.log('用户点击确定');
  72. }
  73. }
  74. });
  75. }
  76. }
  77. },
  78. //调用摄像头
  79. saoCode(){
  80. let _this = this;
  81. uni.scanCode({
  82. onlyFromCamera: true,
  83. success: function (res) {
  84. _this.form.electronicTag=res.result
  85. _this.getBinding();
  86. }
  87. });
  88. },
  89. }
  90. }
  91. </script>
  92. <style lang="stylus" scoped>
  93. #gasRecycle {
  94. height: 100%;
  95. width: 100%;
  96. flex :1;
  97. display flex;
  98. flex-direction column
  99. overflow hidden;
  100. .title{
  101. width: 750rpx;
  102. height: 100rpx;
  103. background: #FFFFFF;
  104. font-size: 28rpx;
  105. font-family: PingFang SC;
  106. font-weight: 500;
  107. color: #333333;
  108. line-height: 100rpx;
  109. padding-left: 40rpx;
  110. }
  111. .register_li{
  112. background #fff;
  113. border-radius:20rpx;
  114. margin:20rpx 20rpx 0;
  115. padding:20rpx 0;
  116. box-sizing: border-box;
  117. .register_li_min{
  118. height: 100rpx;
  119. margin:0 26rpx;
  120. display flex;
  121. align-items center;
  122. /* border-bottom: 1px solid #F5F5F5; */
  123. .icon_img{
  124. width: 30rpx;
  125. height: 30rpx;
  126. margin-right: 12rpx;
  127. }
  128. view{
  129. //width:140rpx;
  130. font-size: 28rpx;
  131. font-family: PingFang SC;
  132. font-weight: 500;
  133. color: #999999;
  134. }
  135. view:nth-child(1){
  136. color:red;
  137. line-height:28rpx;
  138. margin-right: 12rpx;
  139. }
  140. .code_img{
  141. width: 30rpx;
  142. height: 28rpx;
  143. margin-left: 26rpx;
  144. }
  145. >input{
  146. flex:1;
  147. text-align: right;
  148. font-size: 24rpx;
  149. font-family: PingFang SC;
  150. font-weight: 500;
  151. color: #333333;
  152. }
  153. .binding{
  154. font-size: 24rpx;
  155. font-family: PingFang SC;
  156. font-weight: 500;
  157. color: #0183FA;
  158. line-height: 24rpx;
  159. margin-left: 24rpx;
  160. }
  161. }
  162. .issue_li{
  163. margin:34rpx 26rpx 0;
  164. display flex;
  165. border-bottom: 1px solid #F5F5F5;
  166. view:nth-child(1){
  167. color:red;
  168. line-height:28rpx;
  169. margin-right: 12rpx;
  170. }
  171. view:nth-child(2){
  172. //width:140rpx;
  173. font-size: 28rpx;
  174. font-family: PingFang SC;
  175. font-weight: 500;
  176. color: #999999;
  177. }
  178. .issue_img{
  179. width: 210rpx;
  180. height: 210rpx;
  181. border-radius: 10rpx;
  182. margin-left:250rpx;
  183. }
  184. }
  185. }
  186. /* 按钮 */
  187. .sub_btn{
  188. width: 650rpx;
  189. height: 100rpx;
  190. background: #0183FA;
  191. border-radius: 20rpx;
  192. font-size: 28rpx;
  193. font-family: PingFang SC;
  194. font-weight: 500;
  195. color: #FFFFFF;
  196. line-height: 100rpx;
  197. text-align: center;
  198. margin-left: 50rpx;
  199. position: fixed;
  200. bottom:30rpx;
  201. }
  202. }
  203. </style>