potho.vue 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237
  1. <template>
  2. <div>
  3. <div class="controls">
  4. <img src="../../static/icon_bgcx_bg.png" alt="" class="img">
  5. <span>请输入报告编号</span>
  6. </div>
  7. <div class="noticeTXT">
  8. <span>NO:ASJ(</span>
  9. <input type="number" v-for="(item, index) in code_len" :key="index" disabled @tap="onCode(index)"
  10. :value="code_val.length >= index + 1 ? code_val[index] : ''"
  11. class="code-input-item flex-default-center input_r" :maxlength="1"/>
  12. <span style="margin-left: 8upx;">)QG—</span>
  13. <input type="number" v-for="(item, index) in code_lena" :key="index" disabled @tap="onCode(index)"
  14. :value="code_vala.length >= index + 1 ? code_vala[index] : ''"
  15. class="code-input-item flex-default-center input_r" :maxlength="1"/>
  16. <span style="margin-left: 8upx;">)号</span>
  17. <!-- 实际监听 -->
  18. <input v-if="is_focus" @blur="blurCode" @input="setCode" type="number" class="code-input" v-model="code_vals"
  19. maxlength="7" :focus="true" />
  20. <!-- <span>NO:ASJ(</span>
  21. <input class="input_r" v-model="phonenum[0]" :maxlength="1">
  22. <input class="input_r" v-model="phonenum[1]" :maxlength="1">
  23. <input class="input_r" v-model="phonenum[2]" :maxlength="1">
  24. <input class="input_r" v-model="phonenum[3]" :maxlength="1" style="margin-right: 8upx;">
  25. <span>)QG—</span>
  26. <input class="input_r" v-model="phonenum[4]" :maxlength="1">
  27. <input class="input_r" v-model="phonenum[5]" :maxlength="1">
  28. <input class="input_r" v-model="phonenum[6]" :maxlength="1" style="margin-right: 8upx;">
  29. <span>)号</span> -->
  30. </div>
  31. <div class="snu">
  32. <button type="primary" @click="takePhoto">查询</button>
  33. </div>
  34. </div>
  35. </template>
  36. <script>
  37. export default {
  38. data() {
  39. return {
  40. src: '',
  41. device: true,
  42. productNameorCode: "",
  43. children_imgtwo: '',
  44. phonenum: ['', '', '', '', '', '', '', ], //编码展示,
  45. code_len: 4, // 验证码长度,
  46. code_lena:3,
  47. code_val: '', // 前面
  48. code_vala:'',//后面的
  49. code_vals:'',
  50. is_focus: false
  51. };
  52. },
  53. onLoad() {
  54. let token = uni.getStorageSync('phone')
  55. this.phonhe = token
  56. if(!token){
  57. uni.redirectTo({
  58. url: '/pages/login/login'
  59. })
  60. return false
  61. }
  62. },
  63. methods: {
  64. setCode(e) {
  65. var val=e.detail.value;
  66. if(val.length>3){
  67. this.code_val = val.slice(0,4);
  68. this.code_vala = val.slice(4);
  69. }else{
  70. this.code_val =val;
  71. }
  72. this.code_vals = e.detail.value;
  73. },
  74. onCode(e) { e
  75. this.is_focus = true;
  76. },
  77. blurCode() {
  78. this.is_focus = false;
  79. },
  80. fanh() {
  81. this.device = !this.device
  82. },
  83. tipsFn(tit,icon){
  84. icon=icon||'none'
  85. uni.showToast({
  86. title:tit,
  87. icon:icon,
  88. })
  89. },
  90. takePhoto(){
  91. var that=this;
  92. if(that.code_vals.length!=7){
  93. that.tipsFn("请输入正确的报告编号");
  94. return
  95. }
  96. var a=that.code_vals.slice(0,4)
  97. var b=that.code_vals.slice(4);
  98. var reportNumber='NO:ASJ('+a+')QG —'+b+'号'
  99. var phone=uni.getStorageSync('phone')
  100. var params={
  101. reportNumber:reportNumber,
  102. queryPhone:phone
  103. }
  104. that.$http.posta('gateway/query/queryReportNum',params).then(res => {
  105. if(res.code == '200') {
  106. var astr=JSON.stringify(res.data);
  107. wx.redirectTo({
  108. url:'/pages/home/recordtwo?code='+astr
  109. })
  110. }else{
  111. that.tipsFn(res.msg);
  112. }
  113. })
  114. }
  115. }
  116. }
  117. </script>
  118. <style lang="scss">
  119. .font-26 {
  120. font-size: 26rpx;
  121. }
  122. .font-color-9b9ba5 {
  123. color: #9b9ba5;
  124. }
  125. .font-color-0078FF {
  126. color: #0078ff;
  127. }
  128. .login-container {
  129. padding: 0 30rpx;
  130. }
  131. .login-header {
  132. padding: 90rpx 0;
  133. .login-header-item {
  134. font-size: 42rpx;
  135. margin-bottom: 17rpx;
  136. }
  137. }
  138. .code-input {
  139. height: 0;
  140. width: 0;
  141. }
  142. .code-input-item {
  143. width: 100rpx;
  144. height: 100rpx;
  145. border: 1px solid #9b9ba5;
  146. justify-content: center;
  147. text-align: center;
  148. }
  149. .snu {
  150. // width: 100%;
  151. margin: 0 33upx;
  152. button {
  153. flex: 1;
  154. margin: 60upx 10upx;
  155. margin-bottom: 0;
  156. margin-top: 258upx;
  157. border-radius: 46upx;
  158. }
  159. }
  160. .controls {
  161. display: flex;
  162. flex-direction: column;
  163. align-items: center;
  164. margin-top: 56upx;
  165. .img {
  166. width: 123upx !important;
  167. height: 123upx !important;
  168. margin-bottom: 20upx;
  169. }
  170. span {
  171. font-size: 29upx;
  172. font-family: PingFang SC;
  173. font-weight: bold;
  174. color: #1E1E1E;
  175. }
  176. }
  177. .noticeTXT {
  178. padding: 0 44upx;
  179. font-size: 35upx;
  180. font-family: PingFang SC;
  181. font-weight: 400;
  182. color: #1E1E1E;
  183. display: flex;
  184. margin-top: 91upx;
  185. .input_r {
  186. border: 1px solid #969696;
  187. width: 42upx;
  188. height: 42upx;
  189. margin-left: 7upx;
  190. border-radius: 7px;
  191. text-align: center;
  192. }
  193. }
  194. .ines {
  195. padding: 0 33upx;
  196. box-sizing: border-box;
  197. width: 100%;
  198. }
  199. .po {
  200. font-size: 34upx;
  201. color: #333;
  202. text-align: center;
  203. margin-top: 20upx;
  204. }
  205. .potie {
  206. font-size: 28upx;
  207. color: #333;
  208. text-align: right;
  209. margin: 20upx 0;
  210. }
  211. .jhey {
  212. width: 100%;
  213. margin-top: 10upx;
  214. // height: 400upx !important;
  215. }
  216. </style>