添加修改推广人员对接

master
yinliujing 6 years ago
parent 4312a6f990
commit 4bdb9fc97a

@ -7,20 +7,20 @@
<span class="region">区域选择</span> <span class="region">区域选择</span>
</i-col> </i-col>
<i-col span="4" style="padding-left: 10px;"> <i-col span="4" style="padding-left: 10px;">
<Select v-model="selectedRegion" filterable style="width: 200px;"> <Select v-model="selectedRegion" filterable @on-change="downRegionChange" style="width: 200px;">
<Option v-for="item in regionList" :value="item.value" :key="item.value">{{ item.label }}</Option> <Option v-for="item in regionList" :value="item.id" :key="item.id">{{ item.name }}</Option>
</Select> </Select>
</i-col> </i-col>
<i-col span="1" style="text-align: right;"> <i-col span="1" style="text-align: right;">
<span class="region">店铺选择</span> <span class="region">店铺选择</span>
</i-col> </i-col>
<i-col span="4" style="padding-left: 10px;"> <i-col span="4" style="padding-left: 10px;">
<Select v-model="selectedStore" filterable style="width: 200px;"> <Select v-model="selectedStore" filterable style="width: 200px;" >
<Option v-for="item in storeList" :value="item.value" :key="item.value">{{ item.label }}</Option> <Option v-for="item in shopList" :value="item.id" :key="item.id">{{ item.name }}</Option>
</Select> </Select>
</i-col> </i-col>
<i-col span="2"> <i-col span="2">
<Button type="primary"></Button> <Button type="primary" @click="searchCustomerDataBtnClick"></Button>
</i-col> </i-col>
<i-col span="12" style="text-align: right;padding-right: 20px;"> <i-col span="12" style="text-align: right;padding-right: 20px;">
<Button type="primary" style="margin-right: 10px;">批量下载</Button> <Button type="primary" style="margin-right: 10px;">批量下载</Button>
@ -45,7 +45,7 @@
</template> </template>
<template slot-scope="{ row, index }" slot="action"> <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> <Button ghost type="error" size="small" @click="remove(index)"></Button>
</template> </template>
</Table> </Table>
@ -57,7 +57,7 @@
:footer-hide="true" :footer-hide="true"
width="230" width="230"
class-name="vertical-center-modal" class-name="vertical-center-modal"
> >
<div slot="header">{{this.showStoreName}}</div> <div slot="header">{{this.showStoreName}}</div>
<img :src="qrCodeImage" style="width:200px;height:200px;"/> <img :src="qrCodeImage" style="width:200px;height:200px;"/>
<div style="text-align: center;"> <div style="text-align: center;">
@ -69,7 +69,7 @@
<Modal <Modal
v-model="isShowAdd" v-model="isShowAdd"
:footer-hide="true" :footer-hide="true"
> >
<div slot="header"> <div slot="header">
<template v-if="flag === 1"> <template v-if="flag === 1">
<span>添加推广人员</span> <span>添加推广人员</span>
@ -90,57 +90,58 @@
<FormItem label="工号" prop="staffCode"> <FormItem label="工号" prop="staffCode">
<i-input v-model="formValidate.staffCode" placeholder="请输入工号" :disabled="flag !== 1 ? true : false" ></i-input> <i-input v-model="formValidate.staffCode" placeholder="请输入工号" :disabled="flag !== 1 ? true : false" ></i-input>
</FormItem> </FormItem>
<FormItem label="角色" prop="role"> <FormItem label="角色" prop="role" :rules="rules">
<Select v-model="formValidate.role" placeholder="选择角色"> <Select v-model="formValidate.role" placeholder="选择角色">
<Option value="1">角色1</Option> <Option :value="1" >店长</Option>
<Option value="2">角色2</Option> <Option :value="2" >副店长</Option>
<Option value="3">角色3</Option> <Option :value="3" >店长助理</Option>
<Option :value="4" >导购</Option>
</Select> </Select>
</FormItem> </FormItem>
<FormItem label="所属区域" prop="region"> <FormItem label="所属区域" prop="region">
<Select v-model="formValidate.region" placeholder="选择区域"> <Select v-model="formValidate.region" placeholder="选择区域">
<Option value="1">区域1</Option> <Option v-for="item in regionList" :value="item.id" :key="item.id" >{{item.name}}</Option>
<Option value="2">区域2</Option>
<Option value="3">区域3</Option>
</Select> </Select>
</FormItem> </FormItem>
<FormItem label="所属店铺" prop="store"> <FormItem label="所属店铺" prop="store" >
<Select v-model="formValidate.store" placeholder="选择店铺"> <Select v-model="formValidate.store" placeholder="选择店铺">
<Option value="1">店铺1</Option> <Option v-for="item in shopList" :value="item.id" :key="item.id">{{item.name}}</Option>
<Option value="2">店铺2</Option>
<Option value="3">店铺3</Option>
</Select> </Select>
</FormItem> </FormItem>
<FormItem style="text-align: left;"> <FormItem style="text-align: left;">
<Row> <Row>
<i-col span="16"> <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> <Button @click="handleReset('formValidate')" style="margin-left: 8px">取消</Button>
</i-col> </i-col>
<i-col span="8" style="text-align: right;"> <i-col span="8" style="text-align: right;">
<Button>继续添加</Button> <Button @click="handleAdd(formValidate)" v-if="flag === 1">
<span>继续添加</span>
</Button>
</i-col> </i-col>
</Row> </Row>
</FormItem> </FormItem>
</Form> </Form>
</Modal> </Modal>
<div style="margin: 30px;overflow: hidden"> <div style="margin: 30px;overflow: hidden">
<div style="float: right;"> <div style="float: right;">
<Page :total="total" :current="pageNum" :pageSize="pageSize"></Page> <Page :total="total" :current="pageNum" :pageSize="pageSize"></Page>
</div>
</div> </div>
</div>
</div> </div>
</template> </template>
<script> <script>
import data from "../../utils/PhoneRegionData"; 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 { export default {
name: "IncreaseStaffManager", name: "IncreaseStaffManager",
data () { data () {
return { return {
userId: 13,
// 1 2 // 1 2
flag: 1, flag: 1,
prefixDefault: data.prefixDefault, prefixDefault: data.prefixDefault,
@ -152,13 +153,16 @@
spuLoading:false, spuLoading:false,
// //
total: 0, total: 0,
pageSize: 15, pageSize: 10,
pageNum: 1, pageNum: 1,
selectedRegion: null, selectedRegion: null,
regionList: [], regionList: [],
selectedStore: null, selectedStore: null,
storeList: [], storeList: [],
shopList:[],
roleList: [],
rowData:{}, rowData:{},
rules: {required: false},
columns1: [ columns1: [
{ {
title: '序号', title: '序号',
@ -215,11 +219,13 @@
data1: [], data1: [],
// //
formValidate: { formValidate: {
name:'',
staffCode: '', staffCode: '',
region: '', region: '',
phone: '', phone: '',
role: '', role: '',
store: '' store: '',
userId : ''
}, },
ruleValidate: { ruleValidate: {
name: [ name: [
@ -233,19 +239,22 @@
// { type: 'email', message: '', trigger: 'blur' } // { type: 'email', message: '', trigger: 'blur' }
// ], // ],
role: [ role: [
{ required: true, message: '请选择角色', trigger: 'change' } { required: true,type:String ,message: '请选择角色', trigger: 'change' }
], ],
region: [ region: [
{ required: true, message: '请选择区域', trigger: 'change' } { required: true, type:String,message: '请选择区域', trigger: 'change' }
], ],
store: [ store: [
{ required: true, message: '请选择店铺', trigger: 'change' } { required: true,type:String, message: '请选择店铺', trigger: 'change' }
] ]
} }
} }
}, },
mounted() { mounted() {
this.listOfLogistics(); this.listOfLogistics();
this.downRegionData();
this.downShopData();
this.downRoleData()
}, },
methods: { methods: {
changePage (page) { changePage (page) {
@ -256,8 +265,8 @@
let that = this; let that = this;
let request = { let request = {
userId: 1 , userId: 1 ,
region: that.region, region: that.changeData(that.selectedRegion),
shopId: that.store, shopId: that.changeData(that.selectedStore),
pageNum: that.pageNum, pageNum: that.pageNum,
pageSize: that.pageSize, 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 () { onChangeDateLister: function () {
@ -313,9 +402,22 @@
image.src = index.epWechatQrCode; image.src = index.epWechatQrCode;
}, },
// 广 // 广
open: function (flag) { open: function (flag,row) {
this.flag = flag; this.flag = flag;
this.isShowAdd = true; 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 () { remove: function () {
@ -325,19 +427,42 @@
onSwitchChangeLister: function () { onSwitchChangeLister: function () {
}, },
handleSubmit (name) { handleSubmit (value) {
this.$refs[name].validate((valid) => {
if (valid) { 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 { }else {
this.$Message.error('Fail!'); //
this.editSattf(request);
} }
})
} else {
this.$Message.error('Fail!');
}
}, },
handleReset (name) { handleReset (name) {
this.$refs[name].resetFields(); this.$refs[name].resetFields();
this.isShowAdd = false; 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) 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 { export default {
getStaffList getStaffList,
downRegionData,
downShopData,
downRoleData,
addSattf,
editSattf
} }

Loading…
Cancel
Save