123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403 |
- <template>
- <view class="content">
- <!-- 列表 -->
- <view class="itemContent">
- <view v-for="(item,index) in itemData" :key="index">
- <view class="item">
- <!-- 第一行 -->
- <view class="firstView">
- <view class="left">
- <image :src='item.PhotoPath' v-if="item.PhotoPath" class="storeImg"></image>
- <image src="../../static/img/pic_def_ava.png" mode="" class="storeImg" v-else></image>
- <view class="nickName">{{userInfo.nickName?userInfo.nickName:'微信昵称'}}</view>
- </view>
- <!-- 时间截取 -->
- <view class="time">{{item.CreateTime.slice(0,item.CreateTime.length-8)}}</view>
- </view>
- <!-- 第2行 -->
- <view class="secondView">
- <view class="fen">总分</view>
- <!-- 星星 -->
- <uni-rate :value="item.Overallevaluation" :max="5" color="#EEEEEE" active-color="#FF0000"
- :size="13" :margin="2" :readonly="true" />
- <view class="count">服务态度{{item.ServiceEvaluation}}星</view>
- <view class="count">施工质量{{item.ConstructionEvaluation}}星</view>
- <view class="count">店面环境{{item.StoreEvaluation}}星</view>
- </view>
- <view class="contentMes">{{item.EContent}}</view>
- <!-- 照片 -->
- <view v-if="item.imgs.length > 0" class="imgBg">
- <view v-for="(itemImg,indexImg) in item.imgs" :key="indexImg">
- <image :src="itemImg.imageUrl" class="img" :class="{'img4R':(indexImg+1)%4==0&&indexImg!=0}"
- @click.stop="previewImage(itemImg.imageUrl,item.imgs)"></image>
- </view>
- </view>
- <!-- 商家回复 -->
- <view v-if="item.ReplyContent" class="writeBack">
- <view class="title">
- <view style="font-weight: bold;">商家回复</view>
- <view>{{item.ReplyTime.slice(0,item.ReplyTime.length-8)}}</view>
- </view>
- <view>{{item.ReplyContent}}</view>
- </view>
- <view class="bottom">
- <view class="btnBox" @click.stop="deleteItem(item, index)">
- <image src="../../static/img/icon_del.png" class="btnImg"></image>
- <view class="btn">删除</view>
- </view>
- </view>
- </view>
- </view>
- </view>
- <!-- 上拉 加载更多 -->
- <view class="noMore" v-if="noMoreShow">没有更多数据</view>
- <!-- 无数据空白页 -->
- <nodata v-if="itemData.length==0"></nodata>
- </view>
- </template>
- <script>
- import nodata from '../../components/nodata/nodata.vue'
- export default {
- components: {
- nodata,
- },
- data() {
- return {
- itemData: [],
- page: 1,
- noMoreShow: false,
- imgArr: [],
- userInfo: '',
- sheetId: ''
- }
- },
- onLoad(opt) {
- console.log('opt==', opt);
- this.sheetId = opt.sheetId;
- this.userInfo = uni.getStorageSync("userInfo");
- },
- onShow() {
- this.itemData = []
- this.page = 1
- this.getItemData()
- },
- methods: {
- previewImage(img, arrDic) {
- var arr = [];
- arrDic.forEach(item => {
- arr.push(item.imageUrl)
- })
- // 预览图片
- uni.previewImage({
- urls: arr,
- current: img,
- longPressActions: {
- itemList: ['发送给朋友', '保存图片', '收藏'],
- success: function(data) {
- console.log('选中了第' + (data.tapIndex + 1) + '个按钮,第' + (data.index + 1) + '张图片');
- },
- fail: function(err) {
- console.log(err.errMsg);
- }
- }
- });
- },
- deleteItem(item, index) {
- var that = this;
- uni.showModal({
- title: '提示',
- content: '确定删除该条评价吗?',
- success: function(res) {
- if (res.confirm) {
- that.itemData.splice(index, 1);
- uni.showLoading({
- title: '删除中'
- })
- let url = 'openMiniEvaluate/deleteMyOpenEvaluate',
- params = {
- id: item.ID,
- }
- that.$http(url, params, 'POST').then(res => {
- uni.hideLoading();
- uni.showToast({
- title: '成功',
- icon: 'none',
- duration: 2000,
- });
- let pages = getCurrentPages(); // 当前页面
- let beforePage = pages[pages.length - 2]; // 上一页
- setTimeout(function() {
- uni.navigateBack({
- success: function() {
- beforePage.onLoad(); // 执行上一页的onLoad方法
- }
- });
- }, 2000);
-
- })
- }
- }
- });
- },
- getItemData() {
- uni.showLoading({
- title: '加载中'
- })
- let url = 'openMiniEvaluate/queryOpenEvaluateDetail',
- params = {
- sheetId: this.sheetId,
- }
- this.$http(url, params, 'GET').then(res => {
- uni.hideLoading();
- var list = res.data
- // 处理 undefined和null转为空白字符串
- // list.forEach((item, index) => {
- // for (const key in item) {
- // item[key] = this.$praseStrEmpty(item[key])
- // }
- // })
- // if (this.page == 1) {
- // this.itemData = list
- // } else {
- this.itemData = [];
- this.itemData = this.itemData.concat(list)
- // }
- // if (list.length < 10) {
- // this.noMoreShow = false
- // } else {
- // this.noMoreShow = true
- // }
-
- if (res.data.length == 0) {
- uni.showToast({
- title: '评价已删除,无法查看!',
- icon: 'none',
- duration: 2000
- });
-
- setTimeout(function() {
- uni.navigateBack()
- }, 1000);
- }
- })
- },
- },
- // 下拉刷新 上拉加载更多
- onPullDownRefresh() {
- this.page = 1
- this.getItemData()
- setTimeout(function() {
- uni.stopPullDownRefresh();
- }, 1000);
- },
- onReachBottom() {
- this.page++;
- this.getItemData()
- },
- }
- </script>
- <style scoped>
- .content {
- background: #f4f5f7;
- min-height: 100vh;
- padding-top: 20rpx;
- }
- .item {
- border-radius: 10rpx;
- padding: 20rpx;
- background-color: #FFFFFF;
- margin: 0 24rpx 20rpx;
- }
- .firstView,
- .secondView {
- display: flex;
- justify-content: space-between;
- align-items: center;
- }
- .left {
- display: flex;
- align-items: center;
- }
- .storeImg {
- width: 56rpx;
- height: 56rpx;
- border-radius: 8rpx;
- margin-right: 10rpx;
- }
- .nickName {
- font-weight: 500;
- font-size: 26rpx;
- color: #333333;
- }
- .firstView {
- margin-bottom: 24rpx;
- }
- .time {
- font-size: 26rpx;
- color: #999999;
- }
- .fen {
- font-size: 22rpx;
- color: #999999;
- }
- .count {
- font-size: 22rpx;
- color: #999999;
- margin-right: 20rpx;
- }
- .thirdView {
- display: flex;
- justify-content: flex-start;
- padding-top: 10rpx;
- padding-bottom: 20rpx;
- }
- .contentMes {
- font-size: 26rpx;
- color: #333333;
- line-height: 37rpx;
- padding: 16rpx 0;
- }
- .imgBg {
- display: flex;
- justify-content: flex-start;
- padding: 20rpx 0rpx;
- flex-wrap: wrap;
- }
- .img {
- width: 150rpx;
- height: 150rpx;
- margin-right: 20rpx;
- border-radius: 8rpx;
- }
- .img4R {
- margin-right: 0;
- }
- .writeBack {
- font-size: 26rpx;
- color: #666666;
- line-height: 37rpx;
- padding: 20rpx;
- background-color: #F4F5F7;
- margin-bottom: 20rpx;
- border-radius: 10rpx;
- }
- .title {
- display: flex;
- justify-content: space-between;
- margin-bottom: 10rpx;
- }
- .bottom {
- padding-top: 27rpx;
- padding-bottom: 7rpx;
- border-top: 1rpx solid #EEEEEE;
- display: flex;
- justify-content: flex-end;
- align-items: center;
- }
- .btnBox {
- display: flex;
- align-items: center;
- margin-left: 40rpx;
- }
- .btnImg {
- width: 24rpx;
- height: 24rpx;
- }
- .btn {
- color: #666666;
- font-size: 24rpx;
- margin-left: 5rpx;
- }
- .noMore {
- text-align: center;
- line-height: 50rpx;
- color: #999999;
- font-size: 28rpx;
- }
- </style>
|