导购换店开发。

feature_0521
kevin jiang 6 years ago
parent f8b35f9a91
commit 07f8a6a523

@ -1,195 +1,195 @@
<template>
<div>
<Row class="search-row">
<i-col span="24" class="search-col">
<Row class="row-style">
<i-col span="12" style="text-align: left;padding-right: 20px;">
<Button type="primary" @click="back()"></Button>
</i-col>
<i-col span="12" style="text-align: right;padding-right: 20px;">
<Button type="primary" @click="open(1)">广</Button>
</i-col>
<div>
<Row class="search-row">
<i-col span="24" class="search-col">
<Row class="row-style">
<i-col span="12" style="text-align: left;padding-right: 20px;">
<Button type="primary" @click="back()"></Button>
</i-col>
<i-col span="12" style="text-align: right;padding-right: 20px;">
<Button type="primary" @click="open(1)">广</Button>
</i-col>
</Row>
</i-col>
</Row>
</i-col>
</Row>
<Table
:loading="loading"
:columns="columns1"
:data="data1"
style="margin-top: 20px;"
size="small"
>
<template slot-scope="{ row }" 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>
<span slot="close">关闭</span>
</i-switch>
</template>
<Table
:loading="loading"
:columns="columns1"
:data="data1"
style="margin-top: 20px;"
size="small">
<template slot-scope="{ row }" 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="accountFlag">-->
<!-- <i-switch-->
<!-- size="large"-->
<!-- :value="row.accountFlag"-->
<!-- @on-change="onSwitchChangeLister"-->
<!-- >-->
<!-- <span slot="open">开启</span>-->
<!-- <span slot="close">关闭</span>-->
<!-- </i-switch>-->
<!-- </template>-->
<template slot-scope="{ row }" slot="action">
<Button
ghost
type="primary"
size="small"
style="border: 0px;color:#2074E2"
@click="open(2, row)"
>修改
</Button>
<Button
ghost
type="error"
size="small"
style="border: 0px"
@click="remove(row)"
>删除</Button
>
</template>
</Table>
<template slot-scope="{ row }" slot="action">
<Button
ghost
type="primary"
size="small"
style="border: 0px;color:#2074E2"
@click="open(2, row)">修改
</Button>
<Button
ghost
type="error"
size="small"
style="border: 0px"
@click="remove(row)">删除
</Button>
</template>
</Table>
<!-- 预览二维码 -->
<Modal
v-model="isShow"
:footer-hide="true"
width="230"
class-name="vertical-center-modal"
>
<div slot="header">
<p></p>
</div>
<p>{{ this.showStoreCode }}</p>
<p>{{ this.showStoreName }}</p>
<img :src="qrCodeImage" style="width:200px;height:200px;" />
<div style="text-align: center;">
<Button ghost type="primary" @click="download(rowData)"></Button>
</div>
</Modal>
<!-- 预览二维码 -->
<Modal
v-model="isShow"
:footer-hide="true"
width="230"
class-name="vertical-center-modal">
<div slot="header">
<p></p>
</div>
<p>{{ this.showStoreCode }}</p>
<p>{{ this.showStoreName }}</p>
<img :src="qrCodeImage" style="width:200px;height:200px;"/>
<div style="text-align: center;">
<Button ghost type="primary" @click="download(rowData)"></Button>
</div>
</Modal>
<!-- 添加推广人员 -->
<Modal v-model="isShowAdd" :footer-hide="true">
<div slot="header">
<template v-if="flag === 1">
<span>添加推广人员</span>
</template>
<template v-else>
<span>修改推广人员</span>
</template>
</div>
<!-- 添加推广人员 -->
<Modal v-model="isShowAdd" :footer-hide="true">
<div slot="header">
<template v-if="flag === 1">
<span>添加推广人员</span>
</template>
<template v-else>
<span>修改推广人员</span>
</template>
</div>
<Form
ref="formValidate"
:model="formValidate"
:rules="ruleValidate"
:label-width="80"
>
<FormItem label="名称" prop="name">
<i-input
v-model="formValidate.name"
placeholder="请输入名字"
></i-input>
</FormItem>
<FormItem label="手机" prop="phone">
<i-input
v-model="formValidate.phone"
placeholder="成员通过验证该手机号后可加入企业"
:disabled="flag !== 1"
>
</i-input>
</FormItem>
<FormItem label="工号" prop="staffCode">
<i-input
v-model="formValidate.staffCode"
placeholder="请输入工号"
:disabled="flag !== 1"
></i-input>
</FormItem>
<FormItem label="角色" prop="role">
<Select
v-model="formValidate.role"
placeholder="选择角色"
:disabled="flag !== 1"
>
<Option value="DZ-DIANZHANG">店长</Option>
<Option value="DG-DAOGOU">导购</Option>
</Select>
</FormItem>
<FormItem v-if="flag === 1" label="" prop="checkbox">
<CheckboxGroup v-model="formValidate.checkbox">
<Checkbox label="vail">同步开通账号</Checkbox>
</CheckboxGroup>
</FormItem>
<FormItem v-if="flag !== 1 && formValidate.role === 'DZ-DIANZHANG'" label="主店长" prop="type">
<Checkbox :disabled="formValidate.type === 1 ? true : false" v-model="formValidate.type" :true-value="1" :false-value="2"></Checkbox>
</FormItem>
<FormItem style="text-align: left;">
<Row>
<i-col span="16">
<Button type="primary" @click="handleSubmit(formValidate)"
>保存</Button
>
<Button
@click="handleReset('formValidate')"
style="margin-left: 8px"
>取消</Button
>
</i-col>
</Row>
</FormItem>
</Form>
</Modal>
<Form
ref="formValidate"
:model="formValidate"
:rules="ruleValidate"
:label-width="80"
>
<FormItem label="名称" prop="name">
<i-input
v-model="formValidate.name"
placeholder="请输入名字"
></i-input>
</FormItem>
<FormItem label="手机" prop="phone">
<i-input
v-model="formValidate.phone"
placeholder="成员通过验证该手机号后可加入企业"
:disabled="flag !== 1"
>
</i-input>
</FormItem>
<FormItem label="工号" prop="staffCode">
<i-input
v-model="formValidate.staffCode"
placeholder="请输入工号"
:disabled="flag !== 1"
></i-input>
</FormItem>
<FormItem label="角色" prop="role">
<Select
v-model="formValidate.role"
placeholder="选择角色"
:disabled="flag !== 1"
>
<Option value="DZ-DIANZHANG">店长</Option>
<Option value="DG-DAOGOU">导购</Option>
</Select>
</FormItem>
<FormItem v-if="flag === 1" label="" prop="checkbox">
<CheckboxGroup v-model="formValidate.checkbox">
<Checkbox label="vail">同步开通账号</Checkbox>
</CheckboxGroup>
</FormItem>
<FormItem v-if="flag !== 1 && formValidate.role === 'DZ-DIANZHANG'" label="主店长" prop="type">
<Checkbox :disabled="formValidate.type === 1 ? true : false" v-model="formValidate.type"
:true-value="1" :false-value="2"></Checkbox>
</FormItem>
<FormItem style="text-align: left;">
<Row>
<i-col span="16">
<Button type="primary" @click="handleSubmit(formValidate)"
>保存
</Button
>
<Button
@click="handleReset('formValidate')"
style="margin-left: 8px"
>取消
</Button
>
</i-col>
</Row>
</FormItem>
</Form>
</Modal>
<Modal
v-model="modal13"
title="删除提示"
@on-cancel="cancel"
align="center"
>
<p style="margin-top: 20px;margin-bottom: 20px">
确定要删除此账户吗删除后不可恢复
</p>
<div
slot="footer"
style="text-align: center;margin-bottom: 10px;margin-top: 10px"
>
<Button style="width: 100px;" @click="modal13 = false">取消删除</Button>
<Button
type="error"
style="width: 100px;margin-left: 20px"
@click="deleteStaff"
>确认删除</Button
<Modal
v-model="modal13"
title="删除提示"
@on-cancel="cancel"
align="center"
>
</div>
</Modal>
<p style="margin-top: 20px;margin-bottom: 20px">
确定要删除此账户吗删除后不可恢复
</p>
<div
slot="footer"
style="text-align: center;margin-bottom: 10px;margin-top: 10px"
>
<Button style="width: 100px;" @click="modal13 = false">取消删除</Button>
<Button
type="error"
style="width: 100px;margin-left: 20px"
@click="deleteStaff"
>确认删除
</Button
>
</div>
</Modal>
<Page
:total="total"
:current="pageNum"
:page-size="pageSize"
show-elevator
show-total
placement="top"
@on-change="handlePage"
class="ks-page"
></Page>
</div>
<Page
:total="total"
:current="pageNum"
:page-size="pageSize"
show-elevator
show-total
placement="top"
@on-change="handlePage"
class="ks-page"
></Page>
</div>
</template>
<script>
import data from "../../utils/PhoneRegionData";
import http from "../../services/store/IncreaseStoreManager";
import staff from "../../services/staff/staff";
import data from "../../utils/PhoneRegionData";
import http from "../../services/store/IncreaseStoreManager";
import accountManagementService from '../../services/account/AccountManagement';
import staff from "../../services/staff/staff";
export default {
name: "IncreaseStaffManager",
@ -256,8 +256,31 @@ import staff from "../../services/staff/staff";
key: 'epWechatQrCode',
},
{
title: '停用/启用',
slot: 'status',
title: '停用/启用',
key: 'accountFlag',
render: (h, params) => {
let _this = this;
return h('div', [
h('i-switch', {
props: {
value: params.row.accountFlag,
'true-value': true,//
'false-value': false,//
size: 'large'
},
on: { //
'on-change': function (value) {
//
_this.modifyStatus(params.row.accountId, value);
}
},
scopedSlots: {
open: () => h('span', '开启'),
close: () => h('span', '关闭')
}
})
])
}
},
{
title: '操作',
@ -294,7 +317,7 @@ import staff from "../../services/staff/staff";
// { type: 'email', message: '', trigger: 'blur' }
// ],
role: [
{required: true, message: '请选择角色', trigger: 'change'}
{required: true, message: '请选择角色', trigger: 'change'}
],
region: [
{required: true, type: String, message: '请选择区域', trigger: 'change'}
@ -306,8 +329,8 @@ import staff from "../../services/staff/staff";
}
},
mounted() {
this.userId = JSON.parse(sessionStorage.getItem("loginInfo")).userId;
this.setMenuName("门店推广", "推广管理", "门店导购管理");
this.userId = JSON.parse(sessionStorage.getItem("loginInfo")).userId;
this.setMenuName("门店推广", "推广管理", "门店导购管理");
this.listOfLogistics();
},
methods: {
@ -315,7 +338,7 @@ import staff from "../../services/staff/staff";
},
listOfLogistics() {
this.loading = true;
this.loading = true;
let that = this;
let request = {
shopId: that.selectedStore,
@ -323,7 +346,7 @@ import staff from "../../services/staff/staff";
pageSize: that.pageSize,
};
staff.getStaffList(request, function (data) {
that.loading = false;
that.loading = false;
data = data.data;
if (data.code == "0000") {
@ -338,10 +361,15 @@ import staff from "../../services/staff/staff";
if (datas.records == null) {
datas.records = [];
}
that.data1 = datas.records;
for (let i = 0; i < datas.records.length; i++) {
let item = datas.records[i];
that.data1.push(item);
}
}
}, function () {
that.loading = false;
that.loading = false;
});
},
//
@ -427,170 +455,193 @@ import staff from "../../services/staff/staff";
})
},
searchCustomerDataBtnClick: function() {
this.listOfLogistics();
},
changeData: function(value) {
if (value == 0) {
return null;
}
return value;
},
//
handlePage: function(value) {
this.pageNum = value;
this.listOfLogistics();
},
downRegionChange: function() {
this.downShopData();
},
onChangeDateLister: function() {},
//
show: function(index) {
this.isShow = true;
this.showStoreName = "姓名:" + index.name;
this.showStoreCode = "工号:" + index.staffCode;
this.qrCodeImage = index.epWechatQrCode;
this.rowData = index;
},
//
download: function(index) {
let name = index.staffCode + "-" + index.name + "-导购码";
http.downloadImg(
{
url: index.epWechatQrCode,
},
name,
function(/*data*/) {}
);
},
// 广
open: function(flag, row) {
this.flag = flag;
this.isShowAdd = true;
let role;
searchCustomerDataBtnClick: function () {
this.listOfLogistics();
},
changeData: function (value) {
if (value == 0) {
return null;
}
return value;
},
//
handlePage: function (value) {
this.pageNum = value;
this.listOfLogistics();
},
downRegionChange: function () {
this.downShopData();
},
onChangeDateLister: function () {
},
//
show: function (index) {
this.isShow = true;
this.showStoreName = "姓名:" + index.name;
this.showStoreCode = "工号:" + index.staffCode;
this.qrCodeImage = index.epWechatQrCode;
this.rowData = index;
},
//
download: function (index) {
let name = index.staffCode + "-" + index.name + "-导购码";
http.downloadImg(
{
url: index.epWechatQrCode,
},
name,
function (/*data*/) {
}
);
},
// 广
open: function (flag, row) {
this.flag = flag;
this.isShowAdd = true;
let role;
if (row && row.type) {
if (row.type === 1 || row.type === 2) {
role = "DZ-DIANZHANG";
} else {
role = "DG-DAOGOU";
}
}
if (row && row.type) {
if (row.type === 1 || row.type === 2) {
role = "DZ-DIANZHANG";
} else {
role = "DG-DAOGOU";
}
}
if (flag == 2) {
this.formValidate = {
name: row.name,
staffCode: row.staffCode,
phone: row.mobil,
role: role,
store: row.storeId,
type: row.type,
userId: row.userId,
id: row.id,
};
} else {
this.handleAdd(this.formValidate);
}
},
back: function() {
this.$router.push({ path: "/shop/increase/manager" });
},
//
remove: function(row) {
this.modal13 = true;
this.deleteId = row.id;
},
//
deleteStaff: function() {
let requset = {
staffId: this.deleteId,
};
let that = this;
staff.removeStaff(requset, function(data) {
data = data.data;
if (data.results) {
that.$Message.success("删除成功!");
that.modal13 = false;
that.listOfLogistics();
} else {
that.$Message.success("删除失败!");
}
});
},
// switch
onSwitchChangeLister: function() {},
handleSubmit(value) {
if (value) {
let request = {};
if (this.flag == 1) {
if (value.name == null || value.name == "") {
this.$Message.success("名称不能为空!");
return;
}
if (value.staffCode == null || value.staffCode == "") {
this.$Message.success("工号不能为空!");
return;
}
if (value.role == null || value.role == "") {
this.$Message.success("角色不能为空!");
return;
}
//
request = {
name: value.name,
storeId: this.selectedStore,
mobil: value.phone,
staffCode: value.staffCode,
role: value.role,
isOpen: this.formValidate.checkbox[0],
};
this.addSattf(request);
} else {
let newRole;
if (value.role === "DZ-DIANZHANG") {
newRole = 1;
} else {
newRole = 4;
}
if (flag == 2) {
this.formValidate = {
name: row.name,
staffCode: row.staffCode,
phone: row.mobil,
role: role,
store: row.storeId,
type: row.type,
userId: row.userId,
id: row.id,
};
} else {
this.handleAdd(this.formValidate);
}
},
back: function () {
this.$router.push({path: "/shop/increase/manager"});
},
//
remove: function (row) {
this.modal13 = true;
this.deleteId = row.id;
},
//
deleteStaff: function () {
let requset = {
staffId: this.deleteId,
};
let that = this;
staff.removeStaff(requset, function (data) {
data = data.data;
if (data.results) {
that.$Message.success("删除成功!");
that.modal13 = false;
that.listOfLogistics();
} else {
that.$Message.success("删除失败!");
}
});
},
// switch
modifyStatus(accountId, val) {
debugger
let that = this;
let status;
if (val) {
status = 1;
} else {
status = 2;
}
let request = {
accountId: accountId,
status: status
};
accountManagementService.postAccountModifyStatus(request, function (res) {
let data = res.data;
if (data.code !== "0000") {
that.$Message.error("修改失败");
}
}, function (res) {
});
},
handleSubmit(value) {
if (value) {
let request = {};
if (this.flag == 1) {
if (value.name == null || value.name == "") {
this.$Message.success("名称不能为空!");
return;
}
if (value.staffCode == null || value.staffCode == "") {
this.$Message.success("工号不能为空!");
return;
}
if (value.role == null || value.role == "") {
this.$Message.success("角色不能为空!");
return;
}
//
request = {
name: value.name,
storeId: this.selectedStore,
mobil: value.phone,
staffCode: value.staffCode,
role: value.role,
isOpen: this.formValidate.checkbox[0],
};
this.addSattf(request);
} else {
let newRole;
if (value.role === "DZ-DIANZHANG") {
newRole = 1;
} else {
newRole = 4;
}
request = {
name: value.name,
storeId: this.selectedStore,
mobil: value.phone,
staffCode: value.staffCode,
roleId: newRole,
userId: this.formValidate.userId,
type: this.formValidate.type,
id: this.formValidate.id,
};
//
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.type = "";
value.region = "";
value.checkbox = ["vail"];
},
},
};
request = {
name: value.name,
storeId: this.selectedStore,
mobil: value.phone,
staffCode: value.staffCode,
roleId: newRole,
userId: this.formValidate.userId,
type: this.formValidate.type,
id: this.formValidate.id,
};
//
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.type = "";
value.region = "";
value.checkbox = ["vail"];
},
},
};
</script>
<style scoped>
.table-staff {
margin-top: 20px !important;
}
.table-staff {
margin-top: 20px !important;
}
</style>

@ -44,11 +44,21 @@ export function listRoleInfoApi(params, call) {
return http.get('/role/info/list', params).then(call);
}
/**
* 修改账号状态
* @param params
* @param call
* @returns {Promise<any | never>}
*/
export function postAccountModifyStatus(params, call, p) {
return http.post('account/modify/status', params).then(call);
}
export default {
listAccountInfoApi,
removeAccountApi,
listAllShopApi,
listRoleInfoApi
listRoleInfoApi,
postAccountModifyStatus
}

Loading…
Cancel
Save