<template>
	<view>
		
	</view>
</template>

<script>
	export default {
		data() {
			return {
				regionList: []
			}
		},
		methods: {
			getData(obj){
				let _this =this
				let list = []
				this.$request.$webGet('/EShangApiMain/Revenue/GetRevenuePushList', {
					Statistics_Date: obj.Statistics_Date || '2021-12-05',
					pushProvinceCode: obj.ProvinceCode || '340000',
					
				}).then(res => {
					if (res.Result_Code != 100) return
					res.Result_Data.map(n => {
						n.show = false
						let regin = list.find(m=>m.name ===n.SPREGIONTYPE_NAME)
						if(!regin ) {
							list.push({
								name: n.SPREGIONTYPE_NAME,
								crashpay: n.CASHPAY,
								child: [{
									SERVERPART_NAME: n.SERVERPART_NAME,
									CASHPAY: n.CASHPAY
								}]
							})
						}else{
							regin.crashpay+= n.CASHPAY
							let serverpart = regin.child.find(m=>m.SERVERPART_NAME ===n.SERVERPART_NAME)
							if(serverpart) {
								serverpart.CASHPAY+= n.CASHPAY
							}else{
								regin.child.push({
									SERVERPART_NAME: n.SERVERPART_NAME,
									CASHPAY: n.CASHPAY
								})
							}
						}
						
					})
				
					_this.regionList = list
					console.log(list)
				})
			}
		},
		onLoad(option) {
			this.getData(option)
		}
	}
</script>

<style>

</style>
