区域代理

main
liudan 8 months ago
parent e2bacc76b8
commit 940e5d9a8d
  1. 9
      view/admin/src/api/user.js
  2. 92
      view/admin/src/views/user/list/index.vue

@ -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 })
}

@ -222,6 +222,14 @@
<el-dialog v-if="visibleCoupon" title="优惠券列表" :visible.sync="visibleCoupon" width="1000px">
<coupon-List v-if="visibleCoupon" ref="couponList" :couponForm="couponForm" :checkedIds="checkedIds" :allCheck="allCheck" :userFrom="userFrom" @sendSuccess="sendSuccess" />
</el-dialog>
<el-dialog title="设置区域代理" :visible.sync="areaDialogVisible" width="30%">
<el-cascader @change="getAreaText" ref="tree" v-model="selectedValue" :props="props"></el-cascader>
<span slot="footer" class="dialog-footer">
<el-button @click="areaDialogVisible = false"> </el-button>
<el-button type="primary" @click="submitArea"> </el-button>
</span>
</el-dialog>
</div>
</template>
@ -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) {

Loading…
Cancel
Save