区域代理

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) { export function giveMemberApi(id) {
return request.get(`user/svip/${id}/form`) 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"> <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" /> <coupon-List v-if="visibleCoupon" ref="couponList" :couponForm="couponForm" :checkedIds="checkedIds" :allCheck="allCheck" :userFrom="userFrom" @sendSuccess="sendSuccess" />
</el-dialog> </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> </div>
</template> </template>
@ -250,7 +258,9 @@ import {
modifyUserPassword, modifyUserPassword,
changeMemberApi, changeMemberApi,
createUserApi, createUserApi,
giveMemberApi giveMemberApi,
getArea,
setAreaApi
} from '@/api/user' } from '@/api/user'
import newsCategory from '@/components/newsCategory/index.vue' import newsCategory from '@/components/newsCategory/index.vue'
import userDetails from './userDetails' import userDetails from './userDetails'
@ -265,6 +275,7 @@ export default {
}, },
data() { data() {
return { return {
areaDialogVisible:false,
moren: require("@/assets/images/f.png"), moren: require("@/assets/images/f.png"),
pickerOptions: { pickerOptions: {
shortcuts: [{ shortcuts: [{
@ -406,7 +417,59 @@ export default {
昵称: '' 昵称: ''
}, },
allCheck: false, 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('') this.getList('')
}, },
methods: { 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) { onHandle(name) {
this.chkName = this.chkName === name ? '' : name this.chkName = this.chkName === name ? '' : name
@ -646,7 +728,11 @@ export default {
}, },
// //
setLabel(row) { 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) { setMember(row) {

Loading…
Cancel
Save