| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801 |
- <template>
- <div class="content-box">
- <div class="left">
- <!-- <el-icon :size="23" class="camera"><VideoCameraFilled /></el-icon> -->
- <span class="cameratxt">系统设置</span>
- </div>
- <div class="middle">
- <div class="filter">
- <div class="condition">
- <div style="display: flex; align-items: center">
- <h3>开始时间段设置</h3>
- <!-- <el-button
- color="rgba(61, 81, 232, 1)"
- @click="editSystem"
- v-if="timeShow"
- type="primary"
- >修改</el-button
- >
- <el-button
- color="rgba(61, 81, 232, 1)"
- @click="saveSystem"
- v-if="!timeShow"
- type="primary"
- >保存</el-button
- >
- <el-button @click="cancelSystem" v-if="!timeShow" plain
- >取消</el-button
- > -->
- </div>
- <span>周期配置 : </span>
- <div
- style="margin-bottom: 8px"
- v-for="(i, ind) in timeList.list"
- :key="ind"
- >
- <div class="addTime">
- <el-checkbox-group
- @change="saveTime($event, i.id, '星期一')"
- v-model="i.day1"
- >
- <el-checkbox :label="1">星期一</el-checkbox>
- </el-checkbox-group>
- <el-checkbox-group
- @change="saveTime($event, i.id, '星期二')"
- v-model="i.day2"
- >
- <el-checkbox :label="1">星期二</el-checkbox>
- </el-checkbox-group>
- <el-checkbox-group
- @change="saveTime($event, i.id, '星期三')"
- v-model="i.day3"
- >
- <el-checkbox :label="1">星期三</el-checkbox>
- </el-checkbox-group>
- <el-checkbox-group
- @change="saveTime($event, i.id, '星期四')"
- v-model="i.day4"
- >
- <el-checkbox :label="1">星期四</el-checkbox>
- </el-checkbox-group>
- <el-checkbox-group
- @change="saveTime($event, i.id, '星期五')"
- v-model="i.day5"
- >
- <el-checkbox :label="1">星期五</el-checkbox>
- </el-checkbox-group>
- <el-checkbox-group
- @change="saveTime($event, i.id, '星期六')"
- v-model="i.day6"
- >
- <el-checkbox :label="1">星期六</el-checkbox>
- </el-checkbox-group>
- <el-checkbox-group
- @change="saveTime($event, i.id, '星期日')"
- v-model="i.day7"
- >
- <el-checkbox :label="1">星期日</el-checkbox>
- </el-checkbox-group>
- <div style="margin: 0 18px">
- <el-time-picker
- class="timePicker"
- v-model="i.timePicker"
- :clearable="false"
- is-range
- format="HH:mm"
- value-format="HH:mm"
- range-separator="-"
- start-placeholder="开始时间"
- end-placeholder="结束时间"
- @change="saveTime($event, i.id)"
- />
- </div>
- <div>
- <span
- @click="addTime(ind)"
- style="cursor: pointer; color: rgb(30, 125, 251)"
- >添加</span
- >
- <span
- v-if="timeList.list.length > 1"
- @click="delTime(ind, i.id)"
- style="cursor: pointer; color: #f56c6c"
- >删除</span
- >
- </div>
- </div>
- </div>
- </div>
- <div class="condition">
- <h3>截止预约时间设置</h3>
- <div>
- <span>发车前</span>
- <el-input
- :clearable="false"
- v-model="ruleForm.yy_end"
- class="w-50 m-2"
- style="width: 100px"
- @change="timeVerify"
- />
- <!-- <el-time-picker
- v-model="ruleForm.hh_end"
- format="HH:mm"
- value-format="HH:mm"
- @change="timeUpdata"
- /> -->
- <span> 分钟</span>
- </div>
- </div>
- <div class="condition">
- <h3>扫码时间设置</h3>
- <div>
- <span>发车前</span>
- <el-input
- :clearable="false"
- v-model="ruleForm.startTime"
- class="w-50 m-2"
- style="width: 100px"
- @change="timeVerify"
- />
- <span> 分钟 ,</span>
- <span>发车后</span>
- <el-input
- :clearable="false"
- v-model="ruleForm.endTime"
- class="w-50 m-2"
- style="width: 100px"
- @change="timeVerify"
- />
- <span> 分钟可扫码核销 </span>
- </div>
- <div style="margin-top: 15px">
- <span>扫码间隔</span>
- <el-input
- :clearable="false"
- v-model="ruleForm.scanInterval"
- class="w-50 m-2"
- style="width: 100px"
- @change="timeVerify"
- />
- <span> 分钟 ,</span>
- <span>在此时间内多次扫码均提示已预约</span>
- </div>
- </div>
- <!-- <div class="condition">
- <h3>候补截止预约时间设置</h3>
- <div>
- <span>候补截止时间</span>
- <el-time-picker
- v-model="ruleForm.hh_end"
- placeholder="请选择时间"
- format="HH:mm"
- value-format="HH:mm"
- @change="timeUpdata"
- />
- </div>
- </div> -->
- <div class="condition">
- <h3>黑名单设置</h3>
- <div>
- <span>爽约</span>
- <el-input
- :clearable="false"
- v-model="ruleForm.black_count"
- class="w-50 m-2"
- style="width: 100px"
- @change="timeVerify"
- />
- <span> 次,锁定账号</span>
- </div>
- </div>
- <div class="condition">
- <h3>通知时间</h3>
- <div>
- <span>发车前提前</span>
- <el-input
- :clearable="false"
- v-model="ruleForm.notice_time"
- class="w-50 m-2"
- style="width: 100px"
- @change="timeVerify"
- />
- <span> 分钟,发送通知</span>
- </div>
- </div>
- <div class="condition">
- <h3>报备人员开始预约时间设置</h3>
- <div>
- <span>发车前</span>
- <el-input
- :clearable="false"
- v-model="ruleForm.bb_before"
- class="w-50 m-2"
- style="width: 100px"
- @change="timeVerify"
- />
- <span> 分钟,可以预约车辆</span>
- </div>
- </div>
- </div>
- <div class="filter">
- <div class="condition" style="margin: 10px 0">
- <h3>退改设置</h3>
- <div>
- <span>发车前</span>
- <el-input
- :clearable="false"
- v-model="ruleForm.refundRule.a1.start"
- class="w-50 m-2"
- style="width: 80px"
- @change="refundRuleClick"
- />
- <span> 小时以上,免收手续费</span>
- </div>
- <div style="margin-top: 15px">
- <span>发车前</span>
- <el-input
- :clearable="false"
- v-model="ruleForm.refundRule.a2.start"
- class="w-50 m-2"
- style="width: 80px"
- @change="refundRuleClick"
- />
- <span> 小时以上</span>
- <el-input
- :clearable="false"
- v-model="ruleForm.refundRule.a2.end"
- class="w-50 m-2"
- style="width: 80px"
- @change="refundRuleClick"
- />
- <span> 小时以内,收取</span>
- <el-input
- :clearable="false"
- v-model="ruleForm.refundRule.a2.fee"
- class="w-50 m-2"
- style="width: 60px"
- @change="refundRuleClick"
- />
- <span> (元)手续费</span>
- </div>
- <div style="margin-top: 15px">
- <span>发车前</span>
- <el-input
- :clearable="false"
- v-model="ruleForm.refundRule.a3.end"
- class="w-50 m-2"
- style="width: 80px"
- @change="refundRuleClick"
- />
- <span> 小时以内,收取</span>
- <el-input
- :clearable="false"
- v-model="ruleForm.refundRule.a3.fee"
- class="w-50 m-2"
- style="width: 80px"
- @change="refundRuleClick"
- />
- <span> (元)手续费</span>
- </div>
- <div style="margin-top: 15px">
- <span>发车后不退票</span>
- </div>
- </div>
- <div class="condition">
- <h3>客服设置</h3>
- <div>
- <span>客服工作时间 </span>
- <el-time-picker
- style="width: 180px"
- class="timePicker"
- v-model="ruleForm.workTime"
- :clearable="false"
- is-range
- format="HH:mm"
- value-format="HH:mm"
- range-separator="-"
- start-placeholder="开始时间"
- end-placeholder="结束时间"
- @change="timeUpdata"
- />
- </div>
- <div style="margin-top: 15px">
- <span>客服手机号 </span>
- <el-input
- :clearable="false"
- v-model="ruleForm.workMobile"
- class="w-50 m-2"
- style="width: 180px"
- @change="timeUpdata"
- />
- </div>
- </div>
- </div>
- </div>
- <div class="footer"></div>
- </div>
- </template>
- <script setup>
- import {
- ref,
- reactive,
- watch,
- nextTick,
- onBeforeMount,
- onUnmounted,
- } from "vue";
- import { useRouter } from "vue-router";
- import { ElMessage, ElMessageBox } from "element-plus";
- import { dayjs } from "element-plus";
- import lodash from "lodash";
- import axios from "axios";
- import { useStore } from "vuex";
- const store = useStore();
- const api = ref("");
- const router = useRouter();
- // 表格数据
- const ruleForm = reactive({
- yy_duration: "",
- hh_end: "", //截止预约时间设置
- yy_end: "", //候补截止预约时间设置
- black_count: "", //黑名单设置次数
- notice_time: "", //发车前提前
- startTime: "", // 扫码前时间
- endTime: "", // 扫码后时间
- scanInterval: "", // 扫码间隔
- bb_before: "", // 报备人预约车辆时间设置
- workTime: [], // 客服工作时间
- workMobile: [], // 客服手机号
- refundRule: {
- a1: { fee: 0, start: 0 },
- a2: { fee: 0, start: 0, end: 0 },
- a3: { fee: 0, end: 0 },
- }, // 退改设置
- id: "",
- });
- // 开始时间段配置
- const timeList = reactive({
- list: [
- {
- day1: [],
- day2: [],
- day3: [],
- day4: [],
- day5: [],
- day6: [],
- day7: [],
- timePicker: [],
- id: "",
- },
- ],
- });
- const timeShow = ref(true);
- // 获取系统设置数据
- const getlist = async (message) => {
- let res = await axios({
- method: "post",
- url: api.value + "/carBook/cnqueryHb.action",
- headers: {
- token: sessionStorage.getItem("token"),
- },
- });
- console.log(res);
- if (res.data.code == 200) {
- ruleForm.yy_duration = res.data.data.yy_duration;
- ruleForm.scanInterval = res.data.data.scanInterval;
- ruleForm.yy_end = res.data.data.yy_end; //
- ruleForm.hh_end = res.data.data.hh_end; //
- ruleForm.black_count = res.data.data.black_count;
- ruleForm.notice_time = res.data.data.notice_time;
- ruleForm.startTime = res.data.data.sm_start;
- ruleForm.endTime = res.data.data.sm_end;
- ruleForm.bb_before = res.data.data.bb_before;
- ruleForm.workTime = res.data.data.workTime.split("-");
- ruleForm.workMobile = res.data.data.workMobile;
- ruleForm.id = res.data.data.id;
- sessionStorage.setItem("sm_start", res.data.data.sm_start);
- sessionStorage.setItem("sm_end", res.data.data.sm_end);
- ruleForm.refundRule = res.data.data.refundRule;
-
- if (message) {
- ElMessage({
- type: "success",
- showClose: true,
- message: message,
- center: true,
- });
- }
- } else {
- ElMessage({
- type: "error",
- showClose: true,
- message: res.data.message,
- center: true,
- });
- if (res.data.message == "token错误") {
- router.push({
- path: `/login`,
- });
- }
- }
- };
- const getTimeList = async () => {
- let res = await axios({
- method: "post",
- url: api.value + "/carBook/weekConfigqueryList.action",
- headers: {
- token: sessionStorage.getItem("token"),
- },
- });
- console.log(res, "开始时间段配置");
- if (res.data.code == 200) {
- let resData = res.data.data;
- let arr = [];
- resData.forEach((i) => {
- arr.push({
- day1: i.day1 ? [i.day1] : [],
- day2: i.day2 ? [i.day2] : [],
- day3: i.day3 ? [i.day3] : [],
- day4: i.day4 ? [i.day4] : [],
- day5: i.day5 ? [i.day5] : [],
- day6: i.day6 ? [i.day6] : [],
- day7: i.day7 ? [i.day7] : [],
- timePicker: [i.startTime, i.endTime],
- id: i.id,
- });
- });
- timeList.list = arr;
- console.log(arr, "开始时间段配置");
- } else {
- ElMessage({
- type: "error",
- showClose: true,
- message: res.data.message,
- center: true,
- });
- if (res.data.message == "token错误") {
- router.push({
- path: `/login`,
- });
- }
- }
- };
- // 页面数据一修改就调用函数
- const timeVerify = (val) => {
- const regex = /^[0-9]+$/;
- if (regex.test(val)) {
- timeUpdata();
- } else {
- getlist();
- ElMessage({
- type: "warning",
- showClose: true,
- message: "请输入正确数值",
- center: true,
- });
- }
- };
- // 退改设置修改就调用函数
- const refundRuleClick = (val) => {
- const regex = /^(\d+)(\.\d{1,2})?$/;
- if (regex.test(val)) {
- timeUpdata();
- } else {
- getlist();
- ElMessage({
- type: "warning",
- showClose: true,
- message: "请输入正确数值",
- center: true,
- });
- }
- };
- const timeUpdata = async () => {
- if (ruleForm.black_count <= 0) {
- ruleForm.black_count = 1;
- }
- let data = {
- yy_duration: ruleForm.yy_duration,
- scanInterval: ruleForm.scanInterval,
- yy_end: ruleForm.yy_end,
- hh_end: ruleForm.hh_end,
- black_count: ruleForm.black_count,
- notice_time: ruleForm.notice_time,
- sm_start: ruleForm.startTime,
- sm_end: ruleForm.endTime,
- bb_before: ruleForm.bb_before,
- id: ruleForm.id,
- workTime:ruleForm.workTime.join("-"),
- workMobile:ruleForm.workMobile,
- refundRule: JSON.stringify(ruleForm.refundRule),
- };
- console.log(data);
-
- let res = await axios({
- method: "post",
- url: api.value + "/carBook/cnupdate.action",
- headers: {
- "Content-Type": "application/json;charset=utf-8",
- token: sessionStorage.getItem("token"),
- },
- data: data,
- });
- console.log(res, "修改候补");
- if (res.data.code == 200) {
- // getlist();
- store.dispatch("sm_time");
- ElMessage({
- type: "success",
- showClose: true,
- message: res.data.message,
- center: true,
- });
- } else {
- getlist();
- ElMessage({
- type: "error",
- showClose: true,
- message: "修改失败",
- center: true,
- });
- }
- };
- const addTime = lodash.debounce(async (ind) => {
- console.log("添加", ind);
- // timeList.list.splice(ind + 1, 0, {
- // day1: [],
- // day2: [],
- // day3: [],
- // day4: [],
- // day5: [],
- // day6: [],
- // day7: [],
- // timePicker: [],
- // id: "",
- // });
- let arr = {
- day1: 0,
- day2: 0,
- day3: 0,
- day4: 0,
- day5: 0,
- day6: 0,
- day7: 0,
- timePicker: null,
- };
- let res = await axios({
- method: "post",
- url: api.value + "/carBook/weekConfiginsert.action",
- headers: {
- token: sessionStorage.getItem("token"),
- },
- data: arr,
- });
- if (res.data.code == 200) {
- getTimeList();
- ElMessage({
- type: "success",
- showClose: true,
- message: res.data.message,
- center: true,
- });
- } else {
- ElMessage({
- type: "error",
- showClose: true,
- message: res.data.message,
- center: true,
- });
- }
- }, 500);
- const delTime = async (ind, id) => {
- // timeList.list.splice(ind, 1);
- let data = new FormData();
- data.append("id", id);
- let res = await axios({
- method: "post",
- url: api.value + "/carBook/weekConfigdel.action",
- headers: {
- token: sessionStorage.getItem("token"),
- },
- data: data,
- });
- if (res.data.code == 200) {
- getTimeList();
- ElMessage({
- type: "success",
- showClose: true,
- message: res.data.message,
- center: true,
- });
- } else {
- ElMessage({
- type: "error",
- showClose: true,
- message: res.data.message,
- center: true,
- });
- }
- };
- const saveTime = async (event, id, txt) => {
- // console.log(event,'id:'+id,txt);
- console.log(timeList.list);
- let arr = timeList.list.map((i) => {
- console.log(i);
- return {
- day1: i.day1.length ? 1 : 0,
- day2: i.day2.length ? 1 : 0,
- day3: i.day3.length ? 1 : 0,
- day4: i.day4.length ? 1 : 0,
- day5: i.day5.length ? 1 : 0,
- day6: i.day6.length ? 1 : 0,
- day7: i.day7.length ? 1 : 0,
- startTime: i.timePicker[0],
- endTime: i.timePicker[1],
- id: i.id,
- };
- });
- // console.log(arr);
- let augment = arr.filter((i) => {
- return i.id == id;
- });
- // console.log(augment);
- let res = await axios({
- method: "post",
- url: api.value + "/carBook/weekConfigupdate.action",
- headers: {
- "Content-Type": "application/json;charset=utf-8",
- token: sessionStorage.getItem("token"),
- },
- data: augment[0],
- });
- if (res.data.code == 200) {
- getTimeList();
- ElMessage({
- type: "success",
- showClose: true,
- message: res.data.message,
- center: true,
- });
- } else {
- getTimeList();
- ElMessage({
- type: "error",
- showClose: true,
- message: res.data.message,
- center: true,
- });
- }
- };
- const editSystem = () => {
- timeShow.value = false;
- };
- const saveSystem = () => {
- timeShow.value = true;
- };
- const cancelSystem = () => {
- timeShow.value = true;
- };
- onBeforeMount(() => {
- api.value = store.state.user.api;
- getlist();
- getTimeList();
- });
- onUnmounted(() => {});
- </script>
- <style scoped lang="scss">
- .content-box {
- width: calc(100% - 40px);
- height: calc(100% - 105px);
- margin: 20px auto;
- background-color: #fff;
- color: #fff;
- display: flex;
- flex-direction: column;
- .left {
- // width: calc(100wh - 40px);
- display: flex;
- align-items: center;
- height: 60px;
- margin: 0 30px;
- border-bottom: 1px solid #ccc;
- color: #000;
- font-size: 18px;
- font-weight: 600;
- .camera {
- margin-right: 15px;
- color: #4392f7;
- }
- }
- .middle {
- width: calc(100% - 60px);
- height: calc(100% - 60px);
- // overflow: auto;
- margin: 0 auto;
- color: #000;
- display: flex;
- // border-bottom: 1px solid rgb(231, 231, 231);
- .filter {
- height: 100%;
- display: flex;
- // flex-wrap: wrap;
- flex-direction: column;
- overflow: auto;
- .condition {
- display: flex;
- flex-direction: column;
- margin: 10px 30px 10px 0;
- h3 {
- margin: 12px 12px 12px 0;
- }
- span {
- margin: 0 10px 0 0;
- font-size: 18px;
- color: #000;
- }
- .addTime {
- display: flex;
- flex-wrap: wrap;
- align-items: center;
- .el-checkbox-group {
- .el-checkbox {
- margin: 0 15px 0 0;
- }
- }
- :deep(.timePicker) {
- width: 200px;
- }
- }
- }
- }
- .gongneng {
- margin: 10px 0;
- }
- :deep(.cont) {
- width: 60%;
- margin: 20px auto;
- }
- :deep(.download) {
- display: flex;
- align-items: center;
- margin: 10px;
- }
- :deep(.download span) {
- font-size: 16px;
- margin-left: 20px;
- }
- :deep(.cont .el-button) {
- margin-left: 60px;
- margin-bottom: 30px;
- }
- :deep(.cont .accomplish) {
- width: 100%;
- display: flex;
- justify-content: center;
- }
- :deep(.cont .accomplish .el-button) {
- width: 50%;
- margin: 0;
- }
- }
- }
- .el-input {
- width: 192px;
- }
- </style>
|