Merge branch 'feature_0521' of http://git.51jingcheng.com/zhenghuang/bsdgy-front into feature_0521

feature_0521
liuyang 5 years ago
commit 50e60964bf

@ -18,7 +18,8 @@
:columns="columns1"
:data="data1"
style="margin-top: 20px;"
size="small">
size="small"
>
<template slot-scope="{ row }" slot="qrCodeAction">
<img
:src="require('../../../static/img/qrCode-init.png')"
@ -26,16 +27,16 @@
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, 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
@ -43,30 +44,20 @@
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>
@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">
<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;"/>
<img :src="qrCodeImage" style="width:200px;height:200px;" />
<div style="text-align: center;">
<Button ghost type="primary" @click="download(rowData)"></Button>
</div>
@ -83,88 +74,59 @@
</template>
</div>
<Form ref="formValidate"
:model="formValidate"
:rules="ruleValidate"
:label-width="80">
<Form ref="formValidate" :model="formValidate" :rules="ruleValidate" :label-width="80">
<FormItem label="名称" prop="name">
<i-input
v-model="formValidate.name"
placeholder="请输入名字"
></i-input>
<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="staffCode">
<i-input v-model="formValidate.staffCode" placeholder="请输入工号" :disabled="flag !== 1"></i-input>
</FormItem>
<FormItem label="角色" prop="roleId">
<Select
v-model="formValidate.roleId"
placeholder="选择角色"
:disabled="flag !== 1">
<Select v-model="formValidate.roleId" placeholder="选择角色" :disabled="flag !== 1">
<Option :value="4">店长</Option>
<Option :value="5">导购</Option>
</Select>
</FormItem>
<FormItem v-if="flag === 1" label="" prop="checkbox">
<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.roleCode === 'DZ-DIANZHANG'" label="主店长" prop="type">
<Checkbox :disabled="formValidate.type === 1" v-model="formValidate.type"
:true-value="1" :false-value="2"></Checkbox>
<FormItem
v-if="flag !== 1 && formValidate.roleCode === 'DZ-DIANZHANG'"
label="主店长"
prop="type"
>
<Checkbox
:disabled="formValidate.type === 1"
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
>
<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"
>
<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
>
<Button type="error" style="width: 100px;margin-left: 20px" @click="deleteStaff"></Button>
</div>
</Modal>
@ -182,27 +144,28 @@
</template>
<script>
import data from "../../utils/PhoneRegionData";
import http from "../../services/store/IncreaseStoreManager";
import accountManagementService from '../../services/account/AccountManagement';
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 {
export default {
name: "IncreaseStaffManager",
inject: ['setMenuName'],
inject: ["setMenuName"],
data() {
let _this = this;
return {
modal13: false,
deleteId: null,
userId: '',
userId: "",
// 1 2
flag: 1,
prefixDefault: data.prefixDefault,
isShow: false,
isShowAdd: false,
showStoreName: '',
showStoreCode: '',
qrCodeImage: '',
showStoreName: "",
showStoreCode: "",
qrCodeImage: "",
loading: false,
spuLoading: false,
//
@ -216,121 +179,138 @@
shopList: [],
roleList: [],
rowData: {},
rules: {required: false},
rules: { required: false },
columns1: [
{
title: '序号',
key: 'id',
title: "序号",
key: "id"
},
{
title: '姓名',
key: 'name',
title: "姓名",
key: "name"
},
{
title: '员工ID',
key: 'staffCode',
title: "员工ID",
key: "staffCode"
},
{
title: '手机号码',
key: 'mobil',
title: "手机号码",
key: "mobil"
},
{
title: '店铺',
key: 'storeName',
title: "店铺",
key: "storeName"
},
{
title: '角色',
key: 'roleName',
title: "角色",
key: "roleName"
},
{
title: '客户数',
key: 'customerNum',
title: "客户数",
key: "customerNum"
},
{
title: '推广码',
slot: 'qrCodeAction',
key: 'epWechatQrCode',
title: "推广码",
slot: "qrCodeAction",
key: "epWechatQrCode"
},
{
title: '停用/启用',
key: 'status',
title: "停用/启用",
key: "status",
render: (h, params) => {
let _this = this;
return h('div', [
h('i-switch', {
return h("div", [
h("i-switch", {
props: {
value: params.row.status,
'true-value': 1,//
'false-value': 2,//
size: 'large'
"true-value": 1, //
"false-value": 2, //
size: "large"
},
on: { //
'on-change': function (value) {
on: {
//
"on-change": function(value) {
//
// _this.modifyStatus(params.row.accountId, value);
let request = {
status: value,
id: _this.formValidate.id
};
debugger
debugger;
//
_this.editSattf(request);
}
},
scopedSlots: {
open: () => h('span', '开启'),
close: () => h('span', '关闭')
open: () => h("span", "开启"),
close: () => h("span", "关闭")
}
})
])
]);
}
},
{
title: '操作',
slot: 'action',
title: "操作",
slot: "action"
}
],
data1: [],
//
formValidate: {
name: '',
staffCode: '',
region: '',
phone: '',
name: "",
staffCode: "",
region: "",
phone: "",
roleId: 0,
store: '',
userId: '',
type: '',
store: "",
userId: "",
type: "",
status: 0,
checkbox: ['vail'],
roleCode: ''
checkbox: ["vail"],
roleCode: ""
},
ruleValidate: {
name: [
{required: true, message: '名称不能为空', trigger: 'blur'}
],
name: [{ required: true, message: "名称不能为空", trigger: "blur" }],
staffCode: [
{required: true, message: '工号不能为空', trigger: 'blur'}
{ required: true, message: "工号不能为空", trigger: "blur" }
],
phone: [
{required: true, message: '手机号码不能为空', trigger: 'blur'},
{pattern: /^1[1-9]\d{9}$/, message: "手机号码格式不正确", trigger: "blur"}
{ required: true, message: "手机号码不能为空", trigger: "blur" },
{
pattern: /^1[1-9]\d{9}$/,
message: "手机号码格式不正确",
trigger: "blur"
}
],
// mail: [
// { required: true, message: '', trigger: 'blur' },
// { type: 'email', message: '', trigger: 'blur' }
// ],
roleId: [
{type: 'number', required: true, message: '请选择角色', trigger: 'change'}
{
type: "number",
required: true,
message: "请选择角色",
trigger: "change"
}
],
region: [
{required: true, type: String, message: '请选择区域', trigger: 'change'}
{
required: true,
type: String,
message: "请选择区域",
trigger: "change"
}
],
store: [
{required: true, type: String, message: '请选择店铺', trigger: 'change'}
]
{
required: true,
type: String,
message: "请选择店铺",
trigger: "change"
}
]
}
};
},
mounted() {
this.userId = JSON.parse(sessionStorage.getItem("loginInfo")).userId;
@ -338,22 +318,21 @@
this.listOfLogistics();
},
methods: {
cancel: function () {
},
cancel: function() {},
listOfLogistics() {
this.loading = true;
let that = this;
let request = {
shopId: that.selectedStore,
pageNum: that.pageNum,
pageSize: that.pageSize,
pageSize: that.pageSize
};
staff.getStaffList(request, function (data) {
staff.getStaffList(
request,
function(data) {
that.loading = false;
data = data.data;
if (data.code == "0000") {
that.data1 = [];
let datas = data.results;
//
@ -372,17 +351,18 @@
that.data1.push(item);
}
}
}, function () {
},
function() {
that.loading = false;
});
}
);
},
//
downRegionData: function () {
downRegionData: function() {
let that = this;
that.regionList = [{"id": 0, "name": "全部"}];
let request =
{userId: that.userId};
staff.downRegionData(request, function (data) {
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++) {
@ -392,14 +372,16 @@
}
}
}
})
});
},
downShopData: function () {
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) {
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++) {
@ -409,11 +391,11 @@
}
}
}
})
});
},
downRoleData: function () {
downRoleData: function() {
let that = this;
staff.downRoleData({}, function (data) {
staff.downRoleData({}, function(data) {
data = data.data.results;
if (data) {
for (let i = 0; i < data.length; i++) {
@ -423,65 +405,63 @@
}
}
}
})
});
},
addSattf: function (request) {
addSattf: function(request) {
let that = this;
staff.addSattf(request, function (data) {
staff.addSattf(request, function(data) {
data = data.data;
if (data.code == "0000") {
if (data.results == "0001") {
that.$Message.error('添加失败!');
that.$Message.error("添加失败!");
} else if (data.results == "0002") {
that.$Message.error('该工号已经被使用!');
that.$Message.error("该工号已经被使用!");
} else if (data.results == "0003") {
that.$Message.error('该手机号已经被使用!');
that.$Message.error("该手机号已经被使用!");
} else if (data.results == "0004") {
that.$Message.error('该工号已经被使用!');
that.$Message.error("该工号已经被使用!");
} else if (data.results == "0000") {
that.$Message.success('添加成功!');
that.$Message.success("添加成功!");
that.handleAdd(that.formValidate);
that.listOfLogistics();
}
}else{
} else {
that.$Message.error(data.msg);
}
})
});
},
editSattf: function (request) {
editSattf: function(request) {
let that = this;
staff.editSattf(request, function (data) {
staff.editSattf(request, function(data) {
data = data.data;
if (data.code == "0000") {
that.$Message.success('修改成功!');
that.$Message.success("修改成功!");
that.isShowAdd = false;
that.listOfLogistics();
}
})
});
},
searchCustomerDataBtnClick: function () {
searchCustomerDataBtnClick: function() {
this.listOfLogistics();
},
changeData: function (value) {
changeData: function(value) {
if (value == 0) {
return null;
}
return value;
},
//
handlePage: function (value) {
handlePage: function(value) {
this.pageNum = value;
this.listOfLogistics();
},
downRegionChange: function () {
downRegionChange: function() {
this.downShopData();
},
onChangeDateLister: function () {
},
onChangeDateLister: function() {},
//
show: function (index) {
show: function(index) {
this.isShow = true;
this.showStoreName = "姓名:" + index.name;
this.showStoreCode = "工号:" + index.staffCode;
@ -489,19 +469,18 @@
this.rowData = index;
},
//
download: function (index) {
download: function(index) {
let name = index.staffCode + "-" + index.name + "-导购码";
http.downloadImg(
{
url: index.epWechatQrCode,
url: index.epWechatQrCode
},
name,
function (/*data*/) {
}
function(/*data*/) {}
);
},
// 广
open: function (flag, row) {
open: function(flag, row) {
this.flag = flag;
this.isShowAdd = true;
if (flag === 2) {
@ -516,26 +495,26 @@
id: row.id,
roleCode: row.roleCode
};
debugger
debugger;
} else {
this.handleAdd(this.formValidate);
}
},
back: function () {
this.$router.push({path: "/shop/increase/manager"});
back: function() {
this.$router.push({ path: "/shop/increase/manager" });
},
//
remove: function (row) {
remove: function(row) {
this.modal13 = true;
this.deleteId = row.id;
},
//
deleteStaff: function () {
deleteStaff: function() {
let requset = {
staffId: this.deleteId,
staffId: this.deleteId
};
let that = this;
staff.removeStaff(requset, function (data) {
staff.removeStaff(requset, function(data) {
data = data.data;
if (data.results) {
that.$Message.success("删除成功!");
@ -559,14 +538,16 @@
accountId: accountId,
status: status
};
accountManagementService.postAccountModifyStatus(request, function (res) {
accountManagementService.postAccountModifyStatus(
request,
function(res) {
let data = res.data;
if (data.code !== "0000") {
that.$Message.error("修改失败");
}
}, function (res) {
});
},
function(res) {}
);
},
handleSubmit(value) {
if (value) {
@ -591,11 +572,10 @@
mobil: value.phone,
staffCode: value.staffCode,
roleId: value.roleId,
isOpen: this.formValidate.checkbox[0],
isOpen: this.formValidate.checkbox[0]
};
this.addSattf(request);
} else {
request = {
name: value.name,
storeId: this.selectedStore,
@ -604,7 +584,7 @@
roleId: value.roleId,
userId: this.formValidate.userId,
type: this.formValidate.type,
id: this.formValidate.id,
id: this.formValidate.id
};
//
this.editSattf(request);
@ -626,13 +606,13 @@
value.type = "";
value.region = "";
value.checkbox = ["vail"];
},
},
};
}
}
};
</script>
<style scoped>
.table-staff {
.table-staff {
margin-top: 20px !important;
}
}
</style>

Loading…
Cancel
Save