index.vue 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175
  1. <template>
  2. <view>
  3. <view class="actionsheet-class actionsheet" :class="[show?'actionsheet-show':'']">
  4. <view class="tips">
  5. 已选服务
  6. </view>
  7. <view class="actionsheet-body">
  8. <view class="actionsheet-view" v-for="(item, index) in list" :key="index">
  9. <view class="actionsheet-left">
  10. <view class="title">
  11. {{item.chooseName}}
  12. </view>
  13. <view class="menu" v-if="item.menu">
  14. {{item.menu}}
  15. </view>
  16. <view class="menu" v-else>
  17. 个人套餐
  18. </view>
  19. </view>
  20. <image class="actionsheet-img" @click="deleteChoose(item)" :src="require('../../static/delete.png')"></image>
  21. </view>
  22. <view style="height: 200rpx;"></view>
  23. </view>
  24. </view>
  25. <view class="actionsheet-mask" :class="[show?'mask-show':'']" @tap="handleClickMask"></view>
  26. </view>
  27. </template>
  28. <script>
  29. export default {
  30. name: "actionsheet",
  31. props: {
  32. //点击遮罩 是否可关闭
  33. maskClosable: {
  34. type: Boolean,
  35. default: true
  36. },
  37. //显示操作菜单
  38. show: {
  39. type: Boolean,
  40. default: false
  41. },
  42. list: {
  43. type: Array
  44. },
  45. },
  46. methods: {
  47. handleClickMask() {
  48. if (!this.maskClosable) return;
  49. this.handleClickCancel();
  50. },
  51. handleClickItem(e) {
  52. if (!this.show) return;
  53. const dataset = e.currentTarget.dataset;
  54. this.$emit('click', {
  55. index: dataset.index
  56. });
  57. },
  58. handleClickCancel() {
  59. this.$emit('showAction');
  60. },
  61. deleteChoose(item) {
  62. this.$emit('deleted', item);
  63. }
  64. }
  65. }
  66. </script>
  67. <style>
  68. .actionsheet {
  69. width: 100%;
  70. position: fixed;
  71. left: 0;
  72. right: 0;
  73. bottom: 0;
  74. z-index: 9997;
  75. visibility: hidden;
  76. -webkit-transform: translate3d(0, 100%, 0);
  77. transform: translate3d(0, 100%, 0);
  78. -webkit-transform-origin: center;
  79. transform-origin: center;
  80. transition: all 0.3s ease-in-out;
  81. background: #FFFFFF;
  82. min-height: 100rpx;
  83. }
  84. .actionsheet-show {
  85. transform: translate3d(0, 0, 0);
  86. visibility: visible;
  87. }
  88. .actionsheet-left {
  89. float: left;
  90. }
  91. .tips {
  92. width: 100%;
  93. padding: 41rpx 36rpx;
  94. box-sizing: border-box;
  95. text-align: center;
  96. background: #fff;
  97. display: flex;
  98. align-items: center;
  99. /* justify-content: center; */
  100. font-size: 28rpx;
  101. font-family: PingFang SC;
  102. font-weight: 500;
  103. color: #333333;
  104. line-height: 36rpx;
  105. }
  106. .actionsheet-body {
  107. overflow-y: auto;
  108. height: 917rpx;
  109. }
  110. .actionsheet-view {
  111. width: 687rpx;
  112. min-height: 154rpx;
  113. display: flex;
  114. border-bottom: 1px solid #E6E6E6;
  115. margin-left: 32rpx;
  116. align-items: center;
  117. justify-content: space-between;
  118. }
  119. .title {
  120. font-size: 32rpx;
  121. font-family: PingFang SC;
  122. font-weight: bold;
  123. color: #333333;
  124. line-height: 36rpx;
  125. padding: 37rpx 35rpx 0 0;
  126. }
  127. .menu {
  128. width: 112rpx;
  129. height: 34rpx;
  130. background: #FFFFFF;
  131. border: 1px solid #FF6600;
  132. border-radius: 5rpx;
  133. font-size: 22rpx;
  134. font-family: PingFang SC;
  135. font-weight: 500;
  136. color: #FF6600;
  137. line-height: 36rpx;
  138. text-align: center;
  139. margin: 15rpx 0 37rpx 0;
  140. }
  141. .actionsheet-img {
  142. width: 32rpx;
  143. height: 31rpx;
  144. float: right;
  145. }
  146. .actionsheet-mask {
  147. position: fixed;
  148. top: 0;
  149. left: 0;
  150. right: 0;
  151. bottom: 0;
  152. background: rgba(0, 0, 0, 0.6);
  153. z-index: 9996;
  154. transition: all 0.3s ease-in-out;
  155. opacity: 0;
  156. visibility: hidden;
  157. }
  158. .mask-show {
  159. opacity: 1;
  160. visibility: visible;
  161. }
  162. </style>