feat(代理列表): 资料修改新增“代理是否接收主播工资”的开关按钮

This commit is contained in:
hzj 2025-11-18 17:34:37 +08:00
parent 4109704296
commit cbe96c7c82

View File

@ -22,7 +22,12 @@
:closable="false"
style="margin-bottom: 10px;"
/>
<el-form ref="form" :model="form" :rules="formRules" label-width="80px">
<el-form
ref="form"
:model="form"
:rules="formRules"
label-width="80px"
>
<el-form-item prop="region" label="区域">
<select-system-region
ref="regionSelectPolicy"
@ -56,29 +61,50 @@
<div style="padding: 10px 0px;">
<el-divider content-position="left">设置信息</el-divider>
<el-form-item prop="setting.maxMember" label="成员数量">
<el-input v-model="form.setting.maxMember" placeholder="最大成员数量" maxlength="100" show-word-limit />
<el-input
v-model="form.setting.maxMember"
placeholder="最大成员数量"
maxlength="100"
show-word-limit
/>
</el-form-item>
<el-form-item
prop="setting.hostSalaryToAgent"
label="代理接收主播工资"
>
<el-switch
v-model="form.setting.hostSalaryToAgent"
:active-value="false"
:inactive-value="true"
/>
</el-form-item>
</div>
</el-form>
</div>
<div class="drawer-footer">
<el-button :disabled="submitLoading" @click="handleClose()">取消</el-button>
<el-button type="primary" :disabled="submitLoading" :loading="submitLoading" @click="submitForm()">保存</el-button>
<el-button :disabled="submitLoading" @click="handleClose()"
>取消</el-button
>
<el-button
type="primary"
:disabled="submitLoading"
:loading="submitLoading"
@click="submitForm()"
>保存</el-button
>
</div>
</div>
</el-drawer>
</div>
</template>
<script>
import ContrySelect from '@/components/data/ContrySelect'
import { contactTypes, billCyclePolicyTypes } from '@/constant/team-type'
import { updateTeamProfile } from '@/api/team'
import { deepClone } from '@/utils'
import ContrySelect from "@/components/data/ContrySelect";
import { contactTypes, billCyclePolicyTypes } from "@/constant/team-type";
import { updateTeamProfile } from "@/api/team";
import { deepClone } from "@/utils";
export default {
name: 'TeamEdit',
name: "TeamEdit",
components: { ContrySelect },
props: {
profile: {
@ -89,54 +115,53 @@ export default {
},
data() {
const commonRules = [
{ required: true, message: '必填字段不可为空', trigger: 'blur' }
]
{ required: true, message: "必填字段不可为空", trigger: "blur" }
];
return {
billCyclePolicyTypes,
contactTypes,
submitLoading: false,
formSettingDefault: false,
formContactAdd: false,
tmpRegion: '',
tmpRegion: "",
form: {
sysOrigin: '',
region: '',
nickname: '',
avatar: '',
sysOrigin: "",
region: "",
nickname: "",
avatar: "",
setting: {
maxMember: '1000'
maxMember: "1000"
},
country: {
countryId: '',
countryCode: '',
countryName: ''
countryId: "",
countryCode: "",
countryName: ""
}
},
formRules: {
sysOrigin: commonRules,
region: commonRules,
nickname: commonRules,
'country.countryId': commonRules,
'setting.maxMember': commonRules
"country.countryId": commonRules,
"setting.maxMember": commonRules
},
selecteRegion: {}
}
},
computed: {
};
},
computed: {},
watch: {
profile: {
handler(newVal) {
this.tmpRegion = ''
const form = deepClone(newVal)
this.tmpRegion = form.region
this.tmpRegion = "";
const form = deepClone(newVal);
this.tmpRegion = form.region;
if (!form.country) {
form.country = this.form.country
form.country = this.form.country;
}
if (form.country && !form.country.countryId) {
form.country = this.form.country
form.country = this.form.country;
}
this.form = form
this.form = form;
},
immediate: true
}
@ -144,56 +169,74 @@ export default {
methods: {
handleClose() {
if (this.submitLoading) {
this.$opsMessage.warn('正在提交!')
return
this.$opsMessage.warn("正在提交!");
return;
}
this.$emit('close')
this.$emit("close");
},
contrySelectChange(id, row) {
this.form.country.countryId = row.id
this.form.country.countryCode = row.code
this.form.country.countryName = row.name
this.form.country.countryId = row.id;
this.form.country.countryCode = row.code;
this.form.country.countryName = row.name;
},
changeRegionSelectPolicy(val, item) {
this.selecteRegion = item
this.selecteRegion = item;
},
submitForm() {
const that = this
const that = this;
that.$refs.form.validate(valid => {
if (!valid) {
console.error('error submit!!')
return false
console.error("error submit!!");
return false;
}
if (!that.form.id || this.tmpRegion === that.form.region) {
that.submitLoading = true
updateTeamProfile(that.form).then(res => {
that.submitLoading = false
that.$emit('success', Object.assign({}, that.form), that.selecteRegion)
that.handleClose()
}).catch(err => {
that.submitLoading = false
that.$emit('fial', err)
})
return
that.submitLoading = true;
updateTeamProfile(that.form)
.then(res => {
that.submitLoading = false;
that.$emit(
"success",
Object.assign({}, that.form),
that.selecteRegion
);
that.handleClose();
})
.catch(err => {
that.submitLoading = false;
that.$emit("fial", err);
});
return;
}
that.$confirm('变更代理团队区域将清空该代理名下所有主播目标,你确定继续吗?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
that.submitLoading = true
updateTeamProfile(that.form).then(res => {
that.submitLoading = false
that.$emit('success', Object.assign({}, that.form), that.selecteRegion)
that.handleClose()
}).catch(err => {
that.submitLoading = false
that.$emit('fial', err)
that
.$confirm(
"变更代理团队区域将清空该代理名下所有主播目标,你确定继续吗?",
"提示",
{
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}
)
.then(() => {
that.submitLoading = true;
updateTeamProfile(that.form)
.then(res => {
that.submitLoading = false;
that.$emit(
"success",
Object.assign({}, that.form),
that.selecteRegion
);
that.handleClose();
})
.catch(err => {
that.submitLoading = false;
that.$emit("fial", err);
});
})
}).catch(() => {
})
.catch(() => {});
// <el-alert
// :v-if="tmpRegion !== form.region"
// title=",?"
@ -201,9 +244,8 @@ export default {
// effect="dark"
// :closable="false"
// />
})
});
}
}
}
};
</script>