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

Loading…
Cancel
Save