<template>
    <el-dialog :title="title" visible :before-close="closeDialog">
        <div class="" v-if="agreement">
            <el-form ref="form" :model="form" label-position="left" label-width="120px">
              <el-form-item v-if="detail" label="原控货人">
                <el-input v-model="detail.orderNo" readonly></el-input>
              </el-form-item>
              <el-form-item label="原控货手机号" prop="start" required>
                <el-input v-model.number="form.start" type="number"></el-input>
              </el-form-item>
              <el-form-item label="新控货人" prop="end" required>
                <el-input v-model.number="form.end" type="number" :max="detail ? detail.num : 1"></el-input>
              </el-form-item>
              <el-form-item label="新控货手机号" prop="start" required>
                <el-input v-model.number="form.start" type="number">
                    <el-select slot="prepend" v-model="form.areaCode" placeholder="">
                      <el-option :label="1" :value="1"></el-option>
                    </el-select>
                </el-input>
              </el-form-item>
              <el-form-item label="新控货人邮箱" prop="end" required>
                <el-input v-model.number="form.end" type="number" :max="detail ? detail.num : 1"></el-input>
              </el-form-item>
              <el-form-item label="手机验证码" prop="end" required>
                <el-input v-model.number="form.end" type="number">
                    <span slot="append">获取验证码</span>
                </el-input>
              </el-form-item>
              <el-form-item label="">
                <el-button type="primary" @click="showPreview">确定转移</el-button>
              </el-form-item>
            </el-form>
        </div>
        <div v-else>
            <transfer-agreement />
            <div style="margin-top:30px">
                <el-button type="primary" @click="agreement=true">我同意</el-button>
                <el-button @click="closeDialog">关闭</el-button>
            </div>
        </div>
    </el-dialog>
</template>
<script>
import TransferAgreement from "./TransferAgreement"
export default {
    props:{
        orderId: [String, Number]
    },
    components: {TransferAgreement},
    data(){
        return {
            show: false,
            detail: null,
            form:{},
            agreement: false, // 是否同意协议
        }
    },
    computed:{
        title(){
            let t = '控货权转移'
            if(this.detail){
                t += '-' + this.detail.orderNo
            }
            return t
        }
    },
    created(){
        this.show = true
        this.loadData()
    },
    methods:{
        loadData(){
            
        },
        closeDialog(){
            this.show = false
            this.$emit('close');
        },
        
    }
}
</script>