diff --git a/common/http.interceptor.js b/common/http.interceptor.js index f5e4284..b06131f 100644 --- a/common/http.interceptor.js +++ b/common/http.interceptor.js @@ -1,6 +1,6 @@ const install = (Vue, vm) => { Vue.prototype.$u.http.setConfig({ - baseUrl: 'http://192.168.2.17:3100/dev-api', + baseUrl: 'http://192.168.2.24:3100/dev-api', // baseUrl: 'https://znb.ccttiot.com', loadingText: '努力加载中~', loadingTime: 800, diff --git a/page_user/daili/cjdaili.vue b/page_user/daili/cjdaili.vue index c425168..d3bd260 100644 --- a/page_user/daili/cjdaili.vue +++ b/page_user/daili/cjdaili.vue @@ -7,19 +7,19 @@ - 代理级别 + 代理级别 - 代理名称 + 代理名称 - 分成比例 + 分成比例 - 手机号码 + 手机号码 - 省市区 + 省市区 @@ -27,125 +27,22 @@ 商户权限 - + - 允许登录 + {{item.name}} - 代理登录系统 + {{item.tit}} - + - - - - 允许提现 - - - 代理钱包余额提现 - - - - - - - - - - 展示分成比例 - - - 是否展示分成比例 - - - - - - - - - - 代理操作 - - - 是否展示操作代理 - - - - - - - - - - 设备显示 - - - 是否允许设备显示 - - - - - - - - - - 设备操作 - - - 是否展示设备操作 - - - - - - - - - - 店铺操作 - - - 是否展示店铺操作 - - - - - - - - - - 订单管理 - - - 是否允许查看订单 - - - - - - - + - + 保存 @@ -156,16 +53,130 @@ export default { data() { return { - checked: false, + list:[ + {name:'允许登录',tit:'代理登录系统',checked:false}, + {name:'允许提现',tit:'代理钱包余额提现',checked:false}, + {name:'展示分成比例',tit:'是否展示分成比例',checked:false}, + {name:'代理操作',tit:'是否展示操作代理',checked:false}, + {name:'设备显示',tit:'是否允许设备显示',checked:false}, + {name:'设备操作',tit:'是否展示设备操作',checked:false}, + {name:'店铺操作',tit:'是否展示店铺操作',checked:false}, + {name:'订单管理',tit:'是否允许查看订单',checked:false} + ], show:false, bgc: { backgroundColor: " #25CE88", }, + level:'', + name:'', + ratio:'', + tel:'', + sheng:'请选择省市区', + arr:[], + arrqx:[] } }, methods: { confirm(e){ - console.log(e); + this.arr = [] + this.sheng = e.province.label + '/' + e.city.label + "/" + e.area.label + this.arr.push(e.province.label) + this.arr.push(e.city.label) + this.arr.push(e.area.label) + }, + change(e){ + console.log(this.list) + + }, + + btncj(){ + if(this.name == '' || this.name == '请输入代理名称'){ + uni.showToast({ + title: '请输入代理名称', + icon: 'none', + duration: 1000 + }) + }else if(this.ratio == '' || this.ratio == '请输入分成比例 %'){ + uni.showToast({ + title: '请输入分成比例 %', + icon: 'none', + duration: 1000 + }) + }else if(this.tel == '' || this.tel == '请输入手机号码'){ + uni.showToast({ + title: '请输入手机号码', + icon: 'none', + duration: 1000 + }) + }else if(this.sheng == '请选择省市区'){ + uni.showToast({ + title: '请选择省市区', + icon: 'none', + duration: 1000 + }) + }else{ + this.arrqx = [] + const mapping = { + '允许登录': 'agent:login', + '允许提现': 'agent:withdraw', + '展示分成比例': 'agent:point:show', + '代理操作': 'agent:operation', + '设备显示': 'agent:device:show', + '设备操作': 'agent:device:operation', + '店铺操作': 'agent:store:operation', + '订单管理': 'agent:order:manage' + }; + this.list.forEach((item) => { + if (item.checked && mapping.hasOwnProperty(item.name)) { + this.arrqx.push(mapping[item.name]); + } + }) + + let data = { + name:this.name, + point:this.ratio, + mobile:this.tel, + area:this.arr, + permissions:this.arrqx + } + this.$u.post('/agent/agent',data).then(res => { + if (res.code == 200) { + uni.showToast({ + title: '创建成功', + icon: 'success', + duration: 1000 + }) + setTimeout(()=>{ + uni.navigateBack() + },1500) + }else if(res.msg == '请输入正确的手机号'){ + uni.showToast({ + title: '请输入正确的手机号', + icon: 'none', + duration: 1000 + }) + }else if(res.msg == '该手机号所绑定的用户已经是代理商,请勿重复绑定'){ + uni.showToast({ + title: '该手机号所绑定的用户已经是代理商,请勿重复绑定', + icon: 'none', + duration: 1000 + }) + }else if(res.msg == '分成比例不允许超过上级代理,最高:90.00'){ + uni.showToast({ + title: '分成比例不允许超过上级代理,最高:90.00', + icon: 'none', + duration: 1000 + }) + } else if(res.code == 500){ + uni.showToast({ + title: '分成比例必须为数字', + icon: 'none', + duration: 1000 + }) + } + }) + + } } } } diff --git a/page_user/daili/index.vue b/page_user/daili/index.vue index f8550fe..783a0a7 100644 --- a/page_user/daili/index.vue +++ b/page_user/daili/index.vue @@ -1,6 +1,6 @@