<template>
  <view class="account-edit" v-if="viewModel">
	  <view class="account-edit_grid">
		  <view class="account-edit_grid-li" :style="`width: ${690/2}rpx;`" v-for="(gItem,gIdnex) in viewModel.accountList" :key="gIdnex">
			  <view class="account-edit_grid-li-top">
				  <text class="account-edit_grid-li-top_p1">{{gItem.amount}}</text>
				  <text class="account-edit_grid-li-top_p2">冻结：{{gItem.freezeAmount}}</text>
			  </view>
			  <text class="account-edit_grid-li-bottom">{{gItem.moneyTypeName}}</text>
		  </view>
	  </view>
	  <text class="account-edit_text">资产操作</text>
	  <view class="account-edit_ul">
	  	<view class="account-edit_ul-li">
	  		<view class="account-edit_ul-li-lable">
	  			<text class="account-edit_ul-li-lable_t2">用户信息</text>
	  		</view>
			<view class="account-edit_ul-li-ipt"><text class="account-edit_ul-li-h">{{viewModel.user.userName}}({{viewModel.user.name}})</text></view>
	  	</view>
	  	<view class="account-edit_ul-li" style="padding: 0;">
	  		<view class="account-edit_ul-li-lable">
	  			<text class="account-edit_ul-li-lable_t2">操作类型</text>
	  			<text class="account-edit_ul-li-lable_t1">*</text>
	  		</view>
	  		<view class="account-edit_ul-li-ipt">
				<x-radio v-model="viewModel.actionType" type="FinanceActionType"></x-radio>
			</view>
	  	</view>
	  	<view class="account-edit_ul-li" style="padding: 0;">
	  		<view class="account-edit_ul-li-lable">
	  			<text class="account-edit_ul-li-lable_t2">资产类别</text>
	  			<text class="account-edit_ul-li-lable_t1">*</text>
	  		</view>
	  		<view class="account-edit_ul-li-ipt">
	  			<x-radio v-model="viewModel.moneyTypeId" type="MoneyTypeConfig"></x-radio>
	  		</view>
	  	</view>
	  	<view class="account-edit_ul-li">
	  		<view class="account-edit_ul-li-lable">
	  			<text class="account-edit_ul-li-lable_t2">金额</text>
				<text class="account-edit_ul-li-lable_t1">*</text>
	  		</view>
	  		<view class="account-edit_ul-li-ipt"><input v-model="viewModel.amount" type="number" class="account-edit_ul-li-ipt_p" placeholder="请输入" /></view>
	  	</view>
		<view class="account-edit_ul-li">
			<view class="account-edit_ul-li-lable">
				<text class="account-edit_ul-li-lable_t2">支付密码</text>
				<text class="account-edit_ul-li-lable_t1">*</text>
			</view>
			<view class="account-edit_ul-li-ipt"><input v-model="viewModel.payPassword" type="number" class="account-edit_ul-li-ipt_p" placeholder="请输入" /></view>
		</view>
		<view class="account-edit_ul-remark">
			<text class="account-edit_ul-remark-rp1">备注</text>
			<view class="account-edit_ul-remark-rp2">
				<textarea v-model="viewModel.remark" :maxlength="-1" class="account-edit_ul-remark-rp2-rptext" placeholder="占位符字体是红色的"/>
			</view>
		</view>
	  </view>
	  <view class="account-edit_but">
	  	<text class="account-edit_but-t" @click="save">测试</text>
	  </view>
  </view>
</template>
<script>
  import ala from '@/service/ala'
  export default {
    props: {
      widget: {}
    },
    data () {
      return {
        viewModel: null,
        isLoading: true,
        butLoading: false
      }
    },
    mounted () {
      this.init()
    },
    methods: {
      async init () {
        var paras = {
          id: ala.getId(this.widget.route)
        }
        this.viewModel = await ala.httpGet('api/Account/DetailEdit', paras)
        this.viewModel.actionType = 1
        this.isLoading = false
      },
      async save () {
        var response = await ala.httpPost('api/Account/action', this.viewModel)
        if (response) {
          this.$ala.toMessage(response)
        }
      }
    }
  }
</script>

<style rel="stylesheet/scss" lang="scss">
  @import "./styles/style.scss";
</style>
