saleSelfMachine.vue 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  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. },
  45. mounted() {
  46. this.orderNumber=this.$route.query.orderNumber;
  47. let _this = this; // 声明一个变量指向Vue实例this,保证作用域一致
  48. this.timer = setInterval(() => {
  49. _this.nowTime = renderTime(new Date()); // 修改数据date
  50. }, 1000)
  51. },
  52. beforeDestroy() {
  53. if (this.timer) {
  54. clearInterval(this.timer); // 在Vue实例销毁前,清除我们的定时器
  55. }
  56. }
  57. }
  58. </script>
  59. <style lang="scss">
  60. .saleSelfMachine{
  61. width: 100vh;
  62. height: 97vh;
  63. .background {
  64. width: 100%;
  65. height: 100%;
  66. z-index: -1;
  67. position: absolute;
  68. overflow: hidden;
  69. }
  70. .time{
  71. width: 30%;height: 20%;
  72. color: #fff;
  73. position: absolute;
  74. display: flex;
  75. justify-content: center;
  76. align-items: center;
  77. }
  78. .loginForm {
  79. z-index: 1;
  80. width: 196%;height: 100%;
  81. display: flex;
  82. justify-content: center;
  83. align-items: center;
  84. .menu{
  85. width: 20%;
  86. height: 40%;
  87. margin: 30px;
  88. overflow: hidden;
  89. }
  90. }
  91. }
  92. </style>