dmDialog.vue 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166
  1. <template>
  2. <view class="pop-view" v-if='visible'>
  3. <view class="pop-maskView" :style="{
  4. 'background-color': maskBgColor,
  5. zIndex: zIndex - 1
  6. }" @tap.stop="handleMaskTap"
  7. @touchmove.stop.prevent="moveHandle">
  8. </view>
  9. <view :class="['pop-contentView',containerVisible ? 'pop-contentView-show' : '']" :style="{zIndex: zIndex}"
  10. @touchmove.stop.prevent="moveHandle">
  11. <text class="pop-title" v-if="isShowTitle">{{title}}</text>
  12. <image class="pop-close" src="../../static/icons/icon_close@2x.png" v-if="isShowClose" mode="" @click="handleCancel"></image>
  13. <slot></slot>
  14. <text class="pop-commit" :style="{'background-color':color2}" v-if="isShowConfirm" @click="handleConfirm">确定</text>
  15. </view>
  16. </view>
  17. </template>
  18. <script>
  19. export default {
  20. props: {
  21. title: String,
  22. maskColor: {
  23. type: String,
  24. default: 'rgba(0, 0, 0, 0.3)'
  25. },
  26. zIndex: {
  27. type: Number,
  28. default: 999
  29. },
  30. maskTapHide: {
  31. type: Boolean,
  32. default: true
  33. },
  34. isShowTitle: {
  35. type: Boolean,
  36. default: true
  37. },
  38. isShowClose: {
  39. type: Boolean,
  40. default: true
  41. },
  42. isShowConfirm: {
  43. type: Boolean,
  44. default: true
  45. },
  46. isScannerOption:{
  47. type:Boolean,
  48. default:false
  49. }
  50. },
  51. data() {
  52. return {
  53. visible: false,
  54. containerVisible: false,
  55. maskBgColor: '',
  56. selectValue: [0],
  57. selIdx: 0,
  58. color2:''
  59. }
  60. },
  61. mounted() {
  62. let app = getApp();
  63. this.globalData = app.globalData;
  64. this.color2 = this.globalData.color2;
  65. },
  66. methods: {
  67. show() {
  68. this.visible = true
  69. setTimeout(() => {
  70. this.maskBgColor = this.maskColor
  71. this.containerVisible = true
  72. }, 20)
  73. },
  74. hide() {
  75. this.maskBgColor = ''
  76. this.containerVisible = false
  77. setTimeout(() => {
  78. this.visible = false
  79. }, 200)
  80. this.$emit('close')
  81. },
  82. handleCancel() {
  83. this.hide()
  84. },
  85. handleConfirm() {
  86. this.hide()
  87. this.$emit('confirm')
  88. },
  89. handleMaskTap() {
  90. if (this.maskTapHide) {
  91. this.hide()
  92. }
  93. },
  94. moveHandle() {},
  95. }
  96. }
  97. </script>
  98. <style scoped lang="scss">
  99. .pop-view {
  100. position: relative;
  101. .pop-maskView {
  102. position: fixed;
  103. top: 0;
  104. right: 0;
  105. left: 0;
  106. bottom: 0;
  107. }
  108. .pop-contentView {
  109. position: fixed;
  110. right: 0;
  111. left: 0;
  112. bottom: 0;
  113. overflow-y: scroll;
  114. background-color: #fff;
  115. border-radius: 40rpx 40rpx 0rpx 0rpx;
  116. box-shadow: 0rpx 8rpx 12rpx 0rpx;
  117. display: flex;
  118. flex-direction: column;
  119. align-items: center;
  120. .pop-title {
  121. margin-top: 60rpx;
  122. font-size: 32rpx;
  123. font-family: Verdana, Verdana-Bold;
  124. font-weight: 700;
  125. text-align: center;
  126. color: #333333;
  127. }
  128. .pop-close {
  129. position: absolute;
  130. top: 64rpx;
  131. right: 30rpx;
  132. width: 40rpx;
  133. height: 40rpx;
  134. }
  135. .pop-commit {
  136. margin-bottom: 54rpx;
  137. width: 260rpx;
  138. height: 84rpx;
  139. line-height: 84rpx;
  140. border-radius: 42rpx;
  141. font-size: 32rpx;
  142. font-family: Verdana, Verdana-Regular;
  143. font-weight: 400;
  144. text-align: center;
  145. color: #ffffff;
  146. }
  147. }
  148. .pop-contentView-show {
  149. }
  150. }
  151. </style>