<!-- 取消订单 -->
<template>
  <el-dialog :title="topTitle"
             :visible.sync="show"
             :close-on-click-modal="false"
             :before-close="handleClose" append-to-body >

    <el-form ref="form" :model="form" label-width="120px">
      <el-form-item label="退货地址" label-width="120px">
        <p>收 件 人 - {{this.form.takeName}}</p>
        <p>联系电话 - {{this.form.phone}}</p>
        <p>退货地址 - {{this.form.address}}</p>
      </el-form-item>
      <el-form-item label="退还给用户金" prop="refundMoney" label-width="120px" required>
        <el-input-number v-model="form.refundMoney" size="30px"></el-input-number>
        <p style="color: red">支付金额：{{this.form.payMoney}}</p>
      </el-form-item>

      <el-form-item label="商家金额" prop="goodsMoney" label-width="120px" required  v-if="this.form.isPlatformOrder==0">
        <el-input-number v-model="form.goodsMoney" size="30px"></el-input-number>
      </el-form-item>

      <el-form-item label="备注" prop="mark" label-width="120px" required>
        <el-input v-model="form.mark" ></el-input>
      </el-form-item>
    </el-form>

    <!-- 底部 -->
    <span slot="footer" class="dialog-footer">
      <el-button type="primary" :loading="loading" @click="onSubmit" style="width: 200px; height: 40px;display:block;margin:0 auto;" >确 认</el-button>
    </span>

  </el-dialog>
</template>

<script>
  import {putObj,getStateOptions} from '@/api/mall/mallclassify'
  import {ZmMixin} from '@/mixins/ZmMixin.js'
  import request from "@/router/axios";

  export default {
    props: {
      show: Boolean,
      params: Object
    },
    mixins: [ZmMixin],
    components: {},
    computed: {
      topTitle() {
        console.log(JSON.stringify(this.params))
        this.form.isPlatformOrder=0
        return '取消订单'
      },
    },
    watch: {
      params(n, o) {
        if(n) {
          this.form.classifyName = n.classifyName
          this.form.sort = n.sort
        }
      }
    },
    methods: {
      handleClose() {
        this.$emit('close')
      },
      onSubmit() {
        this.params.classifyName=this.form.classifyName
        this.params.sort=this.form.sort
        putObj(this.params).then(r => {
          this.loading = false
          this.$emit('success')
          this.$message.success('修改成功')
        }).catch(e => {
          this.loading = false
        })
        },
    },
    data() {
      return {
        loading: false,
        form: {
          takeName:'张三',
          address:'成都市高新区',
          phone:'12345687892',
          refundMoney:'200.00',
          goodsMoney:'350.00',
          mark:'备注消息',
          pay_money:'100A币',
        }
      }
    }
  }
</script>
