rightSlider.vue 8.1 KB

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