hz-zhhq-app/pages/statistics/statistics-yuyue.vue

618 lines
15 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<template>
<view>
<view class="container">
<view class="banner-box">
<image src="/static/imgs/food-comment-banner.png" mode=""></image>
</view>
<view class="main">
<view class="tab-box">
<view class="tab-item" :class="currentTabIndex == 0 ? 'active_tab' : ''" @click="currentTabIndex = 0">评价统计</view>
<view class="tab-item" :class="currentTabIndex == 1 ? 'active_tab' : ''" @click="currentTabIndex = 1">评价明细</view>
<!-- <view class="tab-item" :class="currentTabIndex == 2 ? 'active_tab' : ''" @click="currentTabIndex = 2">通行记录</view> -->
</view>
<!-- 访客统计-->
<view class="reservation-box" style="background-color: #fff;" v-if="currentTabIndex == 0">
<view class="form-item searchv">
<picker class="time " mode="date" @change="startDateChange">
<view class="">{{ startDate }}</view>
</picker>
<text class="timecenter">至</text>
<picker class="time " mode="date" @change="endDateChange">
<view class="">{{ endDate }}</view>
</picker>
<!-- <view class="search" style="height: 60upx;font-size: 26upx;margin-top: 7upx;" @click="searchYjList">搜索</view> -->
<!-- <image style="width: 5vh;height: 5vh;margin-left: 1vh;" @click="search" src="/static/icons/seach.png" mode=""></image>
-->
</view>
<view class="list-box" v-if="tjData.length > 0">
<view class="form-item" style="width: 100%;margin: 10px 0px 10px 0px;">
<view class="visitcon w25">类型</view>
<view class="visitcon w25">非常满意</view>
<view class="visitcon w25">满意</view>
<view class="visitcon w25">一般</view>
</view>
<view
style="padding: 10px 0px 10px 0px;border-top:1px solid #d2d2d2;align-items: center;display: flex;"
class="form-item"
v-for="(item, index) in tjData"
:key="index"
>
<view class="visitcon w25">{{ statisticsTypes[item.type] }}</view>
<view class="visitconContent w25" @click="gocurrentTabIndex2(item.type,'0')">{{ item.level1 }}</view>
<view class="visitconContent w25" @click="gocurrentTabIndex2(item.type,'1')">{{ item.level2}}</view>
<view class="visitconContent w25" @click="gocurrentTabIndex2(item.type,'2')">{{ item.level3}}</view>
</view>
</view>
<content-none v-else :padTop="20" style="padding-bottom: 20vh;"></content-none>
</view>
<!-- 统计明细列表 -->
<view v-else-if="currentTabIndex == 1" >
<!-- <view class="form-item searchv">
<picker class="time" mode="date" @change="startListDateChange">
<view class="">{{ startListDate }}</view>
</picker>
<text class="timecenter">至</text>
<picker class="time" mode="date" @change="endListDateChange">
<view class="">{{ endListDate }}</view>
</picker>
</view>
<view class="form-item searchv" style="padding:0 80upx; !important;display: flex !important; align-items: center !important;">
<view class="ipt-box select time" style="width: 150upx;margin-left: 2vh; ">
<picker class="picker" v-if="listType.length > 0" :range="listType" @change="listTypeChange" range-key="listTypeIndex">
<view>{{ listType[listTypeIndex] }}</view>
</picker>
</view>
<view class="ipt-box select time" style="width: 150upx;margin-left: 2vh; ">
<picker class="picker" v-if="listLevel.length > 0" :range="listLevel" @change="listLevelChange" range-key="listLevelIndex">
<view>{{ listLevel[listLevelIndex] }}</view>
</picker>
</view>
</view> -->
<view class="comment-list" v-if="commentList.length > 0">
<view class="comment-item" v-for="(item,index) in commentList" :key="index">
<view class="user-head">
<image v-if="item.wx_profile" :src="item.wx_profile" mode=""></image>
<image v-else src="/static/imgs/missing-face.png" mode=""></image>
</view>
<view class="fr-content">
<view class="date">{{item.mobile}}</view><!-- formatDate(item.gmt_created,'dateTime') -->
<view class="name">{{item.applicant_name}}</view>
<view class="food-list" style="margin: 10upx 0upx 20upx 0upx; ">
<view class="food-item" style="background-color: #C5F2E0;">{{commentGrade[item.satisfied_level>2?0:item.satisfied_level].name}}</view>
</view>
<view class="comment-content" style="font-size: 26upx;color: #000000;">{{item.comment_content}}</view>
<view class="comment-content" style="font-size: 24upx;">服务时间:{{item.detail_time}}</view>
<view class="comment-content" style="font-size: 24upx;">评价时间:{{formatDate(item.gmt_created,'m_Time')}}</view>
</view>
</view>
</view>
<content-none v-else :padTop="20" style="padding-bottom: 20vh;"></content-none>
<load-more v-if="currentTabIndex == 1" :loadingType="loadingType" :contentText="contentText"></load-more>
</view>
</view>
</view>
</view>
</template>
<script>
import { getDate, alertTip, callbackRequest, getStorage, regPhone, formatDate } from '@/common/util.js';
import {getYuyueStatistics,getCommentListByType} from '@/common/api.js';
import loadMore from '@/components/loadMore.vue';
import contentNone from '@/components/contentNone.vue';
import datetimePicker from '@/components/dateTime.vue';
import uniCalendar from '@/components/uni-calendar/uni-calendar.vue';
let currentTime = new Date().getTime();
let millisecond = 24 * 7 * 60 * 60 * 1000;
export default {
data() {
return {
formatDate: formatDate,
startDate: this.getDay(),
endDate: this.getDay(),
page: 1,
pageSize: 10,
loadingType: 0, //0-loading前1-loading中2-没有更多了
contentText: {
contentdown: '上拉加载更多',
contentrefresh: '正在加载...',
contentnomore: '没有更多数据了'
},
tjData:[],
statisticsTypes:['','理发','洗车','','','用车','报修','咨询','投诉','报事','就诊'],
listType:['类型','理发','洗车','用车','报修'],
listTypeIndex:0,
startListDate: this.getDay(),
endListDate: this.getDay(),
sLevel:'',
listLevel:['满意度','非常满意','满意','一般'],
listLevelIndex:0,
currentTabIndex:0,
commentList:[],
satisfiedLevel:'',
type:'',
commentGrade: [
{
value: '0',
name: '非常满意'
},
{
value: '1',
name: '满意',
checked: 'true'
},
{
value: '2',
name: '一般'
}
],
};
},
components: {
loadMore,
contentNone,
datetimePicker
},
onLoad(option) {
this.currentTabIndex = option.currentTabIndex || 0;
if (this.currentTabIndex == 1) {
}else{
this.getYuyueStatistics();
}
},
watch: {
currentTabIndex: function(newVal, oldVal) {
if (newVal == 1) {
this.page = 1;
this.loadingType = 0;
this.getCommentListByType();
} else {
// this.startDate=this.getDay();
// this.endDate= this.getDay();
//this.getYuyueStatistics();
}
}
},
methods: {
gocurrentTabIndex2(type,satisfiedLevel){
this.type = type;
this.satisfiedLevel = satisfiedLevel;
this.startListDate = this.startDate;
this.endListDate = this.endDate;
this.currentTabIndex=1;
},
getCommentListByType(){
let params = {
"method":getCommentListByType,
data:{
type:this.type,
pageSize:this.pageSize,
startDate:this.startListDate,
endDate:this.endListDate,
satisfiedLevel:this.satisfiedLevel,
pageNum:this.page
}
}
callbackRequest(params)
.then(res => {
res = res.data;
if (res.returnCode == 1) {
if (this.page == 1) {
this.commentList = res.returnData ;
} else {
if (res.returnData.length > 0) {
this.commentList = this.commentList.concat(res.returnData);
this.loadingType = 0;
} else {
this.loadingType = 2;
}
}
} else {
alertTip(res.returnMsg);
}
})
},
getYuyueStatistics(){
let data = {
method: getYuyueStatistics,
data: {startDate: this.startDate, endDate: this.endDate}
};
callbackRequest(data).then(res => {
if (res.data.returnCode == 1) {
this.tjData = res.data.returnData;
}
});
},
toDetail(url) {
uni.navigateTo({
url
});
},
getDay() {
var date1 = new Date();
var year = date1.getFullYear();
var month = date1.getMonth() + 1;
if(month<10){
month = "0"+month;
}
var day = date1.getDate();
// if(day<10){
// day = "0"+day;
// }
return year + '-' + month + '-' + day;
},
startDateChange: function(e) {
this.startDate = e.target.value;
this.getYuyueStatistics();
},
endDateChange: function(e) {
this.endDate = e.target.value;
this.getYuyueStatistics();
},
startListDateChange: function(e) {
this.startListDate = e.target.value;
},
endListDateChange: function(e) {
this.endListDate = e.target.value;
},
listTypeChange(e){
this.listType = e.detail.value;
},
listLevelChange(e){
this.listLevel = e.detail.value;
},
},
onReachBottom() {
if (this.currentTabIndex == 1) {
if(this.loadingType !== 0){
return false;
}
this.loadingType = 1;
this.page = this.page + 1;
this.getCommentListByType();
}
}
};
</script>
<style lang="scss">
@import '@/static/css/common.scss';
.searchv {
margin-top: 0upx;
text-align: center;
}
.search {
margin-top: 20upx;
display: inline-block;
background-color: #00c277;
color: #fff;
margin-left: 2vh;
font-size: 2vh;
border-radius: 1vh;
padding: 1vh 2vh 1vh 2vh;
}
.timecenter {
font-size: 26upx;
margin-left: 10upx;
margin-right: 10upx;
}
.time {
margin-top: 20upx;
font-size: 28upx;
display: inline-block;
border: 1px solid #e5e5e5;
border-radius: 10upx;
color: #666;
padding: 10upx 40upx;
}
.visitcon {
display: inline-block;
text-align: center;
font-size: 14px;
}
.visitconContent {
text-decoration: underline;
display: inline-block;
text-align: center;
font-size: 14px;
}
.w40 {
width: 40%;
}
.w25 {
width: 25%;
}
.w15 {
width: 15%;
}
.w33 {
width: 33.3%;
}
.w45 {
width: 45%;
}
.container {
position: relative;
overflow: hidden;
background: #f8f8f8;
min-height: 100vh;
.banner-box {
width: 100%;
height: 240upx;
position: absolute;
top: 0;
left: 0;
image {
width: 100%;
height: 100%;
}
}
.main {
margin: 172upx 40upx 0;
position: relative;
z-index: 10;
.tab-box {
overflow: hidden;
border-radius: 10upx 10upx 0 0;
background: rgba(132, 149, 167, 0.8);
height: 70upx;
.tab-item {
float: left;
height: 70upx;
width: 50%;
font-size: 30upx;
color: #e5f6ff;
text-align: center;
line-height: 70upx;
}
.active_tab {
background: #fff;
color: #333;
border-radius: 10upx 10upx 0 0;
font-weight: bold;
}
}
.form-box {
padding: 20upx 30upx 0upx;
margin-bottom: 20upx;
background: #fff;
.form-item {
overflow: hidden;
border-bottom: 1px solid #eee;
padding: 30upx 0;
.label {
float: left;
width: 150upx;
font-size: 28upx;
color: #333;
font-weight: bold;
line-height: 50upx;
}
.ipt-box {
margin-left: 160upx;
input {
width: 100%;
height: 50upx;
line-height: 50upx;
font-size: 26upx;
color: #666;
}
.pic {
width: 60upx;
height: 60upx;
line-height: 80upx;
}
}
.select {
.arrow {
float: right;
width: 16upx;
height: 29upx;
margin-top: 10upx;
}
input {
width: 70%;
}
}
.jian {
width: 50upx;
height: 50upx;
margin-left: 280upx;
}
.select {
.arrow {
float: right;
width: 16upx;
height: 29upx;
margin-top: 10upx;
}
.picker {
height: 50upx;
line-height: 50upx;
font-size: 26upx;
color: #666;
}
}
}
.sure-btn {
width: 100%;
height: 80upx;
font-size: 28upx;
color: #fff;
text-align: center;
line-height: 80upx;
border-radius: 8upx;
background: #0066cc;
background: linear-gradient(to right, #ffc200, #ff9000); /*设置按钮为渐变颜色*/
margin-top: 50upx;
}
}
.list-box {
.list-item {
background: #fff;
margin-bottom: 10upx;
.title {
border-bottom: 1px solid #eee;
padding: 20upx 10upx;
overflow: hidden;
line-height: 40upx;
.line {
display: inline-block;
width: 10upx;
height: 32upx;
background: $assistColor;
margin-top: 4upx;
}
.text {
display: inline-block;
font-size: 28upx;
color: #444;
font-weight: bold;
margin-left: 10upx;
vertical-align: top;
}
.status {
font-size: 26upx;
color: $assistColor;
float: right;
margin-right:20upx;
}
.status1 {
font-size: 26upx;
color: #5063c3;
float: right;
}
.status2 {
font-size: 26upx;
color: red;
float: right;
margin-right:20upx;
}
}
.content {
padding: 10upx 20upx;
// border-bottom:1px solid #d2d2d2;
// border-radius: 10upx;
// padding:10upx 10upx 60upx 10upx;
.info-item {
overflow: hidden;
padding-bottom: 10upx;
.fl-text {
float: left;
font-size: 26upx;
color: #444;
font-weight: bold;
line-height: 40upx;
}
.fr-text {
float: right;
font-size: 26upx;
color: #666;
line-height: 40upx;
}
.green {
color: #00c277;
}
.red{
color: red;
}
}
}
}
.comment-btn {
float: right;
font-size: 24upx;
border-radius: 10upx;
color: #fff;
line-height: 50upx;
text-align: center;
min-width: 140upx;
background-color: #00c277;
}
}
}
}
.comment-list{
padding:30upx 30rpx 0;
background: #fff;
.comment-item{
overflow:hidden;
margin-bottom:20rpx;
.user-head{
float:left;
width:90upx;
height:90upx;
border-radius:50%;
image{
width:100%;
height:100%;
border-radius:50%;
}
}
.fr-content{
margin:0 0 0upx 110upx;
border-bottom:1px solid #f5f5f5;
padding-bottom:26upx;
.name{
font-size:28upx;
font-weight:bold;
line-height:44upx;
}
.date{
float:right;
font-size:26upx;
color:#666;
line-height:44upx;
}
.grade{
padding-bottom:10upx;
text{
display:inline-block;
font-size:26upx;
color:#666;
line-height:36upx;
vertical-align: top;
padding-right:20upx;
}
image{
width:36upx;
height:36upx;
margin-right:8upx;
vertical-align: top;
}
}
.comment-content{
font-size:26upx;
color:#666;
line-height:40upx;
}
.food-list {
padding: 10rpx 0 0;
overflow: hidden;
.food-item {
float: left;
margin-right: 10rpx;
font-size: 24rpx;
line-height: 30rpx;
color: $assistColor;
padding: 4rpx 16rpx;
border: 1px solid $assistColor;
}
}
}
}
}
</style>