detail.vue 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735
  1. <template>
  2. <div class="edityy">
  3. <div
  4. style="width: 100%; height: 0rpx; position: relative; background: white"
  5. >
  6. <div class="status qd" v-if="form.statusStr == '待签到'">待签到</div>
  7. <div class="status rc" v-if="form.statusStr == '待入厂'">待入厂</div>
  8. <div class="status zx" v-if="form.statusStr == '装卸中'">装卸中</div>
  9. <div class="status wc" v-if="form.statusStr == '已完成'">已完成</div>
  10. <div class="status gq" v-if="form.statusStr == '已过期'">已过期</div>
  11. <div class="status qx" v-if="form.statusStr == '已取消'">已取消</div>
  12. </div>
  13. <div class="form bd_bottom">
  14. <div class="form-label">
  15. <span class="form-requird">*</span>
  16. <span>供应商</span>
  17. </div>
  18. <div @click="oepnGysPopup()">
  19. {{ form.gysName ? form.gysName : "请选择" }}
  20. </div>
  21. </div>
  22. <div class="form bd_bottom pdt32 pdb32" style="display: block">
  23. <div class="form-label">
  24. <span class="form-requird">*</span>
  25. <span>车牌号</span>
  26. </div>
  27. <div>
  28. <car-number disabled ref="carNum" v-model="carNumber"></car-number>
  29. </div>
  30. </div>
  31. <div class="form bd_bottom">
  32. <div class="form-label">
  33. <span class="form-requird">*</span>
  34. <span>车辆类型</span>
  35. </div>
  36. <div class="form-value">
  37. {{ form.carType ? form.carType : "请选择" }}
  38. </div>
  39. </div>
  40. <div class="form bd_bottom" style="display: block">
  41. <div style="display: flex">
  42. <div class="form-label">
  43. <span class="form-requird">*</span>
  44. <span>司机姓名</span>
  45. </div>
  46. <div class="form-value">
  47. <input
  48. type="text"
  49. disabled
  50. placeholder="请选择"
  51. v-model="form.driverName"
  52. />
  53. </div>
  54. </div>
  55. <div class="historyList">
  56. <div
  57. class="historyList-item mt32"
  58. v-for="item in nameList"
  59. @click="selectName(item)"
  60. >
  61. <div>{{ item }}</div>
  62. </div>
  63. </div>
  64. </div>
  65. <div class="form bd_bottom" style="display: block">
  66. <div style="display: flex; align-items: center">
  67. <div class="form-label">
  68. <span class="form-requird">*</span>
  69. <span>手机号/账号</span>
  70. </div>
  71. <div class="form-value">
  72. <input
  73. type="text"
  74. disabled
  75. placeholder="请选择"
  76. v-model="form.driverUsername"
  77. />
  78. </div>
  79. </div>
  80. <!-- <div class="historyList">
  81. <div class="historyList-item mt32">
  82. <div>13921516068</div>
  83. </div>
  84. <div class="historyList-item mt32">
  85. <div>13921516068</div>
  86. </div>
  87. <div class="historyList-item mt32">
  88. <div>13921516068</div>
  89. </div>
  90. <div class="historyList-item mt32">
  91. <div>13921516068</div>
  92. </div>
  93. </div> -->
  94. </div>
  95. <div class="form bd_bottom" style="display: block">
  96. <div style="display: flex">
  97. <div class="form-label">
  98. <span class="form-requird">*</span>
  99. <span>联系电话</span>
  100. </div>
  101. <div class="form-value">
  102. <input
  103. type="text"
  104. disabled
  105. placeholder="请选择"
  106. v-model="form.driverContactPhone"
  107. />
  108. </div>
  109. </div>
  110. </div>
  111. <div class="form bd_bottom mt32">
  112. <div class="form-label">
  113. <span class="form-requird">*</span>
  114. <span>装卸类型:</span>
  115. </div>
  116. <div>
  117. {{ form.loadType }}
  118. </div>
  119. </div>
  120. <div class="form bd_bottom">
  121. <div class="form-label">
  122. <span class="form-requird">*</span>
  123. <span>件数/托盘数:</span>
  124. </div>
  125. <div>
  126. <input
  127. type="text"
  128. placeholder="请输入"
  129. disabled
  130. v-model="form.loadNum"
  131. />
  132. </div>
  133. </div>
  134. <div class="form bd_bottom" v-if="mtId">
  135. <div class="form-label">
  136. <span class="form-requird">*</span>
  137. <span>预约日期:</span>
  138. </div>
  139. <div class="uni-input">
  140. {{ form.reservationDate ? form.reservationDate : "请选择" }}
  141. <!-- {{form.reservationDate?form.reservationDate:''}} -->
  142. </div>
  143. </div>
  144. <div class="bottom-form mt32">
  145. <div class="mt-select">
  146. <div
  147. class="select-item"
  148. :style="{
  149. background: item.value == mtId ? '#8A0554' : '#f5f7fa',
  150. color: item.value == mtId ? 'white' : 'black',
  151. }"
  152. v-for="item in mtList"
  153. @click="getMtId(item)"
  154. :key="item.value"
  155. >
  156. {{ item.label }}
  157. </div>
  158. </div>
  159. <div class="sj-select-title">
  160. <div class="sj-label">
  161. <span style="color: red">*</span>
  162. 可选时间
  163. </div>
  164. <div class="legend">
  165. <div class="white-legend"></div>
  166. <div>可选</div>
  167. </div>
  168. <div class="legend">
  169. <div class="purple-legend"></div>
  170. <div>已占用</div>
  171. </div>
  172. </div>
  173. <div class="sj-select">
  174. <div
  175. :class="
  176. item.statusStr == '已预约'
  177. ? 'select-item yyyStatus'
  178. : item.statusStr == '已锁定'
  179. ? 'select-item ysdStatus'
  180. : 'select-item '
  181. "
  182. :key="item.timeEnd"
  183. v-for="item in kxTimeList"
  184. >
  185. {{ item.timeStart }}~{{ item.timeEnd }}
  186. <van-icon
  187. name="success"
  188. v-if="
  189. form.dockSettingDetailId == item.dockSettingDetailId &&
  190. form.dockSettingId == item.dockSettingId &&
  191. form.timeEnd == item.timeEnd &&
  192. form.timeStart == item.timeStart
  193. "
  194. />
  195. </div>
  196. </div>
  197. <div class="foot-btn">
  198. <van-button
  199. @click="cancelYY"
  200. color="rgba(0, 0, 0, 0.05)"
  201. type="default"
  202. class="cancel"
  203. >
  204. 返回
  205. </van-button>
  206. </div>
  207. <van-popup :show="gysPopupStatus" position="bottom" bind:close="onClose">
  208. <div style="text-align: right">
  209. <van-icon @click="closeGysPopup(null)" name="cross" />
  210. </div>
  211. <div class="popupListBox">
  212. <div v-for="item in gysList" class="popupListBox-row">
  213. <div>{{ item.label }}</div>
  214. <van-button size="mini" type="primary" @click="closeGysPopup(item)">
  215. 选择
  216. </van-button>
  217. </div>
  218. </div>
  219. </van-popup>
  220. </div>
  221. </div>
  222. </template>
  223. <script>
  224. import CarNumber from "@/components/codecook-carnumber/codecook-carnumber.vue";
  225. import {
  226. getDockCarType,
  227. getBizByUsername,
  228. getDockSelectList,
  229. getDockLoadType,
  230. getAvailableDateList,
  231. getDockTimeList,
  232. updateReservation,
  233. } from "@/js_sdk/chooseCarApi.js";
  234. import { getReservationVoById } from "@/js_sdk/sjTools.js";
  235. import { getUserLocalStorageInfo } from "@/js_sdk/localUserInfo.js";
  236. export default {
  237. data() {
  238. return {
  239. gysPopupStatus: false,
  240. formData: {
  241. carType: "",
  242. },
  243. carNumber: "",
  244. gysList: [],
  245. form: {},
  246. carNumberList: [],
  247. dockCarTypeList: [],
  248. mtList: [],
  249. yydateList: [],
  250. mtId: "",
  251. kxTimeList: [],
  252. nameList: [],
  253. telList: [],
  254. checkTimeData: {},
  255. };
  256. },
  257. components: {
  258. CarNumber,
  259. },
  260. onLoad(e) {
  261. this.form.id = e.id;
  262. console.log(e);
  263. this.getReservationVoById(e.id);
  264. this.getBizByUsername();
  265. this.getDockCarType();
  266. },
  267. methods: {
  268. cancelYY() {
  269. uni.navigateBack();
  270. },
  271. timeSelect(item) {
  272. if (item.statusStr == "已锁定") {
  273. this.$showToast("该时段已被锁定,请勿选择");
  274. return;
  275. }
  276. if (item.statusStr == "已预约") {
  277. if (
  278. item.dockSettingDetailId == this.checkTimeData.dockSettingDetailId &&
  279. item.dockSettingId == this.checkTimeData.dockSettingId &&
  280. item.timeEnd == this.checkTimeData.timeEnd &&
  281. item.timeStart == this.checkTimeData.timeStart &&
  282. item.dockId == this.checkTimeData.dockId
  283. ) {
  284. } else {
  285. this.$showToast("该时段已被预约,请重新选择");
  286. return;
  287. }
  288. }
  289. console.log(item);
  290. this.form.dockSettingDetailId = item.dockSettingDetailId;
  291. this.form.dockSettingId = item.dockSettingId;
  292. this.form.timeEnd = item.timeEnd;
  293. this.form.dockId = item.dockId;
  294. this.form.timeStart = item.timeStart;
  295. let form = { ...this.form };
  296. this.form = {};
  297. this.form = form;
  298. },
  299. async getAvailableDateList() {
  300. let { data } = await getAvailableDateList({ dockId: this.dockId });
  301. this.yydateList = data;
  302. },
  303. selectDriverContactPhone(e) {
  304. this.form.driverContactPhone = e;
  305. let form = { ...this.form };
  306. this.form = {};
  307. this.form = form;
  308. },
  309. async updateReservation() {
  310. if (!this.form.bizId) {
  311. this.$showToast("请选择供应商");
  312. return;
  313. }
  314. if (!this.carNumber) {
  315. this.$showToast("请输入车牌号");
  316. return;
  317. }
  318. if (!this.form.carType) {
  319. this.$showToast("请选择车辆类型");
  320. return;
  321. }
  322. if (!this.form.driverName) {
  323. this.$showToast("请输入司机姓名");
  324. return;
  325. }
  326. if (!this.form.driverName) {
  327. this.$showToast("请输入司机姓名");
  328. return;
  329. }
  330. if (!this.form.driverUsername) {
  331. this.$showToast("请输入手机号/账号");
  332. return;
  333. }
  334. if (!this.form.driverContactPhone) {
  335. this.$showToast("联系电话");
  336. return;
  337. }
  338. let res = await updateReservation({
  339. ...this.form,
  340. userId: getUserLocalStorageInfo().user.id,
  341. driverId: getUserLocalStorageInfo().user.id,
  342. carNo: this.carNumber,
  343. });
  344. if (res.errmsg == "成功") {
  345. this.$showToast("预约成功");
  346. uni.navigateBack({ delta: 2 });
  347. }
  348. console.log(res);
  349. },
  350. async getReservationVoById(id) {
  351. let { data } = await getReservationVoById({ id: id });
  352. console.log(data);
  353. // this.carNumber = data.carNo;
  354. this.form.carType = data.carType;
  355. this.form.driverName = data.driverName;
  356. this.form.bizId = data.bizId;
  357. this.form.carType = data.carType;
  358. this.form.loadType = data.loadType;
  359. this.form.reservationDate = data.reservationDate;
  360. this.dockId = data.dockId;
  361. this.form.dockId = data.dockId;
  362. this.form.statusStr = data.statusStr;
  363. this.mtId = data.dockId;
  364. this.form.loadType = data.loadType;
  365. this.form.driverUsername = data.driverUsername;
  366. this.form.loadNum = data.loadNum;
  367. this.form.driverContactPhone = data.driverContactPhone;
  368. this.form.gysName = data.businessName;
  369. this.checkTimeData = {
  370. ...{
  371. dockSettingDetailId: data.dockSettingDetailId,
  372. dockSettingId: data.dockSettingId,
  373. timeEnd: data.timeEnd,
  374. timeStart: data.timeStart,
  375. dockId: data.dockId,
  376. },
  377. };
  378. this.form.dockSettingDetailId = data.dockSettingDetailId;
  379. this.form.dockSettingId = data.dockSettingId;
  380. this.form.timeEnd = data.timeEnd;
  381. this.form.timeStart = data.timeStart;
  382. this.$refs.carNum.setCarNumValue(
  383. data.carNo.length == 7 ? data.carNo + " " : data.carNo
  384. );
  385. this.getDockSelectList();
  386. this.getAvailableDateList();
  387. this.getDockTimeList();
  388. },
  389. async getDockTimeList() {
  390. let { data } = await getDockTimeList({
  391. dateStr: this.form.reservationDate,
  392. dockId: this.mtId,
  393. bizId: this.form.bizId,
  394. });
  395. this.kxTimeList = data;
  396. },
  397. selectName(item) {
  398. this.form.driverName = item;
  399. let form = { ...this.form };
  400. this.form = {};
  401. this.form = form;
  402. },
  403. async selectYYDate({ detail }) {
  404. console.log(this.yydateList[detail.value]);
  405. this.form.reservationDate = this.yydateList[detail.value];
  406. let form = { ...this.form };
  407. this.form = {};
  408. this.form = form;
  409. let { data } = await getDockTimeList({
  410. dateStr: this.form.reservationDate,
  411. dockId: this.mtId,
  412. bizId: this.form.bizId,
  413. });
  414. this.kxTimeList = data;
  415. this.form.dockSettingDetailId = "";
  416. this.form.dockSettingId = "";
  417. this.form.timeEnd = "";
  418. this.form.dockId = "";
  419. this.form.timeStart = "";
  420. },
  421. async getMtId(item) {
  422. this.kxTimeList = [];
  423. this.form.reservationDate = "";
  424. console.log(item);
  425. let { data } = await getAvailableDateList({ dockId: item.value });
  426. this.mtId = item.value;
  427. // this.form.dockId = item.value;
  428. this.yydateList = data;
  429. },
  430. async getDockSelectList() {
  431. let { data } = await getDockSelectList({
  432. carType: this.form.carType,
  433. loadType: this.form.loadType.replace("预约", ""),
  434. });
  435. this.mtList = data;
  436. },
  437. selectCarType({ detail }) {
  438. console.log(detail);
  439. this.form.carType = this.dockCarTypeList[detail.value].label;
  440. console.log(this.dockCarTypeList[detail.value]);
  441. let form = { ...this.form };
  442. this.form = {};
  443. this.form = form;
  444. this.getDockSelectList();
  445. },
  446. async getDockCarType() {
  447. let { data } = await getDockCarType();
  448. this.dockCarTypeList = data;
  449. console.log(data);
  450. },
  451. selectCarNumber(e) {
  452. console.log(e);
  453. // this.carNumber = "苏B51WK7";
  454. // this.$forceUpdate();
  455. this.$refs.carNum.setCarNumValue(e);
  456. // this.carNumber = e;
  457. },
  458. oepnGysPopup() {
  459. this.gysPopupStatus = true;
  460. },
  461. async closeGysPopup(item) {
  462. console.log(item);
  463. this.gysPopupStatus = false;
  464. if (item) {
  465. console.log(item);
  466. this.form.gysName = item.label;
  467. this.form.bizId = item.value;
  468. }
  469. },
  470. async getBizByUsername() {
  471. let { data } = await getBizByUsername({
  472. username: getUserLocalStorageInfo().user.username,
  473. });
  474. console.log(data);
  475. this.gysList = data;
  476. },
  477. },
  478. };
  479. </script>
  480. <style lang="scss">
  481. .edityy {
  482. .yyyStatus {
  483. background: #8e8be4 !important;
  484. color: white;
  485. }
  486. .ysdStatus {
  487. background: #ededed !important;
  488. color: #333333;
  489. }
  490. .popupListBox {
  491. height: 800rpx;
  492. padding: 20rpx;
  493. box-sizing: border-box;
  494. .popupListBox-row {
  495. margin-bottom: 15rpx;
  496. display: flex;
  497. align-items: center;
  498. justify-content: space-between;
  499. }
  500. }
  501. .status {
  502. width: 144rpx;
  503. height: 56rpx;
  504. text-align: center;
  505. line-height: 56rpx;
  506. border-top-right-radius: 5%;
  507. border-bottom-left-radius: 50%;
  508. position: absolute;
  509. top: -1rpx;
  510. right: 0;
  511. font-weight: 400;
  512. font-size: 28rpx;
  513. }
  514. .sj-select {
  515. display: flex;
  516. flex-wrap: wrap;
  517. margin-top: 32rpx;
  518. .select-item {
  519. text-align: center;
  520. line-height: 80rpx;
  521. width: 225rpx;
  522. height: 80rpx;
  523. background: rgba(255, 255, 255, 1);
  524. border-radius: 0rpx 0rpx 0rpx 0rpx;
  525. border: 2rpx solid #eaeff6;
  526. }
  527. .iselected {
  528. background: #ededed;
  529. }
  530. .isuse {
  531. background: rgba(142, 139, 228, 1);
  532. }
  533. }
  534. .sj-select-title {
  535. flex-wrap: wrap;
  536. display: flex;
  537. align-items: center;
  538. .legend {
  539. display: flex;
  540. align-items: center;
  541. margin-right: 32rpx;
  542. }
  543. .sj-label {
  544. margin-right: 64rpx;
  545. }
  546. .white-legend {
  547. margin-right: 16rpx;
  548. width: 28rpx;
  549. height: 28rpx;
  550. background: #ffffff;
  551. border-radius: 0rpx 0rpx 0rpx 0rpx;
  552. border: 2rpx solid #e9e9e9;
  553. }
  554. .purple-legend {
  555. margin-right: 16rpx;
  556. width: 28rpx;
  557. height: 28rpx;
  558. background: #8e8be4;
  559. border-radius: 0rpx 0rpx 0rpx 0rpx;
  560. }
  561. }
  562. .qd {
  563. background: rgba(3, 101, 249, 0.2);
  564. color: #0365f9;
  565. }
  566. .rc {
  567. background: rgba(255, 184, 0, 0.3);
  568. color: #d99f00;
  569. }
  570. .zx {
  571. background: rgba(138, 5, 84, 0.2);
  572. color: #8a0554;
  573. }
  574. .wc {
  575. background: rgba(34, 181, 101, 0.2);
  576. color: #22b565;
  577. }
  578. .gq {
  579. color: #c7191f;
  580. background: rgba(199, 25, 31, 0.2);
  581. }
  582. .qx {
  583. color: #888888;
  584. background: rgba(136, 136, 136, 0.3);
  585. }
  586. .foot-btn {
  587. margin-top: 32rpx;
  588. margin-bottom: 32rpx;
  589. display: flex;
  590. justify-content: space-around;
  591. .cancel {
  592. button {
  593. color: rgba(138, 5, 84, 1) !important;
  594. }
  595. }
  596. }
  597. .form-value {
  598. width: 435rpx;
  599. input {
  600. width: 100%;
  601. }
  602. }
  603. .sj-select {
  604. display: flex;
  605. flex-wrap: wrap;
  606. margin-top: 32rpx;
  607. .select-item {
  608. text-align: center;
  609. line-height: 80rpx;
  610. width: 225rpx;
  611. height: 80rpx;
  612. background: rgba(255, 255, 255, 1);
  613. border-radius: 0rpx 0rpx 0rpx 0rpx;
  614. border: 2rpx solid #eaeff6;
  615. }
  616. .iselected {
  617. background: #ededed;
  618. }
  619. .isuse {
  620. background: rgba(142, 139, 228, 1);
  621. }
  622. }
  623. .sj-select-title {
  624. flex-wrap: wrap;
  625. display: flex;
  626. align-items: center;
  627. .legend {
  628. display: flex;
  629. align-items: center;
  630. margin-right: 32rpx;
  631. }
  632. .sj-label {
  633. margin-right: 64rpx;
  634. }
  635. .white-legend {
  636. margin-right: 16rpx;
  637. width: 28rpx;
  638. height: 28rpx;
  639. background: #ffffff;
  640. border-radius: 0rpx 0rpx 0rpx 0rpx;
  641. border: 2rpx solid #e9e9e9;
  642. }
  643. .purple-legend {
  644. margin-right: 16rpx;
  645. width: 28rpx;
  646. height: 28rpx;
  647. background: #8e8be4;
  648. border-radius: 0rpx 0rpx 0rpx 0rpx;
  649. }
  650. }
  651. .bottom-form {
  652. background: #ffffff;
  653. padding: 32rpx;
  654. box-sizing: border-box;
  655. .mt-select {
  656. display: flex;
  657. flex-wrap: wrap;
  658. .select-item {
  659. border-radius: 8rpx 8rpx 8rpx 8rpx;
  660. padding: 12rpx 30rpx;
  661. margin-left: 5rpx;
  662. margin-right: 5rpx;
  663. margin-bottom: 32rpx;
  664. background: rgba(245, 247, 250, 1);
  665. }
  666. }
  667. }
  668. .historyList {
  669. display: flex;
  670. justify-content: flex-start;
  671. flex-wrap: wrap;
  672. .historyList-item {
  673. padding: 10rpx 15rpx;
  674. display: flex;
  675. text-align: center;
  676. font-weight: 400;
  677. color: #666666;
  678. background: #f5f7fa;
  679. border-radius: 8rpx 8rpx 8rpx 8rpx;
  680. margin-left: 5rpx;
  681. margin-right: 5rpx;
  682. .btn {
  683. margin-left: 15rpx;
  684. }
  685. }
  686. }
  687. .form {
  688. padding: 32rpx 32rpx;
  689. display: flex;
  690. background: #ffffff;
  691. min-height: 112rpx;
  692. align-items: center;
  693. box-sizing: border-box;
  694. .form-label {
  695. font-weight: 400;
  696. font-size: 32rpx;
  697. color: #333333;
  698. margin-right: 64rpx;
  699. .form-requird {
  700. color: red;
  701. }
  702. }
  703. }
  704. .pdt32 {
  705. padding-top: 32rpx;
  706. }
  707. .pdb32 {
  708. padding-bottom: 32rpx;
  709. }
  710. .mb32 {
  711. margin-bottom: 32rpx;
  712. }
  713. .mt32 {
  714. margin-top: 32rpx;
  715. }
  716. .bd_bottom {
  717. border-bottom: 2rpx #e6e6e6 solid;
  718. }
  719. }
  720. </style>