queenwuli
2020-12-23 ccf6a0bc014d86290efffc55cbea9cf3dc860d56
hive-app/pages/member/index.vue
@@ -3,33 +3,33 @@
      <!-- #ifndef H5 -->
      <view class="status_bar"></view>
      <!-- #endif -->
      <search-bar></search-bar>
      <search-bar @confirm="search"></search-bar>
      <view class="sort-wrap">
         <view @click="filterCustom(1)">
            <text>本月到店次数</text>
         <view @click="showFilterCustom(1)">
            <text>{{filterText}}</text>
            <text class="iconfont iconjiantouarrow486 gray"></text>
         </view>
         <view @click="filterCustom(3)">
         <view @click="showFilterCustom(2)">
            <text>筛选</text>
            <text class="iconfont iconshaixuan gray"></text>
         </view>
      </view>
      <filter-dropdown ref="filterDropdownEl" :list="filterList" :type="filterType"></filter-dropdown>
      <view class="flex justify-between" @click="toDetail">
      <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="member-list flex align-center" v-for="(item, index) in 15">
               <text class="first-name" :style="{background: caculateBgcolor(index)}">李</text>
            <navigator :url="'./detail?id='+item.id" hover-class="none" class="member-list" v-for="(item, index) in list">
               <text class="first-name" :style="{background: caculateBgcolor(index)}">{{item.vipName | formatName}}</text>
               <view class="flex-1 flex align-center justify-between member-list-con">
                  <view>
                     <text>李广</text>
                     <text class="ml-10">152****9645</text>
                  <view class="flex flex-v">
                     <text>{{item.vipName}}</text>
                     <text class="font-13 gray mt-5">{{$utils.encryptAccount(item.phone)}}</text>
                  </view>
                  <view>
                     <text class="blue">30天未到店</text>
                     <text class="iconfont iconarrow-backimg gray"></text>
                     <text class="blue">到店{{item.arriveCnt || 0}}次</text>
                     <text class="iconfont iconarrow-backimg light-gray"></text>
                  </view>
               </view>
            </view>
            </navigator>
         </view>
         <indexed-list></indexed-list>
      </view>
