app-write-off-code.vue 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. <template>
  2. <view class="app-write-off-code" v-if="hidden">
  3. <view class="app-content">
  4. <view class="app-icon" @click="hiddenHandler"></view>
  5. <view class="app-text">核销码</view>
  6. <image :src="file_path" class="app-image"></image>
  7. </view>
  8. </view>
  9. </template>
  10. <script>
  11. export default {
  12. name: 'app-write-off-code',
  13. props: {
  14. hidden: {
  15. type: Boolean,
  16. default() {
  17. return false;
  18. }
  19. },
  20. itemId: {
  21. type: String,
  22. default() {
  23. return '-1';
  24. }
  25. }
  26. },
  27. data() {
  28. return {
  29. file_path: '',
  30. }
  31. },
  32. watch: {
  33. hidden: {
  34. handler: function(v) {
  35. if (v === true) {
  36. this.$request({
  37. url: this.$api.book.clerk_code,
  38. data: {
  39. id: this.itemId,
  40. }
  41. }).then(response => {
  42. if (response.code === 0) {
  43. this.file_path = response.data.file_path;
  44. }
  45. })
  46. }
  47. }
  48. }
  49. },
  50. methods: {
  51. hiddenHandler() {
  52. this.$emit('hiden', false);
  53. this.file_path = '';
  54. }
  55. }
  56. }
  57. </script>
  58. <style scoped lang="scss">
  59. .app-write-off-code {
  60. background-color: rgba(0,0,0, 0.6);
  61. width: 100%;
  62. height: 100%;
  63. top: 0;
  64. left:0;
  65. position: fixed;
  66. border-radius: 0;
  67. z-index: 1500;
  68. .app-content {
  69. background-color: white;
  70. width: #{600rpx};
  71. height: #{600rpx};
  72. border-radius: #{8rpx};
  73. position: absolute;
  74. top: 50%;
  75. left: 50%;
  76. transform: translate(-50%, -50%);
  77. .app-icon {
  78. width: #{30rpx};
  79. height: #{30rpx};
  80. position: absolute;
  81. top: #{32rpx};
  82. right: #{32rpx};
  83. background-repeat: no-repeat;
  84. background-size: 100% 100%;
  85. background-image: url("../../../static/image/icon/close.png");
  86. }
  87. .app-text {
  88. font-size: #{33rpx};
  89. color: #353535;
  90. margin-top: #{56rpx};
  91. text-align: center;
  92. }
  93. .app-image {
  94. width: #{360rpx};
  95. height: #{360rpx};
  96. margin-top: #{64rpx};
  97. position: absolute;
  98. left: 50%;
  99. transform: translateX(-50%);
  100. }
  101. }
  102. }
  103. </style>