diff --git a/view/admin/src/api/user.js b/view/admin/src/api/user.js index b161526..54d2352 100644 --- a/view/admin/src/api/user.js +++ b/view/admin/src/api/user.js @@ -388,3 +388,12 @@ export function getVersion() { export function giveMemberApi(id) { return request.get(`user/svip/${id}/form`) } +//获取区域列表 +export function getArea(id) { + return request.get(`store/city/lst/${id}`) +} + +// 更改标签 +export function setAreaApi(uid,data) { + return request.post(`user/change_agent/${uid}`, { data }) +} \ No newline at end of file diff --git a/view/admin/src/views/user/list/index.vue b/view/admin/src/views/user/list/index.vue index f4e22db..866875b 100644 --- a/view/admin/src/views/user/list/index.vue +++ b/view/admin/src/views/user/list/index.vue @@ -222,6 +222,14 @@ + + + + 取 消 + 确 定 + + + @@ -250,7 +258,9 @@ import { modifyUserPassword, changeMemberApi, createUserApi, - giveMemberApi + giveMemberApi, + getArea, + setAreaApi } from '@/api/user' import newsCategory from '@/components/newsCategory/index.vue' import userDetails from './userDetails' @@ -265,6 +275,7 @@ export default { }, data() { return { + areaDialogVisible:false, moren: require("@/assets/images/f.png"), pickerOptions: { shortcuts: [{ @@ -406,7 +417,59 @@ export default { 昵称: '' }, allCheck: false, - cancel_time: null + cancel_time: null, + props: { + lazy: true, + lazyLoad (node, resolve) { + console.log(node) + const { level } = node; + if(level==0){ + getArea(0).then(res=>{ + + let nodes=res.data.map(item=>{ + return{ + value:item.id, + label:item.name, + leaf:false + } + }) + resolve(nodes); + + }) + }else if(level==1){ + getArea(node.value).then(res=>{ + + let nodes=res.data.map(item=>{ + return{ + value:item.id, + label:item.name, + leaf:false + } + }) + resolve(nodes); + + }) + }else if(level==2){ + getArea(node.value).then(res=>{ + + let nodes=res.data.map(item=>{ + return{ + value:item.id, + label:item.name, + leaf:true + } + }) + resolve(nodes); + + }) + } + + } + }, + selectedUser:{}, + selectedValue:null, + regionText:'' + } }, @@ -416,6 +479,25 @@ export default { this.getList('') }, methods: { + submitArea(){ + if(!this.selectedValue){ + this.$message.warning('请选择区域'); + return; + } + + setAreaApi(this.selectedUser.uid,{agent_district_id:this.selectedValue[this.selectedValue.length-1],agent_district:this.regionText}).then((res) => { + this.getList('') + this.areaDialogVisible = false; + }).catch(({ message }) => { + this.$message.error(message); + }); + }, + getAreaText(val){ + + let data = this.$refs.tree.getCheckedNodes()[0].pathLabels.toString() + + this.regionText = data + }, // 用户 onHandle(name) { this.chkName = this.chkName === name ? '' : name @@ -646,7 +728,11 @@ export default { }, // 修改标签 setLabel(row) { - this.$modalForm(changelabelApi(row.uid)).then(() => this.getList('')) + this.selectedValue = null; + this.selectedUser = row; + + this.areaDialogVisible = true; + // this.$modalForm(changelabelApi(row.uid)).then(() => this.getList('')) }, // 编辑会员等级 setMember(row) {