rightSlidera.vue 7.6 KB

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