<template>
	<view class="page">
		<uni-nav-bar rightWidth='136rpx' title="暗物质宝库" fixed  :border="false" statusBar backgroundColor="#24234B" color="#FFFFFF">
			<template #left>
				<view class="cl-topbar__icon" @click="navigateBack">
					<text class="cl-icon-arrow-left"></text>
				</view>
			</template>
		</uni-nav-bar>
		<view class="list_info">
			<view style="margin-top: 24rpx;" class="numlist">
				<view class="left">
					<image class="icon" mode="heightFix" src="http://c.yujianmate.com/images/v1/w3/w3_x.png"></image>
					<view class="num">
						<text>{{myinfo.num_gmb}}</text>
						<view class="name">可用数量</view>
					</view>
				</view>
			</view>
			<view style="margin-top: 72rpx;margin-left: 40rpx;">
				<text style="color:#FFFFFF;font-size: 32rpx;">暗物质明细</text>
			</view>
			<view class="mingxiList" v-if="false">
				<view class="left">
					<text style="font-size: 28rpx;color: #FFFFFF;">{{$t('txt.明细类型')}}</text>
					<image class="icon" src="http://c.yujianmate.com/images/v1/me/arrow_down_gray.png"
						mode="heightFix" />
				</view>
				<view class="right">
					<text style="font-size: 28rpx;color: #FFFFFF;">{{$t('txt.开始时间-结束时间')}}</text>
					<image class="icon" src="http://c.yujianmate.com/images/v1/me/arrow_down_gray.png"
						mode="heightFix" />
				</view>
			</view>
			<view  class="empty" v-if="nodata">
				<view class="bg"></view>
				<text style="margin-top: 0rpx;font-size: 24rpx;color: #999999;">暂无数据</text>
			</view>
			<view class="item" v-for="(item,index) in list">
				<view class="left">
					<view class="name">{{item.name}}</view>
					<view class="desc">{{item.create_time}}</view>
				</view>
				<text class="right">
					<view v-if="item.value>0" class="num1">
						<text>+{{ item.value }}</text>
					</view>
					<view v-else class="num1 num2">
						<text>{{item.type}}{{ item.num }}</text>
					</view>
				</text>
			</view>

			<view class="blankHeight"></view>
		</view>

		<DialogBox ref="DialogBox"></DialogBox>
	</view>
</template>

<script>
	import uniNavBar from '../../components/uni-ui/uni-nav-bar/uni-nav-bar.vue'
	export default {
		components: {uniNavBar},
		data() {
			return {
				tab: 1,
				scrollTop: 0,
				myinfo: {},
				nodata: true,
				list: [],
				old: {
					scrollTop: 0
				},
				historyInfo: [{
						reason: "探索奖励",
						value: 1100,
					},
					{
						reason: "传送转出",
						value: -100,
					},
					{
						reason: "传送转入",
						value: 200,
					},
				]
			}
		},
		onLoad() {
			// setTimeout(function() {
			// 	uni.setNavigationBarColor({
			// 		frontColor: '#ffffff',
			// 		backgroundColor: '#00000000',
			// 		animation: {
			// 			duration: 400,
			// 			timingFunc: 'easeIn'
			// 		}
			// 	})
			// }, 200);
			this.loadInfo();
			this.loadData();
		},
		onShow() {},
		methods: {
			navigateBack(){
				uni.navigateBack(1)
			},
			onBack() {},
			checkTab(tab) {
				this.tab = tab;
				// this.loadData();
			},
			loadInfo() {
				console.log({
					uuid: getApp().globalData.uuid,
					skey: getApp().globalData.skey
				});
				uni.request({
					url: this.$apiHost + '/Web/getinfo',
					data: {
						uuid: getApp().globalData.uuid,
						type: 'tuan'
					},
					header: {
						"content-type": "application/json",
						'sign': getApp().globalData.headerSign
					},
					success: (res) => {
						console.log("----:", res.data);
						this.myinfo = res.data;
					},
					complete: (com) => {
						// uni.hideLoading();
					},
					fail: (e) => {
						console.log("----e:", e);
					}
				});
			},
			scroll: function(e) {
				console.log(e)
				this.old.scrollTop = e.detail.scrollTop
			},
			loadData() {
				console.log({
					uuid: getApp().globalData.uuid,
					skey: getApp().globalData.skey
				});
				uni.request({
					url: this.$apiHost + '/My/recordlist',
					data: {
						uuid: getApp().globalData.uuid,
						type: 'GMB',
						stype: this.stype
					},
					header: {
						"content-type": "application/json",
						'sign': getApp().globalData.headerSign
					},
					success: (res) => {
						console.log("----:", res.data);
						this.list = res.data.list;
						if (this.list != null && this.list != undefined) {
							this.nodata = false;
						}
					},
					complete: (com) => {
						// uni.hideLoading();
					},
					fail: (e) => {
						console.log("----e:", e);
					}
				});
			},

		}
	}
</script>

<style scoped lang="scss">
	@import 'X_bank.scss';
</style>