rule.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525
  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. <el-form
  10. ref="ruleFormRef"
  11. :model="ruleForm"
  12. :rules="rules"
  13. label-width="0"
  14. class="demo-ruleForm"
  15. :size="formSize"
  16. label-position="left"
  17. status-icon
  18. >
  19. <el-form-item label="" prop="textarea">
  20. <div class="condition">
  21. <h3 style="margin: 12px 0">可约车时间段设置</h3>
  22. <div>
  23. <span>约车时间段</span>
  24. <el-time-picker
  25. v-model="ruleForm.startTime"
  26. is-range
  27. range-separator="-"
  28. start-placeholder="开始时间"
  29. end-placeholder="结束时间"
  30. format="HH:mm"
  31. value-format="HH:mm"
  32. />
  33. </div>
  34. </div>
  35. </el-form-item>
  36. <el-form-item label="" prop="time">
  37. <div class="condition">
  38. <h3>截至取消订单时间设置</h3>
  39. <div>
  40. <span>乘车时间前</span>
  41. <el-input
  42. :clearable="false"
  43. v-model="ruleForm.time"
  44. class="w-50 m-2"
  45. style="width: 100px"
  46. />
  47. <span>&nbsp;&nbsp;分钟</span>
  48. </div>
  49. </div>
  50. </el-form-item>
  51. <el-form-item label="" prop="textarea">
  52. <div class="condition">
  53. <h3>顺风车须知设置</h3>
  54. <div>
  55. <el-input
  56. v-model="ruleForm.startTime"
  57. style="width: 500px"
  58. :rows="5"
  59. type="textarea"
  60. placeholder="请输入内容"
  61. />
  62. </div>
  63. </div>
  64. </el-form-item>
  65. <el-form-item label="" prop="textarea">
  66. <div class="condition">
  67. <h3>客服联系方式设置</h3>
  68. <div>
  69. <el-input
  70. :clearable="false"
  71. v-model="ruleForm.black_count"
  72. class="w-50 m-2"
  73. style="width: 220px"
  74. placeholder="请输入联系方式"
  75. />
  76. </div>
  77. </div>
  78. </el-form-item>
  79. <el-form-item label="" prop="textarea">
  80. <div class="condition">
  81. <h3>顺风车服务条款设置</h3>
  82. <div>
  83. <el-input
  84. v-model="ruleForm.startTime"
  85. style="width: 500px"
  86. :rows="5"
  87. type="textarea"
  88. placeholder="请输入内容"
  89. />
  90. </div>
  91. </div>
  92. </el-form-item>
  93. <el-form-item label="" prop="textarea">
  94. <div class="condition">
  95. <h3>司机取消订单保证金扣款规则设置</h3>
  96. <div>
  97. <span>司机取消订单,扣当前订单的</span>
  98. <el-input
  99. :clearable="false"
  100. v-model="ruleForm.notice_time"
  101. class="w-50 m-2"
  102. style="width: 100px"
  103. />
  104. <span>(如0.25则是抽当前订单支付金额的25%,保留2位小数)</span>
  105. </div>
  106. </div>
  107. </el-form-item>
  108. <el-form-item label="" prop="textarea">
  109. <div class="condition">
  110. <div>
  111. <span>保证金低于</span>
  112. <el-input
  113. :clearable="false"
  114. v-model="ruleForm.notice_time"
  115. class="w-50 m-2"
  116. style="width: 100px"
  117. />
  118. <span>&nbsp;&nbsp;则不能接单,需补交保证金</span>
  119. </div>
  120. </div>
  121. </el-form-item>
  122. <el-form-item label="" prop="textarea">
  123. <div class="condition">
  124. <h3>用户取消订单违约金规则设置</h3>
  125. <div>
  126. <span>司机取消订单,扣当前订单的</span>
  127. <el-input
  128. :clearable="false"
  129. v-model="ruleForm.notice_time"
  130. class="w-50 m-2"
  131. style="width: 100px"
  132. />
  133. <span>(如0.25则是抽当前订单支付金额的25%,保留2位小数)</span>
  134. </div>
  135. </div>
  136. </el-form-item>
  137. <el-form-item label="" prop="textarea">
  138. <div class="condition">
  139. <h3>保证金规则设置</h3>
  140. <div>
  141. <span>保证金退款</span>
  142. <div>
  143. <el-input
  144. v-model="ruleForm.startTime"
  145. style="width: 500px"
  146. :rows="5"
  147. type="textarea"
  148. placeholder="请输入保证金"
  149. />
  150. </div>
  151. </div>
  152. </div>
  153. </el-form-item>
  154. <el-form-item label="" prop="textarea">
  155. <div class="condition">
  156. <div>
  157. <span>保证金缴纳</span>
  158. <div>
  159. <el-input
  160. v-model="ruleForm.startTime"
  161. style="width: 500px"
  162. :rows="5"
  163. type="textarea"
  164. placeholder="请输入保证金"
  165. />
  166. </div>
  167. </div>
  168. </div>
  169. </el-form-item>
  170. <el-form-item label="" prop="textarea">
  171. <div class="condition">
  172. <div>
  173. <span>充值保证金</span>
  174. <el-input
  175. :clearable="false"
  176. v-model="ruleForm.notice_time"
  177. class="w-50 m-2"
  178. style="width: 100px"
  179. />
  180. </div>
  181. </div>
  182. </el-form-item>
  183. <el-form-item label="" prop="textarea">
  184. <div class="condition">
  185. <h3>提现设置</h3>
  186. <div>
  187. <span>提现时平台技术服务费抽成</span>
  188. <el-input
  189. :clearable="false"
  190. v-model="ruleForm.notice_time"
  191. class="w-50 m-2"
  192. style="width: 100px"
  193. />
  194. <span>(如0.25则是抽当前订单支付金额的25%,保留2位小数)</span>
  195. </div>
  196. </div>
  197. </el-form-item>
  198. <el-form-item label="" prop="quota">
  199. <div class="condition">
  200. <div>
  201. <span>提现最低额度</span>
  202. <el-input
  203. :clearable="false"
  204. v-model="ruleForm.quota"
  205. class="w-50 m-2"
  206. style="width: 100px"
  207. />
  208. <span>&nbsp;&nbsp;元(保留2位小数)</span>
  209. </div>
  210. </div>
  211. </el-form-item>
  212. </el-form>
  213. </div>
  214. <div class="footer">
  215. <div class="options">
  216. <el-button
  217. color="rgba(61, 81, 232, 1)"
  218. class="queding"
  219. type="primary"
  220. @click="edit"
  221. >
  222. 修改
  223. </el-button>
  224. <el-button
  225. color="rgba(61, 81, 232, 1)"
  226. class="queding"
  227. type="primary"
  228. @click="submit(ruleFormRef)"
  229. >
  230. 确定
  231. </el-button>
  232. <el-button class="congzhi" @click="cancel">取消</el-button>
  233. </div>
  234. </div>
  235. </div>
  236. </div>
  237. </template>
  238. <script setup>
  239. import {
  240. ref,
  241. reactive,
  242. watch,
  243. nextTick,
  244. onBeforeMount,
  245. onUnmounted,
  246. } from "vue";
  247. import { useRouter } from "vue-router";
  248. import { ElMessage, ElMessageBox } from "element-plus";
  249. import { dayjs } from "element-plus";
  250. import lodash from "lodash";
  251. import axios from "axios";
  252. import { useStore } from "vuex";
  253. const store = useStore();
  254. const api = ref("");
  255. const router = useRouter();
  256. // 表单数据
  257. const formSize = ref("default");
  258. const ruleFormRef = ref();
  259. const ruleForm = reactive({
  260. time: "",
  261. yy_duration: "",
  262. hh_end: "", //截止预约时间设置
  263. yy_end: "", //候补截止预约时间设置
  264. black_count: "", //黑名单设置次数
  265. notice_time: "", //发车前提前
  266. startTime: "", // 扫码前时间
  267. endTime: "", // 扫码后时间
  268. scanInterval: "", // 扫码间隔
  269. bb_before: "", // 报备人预约车辆时间设置
  270. id: "",
  271. });
  272. // 表单验证
  273. const rules = reactive({
  274. time: [
  275. { required: true, message: "姓名不能为空", trigger: "blur" },
  276. {
  277. pattern: /^(0|[1-9]\d*)$/,
  278. message: "请输入正确数字",
  279. trigger: "blur",
  280. },
  281. ],
  282. quota: [
  283. { required: true, message: "额度不能为空", trigger: "blur" },
  284. {
  285. pattern: /^(?!0\d)\d+(?:\.\d{1,2})?$/,
  286. message: "请输入正确额度",
  287. trigger: "blur",
  288. },
  289. ],
  290. });
  291. // 获取系统设置数据
  292. const getlist = async (message) => {
  293. // let res = await axios({
  294. // method: "post",
  295. // url: api.value + "/carBook/cnqueryHb.action",
  296. // headers: {
  297. // token: sessionStorage.getItem("token"),
  298. // },
  299. // });
  300. // console.log(res);
  301. // if (res.data.code == 200) {
  302. // if (message) {
  303. // ElMessage({
  304. // type: "success",
  305. // showClose: true,
  306. // message: message,
  307. // center: true,
  308. // });
  309. // }
  310. // } else {
  311. // ElMessage({
  312. // type: "error",
  313. // showClose: true,
  314. // message: res.data.message,
  315. // center: true,
  316. // });
  317. // if (res.data.message == "token错误") {
  318. // router.push({
  319. // path: `/login`,
  320. // });
  321. // }
  322. // }
  323. };
  324. const getTimeList = async () => {
  325. // let res = await axios({
  326. // method: "post",
  327. // url: api.value + "/carBook/weekConfigqueryList.action",
  328. // headers: {
  329. // token: sessionStorage.getItem("token"),
  330. // },
  331. // });
  332. // console.log(res, "开始时间段配置");
  333. // if (res.data.code == 200) {
  334. // let resData = res.data.data;
  335. // } else {
  336. // ElMessage({
  337. // type: "error",
  338. // showClose: true,
  339. // message: res.data.message,
  340. // center: true,
  341. // });
  342. // if (res.data.message == "token错误") {
  343. // router.push({
  344. // path: `/login`,
  345. // });
  346. // }
  347. // }
  348. };
  349. const timeUpdata = async () => {
  350. // let data = {
  351. // yy_duration: ruleForm.yy_duration,
  352. // scanInterval: ruleForm.scanInterval,
  353. // yy_end: ruleForm.yy_end,
  354. // hh_end: ruleForm.hh_end,
  355. // black_count: ruleForm.black_count,
  356. // notice_time: ruleForm.notice_time,
  357. // sm_start: ruleForm.startTime,
  358. // sm_end: ruleForm.endTime,
  359. // bb_before: ruleForm.bb_before,
  360. // id: ruleForm.id,
  361. // };
  362. // let res = await axios({
  363. // method: "post",
  364. // url: api.value + "/carBook/cnupdate.action",
  365. // headers: {
  366. // "Content-Type": "application/json;charset=utf-8",
  367. // token: sessionStorage.getItem("token"),
  368. // },
  369. // data: data,
  370. // });
  371. // console.log(res, "修改候补");
  372. // if (res.data.code == 200) {
  373. // // getlist();
  374. // store.dispatch("sm_time");
  375. // ElMessage({
  376. // type: "success",
  377. // showClose: true,
  378. // message: res.data.message,
  379. // center: true,
  380. // });
  381. // } else {
  382. // getlist();
  383. // ElMessage({
  384. // type: "error",
  385. // showClose: true,
  386. // message: "修改失败",
  387. // center: true,
  388. // });
  389. // }
  390. };
  391. //编辑按钮
  392. const edit = () => {};
  393. // 取消
  394. const cancel = () => {
  395. ruleFormRef.value.resetFields();
  396. };
  397. // 确认
  398. const submit = async (formEl) => {
  399. if (!formEl) return;
  400. await formEl.validate(async (valid, fields) => {
  401. if (valid) {
  402. } else {
  403. console.log("error submit!", fields);
  404. }
  405. });
  406. };
  407. onBeforeMount(() => {
  408. api.value = store.state.user.api;
  409. getlist();
  410. getTimeList();
  411. });
  412. onUnmounted(() => {});
  413. </script>
  414. <style scoped lang="scss">
  415. .content-box {
  416. width: calc(100% - 40px);
  417. height: calc(100% - 105px);
  418. margin: 20px auto;
  419. background-color: #fff;
  420. color: #fff;
  421. display: flex;
  422. flex-direction: column;
  423. .left {
  424. // width: calc(100wh - 40px);
  425. display: flex;
  426. align-items: center;
  427. height: 60px;
  428. margin: 0 30px;
  429. border-bottom: 1px solid #ccc;
  430. color: #000;
  431. font-size: 18px;
  432. font-weight: 600;
  433. .camera {
  434. margin-right: 15px;
  435. color: #4392f7;
  436. }
  437. }
  438. .middle {
  439. width: calc(100% - 60px);
  440. height: calc(100% - 60px);
  441. overflow: auto;
  442. margin: 0 auto;
  443. color: #000;
  444. // border-bottom: 1px solid rgb(231, 231, 231);
  445. .filter {
  446. display: flex;
  447. flex-wrap: wrap;
  448. flex-direction: column;
  449. .condition {
  450. display: flex;
  451. flex-direction: column;
  452. margin: 0;
  453. h3 {
  454. font-size: 19px;
  455. margin: 0px 12px 12px 0;
  456. }
  457. span {
  458. margin: 0 10px 0 0;
  459. font-size: 16px;
  460. color: #000;
  461. }
  462. .addTime {
  463. display: flex;
  464. align-items: center;
  465. .el-checkbox-group {
  466. .el-checkbox {
  467. margin: 0 15px 0 0;
  468. }
  469. }
  470. :deep(.timePicker) {
  471. width: 200px;
  472. }
  473. }
  474. }
  475. }
  476. .gongneng {
  477. margin: 10px 0;
  478. }
  479. :deep(.cont) {
  480. width: 60%;
  481. margin: 20px auto;
  482. }
  483. :deep(.download) {
  484. display: flex;
  485. align-items: center;
  486. margin: 10px;
  487. }
  488. :deep(.download span) {
  489. font-size: 16px;
  490. margin-left: 20px;
  491. }
  492. :deep(.cont .el-button) {
  493. margin-left: 60px;
  494. margin-bottom: 30px;
  495. }
  496. :deep(.cont .accomplish) {
  497. width: 100%;
  498. display: flex;
  499. justify-content: center;
  500. }
  501. :deep(.cont .accomplish .el-button) {
  502. width: 50%;
  503. margin: 0;
  504. }
  505. .footer {
  506. margin: 10px 0 25px 0;
  507. .options {
  508. }
  509. }
  510. }
  511. }
  512. .el-input {
  513. width: 192px;
  514. }
  515. </style>