123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687 |
- <template>
- <div class="saleSelfMachine">
- <div class="background">
- <img :src="backgroundImgURL" width="100%" height="100%"/>
- </div>
- <div class="orderNumberData">
- <el-input placeholder="请将二维码放置在扫描区" v-model="orderNumber" :focus="true" ref="inputs">
- </el-input>
- </div>
- </div>
- </template>
- <script>
- export default {
- data(){
- return{
- orderNumber:null,
- backgroundImgURL:require('@/assets/saleSelfMachine/scanCode.jpg'),
- }
- },
- created(){
- this.changfouce();
- },
- // watch:{
- // data:"toSaleSelfMachine"
- // },
- methods:{
- //输入框自动聚焦
- changfouce(){
- this.$nextTick((x)=>{
- this.$refs.inputs.focus();
- })
- },
- //失去焦点后自动执行获得焦点事件
- // onInputBlur(){
- // console.log("获取焦点")
- // this.changfouce();
- // }
- // toSaleSelfMachine(){
- // this.$router.push({
- // path:'/saleSelfMachine',
- // })
- // }
- },
- mounted(){
- // this.changfouce();
- const timer = setInterval(()=>{
- // if(this.$refs.inputs.focus==false){
- // console.log("false")
- this.changfouce();
- //}
- if(this.orderNumber!=null&&this.orderNumber.length==21){
- if(this.orderNumber.startsWith('WYSDD')==true||this.orderNumber.startsWith('wysdd')==true){
- this.$router.push({
- path:"/saleSelfMachine?orderNumber="+this.orderNumber,
- })
-
- }
- }
- },3000)
- this.$once('hook:beforeDestroy', ()=>{
- clearInterval(timer)
- })
- }
- }
- </script>
- <style lang="scss">
- .saleSelfMachine{
- width: 100vh;
- height: 100vh;
- .background {
- width: 100%;
- height: 100%;
- z-index: -1;
- position: absolute;
- overflow: hidden;
- }
- .orderNumberData{
- width: 20%;height: 30%;
- color: #fff;
- position: absolute;
- display: flex;
- justify-content: center;
- align-items: center;
- margin-left: 27rem;
- }
- }
- </style>
|