<template>
  <a-card :bordered="false">
    <div>
      <a-list
        :grid="{ gutter: 0, column: 6 }"
        :data-source="model.livingDayPrices"
      >
        <a-list-item slot="renderItem" slot-scope="item, index">
          <a-card title="价格">
            <p>{{ item.dayTime }}</p>
            <p>
              <a-input-number
                :disabled="item.dayTime < currentDate"
                v-model="item.price"
                placeholder="价格"
                :min="0"
              ></a-input-number>
            </p>
          </a-card>
        </a-list-item>
      </a-list>
    </div>
  </a-card>
</template>

<script>
import { httpAction, getAction, postAction } from "@/api/manage";
import { validateDuplicateValue } from "@/utils/util";
import moment from "moment";
export default {
  name: "BusMemberCardForm",
  components: {},
  props: {
    //表单禁用
    disabled: {
      type: Boolean,
      default: false,
      required: false,
    },
  },
  data() {
    return {
      currentDate: moment(new Date()).format("YYYY-MM-DD"),
      model: { livingDayPrices: [] },
      url: {
        add: "/business/busRoomBookingOrders/booking-to-live",
        edit: "/business/busMemberCard/edit",
        queryById: "/business/busMemberCard/queryById",
      },
      gradeList: [],
      paymentMethodList: [],
      staffList: [],
      customerList: [],
      oldcustomerList: [],
      hourRoomRuleList: [],
    };
  },
  computed: {
    formDisabled() {
      return this.disabled;
    },
  },
  created() {
    var _info = JSON.parse(localStorage.getItem("storeInfo"));
    if (_info) {
      this.model.hotelId = _info.id;
    }
    //备份model原始值
    this.modelDefault = JSON.parse(JSON.stringify(this.model));
  },
  methods: {
    moment,
    add(livingOrderId, roomId) {
      this.modelDefault.livingOrderId = livingOrderId;
      this.modelDefault.roomId = roomId;
      this.edit(this.modelDefault);
    },
    edit(record) {
      this.model = Object.assign({}, record);
      this.visible = true;
    },
    submitForm() {
      this.$emit("ok", this.model.livingDayPrices);
    },
  },
};
</script>

<style scoped>
/deep/ .ant-card-head {
  text-align: center;
  background: #f0f0f0;
  height: 28px !important;
}
/deep/ .ant-card-body {
  padding: 2px !important;
  text-align: center;
}
</style>