detail.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555
  1. <template>
  2. <view class="container">
  3. <!-- 车牌号区域 -->
  4. <view class="box">
  5. <view class="left">
  6. 车牌号
  7. </view>
  8. <view class="right2">
  9. <view class="item">
  10. <view :class="['select', form.selectValue ? 'selected' : '']"
  11. @tap="handleMultiple(form.selectIndex)">
  12. {{form.selectValue || '请选择'}}
  13. </view>
  14. </view>
  15. </view>
  16. <!-- 车牌号选项弹窗区域 -->
  17. <transition>
  18. <multiple-picker title="请选择" :show="selectMultiple.show" :columns="selectMultiple.columns"
  19. :defaultIndex="selectMultiple.index" @confirm="confirmMultiple"
  20. @cancel="selectMultiple.show = false" @change="changeMultiple">
  21. </multiple-picker>
  22. </transition>
  23. </view>
  24. <!-- 人数区域 -->
  25. <view class="box">
  26. <view class="left">
  27. 容量
  28. </view>
  29. <view class="right">
  30. {{info.contain}}
  31. </view>
  32. </view>
  33. <!-- 发车日期区域 -->
  34. <view class="box" v-if="info.state_str!='候补中'">
  35. <view class="left">
  36. 发车日期
  37. </view>
  38. <view class="right">
  39. {{info.yy_date}}
  40. </view>
  41. </view>
  42. <!-- 发车时间区域 -->
  43. <view class="box" v-if="info.state_str!='候补中'">
  44. <view class="left">
  45. 发车时间
  46. </view>
  47. <picker style="width: 40%;" @change="bindPickerChange($event,1)" mode="time" :value="info.ci_time">
  48. <view class="right">
  49. {{info.ci_time}}
  50. <view class="right-img">
  51. <img src="../../static/bottom.png">
  52. </view>
  53. </view>
  54. </picker>
  55. </view>
  56. <!-- 路线区域 -->
  57. <view class="box">
  58. <view class="left">
  59. 路线
  60. </view>
  61. <picker style="width: 60%;" @change="bindPickerChange($event,2)" :range="pathList" range-key="route">
  62. <view class="right">
  63. {{info.route}}
  64. <view class="right-img">
  65. <img src="../../static/bottom.png">
  66. </view>
  67. </view>
  68. </picker>
  69. </view>
  70. <!-- 终点站区域 -->
  71. <view class="box">
  72. <view class="left">
  73. 终点站
  74. </view>
  75. <picker style="width: 60%;" @change="bindPickerChange($event,3)" :range="endList" range-key="route_end">
  76. <view class="right">
  77. {{info.route_end}}
  78. <view class="right-img">
  79. <img src="../../static/bottom.png">
  80. </view>
  81. </view>
  82. </picker>
  83. </view>
  84. <!-- 状态区域 -->
  85. <view class="box">
  86. <view class="left">
  87. 状态
  88. </view>
  89. <view class="right">
  90. {{info.state_str}}
  91. </view>
  92. </view>
  93. <!-- 提前一天预约区域 -->
  94. <view class="box">
  95. <view class="left">
  96. 可否提前一天预约
  97. </view>
  98. <view class="right">
  99. <!-- <switch :checked="isCheck" /> -->
  100. {{info.before_state==0?'可以':'不可以'}}
  101. </view>
  102. </view>
  103. <!-- 保存按钮区域 -->
  104. <view class="saveBtn" @click="handleSave">
  105. 保存
  106. </view>
  107. <!-- 人员名单区域 -->
  108. <view class="list">
  109. <view class="list-title" v-if="info.user_num!=0">
  110. 人员名单({{info.user_num}}/{{info.contain}})
  111. </view>
  112. <view class="list-item" v-for="(item,index) in listData" :key="index">
  113. <view class="item-img">
  114. <img src="../../static/man.png">
  115. </view>
  116. <view class="item-info">
  117. <view class="info-name">
  118. <view>
  119. {{item.user_name}}
  120. </view>
  121. </view>
  122. <view class="info-mes">
  123. {{item.user_zz}}<span>{{item.yy_time}}</span>
  124. </view>
  125. </view>
  126. <view class="item-type">
  127. <img src="../../static/subscribe.png">
  128. </view>
  129. </view>
  130. </view>
  131. </view>
  132. </template>
  133. <script setup>
  134. import {
  135. ref
  136. } from "vue"
  137. import {
  138. onLoad
  139. } from '@dcloudio/uni-app'
  140. import {
  141. myRequest
  142. } from "../../util/api.js"
  143. import {
  144. isWeixin
  145. } from "../../util/isWeixin.js"
  146. onLoad((options) => {
  147. if (isWeixin()) {
  148. info.value = JSON.parse(options.info)
  149. // console.log(info.value);
  150. // 获取人员列表
  151. getData(info.value)
  152. // 获取路线数组
  153. getPathList()
  154. // 获取终点站列表
  155. getEndList()
  156. // 获取车牌号列表
  157. getBusList()
  158. // 处理车牌号数据
  159. form.value.selectValue = info.value.car_number
  160. setTimeout(() => {
  161. let temList = []
  162. selectMultiple.value.columns.forEach((item) => {
  163. if (item.label == form.value.selectValue) {
  164. temList.push(item.value)
  165. }
  166. })
  167. form.value.selectIndex = temList
  168. }, 500)
  169. } else {
  170. uni.redirectTo({
  171. url: "/pages/404/404?message=请在微信客户端打开链接"
  172. })
  173. }
  174. })
  175. // 带过来的预约详情数据
  176. const info = ref({})
  177. // 车牌号绑定数据
  178. const form = ref({
  179. selectValue: '',
  180. selectIndex: [],
  181. })
  182. // 车牌号数组相关数据
  183. const selectMultiple = ref({
  184. show: false,
  185. index: [],
  186. columns: [],
  187. })
  188. // 路线数组
  189. const pathList = ref([])
  190. // 终点站数组
  191. const endList = ref(["666", "888", "999"])
  192. // switch开关状态
  193. // const isCheck = ref(false)
  194. // 人员列表数组
  195. const listData = ref([])
  196. // 获取路线数组请求
  197. const getPathList = async () => {
  198. const res = await myRequest({
  199. url: '/appqueryRoute.action',
  200. })
  201. // console.log(res);
  202. pathList.value = res.data
  203. }
  204. // 获取终点站数组请求
  205. const getEndList = async () => {
  206. const res = await myRequest({
  207. url: '/appqueryEndRoutes.action',
  208. data: {
  209. route: info.value.route
  210. }
  211. })
  212. // console.log(res);
  213. endList.value = res.data
  214. }
  215. // 获取车牌号数组请求
  216. const getBusList = async () => {
  217. const res = await myRequest({
  218. url: '/appqueryCarInfos.action',
  219. })
  220. // console.log(res);
  221. if (res.data.length) {
  222. let temList = []
  223. res.data.forEach((item, index) => {
  224. temList.push({
  225. label: item.car_number,
  226. value: index.toString()
  227. })
  228. })
  229. selectMultiple.value.columns = temList
  230. }
  231. }
  232. // 获取人员名单请求
  233. const getData = async (value) => {
  234. const {
  235. route,
  236. route_end,
  237. yy_date,
  238. ci_time,
  239. car_number
  240. } = value
  241. const res = await myRequest({
  242. url: '/appqueryAppointeds.action',
  243. data: {
  244. route,
  245. route_end,
  246. yy_date,
  247. ci_time,
  248. car_number
  249. }
  250. })
  251. // console.log(res)
  252. listData.value = res.data
  253. }
  254. // 保存按钮回调
  255. const handleSave = () => {
  256. uni.showModal({
  257. title: '提示',
  258. content: '确定保存吗?',
  259. success: (res) => {
  260. if (res.confirm) {
  261. handleSaveRequest()
  262. } else if (res.cancel) {}
  263. }
  264. });
  265. }
  266. // 保存请求
  267. const handleSaveRequest = () => {
  268. console.log(info.value);
  269. const {
  270. id,
  271. car_number,
  272. ci_time,
  273. route,
  274. route_end,
  275. contain
  276. } = info.value
  277. uni.request({
  278. url: '/carstop/carbook/scheupdate.action',
  279. method: "post",
  280. data: {
  281. id,
  282. car_number,
  283. ci_time,
  284. route,
  285. route_end,
  286. contain
  287. },
  288. success: (res) => {
  289. if (res.data.code == 200) {
  290. uni.showToast({
  291. title: res.data.message
  292. })
  293. setTimeout(() => {
  294. uni.redirectTo({
  295. url: "/pages/record/record"
  296. })
  297. }, 1500)
  298. }
  299. }
  300. });
  301. }
  302. // 点击车牌号下拉框回调
  303. const handleMultiple = (val) => {
  304. // console.log(val);
  305. selectMultiple.value.index = val || [];
  306. selectMultiple.value.show = true;
  307. }
  308. // 车牌号下拉框确定按钮回调
  309. const confirmMultiple = (e) => {
  310. // console.log(e);
  311. // console.log(e.value);
  312. if (selectMultiple.value.index != e.value) {
  313. let temp = [];
  314. e.selected.forEach(item => {
  315. temp.push(item.label);
  316. })
  317. form.value.selectValue = temp.toString();
  318. info.value.car_number = temp.toString();
  319. }
  320. form.value.selectIndex = e.value;
  321. selectMultiple.value.show = false;
  322. // 获取汽车容量
  323. getBusContain()
  324. }
  325. // 获取汽车容量请求
  326. const getBusContain = async () => {
  327. const res = await myRequest({
  328. url: '/appqueryCarContain.action',
  329. data: {
  330. car_number: form.value.selectValue
  331. }
  332. })
  333. // console.log(res);
  334. info.value.contain = res.data
  335. }
  336. // 下拉框选择时的回调
  337. const changeMultiple = (e) => {
  338. // console.log(e);
  339. }
  340. // 原生下拉框的选择回调事件
  341. const bindPickerChange = (e, type) => {
  342. if (type == 1) {
  343. info.value.ci_time = e.detail.value
  344. } else if (type == 2) {
  345. info.value.route = pathList.value[e.detail.value].route
  346. getEndList()
  347. } else if (type == 3) {
  348. console.log(e.detail.value);
  349. console.log("终点站");
  350. }
  351. }
  352. // 提前一天预约switch切换回调
  353. // const switchChange = (e) => {
  354. // console.log(e.detail.value);
  355. // isCheck.value = e.detail.value
  356. // }
  357. </script>
  358. <style lang="scss" scoped>
  359. .container {
  360. background-color: #fff;
  361. .box {
  362. display: flex;
  363. justify-content: space-between;
  364. align-items: center;
  365. padding: 0 30rpx;
  366. height: 98rpx;
  367. font-size: 28rpx;
  368. border-bottom: 1rpx solid #E6E6E6;
  369. .left {
  370. flex: 1;
  371. color: #999999;
  372. }
  373. .right {
  374. flex: 1;
  375. display: flex;
  376. justify-content: flex-end;
  377. .right-img {
  378. margin-left: 27rpx;
  379. margin-top: -5rpx;
  380. width: 17rpx;
  381. height: 12rpx;
  382. img {
  383. width: 100%;
  384. height: 100%;
  385. }
  386. }
  387. }
  388. .right2 {
  389. flex: 2;
  390. display: flex;
  391. justify-content: flex-end;
  392. .item {
  393. width: 100%;
  394. padding: 20rpx 0;
  395. .select {
  396. width: 100%;
  397. padding-top: 6px;
  398. padding-bottom: 6px;
  399. padding-left: 9px;
  400. border-radius: 4px;
  401. font-size: 15px;
  402. text-align: end;
  403. box-sizing: border-box;
  404. color: #CCCCCC;
  405. line-height: 26px;
  406. &.selected {
  407. color: black;
  408. }
  409. }
  410. }
  411. }
  412. }
  413. .saveBtn {
  414. margin: 20rpx 30rpx;
  415. line-height: 100rpx;
  416. text-align: center;
  417. color: #fff;
  418. font-size: 34rpx;
  419. border-radius: 15rpx;
  420. background: linear-gradient(180deg, #8684FF 0%, #3C50E8 100%);
  421. }
  422. .list {
  423. padding: 13rpx 30rpx;
  424. .list-title {
  425. height: 41rpx;
  426. color: #999999;
  427. font-size: 28rpx;
  428. }
  429. .list-item {
  430. display: flex;
  431. align-items: center;
  432. box-sizing: border-box;
  433. padding: 29rpx 0 26rpx 0;
  434. height: 155rpx;
  435. border-bottom: 1rpx solid #E6E6E6;
  436. .item-img {
  437. width: 100rpx;
  438. height: 100rpx;
  439. border-radius: 50%;
  440. img {
  441. width: 100%;
  442. height: 100%;
  443. }
  444. }
  445. .item-info {
  446. flex: 1;
  447. display: flex;
  448. flex-direction: column;
  449. justify-content: space-evenly;
  450. margin-left: 6rpx;
  451. height: 100rpx;
  452. .info-name {
  453. display: flex;
  454. align-items: center;
  455. font-size: 32rpx;
  456. .info-name-img {
  457. margin-left: 26rpx;
  458. width: 30rpx;
  459. height: 35rpx;
  460. img {
  461. width: 100%;
  462. height: 100%;
  463. }
  464. }
  465. }
  466. .info-mes {
  467. font-size: 24rpx;
  468. color: #999999;
  469. span {
  470. margin-left: 26rpx;
  471. color: #A6A6A6;
  472. }
  473. }
  474. }
  475. .item-type {
  476. width: 104rpx;
  477. height: 41rpx;
  478. img {
  479. width: 100%;
  480. height: 100%;
  481. }
  482. }
  483. }
  484. }
  485. }
  486. .v-enter-active,
  487. .v-leave-active {
  488. transition: opacity 0.5s ease;
  489. }
  490. .v-enter-from,
  491. .v-leave-to {
  492. opacity: 0;
  493. }
  494. </style>