<template>
  <div class="divBox ">
    <!-- <el-card class="box-card"> -->
    <!-- <div style="width :100%;height:45px;line-height: 45px;background: #f3f3f3; padding-left:20px">
        添加广告
      </div> -->
    <el-form :rules="rules" ref="form" :model="detailData" class="formValidate " label-width="100px">
      <el-row>
        <el-col :span="15">
          <el-form-item label="订单编号:">
            <span>{{ detailData.orderCode }}</span>
          </el-form-item>
        </el-col>
        <el-col :span="18">
          <el-form-item label="取消说明" prop="cancelMark">
            <el-input v-model="detailData.cancelMark" placeholder="请输入取消说明" type="textarea" />
          </el-form-item>
        </el-col>
        <el-col :span="15">
          <el-form-item label="订单金额:">
            <span>¥{{ detailData.marketPrice }}</span>
          </el-form-item>
        </el-col>
        <el-col :span="18">
          <el-form-item label="可退积分">
            <el-input v-model="detailData.integral" disabled />
          </el-form-item>
        </el-col>
      </el-row>

      <el-form-item>
        <el-button type="primary" class="submission" @click="handleSubmit">提交</el-button>
        <el-button :size="$store.getters.size" @click="close">取消</el-button>
      </el-form-item>
    </el-form>
    <!-- </el-card> -->
  </div>
</template>
<script>
import orderInfoApi from '@/api/order/orderInfo.js'
import { loadingFn } from '@/utils/validate'
export default {
  props: {
    detailData: {
      type: Object,
      default() {}
    }
  },
  data() {
    return {
      detailData: {},

      rules: {
        cancelMark: [{ required: true, message: '请输入取消说明', trigger: 'blur' }]
        // integral: [{ required: true, message: '请输入积分', trigger: 'blur' }]
      }
    }
  },
  methods: {
    handleSubmit() {
      this.$refs['form'].validate(valid => {
        if (valid) {
          this.save()
        }
      })
    },
    save() {
      this.detailData.createSource = 'MALL_COMS_WEB'
      loadingFn.call(
        this,
        'loading',

        orderInfoApi.cancelOrder(this.detailData).then(res => {
          if ((res.code = 20000)) this.$message.success(res.msg)
          this.$emit('closeDialog')
          this.$emit('getList')
        })
      )
    },
    uploadSuccess(e, res) {
      console.log(res)
      if (res.code == 20000) {
        this.advertisement.positionImage = res.data.publicUrl
      }
    },

    close() {
      this.$emit('closeDialog')
    }
  }
}
</script>
<style scoped lang="stylus"></style>
