You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

144 lines
3.3 KiB

1 year ago
<import src="../common/prompt.wxml"></import>
<template>
<view class="wrap">
<view>
<u-navbar :is-back="false" title="意见反馈" :border-bottom="false">
</u-navbar>
</view>
<view class="complain-panel complain-align">
<view @tap="add" class="complain-add complain-align">
添加意见
</view>
</view>
<prompt type="Object" :prompt="prompt"></prompt>
<scroll-view scroll-y scroll-with-animation class="weui-panel__bd complain-list" @scrolltolower="pullList" v-if="dataList.length > 0">
<view class="weui-media-box weui-media-box_text" v-for="(item, index) in dataList" :key="index" @tap="showDetail(index)">
<view class="weui-cell weui-cell-complain">
<view class="weui-cell__bd">{{getCanteenObj(item.canteenId)}}</view>
<view class="weui-cell__ft">{{item.replay?'已回复':'未回复'}}</view>
</view>
<view class="weui-media-box__desc">{{item.remark}}</view>
</view>
</scroll-view>
</view>
</template>
<script>
export default {
data() {
return {
dataList: [],
prompt: {
hidden: !0
},
// 查询参数
queryParams: {
pageNum: 1,
pageSize: 10,
},
total: 0,
//食堂对象列表
canteenObj: {},
}
},
methods: {
//查询列表数据
getList() {
this.$u.api.getComplainList(this.queryParams).then((res) => {
if(res.code == 200){
if(res.rows.length>0){
this.dataList = this.dataList.concat(res.rows);
this.total = res.total;
}
this.prompt.hidden = this.dataList.length;
}
})
},
//新增意见
add() {
this.$u.route({
url: 'pages/complain/add/add'
})
},
//明细
showDetail(index) {
let detail ={}
detail = this.dataList[index];
detail['complainerName'] = this.vuex_userInfo.nickName;
detail['canteenName'] = this.getCanteenObj(detail.canteenId);
detail['createTime'] = detail.createTime.split(' ')[0];
detail['updateTime'] = detail.updateTime ==null ? '' :detail.updateTime.split(" ")[0];
console.log("明细参数",detail)
this.$u.route({
url: 'pages/complain/detail/detail',
params: detail
})
},
//获取食堂名称
getCanteenObj(key) {
return this.canteenObj[key];
},
//上拉刷新
pullList() {
console.log('上拉刷新');
if(this.dataList.length == this.total){
return;
}
this.queryParams.pageNum = this.queryParams.pageNum +1;
this. getList();
},
//初始化
showData() {
this.dataList = [];
this.queryParams.pageNum = 1;
this.getList();
}
},
onShow() {
this.showData();
this.canteenObj= uni.getStorageSync('canteenObj');
},
//下拉刷新
onPullDownRefresh() {
console.log('下拉刷新');
this.showData();
setTimeout(function () {
uni.stopPullDownRefresh();
}, 1000);
}
}
</script>
<style lang="scss" scoped>
.complain-panel {
height: 128rpx;
border-bottom: 3rpx solid #F2f2f2;
}
.complain-align {
text-align: center;
display: flex;
align-items: center;
justify-content: center;
}
.weui-cell-complain {
padding-left: 0rpx;
}
.complain-add {
height: 68rpx;
width: 536rpx;
border: 2rpx solid darkgrey;
border-radius: 10rpx;
}
.complain-list {
height: 1000rpx;
}
</style>