saleSelfMachine.vue 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. <template>
  2. <div class="saleSelfMachine">
  3. <div class="background">
  4. <img :src="backgroundImgURL" width="100%" height="100%"/>
  5. </div>
  6. <!-- <div class="time">
  7. <span>{{nowTime}}</span>
  8. </div> -->
  9. <div class="loginForm">
  10. <div class="menu" v-for="(item,index) in menuList" :key="index" @click="onClick(item.url)">
  11. <img :src="item.img" width="100%" height="100%"/>
  12. </div>
  13. </div>
  14. </div>
  15. </template>
  16. <script>
  17. // import {renderTime} from '@/utils/sharedJsFile'
  18. export default {
  19. data(){
  20. return{
  21. orderNumber:"",
  22. nowTime:'',
  23. backgroundImgURL:require('@/assets/saleSelfMachine/backgroundImg.jpg'),
  24. menuList:[
  25. {
  26. img: require("@/assets/saleSelfMachine/billOfLading.png"),
  27. url: "/printLading",
  28. },{
  29. img: require("@/assets/saleSelfMachine/ticketChangeDeliveryNote.png"),
  30. url: "/printReceipt",
  31. },{
  32. img: require("@/assets/saleSelfMachine/Warranty.png"),
  33. url: "/printWarranty",
  34. },
  35. ],
  36. }
  37. },
  38. methods:{
  39. onClick(url){
  40. this.$router.push({
  41. path:url+"?orderNumber="+this.orderNumber,
  42. })
  43. },
  44. backScan(){
  45. this.$router.go(-1);
  46. }
  47. },
  48. mounted() {
  49. this.orderNumber=this.$route.query.orderNumber;
  50. let _this = this; // 声明一个变量指向Vue实例this,保证作用域一致
  51. //三十秒不操作,自动返回扫码页面
  52. const timer = setInterval(()=>{
  53. this.backScan();
  54. },30000)
  55. this.$once('hook:beforeDestroy', ()=>{
  56. clearInterval(timer)
  57. })
  58. // this.timer = setInterval(() => {
  59. // _this.nowTime = renderTime(new Date()); // 修改数据date
  60. // }, 1000)
  61. },
  62. // beforeDestroy() {
  63. // if (this.timer) {
  64. // clearInterval(this.timer); // 在Vue实例销毁前,清除我们的定时器
  65. // }
  66. // }
  67. }
  68. </script>
  69. <style lang="scss">
  70. .saleSelfMachine{
  71. width: 100vh;
  72. height: 97vh;
  73. .background {
  74. width: 100%;
  75. height: 100%;
  76. z-index: -1;
  77. position: absolute;
  78. overflow: hidden;
  79. }
  80. .time{
  81. width: 30%;height: 20%;
  82. color: #fff;
  83. position: absolute;
  84. display: flex;
  85. justify-content: center;
  86. align-items: center;
  87. }
  88. .loginForm {
  89. z-index: 1;
  90. width: 196%;height: 100%;
  91. display: flex;
  92. justify-content: center;
  93. align-items: center;
  94. .menu{
  95. width: 20%;
  96. height: 40%;
  97. margin: 30px;
  98. overflow: hidden;
  99. }
  100. }
  101. }
  102. </style>