<template>
	<view class="content">
		<view class="container">
			<headers :titles="titles"><uni-icons type="arrow-left" color="#fff" size="22px"></uni-icons></headers>
			<view class="title-">交易金额</view>
			<view class="price-">+{{formData.trxAmt}}</view>
			<view class="d-hang">
				<view class="">当前状态</view>
				<view class="">{{tradeStatusName(formData.status)}}</view>
			</view>
			<view class="d-hang">
				<view class="">交易类型</view>
				<view class="">{{tradeTypeName(formData.type)}}</view>
			</view>
			<view class="d-hang">
				<view class="">交易时间</view>
				<view class="">{{formData.createDate}}</view>
			</view>
			<view class="d-hang">
				<view class="">流水单号</view>
				<view class="">{{formData.orderNo}}</view>
			</view>
		</view>

	</view>
</template>

<script>
	import headers from '../../components/header/headers.vue'
	import request from '../../utils/request.js'
	export default {
		data() {
			return {
				titles: "账单详情",
				msg: "1",
				dataList: [],
				show: false,
				status: 'loading',
				formData: {},
				orderNo: null,
				tradeTypeList: [],
				tradeStatusList: []
			}
		},
		onLoad(option) {
			this.getDictList()
			this.orderNo = option.orderNo
		},
		onShow() {
			this.getOrderDetail()
		},
		components: {
			headers
		},
		methods: {
			async getDictList() {
				this.tradeTypeList = await this.$getDictList('pos_order_online_trade_type')
				this.tradeStatusList = await this.$getDictList('pos_order_payment_status')
			},
			tradeTypeName(type) {
				if (this.tradeTypeList && this.tradeTypeList.length > 0) {
					let tempData = this.tradeTypeList.find(item => item.value == type)
					return tempData.label
				} else {
					return '微信扫码'
				}
			},
			tradeStatusName(status) {
				if (this.tradeStatusList && this.tradeStatusList.length > 0) {
					let tempData = this.tradeStatusList.find(item => item.value == status)
					return tempData.label
				} else {
					return '交易成功'
				}
			},
			getOrderDetail() {
				request({
					url: 'app/uaBase/orderDetail',
					method: 'post',
					data: {
						orderNo: this.orderNo
					},
				}).then(res => {
					this.formData = res.data
				}).finally(rrr => {
					this.show = false
					this.addSnNo = null
				})
			},
			goback() {
				uni.navigateBack()
			}
		}
	}
</script>

<style scoped lang="scss">
	.content {
		background: #f4f5f6;
		height: 100vh;
	}

	.container {
		width: 100%;
		background: #f4f5f6;
		box-sizing: border-box;
		padding-top: 88px;
	}

	.d-hang {
		width: 100%;
		box-sizing: border-box;
		padding: 10px 15px;
		border-bottom: 1px solid #d8d8d9;
		display: flex;
		align-items: center;
		justify-content: space-between;

	}

	.title- {
		width: 100%;
		text-align: center;
		margin: 40px auto;
	}

	.price- {
		width: 100%;
		text-align: center;
		margin: 40px auto;
		font-size: 36px;
		font-weight: bold;

	}
</style>