Commit ed993312 by 周志凯

fix: business time

1 parent bbe13f6f
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
></el-option> ></el-option>
</el-select> </el-select>
</div> </div>
<div class="manage-select-box"> <!-- <div class="manage-select-box">
<el-select <el-select
v-model="createTypeVal" v-model="createTypeVal"
class="mall-opt" class="mall-opt"
...@@ -34,7 +34,7 @@ ...@@ -34,7 +34,7 @@
:value="item.value" :value="item.value"
/> />
</el-select> </el-select>
</div> </div> -->
<!-- 监控点 --> <!-- 监控点 -->
<div class="manage-select-box"> <div class="manage-select-box">
<el-input <el-input
...@@ -55,19 +55,19 @@ ...@@ -55,19 +55,19 @@
</el-col> </el-col>
<el-col :span="4"> <el-col :span="4">
<div class="btn-box"> <div class="btn-box">
<!-- <el-button <el-button
type="primary" type="primary"
size="mini" size="mini"
class="manage-add-btn fl-btn" class="manage-add-btn fl-btn"
@click="addClerk" @click="addClerk"
icon="el-icon-circle-plus-outline" icon="el-icon-circle-plus-outline"
>{{$t('dialog.addClerk')}}</el-button> --> >{{$t('dialog.addClerk')}}</el-button>
<el-button <!-- <el-button
type="primary" type="primary"
size="mini" size="mini"
class="manage-add-btn fl-btn" class="manage-add-btn fl-btn"
@click="onMarkClerkClick" @click="onMarkClerkClick"
>{{$t('dialog.markClerk')}}</el-button> >{{$t('dialog.markClerk')}}</el-button> -->
</div> </div>
</el-col> </el-col>
</el-row> </el-row>
...@@ -325,7 +325,7 @@ export default { ...@@ -325,7 +325,7 @@ export default {
}, },
createTypeList: [ createTypeList: [
{ label: this.$t("dialog.addClerk"), value: 0 }, { label: this.$t("dialog.addClerk"), value: 0 },
{ label: this.$t("table.autoTag"), value: 1 } // { label: this.$t("table.autoTag"), value: 1 }
], ],
createTypeVal: "", createTypeVal: "",
clerkName: "", clerkName: "",
......
...@@ -538,41 +538,43 @@ export default { ...@@ -538,41 +538,43 @@ export default {
this.editForm.latitude = latLng.lat; this.editForm.latitude = latLng.lat;
}, },
editBusTime() { editBusTime() {
var today = new Date(), return new Promise(resolve => {
params = {}, var today = new Date(),
url = ""; params = {},
var year = today.getFullYear(); url = "";
let startDate = year + "-01-01 " + this.editForm.businessTime[0] + ":00"; var year = today.getFullYear();
let endDate = year + "-12-31 " + this.editForm.businessTime[1] + ":00"; let startDate = year + "-01-01 " + this.editForm.businessTime[0] + ":00";
if (this.isBusTime) { let endDate = year + "-12-31 " + this.editForm.businessTime[1] + ":00";
params = { if (this.isBusTime) {
startTime: startDate, params = {
endTime: endDate startTime: startDate,
}; endTime: endDate
url = "/mallOpentimes/" + this.businessId; };
} else { url = "/mallOpentimes/" + this.businessId;
params = { } else {
accountId: this.$cookie.get("accountId"), params = {
mallId: this.rowId, accountId: this.$cookie.get("accountId"),
createUser: this.$cookie.get("userId"), mallId: this.rowId,
modifyUser: this.$cookie.get("userId"), createUser: this.$cookie.get("userId"),
startDate: startDate, modifyUser: this.$cookie.get("userId"),
endDate: endDate, startDate: startDate,
startTime: startDate, endDate: endDate,
endTime: endDate, startTime: startDate,
type: 1 endTime: endDate,
}; type: 1
url = "/mallOpentimes"; };
} url = "/mallOpentimes";
this.$api.management }
.addOrEditOpenTime(url, params) this.$api.management
.then(res => {}) .addOrEditOpenTime(url, params)
.catch(err => { .then(res => { resolve() })
this.$message({ .catch(err => {
message: this.$t("message.businessTimeErr"), this.$message({
type: "error" message: this.$t("message.businessTimeErr"),
type: "error"
});
}); });
}); })
}, },
editSubmit(formName) { editSubmit(formName) {
this.$refs[formName].validate(valid => { this.$refs[formName].validate(valid => {
...@@ -581,12 +583,12 @@ export default { ...@@ -581,12 +583,12 @@ export default {
this.editForm.openDate = this.editForm.openDate + " 00:00:00"; this.editForm.openDate = this.editForm.openDate + " 00:00:00";
this.$api.management this.$api.management
.editMall(this.rowId, this.editForm) .editMall(this.rowId, this.editForm)
.then(data => { .then(async data => {
if (this.editForm.businessTime) { if (this.editForm.businessTime) {
this.editBusTime(); await this.editBusTime();
} }
await this.$parent.getOpenTime();
this.editDialogVisible = false; this.editDialogVisible = false;
// this.$parent.getOpenTime();
this.$parent.getTableData(); this.$parent.getTableData();
}) })
.catch(error => { .catch(error => {
......
...@@ -387,35 +387,38 @@ export default { ...@@ -387,35 +387,38 @@ export default {
.catch(error => {}); .catch(error => {});
}, },
getOpenTime() { getOpenTime() {
let accountId = this.$cookie.get("accountId"); return new Promise(resolve => {
this.$api.management let accountId = this.$cookie.get("accountId");
.openTimeList({ this.$api.management
accountId: accountId .openTimeList({
// _t: Date.parse(new Date()) / 1000 accountId: accountId
}) // _t: Date.parse(new Date()) / 1000
.then(res => { })
var result = res.data.data; .then(res => {
var temp = {}, var result = res.data.data;
idObj = {}; var temp = {},
result.forEach((item, index) => { idObj = {};
var startTime = item.startTime.split(" ")[1]; result.forEach((item, index) => {
var endTime = item.endTime.split(" ")[1]; var startTime = item.startTime.split(" ")[1];
idObj[item.mallId] = item.id; var endTime = item.endTime.split(" ")[1];
temp[item.mallId] = idObj[item.mallId] = item.id;
startTime.split(":")[0] + temp[item.mallId] =
":" + startTime.split(":")[0] +
startTime.split(":")[1] + ":" +
"-" + startTime.split(":")[1] +
endTime.split(":")[0] + "-" +
":" + endTime.split(":")[0] +
endTime.split(":")[1]; ":" +
endTime.split(":")[1];
});
this.openTimeObj = temp;
this.openTimeId = idObj;
resolve()
})
.catch(err => {
console.log(err);
}); });
this.openTimeObj = temp; })
this.openTimeId = idObj;
})
.catch(err => {
console.log(err);
});
}, },
TimeFormatter(row, column, cellValue) { TimeFormatter(row, column, cellValue) {
return this.openTimeObj[row.id]; return this.openTimeObj[row.id];
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!