推广人员和店铺人员页面

master
yinliujing 6 years ago
parent 4f2418778c
commit 00e99cd87f

@ -3,28 +3,7 @@
<Row style="margin-top: 20px;width: 100%;background-color: #F7F8FA;">
<i-col span="24" style="text-align: left;padding-left: 10px;">
<Row class="row-style">
<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="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 shopList" :value="item.id" :key="item.id">{{ item.name }}</Option>
</Select>
</i-col>
<i-col span="2">
<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>
<Button type="primary" style="margin-right: 10px;" to="/shop/increase/manager/staff/batch/add">批量添加</Button>
<i-col span="24" style="text-align: right;padding-right: 20px;">
<Button type="primary" @click="open(1)">广</Button>
</i-col>
</Row>
@ -32,11 +11,9 @@
</Row>
<Table :columns="columns1" :data="data1" style="margin-top: 20px;">
<template slot-scope="{ row, index }" slot="qrCodeAction">
<Button ghost type="primary" size="small" style="margin-right: 5px" @click="show(row)"></Button>
<Button ghost type="primary" size="small" @click="download(row)"></Button>
</template>
<template slot-scope="{ row, index }" slot="qrCodeAction">
<img :src="require('../../../static/img/qrCode-init.png')" @click="show(row)" style="margin-left: 5px;margin-top: 5px;width:30px;height:30px;"/>
</template>
<template slot-scope="{ row, index }" slot="state">
<i-switch size="large" :value="row.qrCodeState" @on-change="onSwitchChangeLister(row, index)">
<span slot="open">开启</span>
@ -46,7 +23,7 @@
<template slot-scope="{ row, index }" slot="action">
<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(row)"></Button>
</template>
</Table>
@ -91,52 +68,36 @@
<i-input v-model="formValidate.staffCode" placeholder="请输入工号" :disabled="flag !== 1 ? true : false" ></i-input>
</FormItem>
<FormItem label="角色" prop="role" :rules="rules">
<Select v-model="formValidate.role" placeholder="选择角色">
<Select v-model="formValidate.role" placeholder="选择角色" :disabled="flag !== 1 ? true : false">
<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 v-for="item in regionList" :value="item.id" :key="item.id" >{{item.name}}</Option>
</Select>
</FormItem>
<FormItem label="所属店铺" prop="store" >
<Select v-model="formValidate.store" placeholder="选择店铺">
<Option v-for="item in shopList" :value="item.id" :key="item.id">{{item.name}}</Option>
</Select>
<FormItem v-if="flag === 1" label="" prop="checkbox">
<CheckboxGroup v-model="formValidate.checkbox">
<Checkbox label="vail" >同步开通账号</Checkbox>
</CheckboxGroup>
</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 @click="handleAdd(formValidate)" v-if="flag === 1">
<span>继续添加</span>
</Button>
</i-col>
</Row>
</FormItem>
</Form>
</Modal>
<div style="margin: 30px;overflow: hidden">
<div style="float: right;">
<Page :total="total" :current="pageNum" :pageSize="pageSize"></Page>
</div>
</div>
<Page :total="total" :current="pageNum" :page-size="pageSize" show-elevator show-total
placement="top" @on-change="handlePage" style="margin: 20px 50px 0 0;right:0px;position: absolute;"></Page>
</div>
</template>
<script>
import data from "../../utils/PhoneRegionData";
import staff, {downRoleData} from "../../services/staff/staff";
import customerDetail from "../../services/datacenter/DataCenter";
import staff from "../../services/staff/staff";
export default {
name: "IncreaseStaffManager",
data () {
@ -157,7 +118,7 @@
pageNum: 1,
selectedRegion: null,
regionList: [],
selectedStore: null,
selectedStore: this.$route.query.storeId,
storeList: [],
shopList:[],
roleList: [],
@ -205,12 +166,6 @@
key:'epWechatQrCode',
width: 150
},
{
title: '推广码',
key: 'qrCodeState',
width: 150,
slot: 'state'
},
{
title: '操作',
slot: 'action',
@ -225,7 +180,8 @@
phone: '',
role: '',
store: '',
userId : ''
userId : '',
checkbox: ['vail']
},
ruleValidate: {
name: [
@ -264,9 +220,7 @@
listOfLogistics() {
let that = this;
let request = {
userId: 1 ,
region: that.changeData(that.selectedRegion),
shopId: that.changeData(that.selectedStore),
shopId: that.selectedStore,
pageNum: that.pageNum,
pageSize: that.pageSize,
};
@ -354,6 +308,7 @@
if (data.code == "0000"){
that.$Message.success('修改成功!');
that.isShowAdd = false;
that.listOfLogistics();
}
})
},
@ -365,11 +320,14 @@
if(value == 0){return null;}
return value;
},
//
handlePage:function (value) {
this.pageNum = value;
this.listOfLogistics();
},
downRegionChange: function () {
this.downShopData();
},
//
onChangeDateLister: function () {
},
@ -380,6 +338,7 @@
this.qrCodeImage = index.epWechatQrCode;
this.rowData = index;
},
//
download: function (index) {
let name = index.staffCode+"-"+index.name
@ -409,19 +368,31 @@
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
}
}else {
this.handleAdd(this.formValidate);
}
},
//
remove: function () {
remove: function (row) {
let requset = {
staffId : row.id
}
let that = this;
staff.removeStaff(requset,function (data) {
data = data.data;
if (data.results) {
that.$Message.success('删除成功!');
}else {
that.$Message.success('删除失败!');
}
})
},
// switch
onSwitchChangeLister: function () {
@ -430,19 +401,28 @@
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
};
let request = {};
if (this.flag == 1){
//
request = {
name : value.name,
storeId:this.selectedStore,
mobil: value.phone,
staffCode :value.staffCode,
roleId: value.role,
isOpen: this.formValidate.checkbox[0]
};
this.addSattf(request);
}else {
request = {
name : value.name,
storeId:this.selectedStore,
mobil: value.phone,
staffCode :value.staffCode,
roleId: value.role,
userId : this.formValidate.userId,
id:this.formValidate.id
};
//
this.editSattf(request);
}
@ -463,6 +443,7 @@
value.staffCode ="";
value.role ="";
value.region ="";
value.checkbox=['vail'];
}
}
}

