详情小程序
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

283 lines
7.1 KiB

5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
  1. <template>
  2. <view>
  3. <view class="head">
  4. <!-- <button class="sign-in-btn">最新</button> -->
  5. <!-- tabs -->
  6. <view class="filter-item" v-for="(value, key) in filter" :key="key" @click="switchFilter(key)">
  7. <text style="white-space: nowrap">{{ value.selected || value.name }}</text>
  8. <text class="lf-iconfont icon-iconfront-" :class="{'tab-active': show_filter && filter_key == key}"></text>
  9. </view>
  10. <!-- 普通列表文字选择 -->
  11. <view class="filter-modal" v-if="show_filter && filter_key != 'search'" @click="show_filter = false">
  12. <view class="filter-content">
  13. <view v-for="(item, index) in filter[filter_key].data" :key="index" @click="activeItem(item.text)">{{ item.text }}</view>
  14. </view>
  15. </view>
  16. <!-- 多条件搜索 -->
  17. <view class="filter-modal" v-else-if="show_filter && filter_key == 'search'" @click="show_filter = false">
  18. <view class="filter-many" @click.stop>
  19. <view class="filter-main">
  20. <view v-for="(value, key) in filter[filter_key]" :key="key" v-if="key != 'name'">
  21. <block v-if="key == 'search_value'">
  22. <view class="filter-title">会员编号搜索</view>
  23. <input class="input-search" :focus="on_focus" placeholder="请输入会员编号" :value="value" @blur="inputBlur(key, $event)" />
  24. </block>
  25. <block v-else>
  26. <view class="filter-title">{{ value.name }}</view>
  27. <view class="lf-flex-wrap">
  28. <view class="filter-capsule"
  29. :class="{'filter-active': item.text == value.selected}"
  30. v-for="(item, index) in value.data" :key="index"
  31. @click="switchCondition(key, item.text)"
  32. >{{ item.text }}</view>
  33. </view>
  34. </block>
  35. </view>
  36. </view>
  37. <view class="filter-foot">
  38. <button class="filter-btn" @click="reset">重置条件</button>
  39. <button class="filter-btn solid-btn" @click="comfirm">确定</button>
  40. </view>
  41. </view>
  42. </view>
  43. </view>
  44. <!-- head end -->
  45. <view style="height: 104rpx;"></view>
  46. <lf-user-list></lf-user-list>
  47. <!-- 加载 -->
  48. <view class="loading-more">
  49. <text>没有更多数据啦~</text>
  50. </view>
  51. <!-- 回到顶部 -->
  52. <u-back-top :scrollTop="pageScrollTop"></u-back-top>
  53. </view>
  54. </template>
  55. <script>
  56. import lfUserList from '@/components/lf-userList/lf-userList.vue'
  57. // var filterObj = require('./filter.json');
  58. export default {
  59. components: { lfUserList },
  60. data(){
  61. return {
  62. show_filter: false,
  63. filter: {},
  64. filter_key: '',
  65. name: '最新',
  66. on_focus: false,
  67. filterObj: {}
  68. }
  69. },
  70. onLoad(options){
  71. console.log(this.filter)
  72. this.name = options.name || this.name;
  73. if(this.name == '搜索') {
  74. this.show_filter = true;
  75. this.filter_key = 'search';
  76. this.on_focus = true;
  77. }
  78. this.getMemberParams();
  79. },
  80. methods: {
  81. // 获取查询参数
  82. getMemberParams(){
  83. this.$http(this.API.API_MEMBERS_PARAMS).then(res => {
  84. console.log(res, "---------");
  85. this.filterObj = res.data;
  86. this.filter = this.productionObj();
  87. })
  88. },
  89. // 引入数据,并序列化,避免数据引用
  90. productionObj(){
  91. return JSON.parse( JSON.stringify(this.filterObj) );
  92. },
  93. // 切换显示隐藏筛选
  94. switchFilter(key){
  95. if(this.filter_key != key){
  96. this.show_filter = true;
  97. }else{
  98. this.show_filter = !this.show_filter;
  99. }
  100. this.filter_key = key;
  101. },
  102. // 选中筛选条件
  103. activeItem(value){
  104. this.filter[this.filter_key].selected = value;
  105. // TODO 接口请求
  106. },
  107. // 切换筛选条件
  108. switchCondition(key, value){
  109. this.filter[this.filter_key][key].selected = value;
  110. },
  111. // 输入框失去焦点事件
  112. inputBlur(key, event){
  113. this.filter[this.filter_key][key] = event.detail.value;
  114. },
  115. // 重置筛选条件
  116. reset(){
  117. this.filter = this.productionObj();
  118. this.show_filter = false;
  119. },
  120. // 确定筛选
  121. comfirm(){
  122. this.$msg('筛选成功!');
  123. this.show_filter = false;
  124. console.log(this.filter);
  125. }
  126. }
  127. }
  128. </script>
  129. <style lang="scss" scoped="scoped">
  130. .head{
  131. width: 750rpx;
  132. height: 102rpx;
  133. border-bottom: 1rpx solid #e5e5e5;
  134. position: fixed;
  135. background-color: #FFFFFF;
  136. z-index: 9;
  137. display: flex;
  138. justify-content: space-between;
  139. align-items: center;
  140. padding: 0 32rpx;
  141. box-sizing: border-box;
  142. .sign-in-btn{
  143. margin: 0;
  144. width: 140rpx;
  145. height: 62rpx;
  146. background-color: #FCF7FA;
  147. border: 1rpx solid #E21196;
  148. border-radius: 10rpx;
  149. font-size: 28rpx;
  150. color: #E21196;
  151. line-height: 60rpx;
  152. }
  153. .filter-item{
  154. width: 114rpx;
  155. height: 62rpx;
  156. // line-height: 62rpx;
  157. // text-align: right;
  158. display: flex;
  159. flex-wrap: nowrap;
  160. justify-content: center;
  161. align-items: center;
  162. font-size: 28rpx;
  163. color: #222222;
  164. .tab-active{
  165. display: inline-block;
  166. transform: rotate(180deg);
  167. color: #E21196 !important;
  168. }
  169. }
  170. .filter-modal{
  171. position: absolute;
  172. z-index: 7;
  173. background-color: rgba(0,0,0,0.5);
  174. top: 103rpx;
  175. right: 0;
  176. bottom: 0;
  177. left: 0;
  178. width: 100vw;
  179. height: calc(100vh - 103rpx);
  180. .filter-content{
  181. position: absolute;
  182. width: 100%;
  183. height: 300rpx;
  184. background-color: #FFFFFF;
  185. left: 0;
  186. z-index: 14;
  187. overflow-y: scroll;
  188. padding: 0 0 32rpx 32rpx;
  189. display: flex;
  190. flex-direction: column;
  191. justify-content: space-evenly;
  192. view{
  193. height: 60rpx;
  194. // border-bottom: 1rpx solid #e5e5e5;
  195. padding: 20rpx 0;
  196. line-height: 60rpx;
  197. }
  198. }
  199. .filter-many{
  200. position: absolute;
  201. width: 100%;
  202. height: 806rpx;
  203. background-color: #FFFFFF;
  204. left: 0;
  205. z-index: 14;
  206. .filter-main{
  207. height: 675rpx;
  208. overflow-y: scroll;
  209. box-sizing: border-box;
  210. padding: 32rpx;
  211. .filter-title{
  212. font-size: 28rpx;
  213. color: #222222;
  214. font-weight: bold;
  215. margin-bottom: 20rpx;
  216. }
  217. .filter-capsule{
  218. width: 163rpx;
  219. height: 62rpx;
  220. border-radius: 31rpx;
  221. border: 1rpx solid #999999;
  222. font-size: 20rpx;
  223. color: #999999;
  224. text-align: center;
  225. line-height: 62rpx;
  226. margin-right: 12rpx;
  227. &:nth-child(4n){
  228. margin-right: 0rpx;
  229. }
  230. &:nth-child(n+5){
  231. margin-top: 12rpx;
  232. }
  233. }
  234. .filter-active{
  235. border-color: #E21196;
  236. color: #E21196;
  237. }
  238. .input-search{
  239. width: 686rpx;
  240. height: 62rpx;
  241. background-color: #FFFFFF;
  242. border-radius: 10rpx;
  243. border: 1rpx solid #DDDDDD;
  244. box-sizing: border-box;
  245. padding: 0 15rpx;
  246. font-size: 28rpx;
  247. margin-bottom: 50rpx;
  248. }
  249. }
  250. .filter-main>view:nth-child(n+3){
  251. margin-top: 40rpx;
  252. }
  253. .filter-foot{
  254. height: 130rpx;
  255. border-top: 1rpx solid #e5e5e5;
  256. padding: 32rpx;
  257. display: flex;
  258. justify-content: space-between;
  259. align-items: center;
  260. .filter-btn{
  261. width: 332rpx;
  262. height: 90rpx;
  263. border-radius: 10rpx;
  264. border: 1rpx solid #555555;
  265. background-color: #FFFFFF;
  266. line-height: 88rpx;
  267. font-size: 32rpx;
  268. color: #555555;
  269. margin: 0;
  270. }
  271. .solid-btn{
  272. background-color: #E21196;
  273. color: #FFFFFF;
  274. border: none;
  275. }
  276. }
  277. }
  278. }
  279. }
  280. </style>