123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208 |
- <template>
- <view class="container">
- <scroll-view class="message-list-box" scroll-y="true" @scrolltolower="handleLoadMore()">
- <view class="message-row" v-for="(item, index1) in messageList" :key="index1">
- <image class="message-head" mode="aspectFill" :src="item.headImg"></image>
- <view class="message-info-box">
- <view class="message-name">{{item.userName}}</view>
- <view class="message-date">{{item.leaMsgTime}}</view>
- <view class="message-text">{{item.leaMsgContent}}</view>
- <view class="message-img-box" v-for="(site, index2) in item.orderLeaImgResVOs" :key="index2">
- <!-- <u-image :src="site.imgUrl" width:="76px" height="76px"></u-image> -->
- <image class="message-img" mode="aspectFill" :src="site.imgUrl"></image>
- </view>
- </view>
- </view>
- </scroll-view>
- <view class="message-handle">
- <u-button type="success" shape="circle" :ripple="true" @click="addMessage" class="handle-custom">发布留言</u-button>
- </view>
- <u-top-tips ref="uTips"></u-top-tips>
- </view>
- </template>
- <script>
- const NET = require('@/utils/request')
- const API = require('@/config/api')
- export default {
- data() {
- return {
- orderId: '',
- tenantCode: '',
- pageIndex: 1,
- isOver: false,
- messageList: [],
- }
- },
- onLoad(options) {
- this.orderId = options.orderId
- this.tenantCode = options.tenantCode
- },
- onShow() {
- this.pageIndex = 1
- this.messageList = []
- this.getMessageList()
- },
- onPullDownRefresh() {
- this.pageIndex = 1
- this.messageList = []
- this.getMessageList('refresh')
- },
- methods: {
- // 懒加载
- handleLoadMore() {
- if (!this.isOver) {
- this.pageIndex++
- this.getMessageList()
- }
- },
- // 获取全部留言
- getMessageList(type) {
- NET.request(API.getMessageList + this.pageIndex + '/10', {
- flag: 2,
- orderId: this.orderId
- }, 'GET').then(res => {
- if (res.isSuccess) {
- if (type == 'refresh') {
- uni.stopPullDownRefresh();
- }
- this.isOver = res.data.list.length != 10
- this.messageList = this.messageList.concat(res.data.list)
- } else {
- this.$refs.uTips.show({
- title: res.msg,
- type: 'warning',
- })
- }
- }).catch(error => {
- console.log(error)
- this.$refs.uTips.show({
- title: error.data.msg,
- type: 'warning',
- })
- })
- },
- // 新增留言
- addMessage() {
- uni.navigateTo({
- url: '/pagesMain/messageForm?orderId=' + this.orderId + '&tenantCode=' + this.tenantCode
- });
- },
- }
- }
- </script>
- <style lang="less" scoped>
- page {
- width: 100%;
- height: 100%;
- }
- .container {
- width: 100%;
- height: 100%;
- float: left;
- position: relative;
- .message-list-box {
- width: 100%;
- height: calc(100% - 70px);
- float: left;
- .message-row {
- width: calc(100% - 30px);
- float: left;
- padding-bottom: 15px;
- border-bottom: 1px solid #F6F6F6;
- margin: 0 15px 15px 15px;
- .message-head {
- width: 50px;
- height: 50px;
- object-fit: cover;
- float: left;
- border-radius: 50%;
- overflow: hidden;
- }
- .message-info-box {
- width: calc(100% - 75px);
- float: right;
- .message-name {
- width: 50%;
- height: 30px;
- float: left;
- font-size: 15px;
- font-family: PingFang SC;
- color: #333333;
- line-height: 30px;
- overflow: hidden;
- text-overflow: ellipsis;
- white-space: nowrap;
- }
- .message-date {
- width: 50%;
- height: 30px;
- float: left;
- font-size: 12px;
- font-family: PingFang SC;
- color: #666666;
- text-align: right;
- line-height: 30px;
- overflow: hidden;
- text-overflow: ellipsis;
- white-space: nowrap;
- }
- .message-text {
- width: 100%;
- height: 20px;
- float: left;
- font-size: 12px;
- font-family: PingFang SC;
- color: #666666;
- line-height: 20px;
- overflow: hidden;
- text-overflow: ellipsis;
- white-space: nowrap;
- }
- .message-img-box {
- width: 100%;
- float: left;
- .message-img {
- width: 76px;
- height: 76px;
- object-fit: cover;
- float: left;
- margin: 0 10px 10px 0;
- }
- }
- }
- }
- }
- .message-handle {
- width: calc(100% - 30px);
- height: 40px;
- position: fixed;
- bottom: 20px;
- left: 15px;
- .handle-custom {
- background-color: #51A539;
- /deep/button {
- background-color: #56a83a;
- }
- /deep/.u-btn--success--disabled {
- background-color: #74bd60 !important;
- }
- }
- }
- }
- </style>
|