<template>
  <a-form :form="form">
		<a-descriptions bordered size="small" :column="2" class="data_view">
      <a-descriptions-item label="资产类型">{{ propertyTypeText }}</a-descriptions-item>
      <a-descriptions-item label="用户ID">{{ modalData.login_id }}</a-descriptions-item>
      <a-descriptions-item label="用户名">{{ modalData.real_name }}</a-descriptions-item>
      <a-descriptions-item label="手机号">{{ modalData.phone }}</a-descriptions-item>
      <a-descriptions-item label="邮箱号">{{ modalData.email }}</a-descriptions-item>
      <a-descriptions-item label="收款人">{{ modalData.payee }}</a-descriptions-item>
      <a-descriptions-item label="开户行">{{ modalData.open_bank_info }}</a-descriptions-item>
      <a-descriptions-item label="银行编码">{{ modalData.bank_info_code }}</a-descriptions-item>
      <a-descriptions-item label="收款账号">{{ modalData.account }}</a-descriptions-item>
      <a-descriptions-item label="提现金额">{{ modalData.amount | setZero }}</a-descriptions-item>
			<a-descriptions-item label="创建/更新时间">
				<div class="multi_line">
					<span>{{ modalData.created_date | moment }}</span>
					<span>{{ modalData.updated_date | moment }}</span>
				</div>
			</a-descriptions-item>
      <a-descriptions-item label="客户端IP">{{ modalData.client_ip }}</a-descriptions-item>
      <a-descriptions-item label="客户端信息">{{ modalData.client_os }}</a-descriptions-item>
      <a-descriptions-item label="浏览器信息">{{ modalData.client_agent }}</a-descriptions-item>
      <a-descriptions-item label="审核状态" :span="2">
				<a-form-item v-if="isEdit" class="m_0">
          <a-select
            placeholder="请设置状态"
						style="max-width: 300px"
						dropdownClassName="hide_disabled_option"
						v-model="isReview"
            v-decorator="[
              'status',
              { initialValue: modalData.status }
            ]"
            :options="review_status_modal_options"
          />
				</a-form-item>
				<template v-else>{{ modalData.status | review_status_modal }}</template>
			</a-descriptions-item>
			<a-descriptions-item label="失败原因" :span="2" v-if="isReview === 1">
				<a-form-item class="m_0" v-if="isEdit">
	      	<a-textarea v-decorator="[
						'fail_reason',
						{
							initialValue: modalData.fail_reason,
							rules: [{ required: true, message: '请输入失败原因' }]
						}
					]" :maxLength="36" />
				</a-form-item>
				<template v-else>{{ modalData.fail_reason }}</template>
			</a-descriptions-item>
      <a-descriptions-item label="备注" :span="2">{{ modalData.memo }}</a-descriptions-item>
			<a-descriptions-item label="系统备注">
				<a-form-item class="m_0" v-if="isEdit">
	      	<a-textarea v-decorator="[
						'system_memo',
						{
							initialValue: modalData.system_memo
						}
					]" :maxLength="36" />
				</a-form-item>
				<template v-else>{{ modalData.system_memo }}</template>
			</a-descriptions-item>
    </a-descriptions>
  </a-form>
</template>
<script>
import mix from './mixins'
import finance from '../mixins/finance'
import common from '../mixins/common'
import mixProperty from './mixin.property'
export default {
  mixins: [mix, common, finance(), mixProperty],
  data() {
    return {
			isReview: this.modalData.status
    }
  },
  computed: {
    // 是否可编辑
    isEdit() {
      return this.allow.includes('financeRechargeReview') && this.modalData.status === 3
    },
    successMessage() {
			switch (this.isReview) {
				case 1: return '审核不通过'
				case 2: return '审核通过'
				default: return '操作成功'
			}
    }
  },
  methods: {
		beforeOk(next, done) {
			const status = this.form.getFieldValue('status')
			if (![1, 2].includes(status) || !this.isEdit) return done()
			next()
		},
    async submit(values) {
			const res = await this.request_api.finance_withdraw.review({
				uuid: this.modalData.uuid,
				version: this.modalData.version,
				status: values.status,
				system_memo: values.system_memo || ''
			})
      return res
    }
  }
}
</script>