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/basicsModules/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/apiDemo/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/gasBottle/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. }
  72. }
  73. });
  74. }
  75. }
  76. },
  77. //调用摄像头
  78. saoCode(){
  79. let _this = this;
  80. uni.scanCode({
  81. onlyFromCamera: true,
  82. success: function (res) {
  83. _this.form.electronicTag=res.result
  84. _this.getBinding();
  85. }
  86. });
  87. },
  88. }
  89. }
  90. </script>
  91. <style lang="stylus" scoped>
  92. #gasRecycle {
  93. height: 100%;
  94. width: 100%;
  95. flex :1;
  96. display flex;
  97. flex-direction column
  98. overflow hidden;
  99. .title{
  100. width: 750rpx;
  101. height: 100rpx;
  102. background: #FFFFFF;
  103. font-size: 28rpx;
  104. font-family: PingFang SC;
  105. font-weight: 500;
  106. color: #333333;
  107. line-height: 100rpx;
  108. padding-left: 40rpx;
  109. }
  110. .register_li{
  111. background #fff;
  112. border-radius:20rpx;
  113. margin:20rpx 20rpx 0;
  114. padding:20rpx 0;
  115. box-sizing: border-box;
  116. .register_li_min{
  117. height: 100rpx;
  118. margin:0 26rpx;
  119. display flex;
  120. align-items center;
  121. /* border-bottom: 1px solid #F5F5F5; */
  122. .icon_img{
  123. width: 30rpx;
  124. height: 30rpx;
  125. margin-right: 12rpx;
  126. }
  127. view{
  128. //width:140rpx;
  129. font-size: 28rpx;
  130. font-family: PingFang SC;
  131. font-weight: 500;
  132. color: #999999;
  133. }
  134. view:nth-child(1){
  135. color:red;
  136. line-height:28rpx;
  137. margin-right: 12rpx;
  138. }
  139. .code_img{
  140. width: 30rpx;
  141. height: 28rpx;
  142. margin-left: 26rpx;
  143. }
  144. >input{
  145. flex:1;
  146. text-align: right;
  147. font-size: 24rpx;
  148. font-family: PingFang SC;
  149. font-weight: 500;
  150. color: #333333;
  151. }
  152. .binding{
  153. font-size: 24rpx;
  154. font-family: PingFang SC;
  155. font-weight: 500;
  156. color: #0183FA;
  157. line-height: 24rpx;
  158. margin-left: 24rpx;
  159. }
  160. }
  161. .issue_li{
  162. margin:34rpx 26rpx 0;
  163. display flex;
  164. border-bottom: 1px solid #F5F5F5;
  165. view:nth-child(1){
  166. color:red;
  167. line-height:28rpx;
  168. margin-right: 12rpx;
  169. }
  170. view:nth-child(2){
  171. //width:140rpx;
  172. font-size: 28rpx;
  173. font-family: PingFang SC;
  174. font-weight: 500;
  175. color: #999999;
  176. }
  177. .issue_img{
  178. width: 210rpx;
  179. height: 210rpx;
  180. border-radius: 10rpx;
  181. margin-left:250rpx;
  182. }
  183. }
  184. }
  185. /* 按钮 */
  186. .sub_btn{
  187. width: 650rpx;
  188. height: 100rpx;
  189. background: #0183FA;
  190. border-radius: 20rpx;
  191. font-size: 28rpx;
  192. font-family: PingFang SC;
  193. font-weight: 500;
  194. color: #FFFFFF;
  195. line-height: 100rpx;
  196. text-align: center;
  197. margin-left: 50rpx;
  198. position: fixed;
  199. bottom:30rpx;
  200. }
  201. }
  202. </style>