@@ -56,60 +56,107 @@
            colors: ['#CCC6B4', '#C0CCB4', '#B4C2CC', '#BEB4CC', '#B4CCBE', '#B4CCCA', '#CCB4C6', '#CCB4B4'],
            filterType: 1,
            filterList: [],
            filter1: ['本月到店次数(由低到高)','本月到店次数(由高到低)','本年到店次数(由低到高)','本年到店次数(由高到低)','本月消费(由高到低)','本月消费(由低到高)','本月消耗(由高到低)','本月消耗(由低到高)'],
            filter2: ['7天内卡项到期','15天内卡项到期','30天内卡项到期'],
            filter3: [{
               title: '到店途径',
            filterText: '首字母排序',
            filter1: [{
               title: '首字母排序',
               key: '',
               value: ''
            },{
               title: '本月到店次数(由高到低)',
               key: 'monthArrived',
               value: 'desc'
            },{
               title: '本月到店次数(由低到高)',
               key: 'monthArrived',
               value: 'asc'
            },{
               title: '本年到店次数(由高到低)',
               key: 'yearArrived',
               value: 'desc'
            },{
               title: '本年到店次数(由低到高)',
               key: 'yearArrived',
               value: 'asc'
            },{
               title: '本月消费(由高到低)',
               key: 'used',
               value: 'desc'
            },{
               title: '本月消费(由低到高)',
               key: 'used',
               value: 'asc'
            },{
               title: '本月消耗(由高到低)',
               key: 'consume',
               value: 'desc'
            },{
               title: '本月消耗(由低到高)',
               key: 'consume',
               value: 'asc'
            },{
               title: '会员级别(由高到低)',
               key: 'vipLevel',
               value: 'desc'
            },{
               title: '会员级别(由低到高)',
               key: 'vipLevel',
               value: 'asc'
            },{
               title: '上次到店时间(由近到远)',
               key: 'arriveTime',
               value: 'desc'
            },{
               title: '上次到店时间(由远到近)',
               key: 'arriveTime',
               value: 'asc'
            }],
            filterKeys: {birthType: '', vipType: '', other: ''},
            filter2: [{
               title: '生日',
               key: 'birthType',
               list: [
                  {
                     'title': '美团预约',
                     'value': ''
                     'title': '三天内生日',
                     'value': 1
                  },
                  {
                     'title': '网络预约',
                     'value': ''
                     'title': '本月生日',
                     'value': 2
                  },
                  {
                     'title': '下月生日',
                     'value': 3
                  }
               ]
            },
            {
               title: '会员等级',
               list: [
                  {
                     'title': '一级会员',
                     'value': ''
                  },
                  {
                     'title': '二级会员',
                     'value': ''
                  },
                  {
                     'title': '三级会员',
                     'value': ''
                  }
               ]
               title: '会员类型',
               key: 'vipType',
               list: []
            },
            {
               title: '活跃度',
               title: '其他',
               key: 'other',
               list: [
                  {
                     'title': '活跃',
                     'value': ''
                     'title': '老客户',
                     'value': 1
                  },
                  {
                     'title': '不活跃',
                     'value': ''
                  },
                  {
                     'title': '睡眠',
                     'value': ''
                  },
                  {
                     'title': '沉睡',
                     'value': ''
                     'title': '新客户',
                     'value': 2
                  }
               ]
            }]
            }],
            queryKey: '',
            sort: '',
            order: '',
            list: []
         };
      },
      onLoad() {
         this.loadMemberType()
         this.loadMemberList()
      },
      onHide(){
         this.$refs.filterDropdownEl.hide();
@@ -118,23 +165,76 @@
         caculateBgcolor(index){
            return this.colors[index%8];
         },
         toDetail(){
            uni.navigateTo({
               url:'./detail'
            })
         },
         filterCustom(type){
         showFilterCustom(type){
            this.$refs.filterDropdownEl.show();
            if(type===1){
               this.filterList = this.filter1;
               this.filterType = 1;
            } else if(type===2){
               this.filterList = this.filter2;
               this.filterType = 1;
            } else {
               this.filterList = this.filter3;
               this.filterList = this.filter2;
               this.filterType = 0;
            }
         },
         // 搜索
         search(val){
            this.queryKey = val;
            this.loadMemberList();
         },
         // 重置筛选
         resetFilter(){
            this.filterKeys = {birthType: '', vipType: '', other: ''};
            this.loadMemberList();
         },
         // 全部筛选
         confirmFilter(val){
            if(this.filterType == 1){
               this.sort = val.key;
               this.order = val.value;
               this.filterText = val.title;
            } else {
               this.filterKeys = val;
            }
            this.loadMemberList();
         },
         // 获取会员类型
         loadMemberType(){
            this.$httpUtils.request('/api/vip/findVipType').then((res) => {
               if(res.status == 200){
                  let result = res.rows.map((item) => {
                     return {
                        title: item.levelName,
                        value: item.id
                     }
                  });
                  this.filter2[1].list = result;
               }
            })
         },
         loadMemberList(){
            let parma = Object.assign({
               order: this.order,
               queryKey: this.queryKey,
               sort: this.sort
            }, this.filterKeys)
            this.$httpUtils.request('/api/vip/findVipInfoList', parma, 'POST').then((res) => {
               if(res.status == 200){
                  this.list = res.rows;
               } else {
                  this.list = [];
               }
            }).catch((err) => {
               this.list = [];
            })
         }
      },
      filters:{
         formatName(val){
            if(!val){
               return '无'
            }
            val = val.trim();
            return val.substr(0, 1)
         }
      }
   }
@@ -167,10 +267,12 @@
      font-size: 16px;
   }
   .member-list{
      display: flex;
      align-items: center;
      font-size: 14px;
   }
   .member-list-con{
      padding: 18px 0 18px 5px;
      padding: 15px 0 15px 5px;
      border-bottom: 1px solid #EDEAF4;
   }
   .quick-entry{
@@ -184,7 +286,6 @@
      border-radius: 50%;
      background: #518EFF;
      color: #FFFFFF;
      box-shadow: 4px 4px 5px #ddd;
   }
   .quick-entry .iconfont{
      font-size: 24px;