<template>
	<view class="ecash">
		<dHeader :title="$lang.lang.ecash.query"></dHeader>
		<view class="start-bar"></view>
		<view class="ecash_lists">
			<view class="ecash_list" v-for="(item,index) in ecashData" :key="index">
				<text>{{item.fromFee}}{{ getType(item.fromCurrency)}}</text>
				<text>=</text>
				<text>{{item.toFee}}{{getType(item.toCurrency)}}</text>
			</view>
			<view class="ecash_list" v-if="ecashData.length>0&&ecashData[0].remark">
				<text class="ecash_notice">{{ecashData[0].remark}}</text>
			</view>
		</view>
		<view class="ecash_time">
			<text>{{$lang.lang.ecash.time}}:</text>
			<text>{{ecashData.length>0?ecashData[0].bjStartTime:''}} - {{ecashData.length>0?ecashData[0].bjEndTime:''}}({{$lang.lang.ecash.china}})</text>
			<text>{{ecashData.length>0?ecashData[0].nrlyStartTime:''}} - {{ecashData.length>0?ecashData[0].nrlyEndTime:''}}({{$lang.lang.ecash.Nigeria}})</text>
		</view>
	</view>
</template>

<script>
	import dHeader from '../../components/dHeader/index.vue'
	export default {
		components: {
			dHeader
		},
		data() {
			return {
				ecashData:[],
				currencyType:[],
			}
		},
		onLoad() {
			this.getEcashData()
			this.getConfig()
			// this.getVersion()
			// this.getAdData(2)
		},
		methods: {
			toupdate(){
				uni.navigateTo({
					url:'../updateView/updateView?url='+this.appUrl
				})
			},
			getVersion(){
				this.version = uni.getStorageSync('appversion');
			},
			getEcashData(){
				this.$request.get('/app-api/ecw/currency-ecash/list').then(res => {
					if(res.code==0&&res.data){
						this.ecashData = res.data
					}

				})
			},
			getConfig () {
				this.$request.get('/app-api/ecw/currency/list').then(res => {
					if(res.code==0&&res.data&&res.data.length>0){
						this.currencyType = res.data
					}
				})
			},
			getType(value){
				var title = ''
				let that = this
				that.currencyType.forEach((item)=>{					
					if(item.id == value){
						title =  item.titleZh + '('+ item.titleEn+')'
					}
				})
				return title
			}
		}
	}
</script>

<style scoped>
page{
	background-color: #f8f8f8;
}
.ecash{
	padding-top: 200upx;
}
.ecash_lists{
	width: 84%;
	margin: 0 auto;
	border-radius: 12upx;
	background-color: #fff;
	color: #9e9e9e;
	font-size: 34upx;
	display: flex;
	flex-direction: column;
	padding: 4%;
}
.ecash_list{
	display: flex;
	width: 90%;
	align-items: center;
	justify-content: center;
	margin: 20upx 0;
}
.ecash_time{
	display: flex;
	font-size: 26upx;
	width: 92%;
	margin: 40upx auto;
	flex-direction: column;
	align-items: center;
	justify-content: center;
}

.ecash_time text{
	margin-top: 30upx;
}
.ecash_time text:first-child{
	font-size: 30upx;
}
.ecash_notice{
	font-weight: bold;
	color: #FF0000;
}
</style>
