gx
queenwuli
2021-01-28 b83ba3cc4687f21d744e9866e10e30e91229e8a4
hive-app/pages/member/index.vue
@@ -1,25 +1,25 @@
<template>
   <view class="container">
      <!-- #ifndef H5 -->
      <view class="status_bar"></view>
      <!-- #endif -->
      <search-bar @confirm="search" :focus="isFocus"></search-bar>
      <view class="sort-wrap">
         <view @click="showFilterCustom(1)">
            <text>{{filterText}}</text>
            <text class="iconfont iconjiantouarrow486 gray"></text>
         </view>
         <view @click="showFilterCustom(2)">
            <text>筛选</text>
            <text class="iconfont iconshaixuan gray"></text>
      <view class="sticky-header">
         <search-bar @confirm="search" :focus="isFocus" class="mt-10"></search-bar>
         <view class="sort-wrap">
            <view @click="showFilterCustom(1)">
               <text>{{filterText}}</text>
               <text class="iconfont iconjiantouarrow486 gray"></text>
            </view>
            <view @click="showFilterCustom(2)">
               <text>筛选</text>
               <text class="iconfont iconshaixuan gray"></text>
            </view>
         </view>
      </view>
      <filter-dropdown ref="filterDropdownEl" :list="filterList" :filterKey="filterKeys" :type="filterType" @confirm="confirmFilter" @reset="resetFilter"></filter-dropdown>
      <view class="flex justify-between">
         <view class="flex-1 mr-10">
      <view class="content flex justify-between">
         <view class="flex-1">
            <navigator :url="'./detail?id='+item.id" hover-class="none" class="member-list" v-for="(item, index) in list">
               <template>
                  <image v-if="item.photo" src="item.photo" class="avatar"></image>
                  <image v-if="item.photo" :src="item.photo" class="avatar"></image>
                  <text v-else class="first-name" :style="{background: caculateBgcolor(index)}">{{item.vipName | formatName}}</text>
               </template>
               <view class="flex-1 flex align-center justify-between member-list-con">
@@ -30,15 +30,18 @@
                     </text>
                     <text class="font-13 gray">{{$utils.encryptAccount(item.phone)}}</text>
                  </view>
                  <view>
                  <view class="member-list--con-right">
                     <text class="blue">到店{{item.arriveCnt || 0}}次</text>
                     <text class="iconfont iconarrow-backimg light-gray"></text>
                  </view>
               </view>
            </navigator>
            <no-record :isShow="!list.length"></no-record>
            <view v-if="list.length">
               <uni-load-more :status="loadStatus" color="#a5abaf"></uni-load-more>
            </view>
         </view>
         <indexed-list></indexed-list>
         <!-- <indexed-list></indexed-list> -->
      </view>
      <view class="quick-entry">
         <navigator url="./editMember" hover-class="navigator-hover">
@@ -52,11 +55,13 @@
   import searchBar from '../../components/searchBar/index.vue';
   import indexedList from '../../components/indexedList/index.vue';
   import filterDropdown from '../../components/filterDropdown/index.vue';
   import uniLoadMore from '@/components/uni-load-more/uni-load-more.vue';
   export default {
      components:{
         searchBar,
         indexedList,
         filterDropdown
         filterDropdown,
         uniLoadMore
      },
      data() {
         return {
@@ -64,12 +69,8 @@
            colors: ['#CCC6B4', '#C0CCB4', '#B4C2CC', '#BEB4CC', '#B4CCBE', '#B4CCCA', '#CCB4C6', '#CCB4B4'],
            filterType: 1,
            filterList: [],
            filterText: '首字母排序',
            filterText: '本月到店次数(由高到低)',
            filter1: [{
               title: '首字母排序',
               key: '',
               value: ''
            },{
               title: '本月到店次数(由高到低)',
               key: 'monthArrived',
               value: 'desc'
@@ -157,9 +158,11 @@
               ]
            }],
            queryKey: '',
            sort: '',
            order: '',
            list: []
            sort: 'monthArrived',
            order: 'desc',
            list: [],
            loadStatus: 'more',
            pageNum: 1
         };
      },
      onLoad() {
@@ -173,7 +176,24 @@
         this.$refs.filterDropdownEl.hide();
         getApp().globalData.isFocus = false;
      },
      onPullDownRefresh(){
         this.reloadData();
         let timer = setTimeout(function () {
            uni.stopPullDownRefresh();
            clearTimeout(timer);
            timer = null;
         }, 800);
      },
      onReachBottom(){
         this.loadMemberList()
      },
      methods:{
         reloadData(){
            this.list = [];
            this.pageNum = 1;
            this.loadStatus = 'more';
            this.loadMemberList();
         },
         caculateBgcolor(index){
            return this.colors[index%8];
         },
@@ -192,12 +212,12 @@
         search(val){
            this.$refs.filterDropdownEl.hide();
            this.queryKey = val;
            this.loadMemberList();
            this.reloadData();
         },
         // 重置筛选
         resetFilter(){
            this.filterKeys = {birthType: '', vipType: '', other: ''};
            this.loadMemberList();
            this.reloadData();
         },
         // 全部筛选
         confirmFilter(val){
@@ -208,7 +228,7 @@
            } else {
               this.filterKeys = val;
            }
            this.loadMemberList();
            this.reloadData();
         },
         // 获取会员类型
         loadMemberType(){
@@ -225,16 +245,26 @@
            })
         },
         loadMemberList(){
            if(this.loadStatus!=='more'){
               return;
            }
            let parma = Object.assign({
               order: this.order,
               queryKey: this.queryKey,
               sort: this.sort
               sort: this.sort,
               pageNum: this.pageNum,
               pageSize: 10
            }, this.filterKeys)
            this.$httpUtils.request('/api/vip/findVipInfoList', parma, 'POST').then((res) => {
               if(res.status == 200){
                  this.list = res.rows;
               } else {
                  this.list = [];
                  let result = res.rows;
                  if(result.length < 10){
                     this.loadStatus = 'noMore';
                  } else {
                     this.pageNum ++ ;
                     this.loadStatus = 'more';
                  }
                  this.list = this.list.concat(result);
               }
            }).catch((err) => {
               this.list = [];
@@ -255,7 +285,16 @@
<style scoped>
   .container{
      padding: 10px 10px 0;
      padding: var(--status-bar-height) 10px 0;
   }
   .sticky-header{
      position: fixed;
      top: 0;
      left: 0;
      right: 0;
      padding: var(--status-bar-height) 10px 0;
      background: #FFFFFF;
      z-index: 99;
   }
   .sort-wrap{
      display: flex;
@@ -267,6 +306,9 @@
   .sort-wrap .iconfont{
      font-size: 14px;
      padding-left: 4px;
   }
   .content{
      padding-top: 92px
   }
   .avatar{
      display: inline-block;
@@ -294,6 +336,11 @@
      padding: 15px 0 15px 5px;
      border-bottom: 1px solid #EDEAF4;
   }
   .member-list--con-right{
      width: 90px;
      flex: 0 0 90px;
      text-align: right;
   }
   .member-list .vip-level{
      border: 1px solid #666;
      margin-left: 10px;
@@ -301,6 +348,7 @@
      border-radius: 12px;
      padding: 2px 12px;
      color: #666666;
      word-break: keep-all;
   }
   .quick-entry{
      position: fixed;