添加修改推广人员对接

master
yinliujing 6 years ago
parent 4312a6f990
commit 4bdb9fc97a

@ -7,20 +7,20 @@
<span class="region">区域选择</span>
</i-col>
<i-col span="4" style="padding-left: 10px;">
<Select v-model="selectedRegion" filterable style="width: 200px;">
<Option v-for="item in regionList" :value="item.value" :key="item.value">{{ item.label }}</Option>
<Select v-model="selectedRegion" filterable @on-change="downRegionChange" style="width: 200px;">
<Option v-for="item in regionList" :value="item.id" :key="item.id">{{ item.name }}</Option>
</Select>
</i-col>
<i-col span="1" style="text-align: right;">
<span class="region">店铺选择</span>
</i-col>
<i-col span="4" style="padding-left: 10px;">
<Select v-model="selectedStore" filterable style="width: 200px;">
<Option v-for="item in storeList" :value="item.value" :key="item.value">{{ item.label }}</Option>
<Select v-model="selectedStore" filterable style="width: 200px;" >
<Option v-for="item in shopList" :value="item.id" :key="item.id">{{ item.name }}</Option>
</Select>
</i-col>
<i-col span="2">
<Button type="primary"></Button>
<Button type="primary" @click="searchCustomerDataBtnClick"></Button>
</i-col>
<i-col span="12" style="text-align: right;padding-right: 20px;">
<Button type="primary" style="margin-right: 10px;">批量下载</Button>
@ -45,7 +45,7 @@
</template>
<template slot-scope="{ row, index }" slot="action">
<Button ghost type="primary" size="small" style="margin-right: 5px" @click="open(2, index)">修改</Button>
<Button ghost type="primary" size="small" style="margin-right: 5px" @click="open(2, row)">修改</Button>
<Button ghost type="error" size="small" @click="remove(index)"></Button>
</template>
</Table>
@ -90,35 +90,34 @@
<FormItem label="工号" prop="staffCode">
<i-input v-model="formValidate.staffCode" placeholder="请输入工号" :disabled="flag !== 1 ? true : false" ></i-input>
</FormItem>
<FormItem label="角色" prop="role">
<FormItem label="角色" prop="role" :rules="rules">
<Select v-model="formValidate.role" placeholder="选择角色">
<Option value="1">角色1</Option>
<Option value="2">角色2</Option>
<Option value="3">角色3</Option>
<Option :value="1" >店长</Option>
<Option :value="2" >副店长</Option>
<Option :value="3" >店长助理</Option>
<Option :value="4" >导购</Option>
</Select>
</FormItem>
<FormItem label="所属区域" prop="region">
<Select v-model="formValidate.region" placeholder="选择区域">
<Option value="1">区域1</Option>
<Option value="2">区域2</Option>
<Option value="3">区域3</Option>
<Option v-for="item in regionList" :value="item.id" :key="item.id" >{{item.name}}</Option>
</Select>
</FormItem>
<FormItem label="所属店铺" prop="store">
<FormItem label="所属店铺" prop="store" >
<Select v-model="formValidate.store" placeholder="选择店铺">
<Option value="1">店铺1</Option>
<Option value="2">店铺2</Option>
<Option value="3">店铺3</Option>
<Option v-for="item in shopList" :value="item.id" :key="item.id">{{item.name}}</Option>
</Select>
</FormItem>
<FormItem style="text-align: left;">
<Row>
<i-col span="16">
<Button type="primary" @click="handleSubmit('formValidate')">广</Button>
<Button type="primary" @click="handleSubmit(formValidate)">广</Button>
<Button @click="handleReset('formValidate')" style="margin-left: 8px">取消</Button>
</i-col>
<i-col span="8" style="text-align: right;">
<Button>继续添加</Button>
<Button @click="handleAdd(formValidate)" v-if="flag === 1">
<span>继续添加</span>
</Button>
</i-col>
</Row>
</FormItem>
@ -136,11 +135,13 @@
<script>
import data from "../../utils/PhoneRegionData";
import staff from "../../services/staff/staff";
import staff, {downRoleData} from "../../services/staff/staff";
import customerDetail from "../../services/datacenter/DataCenter";
export default {
name: "IncreaseStaffManager",
data () {
return {
userId: 13,
// 1 2
flag: 1,
prefixDefault: data.prefixDefault,
@ -152,13 +153,16 @@
spuLoading:false,
//
total: 0,
pageSize: 15,
pageSize: 10,
pageNum: 1,
selectedRegion: null,
regionList: [],
selectedStore: null,
storeList: [],
shopList:[],
roleList: [],
rowData:{},
rules: {required: false},
columns1: [
{
title: '序号',
@ -215,11 +219,13 @@
data1: [],
//
formValidate: {
name:'',
staffCode: '',
region: '',
phone: '',
role: '',
store: ''
store: '',
userId : ''
},
ruleValidate: {
name: [
@ -233,19 +239,22 @@
// { type: 'email', message: '', trigger: 'blur' }
// ],
role: [
{ required: true, message: '请选择角色', trigger: 'change' }
{ required: true,type:String ,message: '请选择角色', trigger: 'change' }
],
region: [
{ required: true, message: '请选择区域', trigger: 'change' }
{ required: true, type:String,message: '请选择区域', trigger: 'change' }
],
store: [
{ required: true, message: '请选择店铺', trigger: 'change' }
{ required: true,type:String, message: '请选择店铺', trigger: 'change' }
]
}
}
},
mounted() {
this.listOfLogistics();
this.downRegionData();
this.downShopData();
this.downRoleData()
},
methods: {
changePage (page) {
@ -256,8 +265,8 @@
let that = this;
let request = {
userId: 1 ,
region: that.region,
shopId: that.store,
region: that.changeData(that.selectedRegion),
shopId: that.changeData(that.selectedStore),
pageNum: that.pageNum,
pageSize: that.pageSize,
};
@ -280,6 +289,86 @@
}
})
},
//
downRegionData: function () {
let that = this;
that.regionList = [{"id":0,"name":"全部"}];
let request =
{userId: that.userId};
staff.downRegionData(request, function (data) {
data = data.data.results;
if(data){
for(let i=0;i<data.length;i++){
let entity = data[i];
if(entity){
that.regionList.push(entity);
}
}
}
})
},
downShopData: function () {
let that = this;
that.shopList = [{"id":0,"name":"全部"}];
let request =
{userId: that.userId,regionId: that.changeData(that.selectedRegion)};
staff.downShopData(request, function (data) {
data = data.data.results;
if(data){
for(let i=0;i<data.length;i++){
let entity = data[i];
if(entity){
that.shopList.push(entity);
}
}
}
})
},
downRoleData: function () {
let that = this;
staff.downRoleData({}, function (data) {
data = data.data.results;
if(data){
for(let i=0;i<data.length;i++){
let entity = data[i];
if(entity){
that.roleList.push(entity);
}
}
}
})
},
addSattf : function (request){
let that = this;
staff.addSattf(request,function (data) {
data = data.data;
if (data.code == "0000"){
that.$Message.success('添加成功!');
}
})
},
editSattf : function (request){
let that = this;
staff.editSattf(request,function (data) {
data = data.data;
if (data.code == "0000"){
that.$Message.success('修改成功!');
that.isShowAdd = false;
}
})
},
searchCustomerDataBtnClick: function () {
this.listOfLogistics();
},
changeData: function (value) {
if(value == 0){return null;}
return value;
},
downRegionChange: function () {
this.downShopData();
},
//
onChangeDateLister: function () {
@ -313,9 +402,22 @@
image.src = index.epWechatQrCode;
},
// 广
open: function (flag) {
open: function (flag,row) {
this.flag = flag;
this.isShowAdd = true;
if(flag == 2){
this.formValidate = {
name: row.name,
staffCode: row.staffCode,
region: row.region,
phone: row.mobil,
role: row.type,
store: row.storeId,
userId:row.userId,
id : row.id
}
}
},
//
remove: function () {
@ -325,19 +427,42 @@
onSwitchChangeLister: function () {
},
handleSubmit (name) {
this.$refs[name].validate((valid) => {
if (valid) {
handleSubmit (value) {
if (value) {
let request = {
name : value.name,
storeId:value.store,
mobil: value.phone,
staffCode :value.staffCode,
roleId: value.role,
userId : this.formValidate.userId,
id:this.formValidate.id
};
if (this.flag == 1){
//
this.$Message.success('Success!');
this.addSattf(request);
}else {
//
this.editSattf(request);
}
} else {
this.$Message.error('Fail!');
}
})
},
handleReset (name) {
this.$refs[name].resetFields();
this.isShowAdd = false;
},
handleAdd(value){
value.name = "";
value.store = "";
value.phone ="";
value.staffCode ="";
value.role ="";
value.region ="";
}
}
}

@ -16,6 +16,39 @@ export function getStaffList(params, call) {
return http.get('/store/staff/list', params).then(call)
}
/**
* 下拉框数据区域
*/
export function downRegionData(params, call) {
return http.post('/region/user/only/region',params).then(call)
}
/**
* 下拉框数据店铺
*/
export function downShopData(params, call) {
return http.get('/poi/store/user/shop',params).then(call)
}
/**
* 下拉角色数据
*/
export function downRoleData(params, call) {
return http.get('/role/info/list',params).then(call)
}
export function addSattf(params, call) {
return http.post('/store/staff/add',params).then(call)
}
export function editSattf(params, call) {
return http.post('/store/staff/edit',params).then(call)
}
export default {
getStaffList
getStaffList,
downRegionData,
downShopData,
downRoleData,
addSattf,
editSattf
}

Loading…
Cancel
Save