dmPopMenuView.vue 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286
  1. <template>
  2. <view class="pop-view">
  3. <view class="pop-maskView" :style="{
  4. 'background-color': maskBgColor,
  5. zIndex: zIndex - 1
  6. }" @tap.stop="handleMaskTap"
  7. @touchmove.stop.prevent="moveHandle" v-if='visible'>
  8. </view>
  9. <view class="buttons" :style="{zIndex: zIndex + 1}" v-if="type=='type1'">
  10. <view class="menu_btn" v-if='containerVisible && isshow1' @click="tapAction(1)">
  11. <text class="menu_btn_title">客户扫码到访</text>
  12. <image class="menu_btn_image" src="../../static/icons/icon_my_qrcode@2x.png" mode=""></image>
  13. </view>
  14. <view class="menu_btn" v-if='containerVisible && isshow2' @click="tapAction(2)">
  15. <text class="menu_btn_title">手动录入到访</text>
  16. <image class="menu_btn_image" src="../../static/icons/icon_edit_record@2x.png" mode=""></image>
  17. </view>
  18. <view class="menu_btn" v-if='containerVisible && isshow3' @click="tapAction(3)">
  19. <text class="menu_btn_title">隐号报备到访</text>
  20. <image class="menu_btn_image" src="../../static/icons/icon_saoyisao@2x.png" mode=""></image>
  21. </view>
  22. <view class="main_btn" :style="{'background-color':themeColor}" @click="tapAction(0)">
  23. <image class="main_btn_image" v-if='icon' :src="icon" mode=""></image>
  24. <text class="main_btn_title">{{title}}</text>
  25. </view>
  26. </view>
  27. <view class="buttons" :style="{zIndex: zIndex + 1}" v-if="type=='type2'">
  28. <view class="menu_btn" v-if='containerVisible && isshow1' @click="tapAction(1)">
  29. <text class="menu_btn_title">批量变更</text>
  30. <image class="menu_btn_image" src="../../static/icons/icon_genjin_piliangbiangeng@2x.png" mode=""></image>
  31. </view>
  32. <view class="menu_btn" v-if='containerVisible && isshow2' @click="tapAction(2)">
  33. <text class="menu_btn_title">批量回收</text>
  34. <image class="menu_btn_image" src="../../static/icons/icon_genjin_pilianghuishou@2x.png" mode=""></image>
  35. </view>
  36. <view class="main_btn mainBtn2" :style="{'background-color':themeColor}" @click="tapAction(0)">
  37. <text class="main_btn_title" >批量处理</text>
  38. </view>
  39. </view>
  40. <view class="buttons" :style="{zIndex: zIndex + 1}" v-if="type=='type3'">
  41. <view class="menu_btn" v-if='containerVisible && isshow1' @click="tapAction(1)">
  42. <text class="menu_btn_title">生成邀请图</text>
  43. <image class="menu_btn_image" src="../../static/icons/icon_my_qrcode@2x.png" mode=""></image>
  44. </view>
  45. <view class="menu_btn" v-if='containerVisible && isshow2' @click="tapAction(2)">
  46. <text class="menu_btn_title">分享二维码</text>
  47. <image class="menu_btn_image" src="../../static/icons/icon_edit_record@2x.png" mode=""></image>
  48. </view>
  49. <view class="main_btn" :style="{'background-color':themeColor}" @click="tapAction(0)">
  50. <text class="main_btn_title">{{title}}</text>
  51. </view>
  52. </view>
  53. </view>
  54. </template>
  55. <script>
  56. export default {
  57. props: {
  58. title: String,
  59. maskColor: {
  60. type: String,
  61. default: 'rgba(0, 0, 0, 0.3)'
  62. },
  63. zIndex: {
  64. type: Number,
  65. default: 899
  66. },
  67. maskTapHide: {
  68. type: Boolean,
  69. default: true
  70. },
  71. title: {
  72. type: String,
  73. default: '到访'
  74. },
  75. icon: {
  76. type: String,
  77. default: '../../static/icons/icon_visit_edit@2x.png',
  78. },
  79. isshow1:{
  80. type:Boolean,
  81. default:false
  82. },
  83. isshow2:{
  84. type:Boolean,
  85. default:false
  86. },
  87. isshow3:{
  88. type:Boolean,
  89. default:false
  90. },
  91. menus: {
  92. style: Array,
  93. default () {
  94. return [{
  95. title: '客户扫码到访',
  96. icon: '../../static/icons/icon_my_qrcode@2x.png',
  97. show:true
  98. },
  99. {
  100. title: '手动录入到访',
  101. icon: '../../static/icons/icon_edit_record@2x.png',
  102. show:true
  103. },
  104. {
  105. title: '隐号报备到访',
  106. icon: '../../static/icons/icon_saoyisao@2x.png',
  107. show:true
  108. }
  109. ]
  110. }
  111. },
  112. type: {
  113. type: String,
  114. default: 'type1'
  115. }
  116. },
  117. data() {
  118. return {
  119. visible: false,
  120. containerVisible: false,
  121. maskBgColor: 'rgba(0, 0, 0, 0.3)',
  122. selectValue: [0],
  123. selIdx: 0,
  124. themeColor: '',
  125. }
  126. },
  127. mounted() {
  128. let app = getApp();
  129. this.globalData = app.globalData;
  130. this.themeColor = this.globalData.themeColor;
  131. },
  132. methods: {
  133. tapAction(val) {
  134. // if (this.type == 'pop') {
  135. if (val == 0) {
  136. this.visible = !this.visible
  137. } else {
  138. this.visible = false
  139. }
  140. if (this.visible) {
  141. setTimeout(() => {
  142. this.maskBgColor = this.maskColor
  143. this.containerVisible = true
  144. }, 20)
  145. } else {
  146. this.maskBgColor = ''
  147. this.containerVisible = false
  148. setTimeout(() => {
  149. this.visible = false
  150. }, 200)
  151. }
  152. this.$emit('tapMenu', val)
  153. // }
  154. },
  155. show() {
  156. this.visible = true
  157. setTimeout(() => {
  158. this.maskBgColor = this.maskColor
  159. this.containerVisible = true
  160. }, 20)
  161. },
  162. hide() {
  163. this.maskBgColor = ''
  164. this.containerVisible = false
  165. setTimeout(() => {
  166. this.visible = false
  167. }, 200)
  168. this.$emit('close')
  169. },
  170. handleCancel() {
  171. this.hide()
  172. },
  173. handleConfirm() {
  174. this.hide()
  175. this.$emit('confirm')
  176. },
  177. handleMaskTap() {
  178. if (this.maskTapHide) {
  179. this.hide()
  180. }
  181. },
  182. moveHandle() {},
  183. }
  184. }
  185. </script>
  186. <style scoped lang="scss">
  187. .pop-view {
  188. position: relative;
  189. padding-bottom: 0;
  190. padding-bottom: constant(safe-area-inset-bottom);
  191. padding-bottom: env(safe-area-inset-bottom);
  192. box-sizing: border-box;
  193. .pop-maskView {
  194. position: fixed;
  195. top: 0;
  196. right: 0;
  197. left: 0;
  198. bottom: 0;
  199. transition-property: background-color;
  200. transition-duration: 0.3s;
  201. }
  202. .buttons {
  203. position: fixed;
  204. right: 40rpx;
  205. bottom: 15%;
  206. display: flex;
  207. flex-direction: column;
  208. align-items: flex-end;
  209. .menu_btn {
  210. margin-top: 20rpx;
  211. padding: 0 10rpx 0 40rpx;
  212. box-sizing: border-box;
  213. display: flex;
  214. height: 100rpx;
  215. border-radius: 50rpx;
  216. background: #ffffff;
  217. border: 4rpx solid rgba(255, 255, 255, 0.64);
  218. box-shadow: 0px 6px 20px 0px rgba(20, 85, 85, 0.05);
  219. align-items: center;
  220. .menu_btn_title {
  221. font-size: 28rpx;
  222. font-family: Verdana, Verdana-Regular;
  223. font-weight: 400;
  224. color: #333333;
  225. }
  226. .menu_btn_image {
  227. margin-left: 20rpx;
  228. width: 80rpx;
  229. height: 80rpx;
  230. }
  231. }
  232. .main_btn {
  233. margin-top: 30rpx;
  234. padding: 0 25rpx;
  235. box-sizing: border-box;
  236. display: flex;
  237. height: 100rpx;
  238. border: 4rpx solid rgba(255, 255, 255, 0.64);
  239. border-radius: 50rpx;
  240. align-items: center;
  241. .main_btn_image {
  242. width: 54rpx;
  243. height: 54rpx;
  244. }
  245. .main_btn_title {
  246. font-size: 32rpx;
  247. font-family: Verdana, Verdana-Regular;
  248. font-weight: 400;
  249. color: #ffffff;
  250. }
  251. }
  252. .mainBtn2{
  253. margin-top: 30rpx;
  254. padding: 0;
  255. box-sizing: border-box;
  256. display: flex;
  257. height: 100rpx;
  258. border: 4rpx solid rgba(255, 255, 255, 0.64);
  259. border-radius: 50rpx;
  260. align-items: center;
  261. width: 170rpx;
  262. .main_btn_title {
  263. width: 100%;
  264. font-size: 32rpx;
  265. font-family: Verdana, Verdana-Regular;
  266. font-weight: 400;
  267. text-align: center;
  268. color: #ffffff;
  269. }
  270. }
  271. }
  272. }
  273. </style>