<template>
  <div class="app-container">
    <el-card>
      <xd-base-field
        ref="testForm"
        :list="formList"
        size="medium"
      >
        <template slot="image" slot-scope="scope">
          <el-form
            :label-width="scope.width"
            ref="customForm"
          >
            <el-form-item
              label="套餐图片:"
            >
              <xd-item-image></xd-item-image>
            </el-form-item>
          </el-form>
        </template>
      </xd-base-field>

      <div class="app-container__form-buttons">
        <el-button>返回</el-button>
        <el-button type="primary">保存</el-button>
      </div>
    </el-card>
  </div>

</template>

<script>
  import XdBaseField from "@/components/XdBaseField";
  import XdItemImage from "@/components/XdItemImage";

  export default {
    name: "detail",
    components: {
      XdBaseField,
      XdItemImage
    },

    data() {
      return {
        formList: [],
        operateTable: [
          {
            "operate_name": "退款",
            "remark": "买错或买多",
            "time": "2021-12-15 12:06:30",
            "name": "张三",
          },
        ]
      }
    },

    created() {
      this.initSearchForm()
    },

    methods: {

      /**
       * @description 初始化搜索模块
       */
      initSearchForm() {
        let formList = [
          {
            label: '套餐名称:', //label
            ele: 'el-input',
            valueKey: 'package_name', //form[valueKey]
            value: '入职体检A', //v-model
            disabled: true
          },
          {
            label: '所属机构:', //label
            ele: 'el-input',
            valueKey: 'hosp_name', //form[valueKey]
            value: '北京慈铭体检', //v-model
            disabled: true
          },
          {
            label: '所属城市:', //label
            ele: 'el-input',
            valueKey: 'city', //form[valueKey]
            value: '北京-北京', //v-model
            disabled: true
          },
          {
            label: '适用性别:', //label
            ele: 'el-input',
            valueKey: 'gender', //form[valueKey]
            value: '不限', //v-model
            disabled: true
          },
          {
            label: '渠道价格:', //label
            ele: 'el-input',
            valueKey: 'buy_price', //form[valueKey]
            value: '300', //v-model
            disabled: true
          },
          {
            label: '促销价格:', //label
            ele: 'el-input',
            valueKey: 'sell_price', //form[valueKey]
            value: '320', //v-model
            disabled: true
          },
          {
            label: '是否置顶:', //label
            ele: 'el-input', //package 名称
            valueKey: 'is_top', //form[valueKey]
            value: '默认', //v-model
            disabled: true
          },
          {
            label: '套餐状态:', //label
            ele: 'el-input',
            valueKey: 'package_status', //form[valueKey]
            value: '启用', //v-model
            disabled: true
          },
          {
            label: '', //label
            ele: 'slot', //package 名称
            slot: 'image',
          },
        ];

        this.formList = formList;

      },

      /**
       * @description 退款
       */
      refund() {
        this.$confirm('您确定要退款吗?', '提示', {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          type: 'warning'
        }).then(() => {

        }).catch(() => {

        });
      }
    }
  }
</script>

<style scoped>

</style>
