<template>
	<view class="app">
		<u-table>
			<u-tr>
				<u-th>适用</br>人群</u-th>
				<u-th>行为</br>序号</u-th>
				<u-th>行为</br>名称</u-th>
				<u-th>具体</br>内容</u-th>
				<u-th>积分</br>分值</u-th>
				<u-th>积分</br>周期</u-th>
				<u-th>分值</br>来源</u-th>
			</u-tr>
			<u-tr v-for="(item,index) in list" :key='index'>
				<u-td>{{item.targetGroupsName}}</u-td>
				<u-td>{{index+1}}</u-td>
				<u-td>{{item.actName}}</u-td>
				<u-td @tap='look(item)'>
					<view class="utd">
						查看
					</view>
				</u-td>
				<u-td>{{item.score}}</u-td>
				<u-td>{{item.periodName}}</u-td>
				<u-td>{{item.sourceName}}</u-td>
			</u-tr>
		</u-table>
		<u-popup v-model="lookopen" mode="center" closeable width='600rpx'>
			<view style="padding:80rpx 30rpx">{{lookitem.actContent}}</view>
		</u-popup>
	</view>
</template>

<script>
	import {
		healthActlist
	} from '@/api/pagesB/Behaviorpoints/index.js'
	export default {
		data() {
			return {
				list: [],
				total: 0,
				query: {
					identity: uni.getStorageSync('userinfo').cardNo,
					pageNum: 1,
					pageSize: 20,
					orgNo: ''
				},
				lookopen: false,
				lookitem: {},
			};
		},
		onLoad(options) {
			this.query.orgNo = options.orgNo
			this.info();
		},
		methods: {
			look(item) {
				this.lookitem = item
				this.lookopen = true
			},
			info() {
				healthActlist(this.query).then(res => {
					this.list = [...this.list, ...res.rows]
					this.total = res.total
				})
			},
		},
		onReachBottom() { //下滑加载
			if (this.list.length >= this.total) {} else {
				this.query.pageNum++;
				this.info();
			}
		},
		onPullDownRefresh() { //下拉刷新
			this.query.pageNum = 1;
			this.list = []
			this.info();
			setTimeout(function() {
				uni.stopPullDownRefresh();
			}, 1000);
		},
	}
</script>

<style lang="scss">
	::v-deep .utd {
		color: #26A888 !important;
	}
</style>