queenwuli
2021-01-04 4300b5c714bb7e09f53f7d722c953dec9c809d8e
hive-app/pages/member/index.vue
@@ -1,43 +1,43 @@
<template>
   <view class="container">
      <search-bar></search-bar>
      <!-- #ifndef H5 -->
      <view class="status_bar"></view>
      <!-- #endif -->
      <search-bar @confirm="search"></search-bar>
      <view class="sort-wrap">
         <view>
            <text>到店次数</text>
            <text class="iconfont iconjiantouarrow486"></text>
         <view @click="showFilterCustom(1)">
            <text>{{filterText}}</text>
            <text class="iconfont iconjiantouarrow486 gray"></text>
         </view>
         <view>
            <text>消费金额</text>
            <text class="iconfont iconjiantouarrow486"></text>
         </view>
         <view>
            <text>全部筛选</text>
            <text class="iconfont iconjiantouarrow486"></text>
         <view @click="showFilterCustom(2)">
            <text>筛选</text>
            <text class="iconfont iconshaixuan gray"></text>
         </view>
      </view>
      <view class="sort-tab">
         <text class="sort-tab-item">正式客户</text>
         <text class="sort-tab-item">体验客户</text>
         <text class="sort-tab-item">潜在客户</text>
         <text class="sort-tab-item">潜在客户</text>
      </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="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>
            <no-record :isShow="!list.length"></no-record>
         </view>
         <indexed-list></indexed-list>
      </view>
      <view class="quick-entry">
         <navigator url="./editMember" hover-class="navigator-hover">
            <text class="iconfont iconjia"></text>
         </navigator>
      </view>
   </view>
</template>
@@ -45,19 +45,198 @@
<script>
   import searchBar from '../../components/searchBar/index.vue';
   import indexedList from '../../components/indexedList/index.vue';
   import filterDropdown from '../../components/filterDropdown/index.vue';
   export default {
      components:{
         searchBar,
         indexedList
         indexedList,
         filterDropdown
      },
      data() {
         return {
            colors: ['#CCC6B4', '#C0CCB4', '#B4C2CC', '#BEB4CC', '#B4CCBE', '#B4CCCA', '#CCB4C6', '#CCB4B4']
            colors: ['#CCC6B4', '#C0CCB4', '#B4C2CC', '#BEB4CC', '#B4CCBE', '#B4CCCA', '#CCB4C6', '#CCB4B4'],
            filterType: 1,
            filterList: [],
            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': 1
                  },
                  {
                     'title': '本月生日',
                     'value': 2
                  },
                  {
                     'title': '下月生日',
                     'value': 3
                  }
               ]
            },
            {
               title: '会员类型',
               key: 'vipType',
               list: []
            },
            {
               title: '其他',
               key: 'other',
               list: [
                  {
                     'title': '老客户',
                     'value': 1
                  },
                  {
                     'title': '新客户',
                     'value': 2
                  }
               ]
            }],
            queryKey: '',
            sort: '',
            order: '',
            list: []
         };
      },
      onLoad() {
         this.loadMemberType()
         this.loadMemberList()
      },
      onHide(){
         this.$refs.filterDropdownEl.hide();
      },
      methods:{
         caculateBgcolor(index){
            return this.colors[index%8];
         },
         showFilterCustom(type){
            this.$refs.filterDropdownEl.show();
            if(type===1){
               this.filterList = this.filter1;
               this.filterType = 1;
            } else {
               this.filterList = this.filter2;
               this.filterType = 0;
            }
         },
         // 搜索
         search(val){
            this.$refs.filterDropdownEl.hide();
            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)
         }
      }
   }
@@ -71,29 +250,12 @@
      display: flex;
      justify-content: space-between;
      align-items: center;
      font-size: 14px;
      font-size: 13px;
      padding: 10px 0;
   }
   .sort-wrap .iconfont{
      font-size: 14px;
      color: #999;
      padding-left: 3px;
   }
   .sort-tab{
      display: flex;
      justify-content: space-between;
      margin: 10px 0;
   }
   .sort-tab-item{
      border:1px solid #EDEAF4;
      font-size: 14px;
      color: #ABB1CC;
      padding: 3px 10px;
      border-radius: 4px;
      box-shadow: 3px 3px 5px #EEEEEE;
   }
   .sort-tab-item.active{
      border: 1px solid #518EFF;
      color: #518EFF;
      padding-left: 4px;
   }
   .first-name{
      display: inline-block;
@@ -104,12 +266,33 @@
      border-radius: 50%;
      text-align: center;
      color: #FFFFFF;
      font-size: 16px;
   }
   .member-list{
      font-size: 15px;
      display: flex;
      align-items: center;
      font-size: 14px;
   }
   .member-list-con{
      padding: 20px 0 20px 5px;
      padding: 15px 0 15px 5px;
      border-bottom: 1px solid #EDEAF4;
   }
   .quick-entry{
      position: fixed;
      bottom: 80px;
      right: 15px;
      width: 50px;
      height: 50px;
      line-height: 50px;
      text-align: center;
      border-radius: 50%;
      background: #518EFF;
      color: #FFFFFF;
   }
   .quick-entry .iconfont{
      font-size: 24px;
   }
   .navigator-hover{
      border-radius: 50%;
   }
</style>