|
@@ -7,19 +7,20 @@
|
|
|
</div>
|
|
|
<el-calendar class="doBusinessContainer" :first-day-of-week="7">
|
|
|
<template slot="dateCell" slot-scope="{date, data}">
|
|
|
- <div class="time-duration">
|
|
|
+ <div class="time-duration" v-for="(item,index) in content" :key="index">
|
|
|
<el-time-picker
|
|
|
+ v-if="date.getFullYear()+''+(Number(date.getMonth()+1)>10?Number(date.getMonth()+1):'0'+(Number(date.getMonth()+1)))+''+(date.getDate()>10?date.getDate():'0'+date.getDate())==item.date"
|
|
|
is-range
|
|
|
- v-model="value1"
|
|
|
+ v-model="item.timeRange"
|
|
|
size="mini"
|
|
|
range-separator="-"
|
|
|
start-placeholder="开始时间"
|
|
|
end-placeholder="结束时间"
|
|
|
- placeholder="选择时间范围"
|
|
|
- format="hh:mm"
|
|
|
- value-format="hh:mm"
|
|
|
+ format="HH:mm"
|
|
|
+ value-format="timestamp"
|
|
|
@change="setHours"
|
|
|
- ></el-time-picker>
|
|
|
+ placeholder="选择时间范围">
|
|
|
+ </el-time-picker>
|
|
|
</div>
|
|
|
<div class="dataJoin">{{ data.day.split('-').slice(2).join('')}}</div>
|
|
|
</template>
|
|
@@ -29,68 +30,80 @@
|
|
|
<script>
|
|
|
import Head from "../main/index";
|
|
|
import MonthTemp from "./monthTemp";
|
|
|
-import { queryHours, updateHours } from "@/api/doBusiness/business.js";
|
|
|
+import {queryHours,updateHours} from '@/api/doBusiness/business.js'
|
|
|
+import {toTimestamp,timestamp2String} from '@/utils/helper.js'
|
|
|
export default {
|
|
|
data() {
|
|
|
return {
|
|
|
headText: "营业时间调整",
|
|
|
- value1: [new Date(), new Date()],
|
|
|
- date: "",
|
|
|
- today: ""
|
|
|
+ content:[],
|
|
|
+ date:timestamp2String(+new Date())
|
|
|
};
|
|
|
},
|
|
|
components: {
|
|
|
Head,
|
|
|
MonthTemp
|
|
|
},
|
|
|
+ computed:{
|
|
|
+ gte(){
|
|
|
+ let month = parseInt(this.date.slice(4,6))-1
|
|
|
+ return this.date.slice(0,4) + (month > 10 ? month : ('0'+month) )+ this.date.slice(6,8)
|
|
|
+
|
|
|
+ },
|
|
|
+ lt(){
|
|
|
+ let month = parseInt(this.date.slice(4,6))+1
|
|
|
+ return this.date.slice(0,4) + (month > 10 ? month : ('0'+month) )+ this.date.slice(6,8)
|
|
|
+ }
|
|
|
+ },
|
|
|
+
|
|
|
methods: {
|
|
|
- formatTime() {
|
|
|
- let year = new Date().getFullYear();
|
|
|
- let month =
|
|
|
- new Date().getMonth() + 1 > 10
|
|
|
- ? new Date().getMonth() + 1
|
|
|
- : "0" + (new Date().getMonth() + 1);
|
|
|
- let date =
|
|
|
- new Date().getDate() > 10
|
|
|
- ? new Date().getDate()
|
|
|
- : "0" + new Date.getDate();
|
|
|
- return (this.today = year + "" + month + "" + date);
|
|
|
+ translate(){
|
|
|
+ this.content.forEach(el=>{
|
|
|
+ this.$set(el, 'timeRange', [new Date(toTimestamp(el.date+''+el.openTime)), new Date(toTimestamp(el.date+''+el.endTime))])
|
|
|
+ })
|
|
|
},
|
|
|
pickerVal(val) {
|
|
|
- this.date = val;
|
|
|
+ console.log(val);
|
|
|
+ this.date = val
|
|
|
},
|
|
|
- getHours() {
|
|
|
+ getHours(){
|
|
|
+ console.log(this.date)
|
|
|
let params = {
|
|
|
- postParams: {
|
|
|
- criteria: {
|
|
|
- projectId: "Pj4419000005",
|
|
|
- date: this.today
|
|
|
+ postParams:{
|
|
|
+ criteria:{
|
|
|
+ projectId:'Pj4419000005',
|
|
|
+ date:{
|
|
|
+ "$gte":this.gte,
|
|
|
+ "$lt": this.lt
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
- };
|
|
|
- queryHours(params).then(res => {});
|
|
|
+ }
|
|
|
+ queryHours(params).then(res=>{
|
|
|
+ this.content= res.content?res.content:[]
|
|
|
+ if(this.content.length>0){
|
|
|
+ this.translate()
|
|
|
+ }
|
|
|
+
|
|
|
+ })
|
|
|
},
|
|
|
- setHours() {
|
|
|
+ setHours(val){
|
|
|
+ console.log(val)
|
|
|
let params = {
|
|
|
- postParams: {
|
|
|
- projectId: "Pj4419000005",
|
|
|
- date: this.today,
|
|
|
- openTime:
|
|
|
- this.value1.split("-")[0].slice(0, 2) +
|
|
|
- "" +
|
|
|
- this.value1.split("-")[0].slice(2, 4),
|
|
|
- endTime:
|
|
|
- this.value1.split("-")[1].slice(0, 2) +
|
|
|
- "" +
|
|
|
- this.value1.split("-")[1].slice(2, 4)
|
|
|
+ postParams:{
|
|
|
+ projectId:'Pj4419000005',
|
|
|
+ date: timestamp2String(val[0]).substr(0,8),
|
|
|
+ openTime:timestamp2String(val[0]).substr(8,6),
|
|
|
+ endTime: timestamp2String(val[1]).substr(8,6),
|
|
|
}
|
|
|
- };
|
|
|
- updateHours(params).then(res => {});
|
|
|
+ }
|
|
|
+ updateHours(params).then(res=>{
|
|
|
+ console.log(res)
|
|
|
+ })
|
|
|
}
|
|
|
},
|
|
|
- mounted() {
|
|
|
- this.formatTime();
|
|
|
- this.getHours();
|
|
|
+ mounted(){
|
|
|
+ this.getHours()
|
|
|
}
|
|
|
};
|
|
|
</script>
|