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