rightSlidera.vue 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338
  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. console.log(this.activeList)
  128. let obj = {
  129. brandList:this.activeList,
  130. price_on:this.min,
  131. price_off:this.max,
  132. status:false,
  133. is_trader: this.is_trader
  134. }
  135. this.showBox = false
  136. this.$emit('confirm',obj)
  137. },
  138. close(){
  139. // this.list.forEach((el,index)=>{
  140. // el.check = false
  141. // })
  142. // this.arrFilter()
  143. this.showBox = false
  144. this.$emit('close')
  145. },
  146. moveStop(){}
  147. }
  148. }
  149. </script>
  150. <style lang="scss">
  151. .slideInRight{
  152. animation-duration:.5s
  153. }
  154. .right-wrapper{
  155. z-index: 99;
  156. position: fixed;
  157. left: 0;
  158. top: 0;
  159. width: 100%;
  160. height: 100%;
  161. .control-wrapper{
  162. z-index: 90;
  163. position: absolute;
  164. right: 0;
  165. top: 0;
  166. display: flex;
  167. flex-direction: column;
  168. width: 635rpx;
  169. height: 100%;
  170. background-color: #F5F5F5;
  171. .header{
  172. padding: 50rpx 26rpx 40rpx;
  173. background-color: #fff;
  174. .title{
  175. font-size: 26rpx;
  176. font-weight: bold;
  177. color: #282828;
  178. }
  179. .input-wrapper{
  180. display: flex;
  181. align-items: center;
  182. justify-content: space-between;
  183. margin-top: 28rpx;
  184. input{
  185. width:260rpx;
  186. height:56rpx;
  187. padding: 0 10rpx;
  188. background:rgba(242,242,242,1);
  189. border-radius:28rpx;
  190. font-size: 22rpx;
  191. text-align: center;
  192. }
  193. .line{
  194. width:15rpx;
  195. height:2rpx;
  196. background:#7D7D7D;
  197. }
  198. }
  199. }
  200. .content-box{
  201. position: relative;
  202. flex: 1;
  203. display: flex;
  204. flex-direction: column;
  205. margin-top: 20rpx;
  206. padding: 0 26rpx;
  207. background-color: #fff;
  208. overflow: hidden;
  209. .title{
  210. padding: 40rpx 0 20rpx;
  211. font-size: 26rpx;
  212. font-weight: bold;
  213. color: #282828;
  214. }
  215. .brand-wrapper{
  216. flex: 1;
  217. overflow: hidden;
  218. .wrapper{
  219. display: flex;
  220. flex-wrap: wrap;
  221. padding-bottom: 20rpx;
  222. }
  223. .item{
  224. display: block;
  225. width:186rpx;
  226. height:56rpx;
  227. line-height: 56rpx;
  228. text-align: center;
  229. background:rgba(242,242,242,1);
  230. border-radius:28rpx;
  231. margin-top: 25rpx;
  232. padding: 0 10rpx;
  233. margin-right: 12rpx;
  234. &:nth-child(3n){
  235. margin-right: 0;
  236. }
  237. &.on{
  238. background: var(--view-minorColor);
  239. border:1px solid var(--view-theme);
  240. color: var(--view-theme);
  241. }
  242. }
  243. .btns{
  244. display: flex;
  245. align-items: center;
  246. justify-content: center;
  247. padding-top: 10rpx;
  248. font-size: 22rpx;
  249. color: #999;
  250. .iconfont{
  251. margin-left: 10rpx;
  252. margin-top: 5rpx;
  253. font-size: 20rpx;
  254. }
  255. }
  256. }
  257. .foot-btn{
  258. display: flex;
  259. align-items: center;
  260. justify-content: space-between;
  261. padding-bottom: 30rpx;
  262. .btn-item{
  263. display: flex;
  264. align-items: center;
  265. justify-content: center;
  266. width:286rpx;
  267. height:68rpx;
  268. background:rgba(255,255,255,1);
  269. border:1px solid rgba(170,170,170,1);
  270. border-radius:34rpx;
  271. font-size: 26rpx;
  272. color: #282828;
  273. &.confirm{
  274. background: var(--view-theme);
  275. border-color: var(--view-theme);
  276. color: #fff;
  277. }
  278. }
  279. }
  280. }
  281. .store_type{
  282. position: relative;
  283. margin-top: 20rpx;
  284. padding: 0 26rpx;
  285. background-color: #fff;
  286. overflow: hidden;
  287. .title{
  288. padding: 40rpx 0 20rpx;
  289. font-size: 26rpx;
  290. font-weight: bold;
  291. color: #282828;
  292. }
  293. .brand-wrapper{
  294. overflow: hidden;
  295. .wrapper{
  296. display: flex;
  297. flex-wrap: wrap;
  298. padding-bottom: 20rpx;
  299. }
  300. .item{
  301. display: block;
  302. width:186rpx;
  303. height:56rpx;
  304. line-height: 56rpx;
  305. text-align: center;
  306. background:rgba(242,242,242,1);
  307. border-radius:28rpx;
  308. margin-top: 25rpx;
  309. padding: 0 10rpx;
  310. margin-right: 12rpx;
  311. &:nth-child(3n){
  312. margin-right: 0;
  313. }
  314. &.on{
  315. background: var(--view-minorColor);
  316. border:1px solid var(--view-theme);
  317. color: var(--view-theme);
  318. }
  319. }
  320. }
  321. }
  322. }
  323. .right-bg{
  324. position: absolute;
  325. left: 0;
  326. top: 0;
  327. width: 100%;
  328. height: 100%;
  329. background-color: rgba(0,0,0,.5);
  330. }
  331. }
  332. </style>