<template>
	<view>
		<view>
			<uni-nav-bar  left-icon="left"   right-icon="info"title="Points Details"
			color="#fff" backgroundColor="#000000" @clickRight="goto()" @clickLeft="back"  :fixed="true" 
			:border="false" :statusBar="true" />
		</view>
		<view class="points">
			<view class="points_item" v-for="(item,index) in list" :key="item.log_id">
				<view class="points_item_title">
					<text>{{ item.change_desc }}</text>
					<text class="item_title_price">{{ item.user_money }}</text>
				</view>
				<text>{{ item.change_time }}</text>
			</view>
		</view>
		<view class="empty_item1" v-if="list.length==0">
			<view class="empty_item_img">
				<image src = "../../static/img/dollo.png" mode=""></image>
			</view>
			<view>Full refund for the first order for new members~</view>
			<view>
				<button @click="goPage()">go shopping</button>
			</view>
		</view>
	</view>
</template>

<script>
	import {defaultRequest} from '../../api/index.js'
	export default {
		data() {
			return {
				query:{
					_action:'getpagedata',pagecode:'006-PERSONALCENTERPAGE'
				},
				list:[]
			}
		},
		methods:{
			back(){
				uni.navigateBack()
			},
			goPage(){
			 uni.switchTab({
			 	url:'../index/index'
			 })	
			},
			getUserinfo(){
				let data ={
					_action:'getuseraccountlog',page_index:1,page_size:20
				}
				defaultRequest(data).then( res =>{
					console.log( res)
					if(res.error == 0){
						this.list =  res.data.accountlog_list
					}
				})
			},
			goto(){
			
				uni.navigateTo({
					url:'../specialTitle/index?id='+'POINTSRULE'+'&title='+'POINTS RULE'
				})
			}
		},
		onLoad() {
			let that = this;
			let s = 0;
			let time = setInterval(() => {
				uni.getNetworkType({
					success: (res) => {
						console.log(res.networkType, s);
						if (res.networkType == 'none') {
							uni.showToast({
								icon: 'none',
								title: 'Please connect to the network',
								duration: 3000,
							})
						} else if (res.networkType !== 'none') {
							that.typee = 2;
							clearInterval(time);
							
						}
					}
				})
				s++;
			}, 1000);
			this.getUserinfo()
			defaultRequest(this.query).then( res => {
				console.log(res,'p')
			})
		}
	}
</script>

<style lang="scss" scoped>
	.uni-navbar{
		font-size: 32rpx;
		font-weight: bold;
		// border-bottom: 14.67rpx #F6F5FA solid;
	}
	.points{
		padding: 0 25.33rpx;
		
		.points_item{
			padding: 37.33rpx 0;
			color: #999999;
			font-size: 24rpx;
			font-weight: 400;
			// border-bottom: 1px solid #E2E2E2;
			.points_item_title{
				font-size: 28rpx;
				display: flex;
				justify-content: space-between;
				margin-bottom: 18rpx;
				color: black;
				
				.item_title_price{
					color: #B22234;
				}
			}
			
		}
	}
	.empty_item1{
			
			height: 500rpx;
			padding: 20rpx 100rpx;
			margin:50rpx auto;
			color:#000;
			font-size: 24rpx;
			text-align: center;
			.empty_item_img{
				height: 180rpx;
				width: 180rpx;
				margin: 0 auto;
				margin-bottom: 30rpx;
				image{
					height: 100%;
					width: 100%;
					
				}
			}
			button {
				font-size: 24.33rpx;
				font-weight: 500;
				background-color: black;
				color: white;
				width: 200rpx;
				height: 65.67rpx;
				border-radius: 20rpx !important;
				line-height: 65.67rpx;
				border-radius: 0;
				margin-top: 33.33rpx;
			}
			.uni-button{
				border-radius: 20rpx !important;
			}
		}
</style>