app-model.vue 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199
  1. <template>
  2. <view class="app-mode" :class="{'app-show': display}" @click.stop="close">
  3. <view v-if="type === '1'" class="app-content" :style="{backgroundColor: background, bottom: setHeight, height: `${height+108}rpx`}">
  4. <view class="app-top">
  5. <slot name="title">赠卡券</slot>
  6. <view class="app-icon">
  7. <app-form-id @click="close()">
  8. <icon class="app-icon-close image-no-rep image-cover"></icon>
  9. </app-form-id>
  10. </view>
  11. </view>
  12. <view class="app-bottom">
  13. <slot name="content"></slot>
  14. </view>
  15. </view>
  16. <view v-if="type === '2'" class="app-center" :style="{backgroundColor: background}">
  17. <view class="app-top">
  18. <slot name="title">限购</slot>
  19. <view class="app-icon">
  20. <app-form-id @click.stop="close()">
  21. <icon class="app-icon-close image-no-rep image-cover"></icon>
  22. </app-form-id>
  23. </view>
  24. </view>
  25. <view class="app-bottom">
  26. <slot name="content"></slot>
  27. </view>
  28. </view>
  29. <view v-if="type === '3'" class="app-content" :style="{backgroundColor: background, bottom: setHeight}"
  30. @click.stop="bubble">
  31. <view class="app-common main-center">
  32. <slot name="title">提现方式</slot>
  33. <view class="app-icon">
  34. <app-form-id @click="close()">
  35. <icon class="app-icon-close image-no-rep image-cover"></icon>
  36. </app-form-id>
  37. </view>
  38. </view>
  39. <view class="app-bottom">
  40. <slot name="content"></slot>
  41. </view>
  42. </view>
  43. </view>
  44. </template>
  45. <script>
  46. export default {
  47. name: 'app-model',
  48. props: {
  49. type: {
  50. type: String,
  51. default: function() {
  52. return '1';
  53. }
  54. },
  55. background: {
  56. type: String,
  57. default: function() {
  58. return 'white';
  59. }
  60. },
  61. height: {
  62. type: Number,
  63. default: function() {
  64. return 500;
  65. }
  66. },
  67. value: {
  68. type: Boolean,
  69. default: function() {
  70. return false;
  71. }
  72. }
  73. },
  74. data() {
  75. return {
  76. display: this.value
  77. }
  78. },
  79. methods: {
  80. bubble() {
  81. return false;
  82. },
  83. close() {
  84. this.display = false;
  85. this.$emit('input', this.display);
  86. },
  87. },
  88. computed: {
  89. setHeight() {
  90. if (this.display === true) {
  91. return `0`;
  92. } else {
  93. return `-${this.height + 108}rpx`;
  94. }
  95. }
  96. },
  97. watch: {
  98. value: function() {
  99. this.display = this.value;
  100. }
  101. }
  102. }
  103. </script>
  104. <style scoped lang="scss">
  105. .app-mode {
  106. position: fixed;
  107. z-index: 1600;
  108. top: 0;
  109. left: 0;
  110. width: #{750rpx};
  111. height: 100%;
  112. background-color: rgba(127, 127, 127, 0.4);
  113. transition: all 0.2s linear;
  114. visibility: hidden;
  115. opacity: 0;
  116. overflow: hidden;
  117. .app-common {
  118. color: #353535;
  119. font-size: #{36rpx};
  120. width: 100%;
  121. line-height: #{100rpx};
  122. border-bottom: 1px solid #E2E2E2;
  123. .app-icon-close {
  124. width: #{30rpx};
  125. height: #{30rpx};
  126. position: absolute;
  127. background-image: url("../../../static/image/icon/icon-close.png");
  128. top: #{35rpx};
  129. right: #{32rpx};
  130. }
  131. }
  132. .app-icon {
  133. position: absolute;
  134. top: 0;
  135. right: 0;
  136. height: #{108rpx};
  137. width: #{54rpx};
  138. }
  139. .app-icon-close {
  140. width: #{30rpx};
  141. height: #{30rpx};
  142. position: absolute;
  143. background-image: url("../../../static/image/icon/icon-close.png");
  144. top: #{24rpx};
  145. right: #{24rpx};
  146. }
  147. .app-content {
  148. position: absolute;
  149. width: #{750rpx};
  150. transition: bottom 0.5s linear;
  151. border-top-left-radius: #{16rpx};
  152. border-top-right-radius: #{16rpx};
  153. .app-top {
  154. width: #{750rpx};
  155. height: #{108rpx};
  156. }
  157. }
  158. .app-center {
  159. width: #{600rpx};
  160. border-radius: #{16rpx};
  161. position: absolute;
  162. top: 50%;
  163. left: 50%;
  164. transform: translate(-50%, -50%);
  165. .app-top {
  166. width: #{600rpx};
  167. height: #{108rpx};
  168. }
  169. .app-bottom {
  170. width: #{520rpx};
  171. margin: 0 #{40rpx} #{48rpx} #{40rpx};
  172. font-size: #{28rpx};
  173. color: #353535;
  174. }
  175. }
  176. }
  177. .app-show {
  178. opacity: 1;
  179. visibility: visible;
  180. position: fixed;
  181. top: 0;
  182. left: 0;
  183. right: 0;
  184. bottom: 0;
  185. transform: scale(1);
  186. }
  187. </style>