hm-examples/pagesB/userFootprint/userFootprint.vue

141 lines
4.1 KiB
Vue
Raw Permalink Normal View History

2022-04-25 06:38:26 +00:00
<template>
<view>
<!-- 状态栏 -->
<status-nav :titleVal="'用户足迹'" :statusTitle="true"></status-nav>
<!-- 自定义二级分类 -->
<!-- 列表 -->
<view :style="{paddingTop: statusHeight+'px'}" class="pad-zy30">
<view class="radius20 fon28 col3 mar-sx20">
<view class="disac">
<view class="disjbac width100 radius10 pad-zy20 xialak bacf">
<input class="fon28 width100" type="text" @confirm="searchEv" v-model="keyword" placeholder="请输入姓名/电话查找" placeholder-style="color: #B3B3B3;" />
</view>
<view @tap="searchEv" class="flexs tc mar-z30 colf radius10 customer-btn" :style="{background:publicColor}">搜索</view>
</view>
</view>
<!-- 列表 -->
<view @tap="chooseId(item.id)" v-if="item.name!=null" class="bacf radius10 pad20 mar-x20 fon28" v-for="(item,index) in dataList" :key="index">
<view style="color: #B3B3B3;" class="disjbac">{{item.time}} <view style="color: #000000;">{{item.mobile}}</view></view>
<view class="mar-s20">
<text class="bold col3">{{item.name}}</text>
<text style="color: #B3B3B3;">{{item.action}}</text>
<text class="bold col3" v-if="item.title!=null && item.title!=''">{{item.title}}</text>
<text style="color: #B3B3B3;" v-if="item.zwhat!=null && item.zwhat!=''">{{item.zwhat}}</text>
</view>
</view>
<view v-if="dataList.length==0 && keyword!=''" class="disjcac fc" style="margin-top: 50%;">
<image class="zanw-img" src="/static/public/nothing.png" mode="aspectFill"></image>
<view class="fon24 col3">您搜索的内容暂无结果换个关键词试试吧</view>
</view>
<!-- 返回顶部 -->
<!-- <back-top :showTop="showTop" @backTop="backTop"></back-top> -->
</view>
<!-- 底部客服 -->
<public-customer :nbottom="100"></public-customer>
<!-- 用户信息授权手机号授权 -->
<auth-userInfo-mobileInfo></auth-userInfo-mobileInfo>
</view>
</template>
<script>
export default {
data() {
return {
dataList:[],//数据列表
showTop:false,//是否显示返回顶部的箭头
customer_id:'',//客户ID
keyword:'',//关键词
page:1,
size:10,
total:'',//总数
isZanw:true,
}
},
computed: {
// 主题颜色
publicColor() {
return this.$store.state.publicColor
},
statusHeight() {
return this.$store.state.statusHeight
}
},
onPageScroll(e) {
e.scrollTop > 360 ? this.showTop = true : this.showTop = false
},
onReachBottom() {//触底事件
if(this.total!=this.dataList.length){
this.page++
this.checkList()
} else {
if(this.isZanw) this.$toolAll.tools.showToast('暂无更多足迹内容')
this.isZanw = false
}
},
onShow() {
this.$toolAll.tools.isLogin()
},
onLoad(options) {
if(uni.getStorageSync('token')!='') {
this.checkList();
}
},
methods: {
chooseId(id){
this.backTop()
this.page = 1
this.isZanw = true
this.customer_id = id
this.keyword = ''
this.checkList()
},
searchEv(){//搜索事件
if(this.keyword!='') this.customer_id = ''
this.page = 1
this.isZanw = true
this.checkList()
},
checkList(){//查询列表事件
let params = {
page:this.page,
size:this.size,
customer_id:this.customer_id,//客户ID
keyword:this.keyword,
// user_id:uni.getStorageSync('userId')
}
this.$requst.post('user/footmarks',params).then(res=>{
// console.log('足迹列表查询:',res);
if(this.page==1) this.dataList = []
this.total = res.data.total
if(res.data.list.length!=0){
res.data.list.forEach(item=>{
let newCate = ''
if(item.content_id > 0) newCate = item.category
else newCate = ''
let obj = {
id:item.account_id,
name:item.nickname,
action:item.action,
title:item.title,
time:item.created_at,
zwhat:newCate,
mobile:item.mobile
}
this.dataList.push(obj)
})
}
})
},
backTop(){//回到顶部事件
uni.pageScrollTo({
scrollTop: 0,
duration: 300
});
},
}
}
</script>
<style>
</style>