<template>
	<view class="bill">
		<view class="list_box">
			<view class="option" v-for="(item,index) in list" :key="index">
				<view class="top">
					<view class="type" v-if="item.billType == 1">
						充值
					</view>
					<view class="type" v-if="item.billType == 2">
						余额支付
					</view>
					<view class="type" v-if="item.billType == 3">
						订单收益
					</view>
					<view class="type" v-if="item.billType == 4">
						提现
					</view>
					<view class="type" v-if="item.billType == 6">
						分销
					</view>
					<view class="type" v-if="item.billType == 7">
						订单退款
					</view>
					<view class="type" v-if="item.billType == 8">
						取消订单
					</view>
					<view class="money add" v-if="item.amount>0">
						+{{item.amount}}
					</view>
					<view class="money" v-else>
						{{item.amount}}
					</view>
				</view>
				<view class="top color">
					<view class="type">
						{{item.createTime.slice(0,10)}}
					</view>
					<!-- <view class="money">
						余额{{item.balance}}
					</view> -->
				</view>
			</view>
		</view>

	</view>
</template>

<script>
	import {
		consumptionLog
	} from '../../api/index.js'
	export default {
		data() {
			return {
				list: []
			}
		},
		methods: {
			onsumptionLog() {
				let data = {}
				data.openId = uni.getStorageSync('wx_copenid')
				consumptionLog(data).then(res => {
					this.list = res.data.data.records
				})
			}
		},
		onShow() {
			this.onsumptionLog()
		}
	}
</script>

<style lang="scss" scoped>
	.bill {
		width: 100%;
		height: 100%;

		// padding: 20rpx;
		// box-sizing: border-box;
		.list_box {
			width: 100%;
			padding: 0px 20rpx;
			box-sizing: border-box;

			.option {
				padding: 10px;
				border-bottom: 2px solid #f6f6f6;

				.top {
					width: 100%;
					background-color: #fff;
					display: flex;
					justify-content: space-between;

					.add {
						color: #fac43e;
					}
				}

				.top:nth-child(1) {
					margin-bottom: 10px;
				}
			}

			.color {
				color: #ccc;
			}
		}
	}
</style>