详情小程序
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.

307 lines
7.8 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" v-if="$isRight(filter)">
  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 :list="members"></lf-user-list>
  47. <!-- 加载 -->
  48. <view class="loading-more">
  49. <text :class="{'loading-more-text': loading_class}">{{ loading_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. page: 1,
  69. page_size: 10,
  70. isPage: true,
  71. loading_class: true,
  72. loading_text: '正在加载中',
  73. members: []
  74. }
  75. },
  76. onLoad(options){
  77. console.log(this.filter)
  78. this.name = options.name || this.name;
  79. if(this.name == '搜索') {
  80. this.show_filter = true;
  81. this.filter_key = 'search';
  82. this.on_focus = true;
  83. }
  84. this.getMemberParams();
  85. this.getMembers();
  86. },
  87. methods: {
  88. // 获取查询参数
  89. getMemberParams(){
  90. this.$http(this.API.API_MEMBERS_PARAMS).then(res => {
  91. console.log(res, "---------");
  92. this.filterObj = res.data;
  93. this.filter = this.productionObj();
  94. })
  95. },
  96. // 获取会员列表
  97. getMembers(){
  98. this.$http(this.API.API_MEMBERS_ALL, {
  99. page: this.page,
  100. pagesize: this.page_size
  101. }).then(res => {
  102. let members = res.data.members.data || [];
  103. let isPage = this.$isRight(res.data.members.next_page_url);
  104. this.isPage = isPage;
  105. if(!isPage){
  106. this.loading_class = false;
  107. this.loading_text = '已加载全部数据~';
  108. }
  109. this.members = members;
  110. })
  111. },
  112. // 引入数据,并序列化,避免数据引用
  113. productionObj(){
  114. return JSON.parse( JSON.stringify(this.filterObj) );
  115. },
  116. // 切换显示隐藏筛选
  117. switchFilter(key){
  118. if(this.filter_key != key){
  119. this.show_filter = true;
  120. }else{
  121. this.show_filter = !this.show_filter;
  122. }
  123. this.filter_key = key;
  124. },
  125. // 选中筛选条件
  126. activeItem(value){
  127. this.filter[this.filter_key].selected = value;
  128. // TODO 接口请求
  129. },
  130. // 切换筛选条件
  131. switchCondition(key, value){
  132. this.filter[this.filter_key][key].selected = value;
  133. },
  134. // 输入框失去焦点事件
  135. inputBlur(key, event){
  136. this.filter[this.filter_key][key] = event.detail.value;
  137. },
  138. // 重置筛选条件
  139. reset(){
  140. this.filter = this.productionObj();
  141. this.show_filter = false;
  142. },
  143. // 确定筛选
  144. comfirm(){
  145. this.$msg('筛选成功!');
  146. this.show_filter = false;
  147. console.log(this.filter);
  148. }
  149. }
  150. }
  151. </script>
  152. <style lang="scss" scoped="scoped">
  153. .head{
  154. width: 750rpx;
  155. height: 102rpx;
  156. border-bottom: 1rpx solid #e5e5e5;
  157. position: fixed;
  158. background-color: #FFFFFF;
  159. z-index: 9;
  160. display: flex;
  161. justify-content: space-between;
  162. align-items: center;
  163. padding: 0 32rpx;
  164. box-sizing: border-box;
  165. .sign-in-btn{
  166. margin: 0;
  167. width: 140rpx;
  168. height: 62rpx;
  169. background-color: #FCF7FA;
  170. border: 1rpx solid #E21196;
  171. border-radius: 10rpx;
  172. font-size: 28rpx;
  173. color: #E21196;
  174. line-height: 60rpx;
  175. }
  176. .filter-item{
  177. width: 114rpx;
  178. height: 62rpx;
  179. // line-height: 62rpx;
  180. // text-align: right;
  181. display: flex;
  182. flex-wrap: nowrap;
  183. justify-content: center;
  184. align-items: center;
  185. font-size: 28rpx;
  186. color: #222222;
  187. .tab-active{
  188. display: inline-block;
  189. transform: rotate(180deg);
  190. color: #E21196 !important;
  191. }
  192. }
  193. .filter-modal{
  194. position: absolute;
  195. z-index: 7;
  196. background-color: rgba(0,0,0,0.5);
  197. top: 103rpx;
  198. right: 0;
  199. bottom: 0;
  200. left: 0;
  201. width: 100vw;
  202. height: calc(100vh - 103rpx);
  203. .filter-content{
  204. position: absolute;
  205. width: 100%;
  206. height: max-content;
  207. max-height: 806rpx;
  208. background-color: #FFFFFF;
  209. left: 0;
  210. z-index: 14;
  211. overflow-y: scroll;
  212. padding: 0 0 32rpx 32rpx;
  213. display: flex;
  214. flex-direction: column;
  215. justify-content: space-evenly;
  216. view{
  217. height: 60rpx;
  218. // border-bottom: 1rpx solid #e5e5e5;
  219. padding: 20rpx 0;
  220. line-height: 60rpx;
  221. }
  222. }
  223. .filter-many{
  224. position: absolute;
  225. width: 100%;
  226. height: 806rpx;
  227. background-color: #FFFFFF;
  228. left: 0;
  229. z-index: 14;
  230. .filter-main{
  231. height: 675rpx;
  232. overflow-y: scroll;
  233. box-sizing: border-box;
  234. padding: 32rpx;
  235. .filter-title{
  236. font-size: 28rpx;
  237. color: #222222;
  238. font-weight: bold;
  239. margin-bottom: 20rpx;
  240. }
  241. .filter-capsule{
  242. width: 163rpx;
  243. height: 62rpx;
  244. border-radius: 31rpx;
  245. border: 1rpx solid #999999;
  246. font-size: 20rpx;
  247. color: #999999;
  248. text-align: center;
  249. line-height: 62rpx;
  250. margin-right: 12rpx;
  251. &:nth-child(4n){
  252. margin-right: 0rpx;
  253. }
  254. &:nth-child(n+5){
  255. margin-top: 12rpx;
  256. }
  257. }
  258. .filter-active{
  259. border-color: #E21196;
  260. color: #E21196;
  261. }
  262. .input-search{
  263. width: 686rpx;
  264. height: 62rpx;
  265. background-color: #FFFFFF;
  266. border-radius: 10rpx;
  267. border: 1rpx solid #DDDDDD;
  268. box-sizing: border-box;
  269. padding: 0 15rpx;
  270. font-size: 28rpx;
  271. margin-bottom: 50rpx;
  272. }
  273. }
  274. .filter-main>view:nth-child(n+3){
  275. margin-top: 40rpx;
  276. }
  277. .filter-foot{
  278. height: 130rpx;
  279. border-top: 1rpx solid #e5e5e5;
  280. padding: 32rpx;
  281. display: flex;
  282. justify-content: space-between;
  283. align-items: center;
  284. .filter-btn{
  285. width: 332rpx;
  286. height: 90rpx;
  287. border-radius: 10rpx;
  288. border: 1rpx solid #555555;
  289. background-color: #FFFFFF;
  290. line-height: 88rpx;
  291. font-size: 32rpx;
  292. color: #555555;
  293. margin: 0;
  294. }
  295. .solid-btn{
  296. background-color: #E21196;
  297. color: #FFFFFF;
  298. border: none;
  299. }
  300. }
  301. }
  302. }
  303. }
  304. </style>