123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264 |
- <template xmlns="http://www.w3.org/1999/html">
- <div class="saleSelfMachine">
- <div class="background">
- <img :src="backgroundImgURL" width="100%" height="100%" />
- </div>
- <el-button @click.native="fullScreen" id="full" v-show="false"></el-button>
- <div class="orderNumberData">
- <!--v-show="false" disabled="!isEdit"-->
- <el-input
- placeholder="请将二维码放置在扫描区"
- v-model="orderNumber"
- :focus="true"
- ref="inputs"
- >
- </el-input>
- <!--style="display:block;width:120px"-->
- <div v-show="false">
- 手动输入开关:
- </div>
- <!-- <i class="el-icon-full-screen" @click="fullScreen"
- v-show="edit1"></i>-->
- <!-- <el-switch
- =======
- <i class="el-icon-full-screen" @click="fullScreen" v-show="edit1"></i>
- <el-switch
- :disabled="!isEdit"
- v-show="false"
- >
- </el-input>style="display:block;width:120px"-->
- <div v-show="false">
- 手动输入开关:
- </div>
- <i class="el-icon-full-screen" @click="fullScreen" v-show="edit1"></i>
- <!-- <el-switch
- v-model="isEdit"
- active-color="#66ccff"
- inactive-color="#ffffff"
- >
- </el-switch>-->
- </div>
- <!-- <div class="tip">
- 手机二维码对准下方摄像头<br />
- <div class="arrowDown">⇩</div>
- <!– <i
- class="el-icon-bottom"
- style="padding-left: 450px;font-size: 300px;color: red"
- ></i> –>
- </div>-->
- <div class="emg"><span style="">紧急联系人:0818-2521703</span></div>
- </div>
- </template>
- <script>
- import screenfull from 'screenfull'
- export default {
- data() {
- return {
- orderNumber: null,
- isEdit: true,
- edit1: true,
- backgroundImgURLList:[require('@/assets/saleSelfMachine/00.png'),
- require('@/assets/saleSelfMachine/01.png'),
- require('@/assets/saleSelfMachine/02.png'),
- require('@/assets/saleSelfMachine/03.png')],
- backgroundImgURL: require('@/assets/saleSelfMachine/00.png')
- }
- },
- created() {
- this.changfouce()
- },
- // watch:{
- // data:"toSaleSelfMachine"
- // },
- methods: {
- //打印函数
- printing(){
- console.log("进入了打印方法")
- this.backgroundImgURL=this.backgroundImgURLList[2];
- setTimeout(()=>{
- console.log("进入了第一层定时器")
- this.backgroundImgURL=this.backgroundImgURLList[3]
- setTimeout(()=>{
- console.log("进入了第二层定时器")
- this.backgroundImgURL=this.backgroundImgURLList[0]
- this.$route.params.index=0
- },2000)
- },30000);
- },
- //全屏函数
- fullScreen() {
- // screenfull.request()
- // console.log('wbei')
- // // documentElement 属性以一个元素对象返回一个文档的文档元素
- // // var el = document.documentElement
- // // el.requestFullscreen ||
- // // el.mozRequestFullScreen ||
- // // el.webkitRequestFullscreen ||
- // // el.msRequestFullScreen
- // // ? el.requestFullscreen() ||
- // // el.mozRequestFullScreen() ||
- // // el.webkitRequestFullscreen() ||
- // // el.msRequestFullscreen()
- // // : null
- var wscript = new ActiveXObject('WScript.Shell') //创建ActiveX
- if (wscript !== null) {
- //创建成功
- wscript.SendKeys('{F11}') //触发f11
- }
- },
- //输入框自动聚焦
- changfouce() {
- this.$nextTick(x => {
- this.$refs.inputs.focus()
- })
- },
- /*fullScreen() {
- if (screenfull.isEnabled && !screenfull.isFullscreen) {
- screenfull.request()
- this.edit1 = false
- }
- },*/
- /*async querynumber(){
- console.log(this.orderNumber)
- let orderNumber=this.orderNumber
- let i=0
- await this.axios.post("/api/v1/tms/queryNumber?orderNumber=" + orderNumber)
- .then((res)=>{
- console.log("查找出来的数据")
- console.log(res.data)
- console.log("-------------------------")
- if (res.data.printnumber==1){
- i=1
- }
- })
- console.log(i)
- return i
- this.edit1 = false;
- }
- },*/
- async querynumber() {
- console.log(this.orderNumber)
- let orderNumber = this.orderNumber
- let i = 0
- await this.axios
- .post('/api/v1/tms/queryNumber?orderNumber=' + orderNumber)
- .then(res => {
- console.log('查找出来的数据')
- console.log(res.data)
- console.log('-------------------------')
- if (res.data.printnumber == 1) {
- i = 1
- }
- })
- console.log(i)
- return i
- }
- //失去焦点后自动执行获得焦点事件
- // onInputBlur(){
- // console.log("获取焦点")
- // this.changfouce();
- // }
- // toSaleSelfMachine(){
- // this.$router.push({
- // path:'/saleSelfMachine',
- // })
- // }
- },
- mounted() {
- document.getElementById('full').click()
- console.log(screenfull.isFullscreen)
- console.log(this.$route.params.index)
- if (this.$route.params.index==1){
- this.printing();
- }
- /*const timer1 = setInterval(async ()=>{
- this.backgroundImgURL=this.backgroundImgURLList[0]
- },3000)*/
- const timer = setInterval(async () => {
- // if(this.$refs.inputs.focus==false){
- // console.log("false")
- this.changfouce()
- //}
- if (
- this.orderNumber != null &&
- this.orderNumber != '' &&
- this.orderNumber.length == 21
- ) {
- if (
- this.orderNumber.startsWith('WYSDD') == true ||
- this.orderNumber.startsWith('wysdd') == true
- ) {
- let promise = await this.querynumber(this.orderNumber)
- console.log(promise)
- if (promise == 1) {
- this.backgroundImgURL=this.backgroundImgURLList[1]
- this.orderNumber = null
- setTimeout(()=>{
- this.backgroundImgURL=this.backgroundImgURLList[0]
- console.log("进入该方法了")
- },4000)
- return
- }
- this.$router.push({
- path: '/printReceipt1?orderNumber=' + this.orderNumber
- })
- }
- } else if (
- this.orderNumber != null &&
- this.orderNumber != '' &&
- this.orderNumber.length > 21
- ) {
- //清空输入框,免得一次多个重复订单还无法删除
- this.orderNumber = null
- }
- }, 3000)
- this.$once('hook:beforeDestroy', () => {
- clearInterval(timer)
- })
- }
- }
- </script>
- <style lang="scss">
- .saleSelfMachine {
- width: 100vh;
- height: 100vh;
- .background {
- width: 100%;
- height: 100%;
- margin-top: 30px;
- z-index: -1;
- position: absolute;
- overflow: hidden;
- }
- .orderNumberData {
- width: 100%;
- color: #fff;
- position: absolute;
- display: flex;
- justify-content: center;
- align-items: center;
- }
- .tip {
- width: 1800px;
- height: 600px;
- font-size: 100px;
- padding-left: 350px;
- padding-top: 500px;
- color: #4cc9e9;
- .arrowDown {
- margin-top: 150px;
- padding-left: 450px;
- font-size: 300px;
- color: red;
- }
- }
- .emg {
- position: fixed;
- right: 20px;
- bottom: 20px;
- font-size: 30px;
- color: red;
- font-weight: 500;
- }
- }
- </style>
|