You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

219 lines
5.5 KiB

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

<template>
<div>
<!-- 编辑-->
<xy-dialog :is-show.sync="isShow" title="活动用户编辑" type="form" :form="detail" :rules="rules" @submit="editor"
ref="addActivity">
<template v-slot:name>
<div class="xy-table-item">
<div class="xy-table-item-label">
<span style="color: red;font-weight: 600;padding-right: 4px;">*</span>用户名称
</div>
<div class="xy-table-item-content">
<el-input clearable placeholder="请填写用户名称" v-model="detail.name" style="width: 300px;" />
</div>
</div>
</template>
<template v-slot:mobile>
<div class="xy-table-item">
<div class="xy-table-item-label">
<span style="color: red;font-weight: 600;padding-right: 4px;">*</span>手机号
</div>
<div class="xy-table-item-content">
<el-input clearable placeholder="请填写手机号" v-model="detail.mobile" style="width: 300px;" />
</div>
</div>
</template>
<template v-slot:username>
<div class="xy-table-item">
<div class="xy-table-item-label">
<span style="color: red;font-weight: 600;padding-right: 4px;">*</span>登录账号
</div>
<div class="xy-table-item-content">
<el-input clearable placeholder="请填写登录账号" v-model="detail.username" style="width: 300px;" />
</div>
</div>
</template>
<template v-slot:password>
<div class="xy-table-item">
<div class="xy-table-item-label">
<span style="color: red;font-weight: 600;padding-right: 4px;">*</span>用户密码
</div>
<div class="xy-table-item-content">
<el-input clearable placeholder="请填写用户密码" type="password" v-model="detail.password" style="width: 300px;" />
</div>
</div>
</template>
<template v-slot:activity_list_id>
<div class="xy-table-item">
<div class="xy-table-item-label">
<span style="color: red;font-weight: 600;padding-right: 4px;">*</span>相关活动
</div>
<div class="xy-table-item-content">
<el-select clearable v-model="detail.activity_list_id">
<el-option v-for="(item,index) of listActivity" :key="item.id" :value="item.id" :label="item.name">
</el-option>
</el-select>
</div>
</div>
</template>
<template v-slot:status>
<div class="xy-table-item">
<div class="xy-table-item-label">状态
</div>
<div class="xy-table-item-content">
<el-select clearable v-model="detail.status">
<el-option :value="1" label="启用"></el-option>
<el-option :value="0" label="禁用"></el-option>
</el-select>
</div>
</div>
</template>
</xy-dialog>
</div>
</template>
<script>
import {
save,
show
} from "@/api/activity/activityUser";
export default {
props: {
listActivity: Array
},
data() {
return {
isShow: false,
id: "",
type: "add",
detail: {
activity_list_id: "",
username: "",
password: "",
name: "",
mobile: "",
status: 1
},
rules: {
name: [{
required: true,
message: "用户名称必填写"
}],
tag: [{
required: true,
message: "登录账号必填"
}],
}
}
},
watch: {
isShow(newVal) {
if (newVal) {
if (this.type === 'editor') {
this.getDetail()
}
} else {
this.id = ''
this.type = ''
this.$refs['addActivity'].reset()
}
}
},
methods: {
async getDetail() {
let res = await show({
id: this.id
})
Object.assign(this.detail, res);
this.detail.activity_list_id = parseInt(res.activity_list_id)
},
editor() {
save(this.detail).then(res => {
this.isShow = false
this.$Message.success("操作成功");
this.$emit('refresh')
})
},
},
computed: {
},
mounted() {
let that = this;
}
}
</script>
<style scoped lang="scss">
.contract-add-plan {
min-height: 30px;
border: 1px solid #dcdee2;
border-radius: 4px;
display: flex;
flex-wrap: wrap;
align-items: center;
align-content: center;
padding: 0 8px;
&-no-plan {
height: 30px;
line-height: 30px;
color: #CDD0D5;
}
}
.xy-table-item-label {
width: 140px;
}
.xy-table-item-price {
position: relative;
&::after {
z-index: 1;
position: absolute;
right: 0;
top: 0;
content: ''
}
::v-deep .el-input__clear {
position: relative;
right: 30px;
z-index: 2;
}
}
.xy-table-item-price-wan {
position: relative;
&::after {
position: absolute;
right: 0;
top: 0;
content: ''
}
::v-deep .el-input__clear {
position: relative;
right: 46px;
z-index: 2;
}
}
</style>