<template>
  <div>
    <!-- <base-input
      label="现有资金"
      placeholder="现有资金"
      v-model="form.NowCapital"
    ></base-input> -->
    <base-radio
      v-for="oM in orderModes"
      :key="oM.value"
      inline
      :name="oM.value"
      class="mb-3"
      v-model="form.OrderAmountType"
    >
      {{ oM.name }}
    </base-radio>
    <div class="row">
      <div class="col-md-6">
        <base-input
          label="总资金"
          placeholder="总资金"
          v-model="form.NowCapital"
        ></base-input>
      </div>
      <div class="col-md-6">
        <base-input
          label="固定下单金额"
          placeholder="固定下单金额"
          v-model="form.TradeAmount"
        ></base-input>
      </div>
    </div>
    <base-input
      label="总资金"
      placeholder="总资金"
      v-model="form.NowCapital"
    ></base-input>
    <base-input
      label="冻结金额"
      placeholder="冻结金额"
      v-model="form.FrozenProfit"
    ></base-input>
    <base-input
      label="下单金额比（%）"
      placeholder="下单金额比（%）"
      v-model="form.TradeAmountRatio"
    ></base-input>
    <p class="form-label">下单金额：{{ total }}</p>

    <base-checkbox inline v-model="form.IsEnabledLimit">
      是否启用限价单
    </base-checkbox>
    <base-checkbox inline v-model="form.IsV2">
      是否启用动量趋势2.0
    </base-checkbox>
  </div>
</template>
<script>
import BaseRadio from "../../components/BaseRadio";
export default {
  model: { prop: "form", event: "formChange" },
  props: {
    form: {
      type: Object,
      default: () => {}
    }
  },
  components: { BaseRadio },
  watch: {
    form() {
      this.$emit("formChange", this.form);
    }
  },
  data() {
    return {
      orderModes: [
        { value: 0, name: "灵活百分比" },
        { value: 1, name: "固定金额" }
      ]
    };
  },
  computed: {
    total() {
      return (
        ((this.form.NowCapital - this.form.FrozenProfit) *
          this.form.TradeAmountRatio) /
        100
      );
    }
  }
};
</script>
