| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262 |
- <template>
- <view class="user">
- <view class="fix">
- <view class="head_top">
- <view class="top"></view>
- <view class="head">
- <span class="cuIcon-back" @click="back"></span>
- <view class="case">
- 用户管理
- </view>
- </view>
- </view>
- <view class="type">
- <view class="type_item" v-for="(item,index) in user" :key="index" :class="currentIndex == index?'active':''"
- @click="change(item,index)">
- {{item.name}}
- <span>({{item.num}}) </span>
- </view>
- </view>
- </view>
- <mescroll-uni class="list" :fixed="false" ref="mescrollRef" @up="getNewList" @init="mescrollInit" :use="false"
- v-if="currentIndex == 0">
- <view class="item" v-for="(item,index) in newList" :key="index">
- <view class="img">
- <image :src="item.userAvatar?item.userAvatar:'/static/product/user.png'" mode=""></image>
- </view>
- <view class="right">
- {{item.nickName}}<br />
- <span>{{item.phone}}</span>
- </view>
- </view>
- </mescroll-uni>
- <mescroll-uni class="list" :fixed="false" ref="mescrollRef" @up="getAllList" @init="mescrollInit" :use="false"
- v-if="currentIndex == 1">
- <view class="item" v-for="(item,index) in allList" :key="index">
- <view class="img">
- <image :src="item.userAvatar?item.userAvatar:'/static/product/user.png'" mode=""></image>
- </view>
- <view class="right">
- {{item.nickName}}<br />
- <span>{{item.phone}}</span>
- </view>
- </view>
- </mescroll-uni>
- </view>
- </template>
- <script>
- export default {
- data() {
- return {
- user: [{
- name: '新客',
- num: '0'
- },
- {
- name: '合计',
- num: '0'
- }
- ],
- currentIndex: 0,
- upOption: {
- page: {
- num: 0,
- size: 10 // 每页数据的数量,默认10
- },
- noMoreSize: 5, // 配置列表的总数量要大于等于5条才显示'-- END --'的提示
- empty: {
- tip: '暂无相关数据'
- }
- },
- newList: [],
- allList: []
- }
- },
- methods: {
- //返回
- back() {
- uni.navigateBack({
- delta: 1
- });
- },
- change(item, index) {
- this.currentIndex = index
- let page = {
- size: 10,
- num: 1,
- }
- this.currentIndex == 0 ?this.allList=[]:this.newList = []
- this.currentIndex == 0 ? this.getNewList(page) : this.getAllList(page)
- },
- mescrollInit(mescroll) {
- this.mescroll = mescroll;
- },
- getNewList(page) {
- let data = {
- type: 1,
- pageSize: page.size,
- pageNo: page.num,
- }
- this.$http.post('/newCustomer/list', data).then(res => {
- console.log(res)
- this.newList = this.newList.concat(res.data.result.records)
- this.mescroll.endSuccess(res.data.result.records.length, res.data.result.total);
- })
- },
- getAllList(page) {
- let data = {
- type: 2,
- pageSize: page.size,
- pageNo: page.num,
- }
- this.$http.post('/newCustomer/list', data).then(res => {
- this.allList = this.allList.concat(res.data.result.records)
- this.mescroll.endSuccess(res.data.result.records.length, res.data.result.total);
- })
- },
- getNum() {
- let data = {}
- this.$http.post('/newCustomer/count', data).then(res => {
- this.user[0].num = res.data.result.newCustomerCount
- this.user[1].num = res.data.result.totalCustomerCount
- })
- }
- },
- mounted() {
- this.mescroll.optDown.use = false
- this.getNum()
- // this.getList()
- },
- }
- </script>
- <style scoped lang="scss">
- .user {
- width: 100%;
- height: 100%;
- background: #F7F8FC;
- display: flex;
- flex-direction: column;
- justify-content: space-between;
- position: fixed;
- .fix {
- .head_top {
- // background: linear-gradient( 90deg, #DFF9FF 4%, #E6F8F8 67%, #DDF1FA 100%), linear-gradient( 0, #FFFFFF 0%, rgba(247,248,252,0) 100%);
- background:
- linear-gradient(360deg, #FFFFFF 0%, rgba(255, 255, 255, 0) 100%),
- linear-gradient(90deg, #DFF9FF 4%, #E6F8F8 67%, #DDF1FA 100%);
- /*#ifdef APP-PLUS*/
- .top {
- width: 100%;
- height: var(--status-bar-height);
- }
- /*#endif*/
- .head {
- width: 100%;
- height: 112rpx;
- padding: 20rpx;
- display: flex;
- align-items: center;
- position: relative;
- .cuIcon-back {
- font-size: 40rpx;
- margin-right: 40rpx;
- }
- .case {
- position: absolute;
- left: 50%;
- transform: translateX(-50%);
- font-size: 36rpx;
- font-weight: 600;
- }
- }
- }
- .type {
- display: flex;
- justify-content: space-around;
- align-items: center;
- height: 79rpx;
- border-top: 1px solid #EEEEEE;
- border-bottom: 1px solid #EEEEEE;
- .type_item {
- font-weight: normal;
- font-size: 28rpx;
- color: #666666;
- span{
- margin-left: 20rpx;
- }
- }
- .active {
- font-size: 28rpx;
- color: #333333;
- font-weight: 600;
- position: relative;
- }
- .active::after {
- content: "";
- position: absolute;
- bottom: -10rpx;
- left: 50%;
- transform: translateX(-50%);
- width: 44rpx;
- height: 6rpx;
- background-color: #2D88F4;
- border-radius: 7rpx;
- }
- }
- }
- .list {
- background-color: transparent;
- padding: 16rpx 32rpx;
- overflow-y: auto;
- .item {
- width: 100%;
- height: 128rpx;
- padding: 20rpx;
- background: #FFFFFF;
- border-radius: 16rpx;
- margin-bottom: 16rpx;
- display: flex;
- align-items: center;
- .img {
- margin-right: 16rpx;
- image {
- width: 80rpx;
- height: 80rpx;
- }
- }
- .right {
- font-size: 28rpx;
- color: #000000;
- font-weight: 600;
- height: 100%;
- display: flex;
- flex-direction: column;
- justify-content: space-between;
- span {
- font-size: 24rpx;
- color: #8A91A8;
- font-weight: 400;
- }
- }
- }
- }
- }
- </style>
|