printScan.vue 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242
  1. <template xmlns="http://www.w3.org/1999/html">
  2. <div class="saleSelfMachine">
  3. <div class="background">
  4. <img :src="backgroundImgURL" width="100%" height="100%" />
  5. </div>
  6. <el-button @click.native="fullScreen" id="full" v-show="false"></el-button>
  7. <div class="orderNumberData">
  8. <!--v-show="false" disabled="!isEdit"-->
  9. <el-input
  10. placeholder="请将二维码放置在扫描区"
  11. v-model="orderNumber"
  12. :focus="true"
  13. ref="inputs"
  14. >
  15. </el-input>
  16. <!--style="display:block;width:120px"-->
  17. <div v-show="false">
  18. 手动输入开关:
  19. </div>
  20. <!-- <i class="el-icon-full-screen" @click="fullScreen"
  21. v-show="edit1"></i>-->
  22. <!-- <el-switch
  23. =======
  24. <i class="el-icon-full-screen" @click="fullScreen" v-show="edit1"></i>
  25. <el-switch
  26. :disabled="!isEdit"
  27. v-show="false"
  28. >
  29. </el-input>style="display:block;width:120px"-->
  30. <div v-show="false">
  31. 手动输入开关:
  32. </div>
  33. <i class="el-icon-full-screen" @click="fullScreen" v-show="edit1"></i>
  34. <!-- <el-switch
  35. v-model="isEdit"
  36. active-color="#66ccff"
  37. inactive-color="#ffffff"
  38. >
  39. </el-switch>-->
  40. </div>
  41. <!-- <div class="tip">
  42. 手机二维码对准下方摄像头<br />
  43. <div class="arrowDown">⇩</div>
  44. &lt;!&ndash; <i
  45. class="el-icon-bottom"
  46. style="padding-left: 450px;font-size: 300px;color: red"
  47. ></i> &ndash;&gt;
  48. </div>-->
  49. <div class="emg"><span style="">紧急联系人:0818-2521703</span></div>
  50. </div>
  51. </template>
  52. <script>
  53. import screenfull from 'screenfull'
  54. export default {
  55. data() {
  56. return {
  57. orderNumber: null,
  58. isEdit: true,
  59. edit1: true,
  60. backgroundImgURLList:[require('@/assets/saleSelfMachine/00.png'),
  61. require('@/assets/saleSelfMachine/01.png'),
  62. require('@/assets/saleSelfMachine/02.png'),
  63. require('@/assets/saleSelfMachine/03.png')],
  64. backgroundImgURL: require('@/assets/saleSelfMachine/00.png')
  65. }
  66. },
  67. created() {
  68. this.changfouce()
  69. },
  70. // watch:{
  71. // data:"toSaleSelfMachine"
  72. // },
  73. methods: {
  74. //全屏函数
  75. fullScreen() {
  76. // screenfull.request()
  77. // console.log('wbei')
  78. // // documentElement 属性以一个元素对象返回一个文档的文档元素
  79. // // var el = document.documentElement
  80. // // el.requestFullscreen ||
  81. // // el.mozRequestFullScreen ||
  82. // // el.webkitRequestFullscreen ||
  83. // // el.msRequestFullScreen
  84. // // ? el.requestFullscreen() ||
  85. // // el.mozRequestFullScreen() ||
  86. // // el.webkitRequestFullscreen() ||
  87. // // el.msRequestFullscreen()
  88. // // : null
  89. var wscript = new ActiveXObject('WScript.Shell') //创建ActiveX
  90. if (wscript !== null) {
  91. //创建成功
  92. wscript.SendKeys('{F11}') //触发f11
  93. }
  94. },
  95. //输入框自动聚焦
  96. changfouce() {
  97. this.$nextTick(x => {
  98. this.$refs.inputs.focus()
  99. })
  100. },
  101. /*fullScreen() {
  102. if (screenfull.isEnabled && !screenfull.isFullscreen) {
  103. screenfull.request()
  104. this.edit1 = false
  105. }
  106. },*/
  107. /*async querynumber(){
  108. console.log(this.orderNumber)
  109. let orderNumber=this.orderNumber
  110. let i=0
  111. await this.axios.post("/api/v1/tms/queryNumber?orderNumber=" + orderNumber)
  112. .then((res)=>{
  113. console.log("查找出来的数据")
  114. console.log(res.data)
  115. console.log("-------------------------")
  116. if (res.data.printnumber==1){
  117. i=1
  118. }
  119. })
  120. console.log(i)
  121. return i
  122. this.edit1 = false;
  123. }
  124. },*/
  125. async querynumber() {
  126. console.log(this.orderNumber)
  127. let orderNumber = this.orderNumber
  128. let i = 0
  129. await this.axios
  130. .post('/api/v1/tms/queryNumber?orderNumber=' + orderNumber)
  131. .then(res => {
  132. console.log('查找出来的数据')
  133. console.log(res.data)
  134. console.log('-------------------------')
  135. if (res.data.printnumber == 1) {
  136. i = 1
  137. }
  138. })
  139. console.log(i)
  140. return i
  141. }
  142. //失去焦点后自动执行获得焦点事件
  143. // onInputBlur(){
  144. // console.log("获取焦点")
  145. // this.changfouce();
  146. // }
  147. // toSaleSelfMachine(){
  148. // this.$router.push({
  149. // path:'/saleSelfMachine',
  150. // })
  151. // }
  152. },
  153. mounted() {
  154. document.getElementById('full').click()
  155. console.log(screenfull.isFullscreen)
  156. const timer1 = setInterval(async ()=>{
  157. this.backgroundImgURL=this.backgroundImgURLList[0]
  158. },3000)
  159. const timer = setInterval(async () => {
  160. // if(this.$refs.inputs.focus==false){
  161. // console.log("false")
  162. this.changfouce()
  163. //}
  164. if (
  165. this.orderNumber != null &&
  166. this.orderNumber != '' &&
  167. this.orderNumber.length == 21
  168. ) {
  169. if (
  170. this.orderNumber.startsWith('WYSDD') == true ||
  171. this.orderNumber.startsWith('wysdd') == true
  172. ) {
  173. let promise = await this.querynumber(this.orderNumber)
  174. console.log(promise)
  175. if (promise == 1) {
  176. this.backgroundImgURL=this.backgroundImgURLList[1]
  177. this.orderNumber = null
  178. return
  179. }
  180. this.$router.push({
  181. path: '/printReceipt?orderNumber=' + this.orderNumber
  182. })
  183. }
  184. } else if (
  185. this.orderNumber != null &&
  186. this.orderNumber != '' &&
  187. this.orderNumber.length > 21
  188. ) {
  189. //清空输入框,免得一次多个重复订单还无法删除
  190. this.orderNumber = null
  191. }
  192. }, 3000)
  193. this.$once('hook:beforeDestroy', () => {
  194. clearInterval(timer)
  195. })
  196. }
  197. }
  198. </script>
  199. <style lang="scss">
  200. .saleSelfMachine {
  201. width: 100vh;
  202. height: 100vh;
  203. .background {
  204. width: 100%;
  205. height: 100%;
  206. margin-top: 30px;
  207. z-index: -1;
  208. position: absolute;
  209. overflow: hidden;
  210. }
  211. .orderNumberData {
  212. width: 100%;
  213. color: #fff;
  214. position: absolute;
  215. display: flex;
  216. justify-content: center;
  217. align-items: center;
  218. }
  219. .tip {
  220. width: 1800px;
  221. height: 600px;
  222. font-size: 100px;
  223. padding-left: 350px;
  224. padding-top: 500px;
  225. color: #4cc9e9;
  226. .arrowDown {
  227. margin-top: 150px;
  228. padding-left: 450px;
  229. font-size: 300px;
  230. color: red;
  231. }
  232. }
  233. .emg {
  234. position: fixed;
  235. right: 20px;
  236. bottom: 20px;
  237. font-size: 30px;
  238. color: red;
  239. font-weight: 500;
  240. }
  241. }
  242. </style>