Commit 0e99bfad by 李君

营业时间设置

1 parent 238ac844
......@@ -65,7 +65,20 @@ const queueManagementApi = {
getCountData(params, config) {
return req('get', `/queuing/countData`, params, config)
},
// 营业时间设置
getOpentimeList(params, config) {
return req('get', `/b-queue-mall-opentime/list`, params, config)
},
addOpentime(params, config) {
return req('POST', `/b-queue-mall-opentime`, params, config)
},
updateOpentime(params, config) {
return req('PUT', `/b-queue-mall-opentime/${params.id}`, params, config)
},
deleteOpentime(params, config) {
return req('DELETE', `/b-queue-mall-opentime/${params.id}`, params, config)
},
}
......
......@@ -75,6 +75,14 @@ const queueManagementRouterMap = {
permissionPath: 'dataPlaybackTime'
},
component: () => import('@/views/queueManagement/dataPlaybackTime/'),
},
{
name: 'businessTimeSetting',
path: '/queueManagement/businessTimeSetting',
meta: {
permissionPath: 'businessTimeSetting'
},
component: () => import('@/views/queueManagement/businessTimeSetting/'),
}
]
......
<template>
<div>
<el-dialog :title="isEdit=='add'?$t('button.groupAdd'):$t('button.groupEdit')" :visible.sync="isShow" v-if="isShow" :close-on-click-modal='false' class="manage-dialog dialog_lj" :before-close="closeDialog">
<el-form :model="addForm" label-width="100px" :rules="rules" ref="addForm">
<el-form-item :label="$t('table.squareName')" prop="mallId">
<el-select v-model="addForm.mallId" filterable :placeholder="$t('pholder.select')" :disabled="isEdit=='add'?false:true">
<el-option v-for="item in mallListForTerm" :key="item.id" :label="item.name" :value="item.id" />
</el-select>
<i class="error-tip">*</i>
</el-form-item>
<el-form-item :label="$t('table.monday')" prop="code">
<el-time-picker v-model="addForm.monStartTime"> </el-time-picker><span>{{$t('dialog.to')}}</span>
<el-time-picker v-model="addForm.monEndTime"> </el-time-picker>
<i class="error-tip">*</i>
</el-form-item>
<el-form-item :label="$t('table.tuesday')" prop="code">
<el-time-picker v-model="addForm.tueStartTime"> </el-time-picker><span>{{$t('dialog.to')}}</span>
<el-time-picker v-model="addForm.tueEndTime"> </el-time-picker>
<i class="error-tip">*</i>
</el-form-item>
<el-form-item :label="$t('table.wednesday')" prop="code">
<el-time-picker v-model="addForm.wedStartTime"> </el-time-picker><span>{{$t('dialog.to')}}</span>
<el-time-picker v-model="addForm.wedEndTime"> </el-time-picker>
<i class="error-tip">*</i>
</el-form-item>
<el-form-item :label="$t('table.thursday')" prop="code">
<el-time-picker v-model="addForm.thuStartTime"> </el-time-picker><span>{{$t('dialog.to')}}</span>
<el-time-picker v-model="addForm.thuEndTime"> </el-time-picker>
<i class="error-tip">*</i>
</el-form-item>
<el-form-item :label="$t('table.friday')" prop="code">
<el-time-picker v-model="addForm.friStartTime"> </el-time-picker><span>{{$t('dialog.to')}}</span>
<el-time-picker v-model="addForm.friEndTime"> </el-time-picker>
<i class="error-tip">*</i>
</el-form-item>
<el-form-item :label="$t('table.saturday')" prop="code">
<el-time-picker v-model="addForm.satStartTime"> </el-time-picker><span>{{$t('dialog.to')}}</span>
<el-time-picker v-model="addForm.satEndTime"> </el-time-picker>
<i class="error-tip">*</i>
</el-form-item>
<el-form-item :label="$t('table.sunday')" prop="code">
<el-time-picker v-model="addForm.sunStartTime"> </el-time-picker><span>{{$t('dialog.to')}}</span>
<el-time-picker v-model="addForm.sunEndTime"> </el-time-picker>
<i class="error-tip">*</i>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="closeDialog" class="dialog-btn">{{$t('dialog.cancel')}}</el-button>
<el-button type="primary" @click="addSubmit('addForm')" class="dialog-btn dialog-confirm-btn">
{{$t('dialog.confirm')}}</el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import moment from 'moment'
export default {
data() {
return {
isEdit:'add',
isShow: false,
addForm: {},
rules: {
mallId: [{
required: true,
message: this.$t("pholder.input"),
trigger: 'blur'
}]
},
}
},
methods: {
getMallListForTerm() {
this.mallListForTerm = [];
this.$api.base.mall(
{
accountId: this.$cookie.get('accountId'),
status_arr: "1,3"
},
null,
true
)
.then(data => {
let result = data.data;
if (result.data.length) {
this.mallListForTerm = result.data;
this.$forceUpdate()
}
})
},
dialogInit(type,row) {
this.getMallListForTerm()
this.isEdit = type;
this.isShow = true;
if(row){
this.addForm = row
}else{
this.addForm = {
accountId: this.$cookie.get('accountId'),
mallId: null,
monStartTime:new Date(2022, 1, 1, 9, 0),
monEndTime:new Date(2022, 1, 1, 22, 0),
tueStartTime:new Date(2022, 1, 1, 9, 0),
tueEndTime:new Date(2022, 1, 1, 22, 0),
wedStartTime:new Date(2022, 1, 1, 9, 0),
wedEndTime:new Date(2022, 1, 1, 22, 0),
thuStartTime:new Date(2022, 1, 1, 9, 0),
thuEndTime:new Date(2022, 1, 1, 22, 0),
friStartTime:new Date(2022, 1, 1, 9, 0),
friEndTime:new Date(2022, 1, 1, 22, 0),
satStartTime:new Date(2022, 1, 1, 9, 0),
satEndTime:new Date(2022, 1, 1, 22, 0),
sunStartTime:new Date(2022, 1, 1, 9, 0),
sunEndTime:new Date(2022, 1, 1, 22, 0),
}
}
this.$forceUpdate()
},
addSubmit(formName) {
this.$refs[formName].validate((valid) => {
if (valid) {
Object.keys(this.addForm).forEach(key=>{
if(key != 'mallId' && key != 'accountId' && key != 'id'){
this.addForm[key] = moment(this.addForm[key]).format('YYYY-MM-DD HH:mm:ss')
}
})
if(this.isEdit=='add'){
this.$api.queueManagementApi.addOpentime(this.addForm)
.then((res) => {
let result = res.data;
if(result.code==200){
this.$message({
message: result.msg,
type: 'success'
});
this.$parent.getTableData();
this.$refs.addForm.resetFields();
this.addForm = {}
this.isShow = false
}else{
this.$message({
message: result.msg,
type: 'error'
});
}
})
}else{
this.$api.queueManagementApi.updateOpentime(this.addForm).then((res) => {
let result = res.data;
if(result.code==200){
this.$message({
message: result.msg,
type: 'success'
});
this.$parent.getTableData();
this.$refs.addForm.resetFields();
this.addForm = {}
this.isShow = false
}else{
this.$message({
message: result.msg,
type: 'error'
});
}
})
}
} else {
return false;
}
});
},
closeDialog() {
this.$refs.addForm.resetFields();
this.addForm = {}
this.isShow = false;
}
}
}
</script>
<style lang="less" scoped="scoped">
.dialog_lj{
/deep/.el-form-item__label{
width: 100px;
text-align:left;
margin-top: 12px;
}
/deep/.el-select{
width: 100%;
}
/deep/.el-date-editor.el-input{
width: 200px;
}
/deep/.el-form-item__label+.el-form-item__content{
float: none !important;
line-height:40px !important;
}
/deep/.el-form-item__error{
padding-top: 0px !important;
}
}
</style>
<template>
<div class="clerk-wrapper queueManagementContainer">
<div class="header manage-head-wrapper">
<el-form ref="form" label-width="100px" inline class="searchForm boxShadow searchFormSocial">
<el-form-item :label="$t('table.mall')">
<el-select v-model="searchForm.mallId" filterable :placeholder="$t('pholder.select')" @change="mallChange">
<el-option :label="$t('pholder.all')" value=""></el-option>
<el-option v-for="item in mallListForTerm" :key="item.id" :label="item.name" :value="item.id" />
</el-select>
</el-form-item>
<el-form-item>
<el-button type="primary" class="search-btn" size="mini" plain @click="searchFun">{{$t('button.search')}}</el-button>
</el-form-item>
<div class="btns">
<el-button type="primary" size="mini" class="manage-add-btn fl-btn" @click="addClerk">{{$t('button.groupAdd')}}</el-button>
</div>
</el-form>
</div>
<div class="manage-content">
<div class="asis-table-content boxShadow" v-loading="loading">
<el-table
:data="tableData"
:max-height="tableHeight"
style="width: 100%;"
ref="row_table"
v-loading="loading"
class="clerk-manage-table"
header-row-class-name="manage-tab-head"
>
<el-table-column :label="$t('table.order')" align="center" type="index" width="100"></el-table-column>
<el-table-column :label="$t('table.squareName')" align="center" prop="name">
<template slot-scope="{row}">
{{mallNameFormat(row.mallId)}}
</template>
</el-table-column>
<el-table-column :label="$t('table.monday')" align="center" prop="name">
<template slot-scope="{row}">
{{timeFormat(row.monStartTime)}}-{{timeFormat(row.monEndTime)}}
</template>
</el-table-column>
<el-table-column :label="$t('table.tuesday')" align="center" prop="name">
<template slot-scope="{row}">
{{timeFormat(row.tueStartTime)}}-{{timeFormat(row.tueEndTime)}}
</template>
</el-table-column>
<el-table-column :label="$t('table.wednesday')" align="center" prop="name">
<template slot-scope="{row}">
{{timeFormat(row.wedStartTime)}}-{{timeFormat(row.wedEndTime)}}
</template>
</el-table-column>
<el-table-column :label="$t('table.thursday')" align="center" prop="name">
<template slot-scope="{row}">
{{timeFormat(row.thuStartTime)}}-{{timeFormat(row.thuEndTime)}}
</template>
</el-table-column>
<el-table-column :label="$t('table.friday')" align="center" prop="name">
<template slot-scope="{row}">
{{timeFormat(row.friStartTime)}}-{{timeFormat(row.friEndTime)}}
</template>
</el-table-column>
<el-table-column :label="$t('table.saturday')" align="center" prop="name">
<template slot-scope="{row}">
{{timeFormat(row.satStartTime)}}-{{timeFormat(row.satEndTime)}}
</template>
</el-table-column>
<el-table-column :label="$t('table.sunday')" align="center" prop="name">
<template slot-scope="{row}">
{{timeFormat(row.sunStartTime)}}-{{timeFormat(row.sunEndTime)}}
</template>
</el-table-column>
<el-table-column :label="$t('table.operate')" align="center" width="120">
<template slot-scope="scope">
<el-button type="text" class="tab-btn" @click="editHandle(scope.row)">{{$t('button.edit')}}</el-button>
<el-button type="text" class="tab-btn" @click="delHandle(scope.row)">{{$t('button.delete')}}</el-button>
</template>
</el-table-column>
</el-table>
<el-pagination
class="manage-pagination-box"
background
:current-page="currentPage"
:page-sizes="[10, 20, 50, 100]"
:page-size="pageSize"
@size-change="sizeChange"
@current-change="cerrentChange"
layout="sizes, prev, pager, next, slot"
:total="total"
>
<span
class="slot-ele-total"
>{{$t('table.pageHead')}} {{ total }} {{$t('table.pageTail')}}</span>
</el-pagination>
</div>
</div>
<add-dialog ref="addModel"></add-dialog>
</div>
</template>
<script>
import addDialog from './add.vue'
import moment from 'moment'
export default {
data() {
return {
mallListForTerm:[],
tableData: [],
total: 0,
pageSize: 10,
currentPage: 1,
pagesizeArr: [10, 20, 50, 100],
loading: false,
searchForm:{
mallId:'',
},
}
},
components:{
addDialog
},
mounted() {
this.getMallListForTerm()
},
computed: {
tableHeight() {
const windowInnerHeight = window.innerHeight;
return windowInnerHeight - windowInnerHeight * 0.24;
},
},
methods: {
getMallListForTerm() {
this.mallListForTerm = [];
this.searchForm.mallId = "";
this.$api.base.mall({
accountId: this.$cookie.get('accountId'),
status_arr: "1,3"
}).then(data => {
let result = data.data;
if (result.data.length) {
this.mallListForTerm = result.data;
}
this.getTableData();
})
},
mallNameFormat(val){
let name = ''
this.mallListForTerm.forEach(item=>{
if(item.id==val){
name = item.name
}
})
return name || ''
},
mallChange(val) {
this.getTableData();
},
timeFormat(time){
return moment(time).format('HH:mm:ss')
},
addClerk(){
this.$refs.addModel.dialogInit('add');
},
editHandle(row){
this.$refs.addModel.dialogInit('edit',row);
},
delHandle(row) {
this.$confirm(this.$t("message.delete"), this.$t("message.prompt"), {
confirmButtonText: this.$t("message.confirm"),
cancelButtonText: this.$t("message.cancel"),
type: "warning"
}).then(() => {
this.$api.queueManagementApi.deleteOpentime({id:row.id}).then(res => {
let result = res.data;
if(result.code==200){
this.$message({
message: result.msg,
type: 'success'
});
this.getTableData();
}else{
this.$message({
message: result.msg,
type: 'error'
});
}
})
})
},
searchFun(){
this.currentPage = 1;
this.getTableData()
},
getTableData() {
this.loading = true;
this.tableData = [];
this.$api.queueManagementApi.getOpentimeList({
mallId: this.searchForm.mallId,
pageNum: this.currentPage,
pageSize: this.pageSize
}).then(res => {
let result = res.data;
if(result.code==200){
this.tableData = result.data.list;
this.total = result.data.total;
}
this.loading = false;
})
},
sizeChange(val) {
this.pageSize = val;
this.getTableData();
},
cerrentChange(val) {
if (this.currentPage != val) {
this.currentPage = val;
this.getTableData();
}
},
}
}
</script>
<style scoped="scoped" lang="less">
.btns{
margin-right: 20px;
margin-top: 7px;
}
</style>
......@@ -530,7 +530,7 @@ export default {
cashierAreaId: this.regionId,
mallId: this.mallId,
chartType: "line",
countDate: moment().format("YYYY-MM-DD"),
// countDate: moment().format("YYYY-MM-DD"),
cashierChannelId: this.laneId,
});
this.isloading = false;
......@@ -558,7 +558,7 @@ export default {
this.$api.queueManagementApi.getCustomersOverview({
mallId: this.mallId,
chartType: "line",
countDate: moment().format("YYYY-MM-DD"),
// countDate: moment().format("YYYY-MM-DD"),
}).then(res => {
this.loading = false;
if(res.data.code==200){
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!