gasListBinding.vue 4.3 KB

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