app-model.vue 5.5 KB

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