文件

340 行
12 KiB
HTML
可执行文件

<!--[1.7.90]-->
<style>
.el-pagination {
padding: 8px;
}
.el-table__row > td:last-child > .cell {
white-space: nowrap;
}
.table-cell-long-text {
flex: 1;
overflow: hidden;
white-space: nowrap;
}
.table-cell-long-text > div {
overflow: hidden;
text-overflow: ellipsis;
line-height: 20px;
}
.table-cell-flex-column .el-button {
margin-left: 0;
}
#cashierApp .el-table thead th {
background: #f5f7fa;
}
#cashierApp .el-table--small td {
padding: 3px 0;
}
.state-box {
display: flex;
align-items: center;
flex-wrap: wrap;
}
.table-cell-long-text > span:nth-child(1) {
color: #999;
}
.state-box > .table-cell-long-text {
flex: none;
margin-right: 20px;
}
</style>
<div id="cashierApp">
<el-form :inline="true" size="small">
<el-form-item>
<el-input v-model="searchForm.keyword"
style="width:200px" clearable
placeholder="姓名/手机号"
@keydown.enter.exact.native.prevent="searchData"></el-input>
</el-form-item>
<el-form-item style="padding-top: 1px">
<date-picker-range :date-time.sync="searchForm.add_time"></date-picker-range>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="searchData">搜索</el-button>
<if condition="$global_store_jurisdiction['addcashier'] eq '1'">
<el-button type="primary" plain @click="addCashier" v-if="operate.addCashier">添加收银员</el-button>
</if>
<if condition="$global_store_jurisdiction['data_export'] eq '1'">
<el-button @click="exportData" v-if="operate.cashierInfoExport">导出</el-button>
</if>
</el-form-item>
</el-form>
<div>
<el-table v-loading="loading"
:data="userList"
size="mini"
border
style="width: 100%">
<el-table-column align="center" fixed type="index" label="序号" width="50"></el-table-column>
<el-table-column prop="name" label="姓名" min-width="80px" show-overflow-tooltip></el-table-column>
<el-table-column prop="jobnum" label="工号" min-width="80px" show-overflow-tooltip></el-table-column>
<el-table-column prop="mobile" label="手机号" min-width="110px" show-overflow-tooltip></el-table-column>
<el-table-column prop="addtime" label="加入时间" min-width="140px" show-overflow-tooltip></el-table-column>
<el-table-column label="权限" min-width="260px">
<template slot-scope="scope">
<div class="state-box">
<div class="table-cell-long-text">
<span>退款权限:</span><span v-text="scope.row.canrefund"></span>
</div>
<div class="table-cell-long-text">
<span>充值权限:</span><span v-text="scope.row.canrecharge"></span>
</div>
<div class="table-cell-long-text">
<span>编辑会员:</span><span v-text="scope.row.modifymem"></span>
</div>
<div class="table-cell-long-text">
<span>赠送金额:</span><span v-text="scope.row.customviprecharge"></span>
</div>
<div class="table-cell-long-text">
<span>销售明细:</span><span v-text="scope.row.salesdiction"></span>
</div>
<div class="table-cell-long-text">
<span>结算打折:</span><span v-text="scope.row.preferential"></span>
</div>
</div>
</template>
</el-table-column>
<el-table-column fixed="right" align="center" label="操作" width='150px'>
<template slot-scope="scope">
<div class="state-box" style="justify-content: center">
<el-button size="mini" type="text"
v-if="operate.permiset"
@click="jurSet(scope.row)">权限
</el-button>
<el-button size="mini" type="text"
v-if="operate.editCashier"
@click="editCashier(scope.row.id)">编辑
</el-button>
<el-button size="mini" type="text"
v-if="operate.model"
@click="setModel(scope.row)">模板
</el-button>
<el-button size="mini" type="text"
v-if="operate.shiftingdetail"
@click="detail(scope.row.id)">交接班
</el-button>
<el-button size="mini" type="text"
v-if="operate.delCashier"
style="color: #aaa" @click="delCashier(scope.row.id)">删除
</el-button>
</div>
</template>
</el-table-column>
</el-table>
<el-pagination
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
:current-page="searchForm.page"
:page-sizes="[10, 15, 20, 25, 30, 35, 40, 45, 50]"
:page-size="100"
layout="total, sizes, prev, pager, next, jumper"
:total="currentLen">
</el-pagination>
</div>
</div>
<script>
var cashierApp = new Vue({
el: '#cashierApp',
data() {
return {
userList: [],
searchForm: {
add_time: '',
keyword: '',
page: 1,
limit: 10,
},
currentLen: 0,
operate: {},
loading: false,
}
},
methods: {
searchData() {
this.searchForm.page = 1;
this.getData();
},
getData() {
$.ajax({
url: "{:U(lists)}",
type: 'POST',
data: {
...this.searchForm,
},
success: (res) => {
if (res.code == 0) {
this.loading = false;
this.userList = [];
this.userList = res.data;
this.$nextTick(() => {
this.currentLen = parseInt(res.count);
})
} else {
this.$confirm(res.msg, '提示', {
confirmButtonText: '确定',
type: 'warning'
}).then(() => {
}).catch(() => {
});
}
}
});
},
handleSizeChange(val) {
this.searchForm.limit = val;//切换每页数量
this.searchForm.page = 1;
this.getData();
},
handleCurrentChange(val) {
this.searchForm.page = val;
this.getData();//切换页数
},
//添加收银员
addCashier() {
layer.open({
type: 2,
content: "{:U('addCashier')}",
title: "添加收银员",
area: ["600px", '450px'],
btnAlign: 'c',
end: () => {
this.searchData();
}
})
},
//编辑收银员
editCashier(id) {
layer.open({
type: 2,
content: "{:U('editadCashier')}?id=" + id,
title: "编辑-收银员信息",
area: ["600px", '450px'],
btnAlign: 'c',
end: () => {
this.getData();
}
})
},
//权限设置
jurSet(item) {
layer.open({
type: 2,
title: "收银员-" + item.name + "-权限设置",
content: "{:U('permiset')}?id=" + item.id,
area: ['calc(100% - 160px)', 'calc(100% - 65px)'],
offset: 'rb',
shade: 0,
btnAlign: 'c',
end: () => {
this.getData();
}
})
},
//收银机模板
setModel(item) {
layer.open({
type: 2,
content: "{:U('model')}?type=2&id=" + item.id,
title: "编辑-收银机模板(" + item.name + ")",
area: ['calc(100% - 160px)', 'calc(100% - 65px)'],
offset: 'rb',
shade: 0,
btnAlign: 'c'
})
},
//查看交接班
detail(id) {
MenuApp.pathData.push({
name:'交接班信息',
path: '/index.php/Retail/Cashier/shiftingdetail?id=' + id,
onClose: () => {
this.getData();
}
});
// layer.open({
// type: 2,
// content: "{:U('shiftingdetail')}?id=" + id,
// title: "交接班信息",
// area: ['calc(100% - 160px)', 'calc(100% - 65px)'],
// offset: 'rb',
// shade: 0,
// btnAlign: 'c',
// })
},
//删除收银员
delCashier(id) {
this.$confirm('您确认要删除该收银员吗?', '提示', {
confirmButtonText: '删除',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
$.ajax({
url: "{:U('delCashier')}",
type: "POST",
data: {id: id},
success: (res) => {
if (res.status == 1) {
this.getData();
this.$message.success(res.msg);
} else {
this.$message.error(res.msg);
}
}
})
}).catch(() => {
});
},
//导出
exportData() {
window.location.href = "{:U('cashierInfoExport')}?keyword=" + this.searchForm.keyword;
},
//获取操作权限
getOperate() {
var auth_list = {
cashierInfoExport: '/index.php/Retail/Cashier/cashierInfoExport',
addCashier: '/index.php/Retail/Cashier/addCashier',
editCashier: '/index.php/Retail/Cashier/editadCashier',
model: '/index.php/Retail/Cashier/model',
delCashier: '/index.php/Retail/Cashier/delCashier',
shiftingdetail: '/index.php/Retail/Cashier/shiftingdetail',
permiset: '/index.php/Retail/Cashier/permiset',
};
$.ajax({
url: '/index.php/Retail/Component/checkOperateAuth',
type: "post",
data: {
auth_list: JSON.stringify(auth_list),
},
success: (res) => {
if (res.status == 1) {
this.operate = res.data;
}
}
})
},
},
created() {
this.getData();
this.getOperate();
},
});
</script>