<!--

  会员账户流水列表页面， 数据渲染 
   业务： 会员账户流水

  @author terrfly
  @site https://www.jeequan.com
  @date 2022/11/30 07:07
-->
<template>
	<view class="card">
		<view class="card-content" @tap="toDetails">
			<view class="card-content-title">
				<view class="card-content-title-left">
					<image :src="props.record.avatarUrl" />
					<text>{{ props.record.mbrName }}</text>
				</view>
				<view class="card-content-title-right">
                   
					<text>{{ props.record.changeAmount < 0? '-' : '+'}}{{cal.cert2Dollar(Math.abs(props.record.changeAmount))}}</text>
				</view>
			</view>
			<view class="card-content-line"></view>
			<view class="card-content-body">
				<view  class="card-content-body-row">
					<text>变动时间</text>
					<text>{{ props.record.createdAt }}</text>
				</view>
				<view class="card-content-body-row">
					<text>业务类型</text>
					<text>{{ props.record.bizType==1?'支付充值':props.record.bizType==2?'现金充值':props.record.bizType==3?'会员消费':props.record.bizType==4?'消费退款':props.record.bizType==5?'人工调账':'其他' }}</text>
				</view>
				<view class="card-content-body-row">
					<text>变动后余额</text>
					<text>￥{{ cal.cert2Dollar(props.record.afterAmount) }}</text>
				</view>
			</view>
		</view>
	</view>
</template>

<script setup>
import { reactive, ref } from 'vue'
import cal from '@/commons/utils/cal.js'
import go from '@/commons/utils/go.js'


// 定义传入属性
const props = defineProps({
  record: { type: Object, default: () => {} }, // 渲染对象
})

//前往会员详情
const toDetails = () => {
	go.to('PAGES_MEMBER_ACCOUNT_HISTORY_DETAIL', { hid: props.record.hid })
}

</script>

<style lang="scss" scoped>
	.card {
		width: 690rpx;
		
		margin: 30rpx auto;
	}
	.card-content {
		border-radius: 20rpx;
		background-color: $J-bg-ff;
		margin: 10rpx 0;
	}
	
	.card-content-title {
		height: 100rpx;
		display: flex;
		flex-direction: row;
		justify-content: space-between;
		align-items: center;
		padding: 0 30rpx;
		
		.card-content-title-left {
			height: 100rpx;
			display: flex;
			color: #000000ff;
			font-size: 30rpx;
			flex-direction: row;
			align-items: center;
			
			image {
				width: 40rpx;
				height: 40rpx;
				border-radius: 50%;
			}
			text {
				padding-left: 10rpx;
			}
		}
		.card-content-title-right {
			font-weight: 600;
			color: #000000ff;
			
			text {
				font-size: 30rpx;
			}
			
		}
	}
	
	.card-content-line {
		border-bottom: 2rpx solid rgba(0, 0, 0, 0.06);
	}
	
	.card-content-body {
		
		padding: 20rpx;
		display: flex;
		flex-direction: column;
		align-items: flex-start;
		justify-content: space-evenly;
		box-sizing: border-box;
		
		.card-content-body-row {
			display: flex;
			flex-direction: row;
            align-items: center;
			justify-content: flex-start;
			padding-left: 50rpx;
			height: 60rpx;
			text:first-child {
				width: 170rpx;
				color: #999999ff;
				font-size: 26rpx;
				font-weight: 400;
			}
			text:last-child {
				color: #000000ff;
				font-size: 26rpx;
				font-weight: 400;
			}
		}
	}
</style>
