<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 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 class="num">{{item.type}} {{item.num}}</view>
				</text>
			</view>

			<view class="no-content" v-if="nodata">
				<image class="icon" mode="widthFix" src="http://c.yujianmate.com/images/v1/w3/empty.png"></image>
				<text>暂无数据</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,
				old: {
					scrollTop: 0
				},
				list: [],
				stype: '',
				nodata: true,
			}
		},
		onLoad(parms) {
			this.stype = parms.stype || ''
			// setTimeout(function() {
			// 	uni.setNavigationBarColor({
			// 		frontColor: '#ffffff',
			// 		backgroundColor: '#00000000',
			// 		animation: {
			// 			duration: 400,
			// 			timingFunc: 'easeIn'
			// 		}
			// 	})
			// }, 200);
		},
		onShow() {
			this.loadData();
		},
		methods: {
			navigateBack(){
				uni.navigateBack(1)
			},
			onBack() {},
			checkTab(tab) {
				this.tab = tab;
				// this.loadData();
			},
			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 'tranRecord.scss';
</style>