<template>
    <el-dialog :title="titleMap[mode]" v-model="visible" :width="600" destroy-on-close @closed="$emit('closed')" :close-on-click-modal="false" :close-on-press-escape="false">
        <el-form ref="dialogForm" :model="formData" :rules="rules" label-width="100px" label-position="top">
            <el-form-item label="短信内容">
                <el-input v-model="sms" type="textarea" disabled readonly clearable placeholder="门店名称" rows="5"></el-input>
                <div class="el-form-item-msg" style="margin-top: 10px;">
                    <el-button v-copy="sms">复制</el-button>
                </div>
            </el-form-item>
        </el-form>
		<template #footer>
			<el-button @click="visible=false" >关 闭</el-button>
		</template>
    </el-dialog>
</template>
<script>
export default {
    data(){
        return {
            loading: false,
            mode:"add",
            titleMap:{
                add:"查看短信",
                edit:"查看短信"
            },
            visible: false,
            isSaveing: false,
            formData:{},
            submitState:false,
            disabled:false,
            rules:{},
            sms:""
        }
    },
    methods:{
        open(mode = 'add'){
            this.mode = mode;
            this.visible = true;
            return this
        },
        //表单注入数据
        setData(data){
            this.formData = data;
            this.getSms();
        },
        async getSms(){
            var resp = await this.$API.merOrderlife.sms.get({id:this.formData.id});
            if (resp.code == 0) {
                return this.$message.error(resp.msg);
            }
            this.sms = resp.data.sms;
        }
    }
}
</script>
<style>
.mt20 {margin-top: 20px;}
.login-msg-yzm {display: flex;width: 100%;}
.login-msg-yzm .el-button {margin-left: 10px;--el-button-size:42px;}
</style>