index.vue 7.1 KB

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