123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173 |
- <template>
- <view>
- <u-navbar :title="title" title-color="#101010" ></u-navbar>
- <view class="main" v-if="type=='aa'">
- <view class="item" v-for="(item,i) in list"
-
- @click="gotoUrl('/pages/deductionRecord/billPush?site=1&id='+item.id)"
-
- :key="i">
- <view class="item-message">
- <view>{{item.name}}</view>
- <view class="billAmount">¥{{item.billAmount}}元</view>
- </view>
- <view class="item-time">
- {{item.createTime}} <!-- {{item.tenantName}} -->
- </view>
- </view>
- <u-divider :isnone="list.length==0" nonetext="没有找到相关内容"
- border-color="#CFD2D5">已经到底了</u-divider>
- </view>
- <view class="main" v-else >
- <view class="item" v-for="(item,i) in list" :key="i">
- <view class="item-message">
- <view>{{item.content}}</view>
- <view class="billAmount"></view>
- </view>
- <view class="item-time">
- {{item.createTime}} <!-- {{item.tenantName}} -->
- </view>
- </view>
- <u-divider :isnone="list.length==0" nonetext="没有找到相关内容"
- border-color="#CFD2D5">已经到底了</u-divider>
- </view>
- </view>
- </template>
- <script>
- import * as API from '@/apis/pagejs/message.js'
-
- export default {
- data() {
- return {
- type:0,
- formData:{
- pageIndex:1,
- pageSize:20,
- },
- list:[],
- recordsTotal:0
- }
- },
- computed:{
- title(){
- if(this.type=='AA'){
- return '账单提醒'
- }else if(this.type==5){
- return '停电通知'
- }else if(this.type==4){
- return '故障警报'
- }else if(this.type==3){
- return '断电通知'
- }else{
- return '消息提醒'
- }
- }
- },
- onLoad(op) {
- if(op.type){
- this.type=op.type;
- this.formData.type=op.type;
- }
-
- this.getList()
- },
- onReachBottom() {
-
- if (this.list.length < this.recordsTotal) {
- this.myLoadmore();
- }
- },
- methods: {
- getList(){
- if(this.type=='AA'){
- this.getBillList()
- }else{
- this.getMessageList()
- }
-
- },
- myLoadmore() {
- this.formData.pageIndex += 1;
- this.getList()
- },
- getMessageList(){
- uni.showLoading({
- mask:true,title:'加载中...'
- })
- API.messageList(this.formData).then((res) => {
- uni.hideLoading();
- if(this.formData.pageIndex==1){
- this.list = [
-
- ...res.data.data
- ];
- }else{
- this.list = [
- ...this.list,
- ...res.data.data
- ];
- }
- this.recordsTotal = res.data.recordsTotal;
-
- //this.list=response.data.data;
- }).catch(error => {
- uni.hideLoading();
-
- })
- },
- getBillList(){
- uni.showLoading({
- mask:true,title:'加载中...'
- })
- API.billList(this.formData).then((res) => {
- uni.hideLoading();
- if(this.formData.pageIndex==1){
- this.list = [
-
- ...res.data.data
- ];
- }else{
- this.list = [
- ...this.list,
- ...res.data.data
- ];
- }
- this.recordsTotal = res.data.recordsTotal;
-
- //this.list=response.data.data;
- }).catch(error => {
- uni.hideLoading();
-
- })
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- .main{
- background-color: #fff;
- margin-top: 24rpx;
- .item{
- padding: 32rpx;
- border-bottom: 1px solid rgba(244,244,244,1);
- .item-message{
- line-height: 44rpx;
- display: flex;
- justify-content: space-between;
- color: rgba(51,51,51,1);
- .billAmount{
- color: #F44336;
- }
-
- }
- .item-time{
- color: rgb(153,153,153);
- font-size: 24rpx;
- margin-top: 16rpx;
- }
- }
- }
- </style>
|