@ -3,12 +3,15 @@
<Row style="margin-top: 20px;width: 100%;background-color: #F7F8FA;">
<i-col span="24" style="text-align: left;padding-left: 10px;">
<Row class="row-style">
<i-col span="3">
<i-input placeholder="请输入店铺名称或编码" style="margin-left: 10px;padding-right: 10px;" v-model="searchShop"/>
</i-col>
<i-col span="1" style="text-align: right;">
<span class="region">区域选择</span>
<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 }}
<Select v-model="selectedRegion" filterable style="width: 200px;" @on-change="downRegionChange" >
<Option v-for="item in regionList" :value="item.id" :key="item.id">{{ item.name }}
</Option>
</Select>
</i-col>
@ -17,17 +20,16 @@
</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 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;">
<i-col span="9" style="text-align: right;padding-right: 20px;">
<Button type="primary" @click="downloadStoreCode" style="margin-right: 10px;">批量下载门店码</Button>
<Button type="primary" @click="downloadStoreSellerCode" style="margin-right: 10px;">批量下载导购码</Button>
<Button type="primary" @click="showImport" style="margin-right: 10px;">批量开通</Button>
</i-col>
</Row>
</i-col>
@ -35,14 +37,7 @@
<Table :columns="columns1" :data="data1" style="margin-top: 20px;">
<template slot-scope="{ row, index }" slot="qrCodeAction">
<Button ghost type="primary" size="small" style="margin-right: 5px" @click="instance(index)" >预览</Button>
<Button ghost type="primary" size="small" @click="download(index)"></Button>
</template>
<template slot-scope="{ row, index }" slot="action">
<Button ghost type="primary" size="small" style="margin-right: 5px" @click="open(index)">
</Button>
<Button ghost type="error" size="small" @click="remove(index)"></Button>
<img :src="require('../../../static/img/qrCode-init.png')" @click="show(row)" style="margin-left: 5px;margin-top: 5px;width:30px;height:30px;"/>
</template>
</Table>
@ -57,7 +52,7 @@
<div slot="header">{{this.showStoreName}}</div>
<img :src="qrCodeImage" style="width:200px;height:200px;"/>
<div style="text-align: center;">
<Button ghost type="primary"></Button>
<Button ghost type="primary" @click="download(rowData)"></Button>
</div>
</Modal>
@ -76,42 +71,41 @@
<i-input v-model="formValidate.alias" placeholder="请输入别名"></i-input>
</FormItem>
<FormItem label="账号" prop="account">
<i-input v-model="formValidate.account" placeholder="请输入账号"></i-input>
</FormItem>
<FormItem label="性别" prop="gender">
<RadioGroup v-model="formValidate.gender">
<Radio label="男"></Radio>
<Radio label="女"></Radio>
</RadioGroup>
<i-input v-model="formValidate.userId" placeholder="请输入账号"></i-input>
</FormItem>
<FormItem label="手机" prop="phone">
<i-input v-model="formValidate.phone" placeholder="成员通过验证该手机号后可加入企业">
<i-input v-model="formValidate.mobile" placeholder="成员通过验证该手机号后可加入企业">
<Select v-model="formValidate.selectedPhoneRegion" slot="prepend" style="width: 80px" >
<Option v-for="item in prefixDefault" :key="item.prefix + item.en" :value="item.prefix">{{item.prefix}}</Option>
</Select>
</i-input>
</FormItem>
<FormItem label="邮箱" prop="mail">
<i-input v-model="formValidate.mail" placeholder="请输入邮箱"></i-input>
<i-input v-model="formValidate.email" placeholder="请输入邮箱"></i-input>
</FormItem>
<FormItem label="地址" prop="address">
<i-input v-model="formValidate.address" placeholder="请输入地址"></i-input>
</FormItem>
<FormItem label="部门" prop="party">
<Select v-model="formValidate.party" placeholder="选择部门">
<Option value="1">部门1</Option>
<Option value="2">部门2</Option>
<Option value="3">部门3</Option>
<FormItem label="零售公司" prop="party">
<Select v-model="formValidate.departIds" placeholder="选择零售公司" @on-change="downCompanyChange(formValidate)">
<Option v-for="item in regionList" :value="item.id" :key="item.id">{{item.name}}</Option>
</Select>
</FormItem>
<FormItem label="店铺" prop="party">
<Select v-model="formValidate.storeId" placeholder="选择店铺">
<Option v-for="item in shopList" :value="item.id" :key="item.id">{{item.name}}</Option>
</Select>
</FormItem>
<!--
<FormItem label="职务" prop="duty">
<i-input v-model="formValidate.duty" placeholder="请输入职务"></i-input>
<FormItem label="职务" prop="position">
<i-input v-model="formValidate.position" placeholder="请输入职务"></i-input>
</FormItem>
-->
<FormItem label="身份" prop="position">
<!--<FormItem label="身份" prop="position">
<i-input v-model="formValidate.position" placeholder="请输入身份"></i-input>
</FormItem>
</FormItem>-->
<FormItem label="">
<CheckboxGroup v-model="formValidate.checkbox">
@ -120,7 +114,7 @@
</FormItem>
<FormItem style="text-align: left;">
<Button type="primary" @click="handleSubmit('formValidate')"></Button>
<Button type="primary" @click="handleSubmit(formValidate)"></Button>
<Button @click="handleReset('formValidate')" style="margin-left: 8px">取消</Button>
</FormItem>
</Form>
@ -159,17 +153,25 @@
</div>
</Upload>
</Modal>
<Page :total="total" :current="pageNum" :page-size="pageSize" show-elevator show-total
placement="top" @on-change="handlePage" style="margin: 20px 50px 0 0;right:0px;position: absolute;"></Page>
</div>
</template>
<script>
import data from '../../utils/PhoneRegionData';
import http from '../../services/store/IncreaseStoreManager';
import staff from "../../services/staff/staff";
export default {
name: "IncreaseStoreManager",
data() {
return {
userId: 13,
searchShop:null,
total: 0,
pageSize: 10,
pageNum: 1,
prefixDefault: data.prefixDefault,
isShow: false,
isShowImport: false,
@ -183,20 +185,26 @@
regionList: [],
errorList: [],
selectedStore: null,
storeList: [],
shopList: [],
rowData:{},
company:null,
columns1: [
{
title: '序号',
key: 'id',
key: 'orderNum',
width: 100
},
{
title: '门店名称',
key: 'storeName'
title: '店铺名称',
key: 'name'
},
{
title: '店铺编码',
key: 'code'
},
{
title: '门店企业号',
key: 'storeWx'
key: 'cpUserId'
},
{
title: '员工数',
@ -218,7 +226,7 @@
}
],
data1: [
{
/* {
id: 1,
storeName: '店铺1',
storeWx: 'D1',
@ -245,23 +253,24 @@
storeWx: 'D4',
staffNum: 10,
customerNum: 999
}
}*/
],
//
formValidate: {
alias: '',
account: '',
userId: '',
gender: '',
phone: '',
mail: '',
mobile: '',
email: '',
address: '',
party: '',
departIds: '',
selectedPhoneRegion: '86',
duty: '',
position: '',
interest: [],
desc: '',
checkbox: ['vail']
checkbox: ['vail'],
storeId:'',
},
ruleValidate: {
account: [
@ -283,23 +292,148 @@
}
}
},
mounted() {
this.listOfStore();
this.downRegionData();
this.downShopData();
},
methods: {
onChangeDateLister: function () {
},
instance: function () {
searchCustomerDataBtnClick: function () {
this.listOfStore();
},
listOfStore() {
let that = this;
let request = {
userId: 1 ,
companyId: that.changeData(that.selectedRegion),
storeId: that.changeData(that.selectedStore),
pageNum: that.pageNum,
pageSize: that.pageSize,
code:that.searchShop
};
http.storeList(request, function (data) {
data = data.data;
if(data.code == "0000") {
that.data1 = [];
let datas = data.results;
//
if (datas.total == null) {
that.total = 0;
} else {
that.total = datas.total;
}
if (datas.list == null) {
datas.list = [];
}
that.data1 = datas.list;
}
})
},
addStoreWX : function (request){
let that = this;
http.addStoreWX(request,function (data) {
data = data.data;
if (data.code == "0000"){
if (data.results.indexOf("8888") != -1){
let str = data.results.split(",");
that.$Message.success('该企业微信已被 【' + str[1] + '】绑定 请从新绑定微信号' );
}else {
that.$Message.success('添加成功!');
that.listOfStore();
}
}
})
},
//
downRegionData: function () {
let that = this;
that.regionList = [{"id":0,"name":"全部"}];
let request =
{userId: that.userId};
http.downCompanyData(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);
}
}
}
})
},
downRegionChange: function () {
this.downShopData();
},
downCompanyChange: function (formValidate) {
this.downShopData(formValidate.departIds);
},
downShopData: function (selected) {
let that = this;
that.shopList = [{"id":0,"name":"全部"}];
let selectValue = selected;
if (!selected){
selectValue = that.selectedRegion
}
let request =
{userId: that.userId,regionId: that.changeData(selectValue)};
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);
}
}
}
})
},
changeData: function (value) {
if(value == 0){return null;}
return value;
},
show: function (index) {
this.isShow = true;
this.showStoreName = '店铺1';
this.qrCodeImage = '../static/img/logo-title.png';
this.showStoreName = index.name;
this.qrCodeImage = index.qrCodeAction;
this.rowData = index;
},
//
download: function (index) {
let name = index.code+"-"+index.name
let image = new Image();
// Canvas
image.setAttribute("crossOrigin", "anonymous");
image.onload = function() {
let canvas = document.createElement("canvas");
canvas.width = image.width;
canvas.height = image.height;
let context = canvas.getContext("2d");
context.drawImage(image, 0, 0, image.width, image.height);
let url = canvas.toDataURL("image/png"); //base64
let a = document.createElement("a"); // a
let event = new MouseEvent("click"); //
a.download = name || "photo"; //
a.href = url; // URLa.href
a.dispatchEvent(event); // a
};
image.src = index.qrCodeAction;
},
//
handlePage:function (value) {
this.pageNum = value;
this.listOfStore();
},
ok: function () {
this.isShow = false;
},
cancel: function () {
this.isShow = false;
},
download: function () {
},
open: function () {
this.isShowAdd = true;
@ -312,21 +446,13 @@
this.isShowImport = true;
this.isShowError = false
},
downloadStoreCode(){
http.downloadStoreCode({},null);
},
downloadStoreSellerCode(){
http.downloadStoreSellerCode({},null);
},
handleSubmit (name) {
this.$refs[name].validate((valid) => {
if (valid) {
if (name) {
//
this.$Message.success('Success!');
this.addStoreWX(name);
} else {
this.$Message.error('Fail!');
}
})
},
handleReset (name) {
this.$refs[name].resetFields();

@ -44,11 +44,16 @@ export function editSattf(params, call) {
return http.post('/store/staff/edit',params).then(call)
}
export function removeStaff(params, call) {
return http.post('/store/staff/delete',params).then(call)
}
export default {
getStaffList,
downRegionData,
downShopData,
downRoleData,
addSattf,
editSattf
editSattf,
removeStaff
}

@ -15,6 +15,20 @@ import axios from "axios";
export function uploadUser(params, call) {
return http.post('/store/emp/import', params).then(call);
}
export function storeList(params, call) {
return http.post('/store/emp/list', params).then(call);
}
export function addStoreWX(params, call) {
return http.post('/user/add', params).then(call);
}
/**
* 下拉框数据品牌公司
*/
export function downCompanyData(params, call) {
return http.get('/retail/company',params).then(call)
}
/**
* 下载门店码
* @param params
@ -41,7 +55,11 @@ export function getBaseUrl() {
export default {
uploadUser,
getBaseUrl,
storeList,
addStoreWX,
downCompanyData,
downloadStoreCode,
downloadStoreSellerCode,
getBaseUrl
}

Loading…
Cancel
Save