waiting.vue 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351
  1. <template>
  2. <div class="content-box">
  3. <div class="left">
  4. <!-- <el-icon :size="23" class="camera"><VideoCameraFilled /></el-icon> -->
  5. <span class="cameratxt">系统设置</span>
  6. </div>
  7. <div class="middle">
  8. <div class="filter">
  9. <div class="condition">
  10. <h3>开始时间段设置</h3>
  11. <div>
  12. <el-time-picker
  13. v-model="ruleForm.yy_duration"
  14. is-range
  15. format="HH:mm"
  16. value-format="HH:mm"
  17. range-separator="-"
  18. start-placeholder="开始时间"
  19. end-placeholder="结束时间"
  20. @change="timeUpdata"
  21. />
  22. </div>
  23. </div>
  24. <div class="condition">
  25. <h3>截止预约时间设置</h3>
  26. <div>
  27. <span>正常发车前</span>
  28. <!-- <el-input
  29. clearable
  30. v-model="ruleForm.yy_end"
  31. class="w-50 m-2"
  32. style="width: 100px"
  33. /> -->
  34. <el-time-picker
  35. v-model="ruleForm.hh_end"
  36. format="HH:mm"
  37. value-format="HH:mm"
  38. @change="timeUpdata"
  39. />
  40. <!-- <span>&nbsp;&nbsp;分钟</span> -->
  41. </div>
  42. </div>
  43. <div class="condition">
  44. <h3>候补截止预约时间设置</h3>
  45. <div>
  46. <span>候补截止时间</span>
  47. <!-- <el-time-picker
  48. v-model="ruleForm.hh_end"
  49. placeholder="请选择时间"
  50. format="HH:mm"
  51. value-format="HH:mm"
  52. @change="timeUpdata"
  53. /> -->
  54. <el-input
  55. clearable
  56. v-model="ruleForm.yy_end"
  57. class="w-50 m-2"
  58. style="width: 100px"
  59. @blur="timeUpdata"
  60. />
  61. <span>&nbsp;&nbsp;分钟</span>
  62. </div>
  63. </div>
  64. <div class="condition">
  65. <h3>黑名单设置</h3>
  66. <div>
  67. <span>爽约超过</span>
  68. <el-input
  69. clearable
  70. v-model="ruleForm.black_count"
  71. class="w-50 m-2"
  72. style="width: 100px"
  73. @blur="timeUpdata"
  74. />
  75. <span>&nbsp;&nbsp;次,锁定账号</span>
  76. </div>
  77. </div>
  78. <div class="condition">
  79. <h3>通知时间</h3>
  80. <div>
  81. <span>发车前提前</span>
  82. <el-input
  83. clearable
  84. v-model="ruleForm.notice_time"
  85. class="w-50 m-2"
  86. style="width: 100px"
  87. @blur="timeUpdata"
  88. />
  89. <span>&nbsp;&nbsp;分钟,发送通知</span>
  90. </div>
  91. </div>
  92. </div>
  93. </div>
  94. <div class="footer"></div>
  95. </div>
  96. </template>
  97. <script setup>
  98. import {
  99. ref,
  100. reactive,
  101. watch,
  102. nextTick,
  103. onBeforeMount,
  104. onUnmounted,
  105. } from "vue";
  106. import { useRouter } from "vue-router";
  107. import { ElMessage, ElMessageBox } from "element-plus";
  108. import { dayjs } from "element-plus";
  109. import lodash from "lodash";
  110. import axios from "axios";
  111. import { useStore } from "vuex";
  112. const store = useStore();
  113. const api = ref("");
  114. const router = useRouter();
  115. // 表格数据
  116. const ruleForm = reactive({
  117. yy_duration: [], // 开始时间段设置
  118. hh_end: "", //截止预约时间设置
  119. yy_end: "", //候补截止预约时间设置
  120. black_count: "", //黑名单设置次数
  121. notice_time: "", //发车前提前
  122. id: "",
  123. });
  124. const getlist = async (message) => {
  125. let res = await axios({
  126. method: "post",
  127. url: api.value + "/carBook/cnqueryHb.action",
  128. headers: {
  129. token: sessionStorage.getItem("token"),
  130. },
  131. });
  132. console.log(res);
  133. if (res.data.code == 200) {
  134. console.log(res.data.data.yy_duration.split("~"));
  135. ruleForm.yy_duration = res.data.data.yy_duration.split("~");
  136. ruleForm.yy_end = res.data.data.yy_end; //
  137. ruleForm.hh_end = res.data.data.hh_end; //
  138. ruleForm.black_count = res.data.data.black_count;
  139. ruleForm.notice_time = res.data.data.notice_time;
  140. ruleForm.id = res.data.data.id;
  141. if (message) {
  142. ElMessage({
  143. type: "success",
  144. showClose: true,
  145. message: message,
  146. center: true,
  147. });
  148. }
  149. } else {
  150. ElMessage({
  151. type: "error",
  152. showClose: true,
  153. message: res.data.message,
  154. center: true,
  155. });
  156. if (res.data.message == "token错误") {
  157. router.push({
  158. path: `/login`,
  159. });
  160. }
  161. }
  162. };
  163. const timeUpdata = async () => {
  164. let data = {
  165. yy_duration: ruleForm.yy_duration.join("~"),
  166. yy_end: ruleForm.yy_end,
  167. hh_end: ruleForm.hh_end,
  168. black_count: ruleForm.black_count,
  169. notice_time: ruleForm.notice_time,
  170. id: ruleForm.id,
  171. };
  172. // let res = await admin.adminAdd(data);
  173. let res = await axios({
  174. method: "post",
  175. url: api.value + "/carBook/cnupdate.action",
  176. headers: {
  177. "Content-Type": "application/json;charset=utf-8",
  178. token: sessionStorage.getItem("token"),
  179. },
  180. data: data,
  181. });
  182. console.log(res, "修改候补");
  183. if (res.data.code == 200) {
  184. // getlist();
  185. ElMessage({
  186. type: "success",
  187. showClose: true,
  188. message: res.data.message,
  189. center: true,
  190. });
  191. } else {
  192. getlist();
  193. ElMessage({
  194. type: "error",
  195. showClose: true,
  196. message: "修改失败",
  197. center: true,
  198. });
  199. }
  200. };
  201. onBeforeMount(() => {
  202. api.value = store.state.user.api;
  203. getlist();
  204. });
  205. onUnmounted(() => {});
  206. </script>
  207. <style scoped lang="scss">
  208. .content-box {
  209. width: 97.5%;
  210. height: 89%;
  211. margin: 20px auto;
  212. background-color: #fff;
  213. color: #fff;
  214. display: flex;
  215. flex-direction: column;
  216. .left {
  217. // width: calc(100wh - 40px);
  218. display: flex;
  219. align-items: center;
  220. height: 60px;
  221. margin: 0 30px;
  222. padding: 20px 0;
  223. border-bottom: 1px solid #ccc;
  224. color: #000;
  225. font-size: 18px;
  226. font-weight: 600;
  227. .camera {
  228. margin-right: 15px;
  229. color: #4392f7;
  230. }
  231. }
  232. .middle {
  233. width: 96%;
  234. margin: 0 auto;
  235. color: #000;
  236. // border-bottom: 1px solid rgb(231, 231, 231);
  237. .filter {
  238. display: flex;
  239. flex-wrap: wrap;
  240. flex-direction: column;
  241. margin: 10px 0 0 0;
  242. .condition {
  243. display: flex;
  244. flex-direction: column;
  245. margin: 10px 30px 10px 0;
  246. span {
  247. margin: 0 10px 0 0;
  248. }
  249. }
  250. }
  251. .gongneng {
  252. margin: 10px 0;
  253. }
  254. :deep(.cont) {
  255. width: 60%;
  256. margin: 20px auto;
  257. }
  258. :deep(.download) {
  259. display: flex;
  260. align-items: center;
  261. margin: 10px;
  262. }
  263. :deep(.download span) {
  264. font-size: 16px;
  265. margin-left: 20px;
  266. }
  267. :deep(.cont .el-button) {
  268. margin-left: 60px;
  269. margin-bottom: 30px;
  270. }
  271. :deep(.cont .accomplish) {
  272. width: 100%;
  273. display: flex;
  274. justify-content: center;
  275. }
  276. :deep(.cont .accomplish .el-button) {
  277. width: 50%;
  278. margin: 0;
  279. }
  280. }
  281. .footer {
  282. width: 96%;
  283. height: 550px;
  284. margin: 10px auto 30px;
  285. .el-table--fit {
  286. height: 100%;
  287. :deep(.el-table__header-wrapper) {
  288. background-color: #000;
  289. }
  290. :deep(.el-table__row) {
  291. height: 50px;
  292. }
  293. :deep(.el-table__row td) {
  294. padding: 0;
  295. border: 0;
  296. }
  297. .el-button--primary {
  298. margin-left: 5px;
  299. }
  300. :deep(.el-table__body .even) {
  301. background-color: #fff;
  302. }
  303. :deep(.el-table__body .odd) {
  304. background-color: #f7fafe;
  305. }
  306. :deep(.look) {
  307. padding: 5px 14px;
  308. border-radius: 45px;
  309. border: 0.74px solid rgba(30, 125, 251, 1);
  310. }
  311. }
  312. }
  313. .el-pagination {
  314. // width: 1600px;
  315. width: 96%;
  316. margin: 0 auto 18px;
  317. justify-content: flex-end;
  318. :deep(.el-pagination__total) {
  319. color: #000;
  320. }
  321. :deep(.el-pagination__goto) {
  322. color: #000;
  323. }
  324. :deep(.el-pagination__classifier) {
  325. color: #000;
  326. }
  327. :deep(.el-pager li) {
  328. margin: 0 3px;
  329. }
  330. :deep(.btn-prev) {
  331. margin-right: 3px;
  332. }
  333. :deep(.btn-next) {
  334. margin-left: 3px;
  335. }
  336. }
  337. }
  338. .el-input {
  339. width: 192px;
  340. }
  341. </style>