index.vue 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283
  1. <template>
  2. <view class="right-wrapper" @touchmove.stop.prevent="moveStop" :style="viewColor">
  3. <view class="control-wrapper animated" :class="showBox?'slideInRight':''">
  4. <view class="wrapper-count">
  5. <view class="content-box">
  6. <view class="content-title">
  7. <view class="title">店铺类型</view>
  8. <view v-if="list.length>20">
  9. <view class="btns" @click="isShowType = !isShowType">{{isShowType?'收起':'展开'}}<text class="iconfont" :class="isShowType ? 'icon-xiangshang' : 'icon-xiangxia'"></text></view>
  10. </view>
  11. </view>
  12. <view class="brand-wrapper">
  13. <scroll-view style="max-height: 400rpx;" :scroll-y="isShow">
  14. <view class="wrapper">
  15. <view class="item line1" v-for="(item,index) in list" :key="index" :class="item.check?'on':''" @tap="bindChenck1(item)">
  16. {{item.type_name}}
  17. </view>
  18. </view>
  19. </scroll-view>
  20. </view>
  21. </view>
  22. <view class="content-box">
  23. <view class="content-title">
  24. <view class="title">商户分类</view>
  25. <view v-if="merCate.length>20">
  26. <view class="btns" @click="isShowCate = !isShowCate">{{isShowCate?'收起':'展开'}}<text class="iconfont" :class="isShowCate ? 'icon-xiangshang' : 'icon-xiangxia'"></text></view>
  27. </view>
  28. </view>
  29. <view class="brand-wrapper">
  30. <scroll-view style="max-height: 400rpx;" :scroll-y="isShow">
  31. <view class="wrapper">
  32. <view class="item line1" v-for="(item,index) in merCate" :key="index" :class="item.check?'on':''" @tap="bindChenck2(item)">
  33. {{item.category_name}}
  34. </view>
  35. </view>
  36. </scroll-view>
  37. </view>
  38. </view>
  39. </view>
  40. <view class="foot-btn">
  41. <view class="btn-item" @click="reset">重置</view>
  42. <view class="btn-item confirm" @click="confirm">确定</view>
  43. </view>
  44. </view>
  45. <view class="right-bg" @click="close"></view>
  46. </view>
  47. </template>
  48. <script>
  49. // +----------------------------------------------------------------------
  50. // | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
  51. // +----------------------------------------------------------------------
  52. // | Copyright (c) 2016~2024 https://www.crmeb.com All rights reserved.
  53. // +----------------------------------------------------------------------
  54. // | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
  55. // +----------------------------------------------------------------------
  56. // | Author: CRMEB Team <admin@crmeb.com>
  57. // +----------------------------------------------------------------------
  58. import { mapGetters } from "vuex";
  59. export default{
  60. props: {
  61. storeTypeArr: { //店铺类型
  62. type: Array,
  63. },
  64. merList: { //商户分类
  65. type: Array,
  66. },
  67. status:{
  68. type:Boolean,
  69. default:false
  70. },
  71. },
  72. computed: mapGetters(['viewColor']),
  73. data(){
  74. return {
  75. min: '',
  76. max:'',
  77. isShow: false,
  78. isShowType: false,
  79. isShowCate: false,
  80. list:[],
  81. merCate: [],
  82. activeList:[],
  83. selectList: [],
  84. showBox:false
  85. }
  86. },
  87. mounted() {
  88. // 重要组件挂载后
  89. this.list = this.storeTypeArr //店铺类型
  90. this.merCate = this.merList //商户分类
  91. this.showBox = this.status
  92. },
  93. methods:{
  94. bindChenck1(item){
  95. item.check = !item.check
  96. this.arrFilter1()
  97. },
  98. bindChenck2(item){
  99. item.check = !item.check
  100. this.arrFilter2()
  101. },
  102. arrFilter1(){
  103. this.selectList = this.list.filter(item=>{
  104. return item.check == true
  105. })
  106. },
  107. arrFilter2(){
  108. this.activeList = this.merCate.filter(item=>{
  109. return item.check == true
  110. })
  111. },
  112. reset(){
  113. this.list.forEach((el,index)=>{
  114. el.check = false
  115. })
  116. this.merCate.forEach((el,index)=>{
  117. el.check = false
  118. })
  119. this.arrFilter1()
  120. this.arrFilter2()
  121. },
  122. confirm(){
  123. this.arrFilter1()
  124. this.arrFilter2()
  125. console.log(this.activeList)
  126. let obj = {
  127. storeTypeArr:this.selectList,
  128. merList: this.activeList,
  129. status:false
  130. }
  131. this.showBox = false
  132. this.$emit('confirm',obj)
  133. },
  134. close(){
  135. this.showBox = false
  136. this.$emit('close')
  137. },
  138. moveStop(){}
  139. }
  140. }
  141. </script>
  142. <style lang="scss">
  143. .slideInRight{
  144. animation-duration:.5s
  145. }
  146. .content-border{
  147. border-top: 20rpx solid #f5f5f5;
  148. }
  149. .right-wrapper{
  150. z-index: 99;
  151. position: fixed;
  152. left: 0;
  153. top: 0;
  154. width: 100%;
  155. height: 100%;
  156. .control-wrapper{
  157. z-index: 90;
  158. position: absolute;
  159. right: 0;
  160. top: 0;
  161. display: flex;
  162. flex-direction: column;
  163. width: 635rpx;
  164. height: 100%;
  165. background-color: #FFFFFF;
  166. .wrapper-count{
  167. height: calc(100% - 120rpx);
  168. overflow-y: auto;
  169. }
  170. .content-box{
  171. position: relative;
  172. display: flex;
  173. flex-direction: column;
  174. padding: 0 26rpx;
  175. .content-title{
  176. display: flex;
  177. align-items: center;
  178. justify-content: space-between;
  179. padding: 40rpx 0 20rpx;
  180. .title{
  181. font-size: 26rpx;
  182. font-weight: bold;
  183. color: #282828;
  184. }
  185. .btns{
  186. display: flex;
  187. align-items: center;
  188. justify-content: center;
  189. font-size: 22rpx;
  190. color: #999;
  191. .iconfont{
  192. margin-left: 10rpx;
  193. margin-top: 5rpx;
  194. font-size: 20rpx;
  195. }
  196. }
  197. }
  198. .brand-wrapper{
  199. flex: 1;
  200. overflow: hidden;
  201. .wrapper{
  202. display: flex;
  203. flex-wrap: wrap;
  204. padding-bottom: 20rpx;
  205. }
  206. .item{
  207. display: block;
  208. width:186rpx;
  209. height:56rpx;
  210. line-height: 56rpx;
  211. text-align: center;
  212. background:rgba(242,242,242,1);
  213. border-radius:28rpx;
  214. margin-top: 25rpx;
  215. padding: 0 10rpx;
  216. margin-right: 12rpx;
  217. &:nth-child(3n){
  218. margin-right: 0;
  219. }
  220. &.on{
  221. background: var(--view-minorColor);
  222. border:1px solid var(--view-theme);
  223. color: var(--view-theme);
  224. }
  225. }
  226. .btns{
  227. display: flex;
  228. align-items: center;
  229. justify-content: center;
  230. padding-top: 10rpx;
  231. font-size: 22rpx;
  232. color: #999;
  233. .iconfont{
  234. margin-left: 10rpx;
  235. margin-top: 5rpx;
  236. font-size: 20rpx;
  237. }
  238. }
  239. }
  240. }
  241. }
  242. .foot-btn{
  243. display: flex;
  244. align-items: center;
  245. justify-content: space-between;
  246. padding-bottom: 30rpx;
  247. position: absolute;
  248. bottom: 0;
  249. left: 20rpx;
  250. .btn-item{
  251. display: flex;
  252. align-items: center;
  253. justify-content: center;
  254. width:286rpx;
  255. height:68rpx;
  256. background:rgba(255,255,255,1);
  257. border:1px solid rgba(170,170,170,1);
  258. border-radius:34rpx;
  259. font-size: 26rpx;
  260. color: #282828;
  261. &.confirm{
  262. background: var(--view-theme);
  263. border-color: var(--view-theme);
  264. color: #fff;
  265. margin-left: 20rpx;
  266. }
  267. }
  268. }
  269. .right-bg{
  270. position: absolute;
  271. left: 0;
  272. top: 0;
  273. width: 100%;
  274. height: 100%;
  275. background-color: rgba(0,0,0,.5);
  276. }
  277. }
  278. </style>