Commit ed993312 by 周志凯

fix: business time

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