<template>
	<!-- 疗程服务日志 -->
	<view class='main'>
		<view v-show="pageInfo.total==0">
			<view class='empty cuIcon-info'></view>
			<view class='empty-text text-gray'>暂无数据</view>
		</view>
		<view class="cu-card article isCard">
			<view class="cu-item" v-for="(item,index) in pageInfo.projectProgress" :key='index'>
				<view class="title ">
					<view class="text-cut">{{item.projectName}}</view>
				</view>
				<view class="content flex justify-center align-center ">
					<view class="desc">
						<view>
							<text class='text-gray'>会员：</text>{{item.memberName}}
						</view>
						<view>
							<text class='text-gray'>单据：</text>{{item.docNum}}
						</view>
						<view>
							<text class='text-gray'>日期：</text>{{item.docDate}}
						</view>
						<view>
							<text class='text-gray'>使用前效果：</text>{{item.symptomatic}}
						</view>
						<view>
							<text class='text-gray'>使用后效果：</text>{{item.nursingEffect}}
						</view>
						<view>
							<text class='text-gray '>会员建议：</text>{{item.feedBack}}
						</view>
					</view>
					<navigator :url="'./service-detail/service-detail?item='+ JSON.stringify(item)">
						<button class=" cu-btn round bg-red" >查看详情</button>
					</navigator>
				</view>
			</view>
		</view>
		<view class="margin-left">共 {{pageInfo.total}} 条数据</view>
	</view>
</template>
<script>
	export default {
		data() {
			return {
				userInfo: null,
				pageInfo: {
					total: 0,
					pageNum: 1,
					pageSize: 5,
					projectProgress: [],
				},
				loadingMoreHidden: false,
			}
		},
		methods: {
			selectList() {
				this.pageInfo.pageSize++
				this.getProjectProgress()
			},

			getProjectProgress() {
				var page = {
					pageNum: this.pageInfo.pageNum,
					pageSize: this.pageInfo.pageSize,
					storeId: this.userInfo.storeId,
					memberId: this.userInfo.id,
					source:1
				}
				this.$api.getProjectProgress(page).then(res => {
					if (res.code == '000000') {
						res.pageInfo.projectProgress = res.pageInfo.list
						this.pageInfo = res.pageInfo
					} else if(res.code=='510002'||res.code=='502001'){
					}else{
						uni.showToast({
							title: res.message,
							icon: "none",
							duration: 1000
						})
					}
				})
			}
		},
		onReachBottom: function() {
			this.pageInfo.pageSize = this.pageInfo.pageSize+5
			this.selectList()
		},
		onShow: function() {
			this.userInfo = uni.getStorageSync('userInfo')
			this.getProjectProgress()
		},
		onPullDownRefresh: function() {
			setTimeout(function() {
				uni.redirectTo({
					url: './service-log'
				})
				uni.showToast({
					title: '刷新成功',
					icon: 'success',
					duration: 2000
				});
				uni.stopPullDownRefresh();
			}, 1000);
		},
	}
</script>

<style>

</style>
