index.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658
  1. <template>
  2. <view>
  3. <view>
  4. <!-- 头部 -->
  5. <view class="head">
  6. <!-- 定位 -->
  7. <view class="location" v-if="studentCampus">
  8. 所属校区:{{studentCampus}}
  9. </view>
  10. <!-- 公告 -->
  11. <view class="notice">
  12. <view class="notice-content" style="margin-top: 16rpx;">
  13. <view class="notice-first">公告<image src="../../static/horn.svg" mode=""></image>:<text
  14. class="notice-second" selectable space="nbsp">{{notices}}</text></view>
  15. </view>
  16. </view>
  17. </view>
  18. <!-- 跳转导航 -->
  19. <view class="nav">
  20. <navigator url="../list/list" class="nav1">
  21. <image src="../../static/repair.svg"></image>
  22. <view>前往报修</view>
  23. </navigator>
  24. <navigator url="../personal-information/personal-information" class="nav2">
  25. <image src="../../static/person.svg"></image>
  26. <view>修改信息</view>
  27. </navigator>
  28. </view>
  29. <!-- 报修订单 -->
  30. <view class="content">
  31. <!-- 导航与报修单间的灰色背景 -->
  32. <view class="point"></view>
  33. <view class="list-text" v-if="Studentlist.length!==0">
  34. ----报修订单----
  35. </view>
  36. <view class="list-text" v-else>
  37. ----暂无数据----
  38. </view>
  39. <!-- 订单 -->
  40. <view class="content-list" v-for="(item,index) in Studentlist" :key="index"
  41. @click="handleLookInfo(item)">
  42. <text class="num">订单号:{{item.orderId}}</text>
  43. <text class="newList">{{item.orderStatus==0?'等待后台分配':''}} </text> <!-- 新订单 -->
  44. <text class="waitList">{{item.orderStatus==1?'等待维修工接单':''}} </text> <!-- 待接单 -->
  45. <text class="readyList">{{item.orderStatus==2?'维修工已接单':''}} </text> <!-- 已接单 -->
  46. <text class="finishList">{{item.orderStatus==3?'维修完成':''}} </text> <!-- 维修完成 -->
  47. <text class="refuseList">{{item.orderStatus==4?'已退单':''}} </text> <!-- 已退单 -->
  48. <view class="list">
  49. <view>
  50. 故障类型:{{item.repairsFault.faultName}}
  51. </view>
  52. <view>
  53. 维修人员:{{item.repairsWork.workName==null?"等待分配":item.repairsWork.workName}}
  54. </view>
  55. <view>
  56. 提交时间:{{item.orderCommitTime}}
  57. </view>
  58. <view>
  59. {{item.orderStatus==3?'完成时间:':'预约时间:'}}{{item.orderStatus==3?item.orderCompleteTime:item.orderExpectedTime}}
  60. </view>
  61. </view>
  62. <button @click.stop="appraise(item)" v-if="item.orderStatus == 3 && item.orderAdvice == null"
  63. style="width: 185rpx; height: 36rpx; background-color:rgba(42, 130, 228, 1); color: white;font-size: 24rpx; border-radius: 32rpx;">
  64. 维修后评价
  65. </button>
  66. <view class="sug">{{(item.orderStatus == 3 && item.orderAdvice !== null)?'已评价':''}}</view>
  67. <button class="sug_left" v-if="item.orderStatus == 0" @click.stop="handleDelete(item)">撤回订单</button>
  68. </view>
  69. <view class="isOver" v-if="flag">
  70. ----我是有底线的----
  71. </view>
  72. </view>
  73. </view>
  74. <!-- 查看详情弹窗 -->
  75. <uni-popup ref="popup" background-color="#fff">
  76. <view class="popup_view" v-if="info">
  77. <view class="popup_title">订单信息</view>
  78. <view class="popup_item">订单号:{{info.orderId}}</view>
  79. <view class="popup_item">报修类型:{{info.repairsFault.faultName}}</view>
  80. <view class="popup_item">宿舍楼栋:{{info.repairsStudent.dormNumber}}</view>
  81. <view class="popup_item">提交时间:{{info.orderCommitTime}}</view>
  82. <view class="popup_item">预约时间:{{info.orderExpectedTime}}</view>
  83. <view class="popup_item">联系电话:{{info.repairsStudent.studentPhone}}</view>
  84. <view class="popup_item">备选电话:{{info.repairsStudent.studentOtherPhone}}</view>
  85. <view class="popup_item" v-if="info.orderBack">退回原因:{{info.orderBack}}</view>
  86. <view class="popup_item" v-if="info.orderAdvice">修后评价:{{info.orderAdvice}}</view>
  87. <view class="popup_img">
  88. <text>故障图片:</text>
  89. <image v-for="(item,index) in info.orderImages" :key="index"
  90. :src="item?item:'../../static/no-image.gif'" mode="aspectFit" @click="handleBig(index)"></image>
  91. </view>
  92. </view>
  93. </uni-popup>
  94. <!-- 图片放大弹窗 -->
  95. <uni-popup ref="popup2">
  96. <view class="popup_view" v-if="info" style="padding: 0px;">
  97. <image v-for="(item,index) in info.orderImages" :key="index"
  98. :src="item?item:'../../static/no-image.gif'" v-if="index==activeIndex">
  99. </image>
  100. </view>
  101. </uni-popup>
  102. <!-- 修改评价遮罩层 -->
  103. <view class="box" v-if="dialogShow">
  104. <view id="dialog">
  105. <view class="replace">
  106. 修改评价
  107. </view>
  108. <view class="uni-textarea">
  109. <textarea v-model="inputcontent" placeholder-style="color:rgba(229, 229, 229, 0.7)" cols="20"
  110. row="2" placeholder="请输入内容" />
  111. </view>
  112. <view class="cancle" @click="cancle">
  113. 取消
  114. </view>
  115. <view class="agree" @click="agree">
  116. 确定
  117. </view>
  118. </view>
  119. </view>
  120. </view>
  121. </template>
  122. <script>
  123. export default {
  124. data() {
  125. return {
  126. pageNum: 1,
  127. pageSize: 6,
  128. total: "",
  129. dialogShow: false,
  130. flag: false,
  131. notices: "",
  132. Studentlist: [],
  133. value: [],
  134. inputcontent: '',
  135. orderId: null,
  136. info: null,
  137. activeIndex: null,
  138. studentCampus: null,
  139. }
  140. },
  141. onLoad() {
  142. let res = uni.getStorageSync("student")
  143. if (res.studentCampus == 0) {
  144. this.studentCampus = "黄家湖校区"
  145. } else if (res.studentCampus == 1) {
  146. this.studentCampus = "墨轩湖校区"
  147. }
  148. this.getNotice()
  149. this.getStudentlist()
  150. },
  151. methods: {
  152. // 获取最新公告数据
  153. async getNotice() {
  154. let res = await this.$myRequest({
  155. method: "post",
  156. url: `/notice/releaseNotice`,
  157. })
  158. // console.log(res)
  159. if (res.status == 200) {
  160. this.notices = res.data.noticeContent
  161. } else {
  162. console.log("获取最新公告数据失败")
  163. }
  164. },
  165. // 获取学生订单
  166. async getStudentlist() {
  167. let res = await this.$myRequest({
  168. method: "post",
  169. url: `/order/queryAllOrderByStudentId?pageNum=${this.pageNum}&pageSize=${this.pageSize}`
  170. })
  171. // console.log(res)
  172. if (res.status == 200) {
  173. this.total = res.data.total
  174. this.Studentlist = [...this.Studentlist, ...res.data.list]
  175. uni.hideLoading()
  176. } else {
  177. console.log("获取订单数据失败")
  178. }
  179. },
  180. // 下拉刷新
  181. onPullDownRefresh() {
  182. this.flag = false
  183. this.Studentlist = []
  184. this.pageNum = 1
  185. this.getStudentlist()
  186. this.getNotice()
  187. setTimeout(() => {
  188. uni.stopPullDownRefresh();
  189. }, 1000);
  190. },
  191. // 上拉加载+结尾语句显示
  192. onReachBottom() {
  193. if (this.Studentlist.length < this.total) {
  194. uni.showLoading({
  195. title: "数据加载中"
  196. })
  197. this.pageNum++
  198. this.getStudentlist()
  199. } else {
  200. this.flag = true
  201. }
  202. },
  203. // 点击维修后评价按钮回调
  204. appraise(item) {
  205. this.dialogShow = true
  206. this.inputcontent = ''
  207. this.orderId = item.orderId
  208. },
  209. // 弹窗确定按钮回调
  210. agree() {
  211. if (this.inputcontent == '') {
  212. uni.showToast({
  213. title: '请输入内容',
  214. icon: 'none',
  215. duration: 2000,
  216. })
  217. } else {
  218. this.dialogShow = false
  219. this.getsuggest()
  220. }
  221. },
  222. // 弹窗取消按钮回调
  223. cancle() {
  224. this.dialogShow = false
  225. this.inputcontent = ''
  226. uni.showToast({
  227. title: '已取消评价',
  228. icon: 'none',
  229. duration: 2000
  230. })
  231. },
  232. // 修后评价请求
  233. async getsuggest() {
  234. let res = await this.$myRequest({
  235. method: "post",
  236. url: `/order/updateOrderAdvice?orderAdvice=${this.inputcontent}&orderId=${this.orderId}`,
  237. })
  238. // console.log(res)
  239. if (res.status == 200) {
  240. uni.showToast({
  241. title: "评价成功",
  242. icon: "success"
  243. })
  244. this.Studentlist = []
  245. this.pageNum = 1
  246. uni.pageScrollTo({
  247. scrollTop: 0
  248. });
  249. this.getStudentlist()
  250. } else {
  251. console.log("修后评价请求失败")
  252. }
  253. },
  254. // 查看详情回调
  255. async handleLookInfo(item) {
  256. this.info = null
  257. this.$refs.popup.open()
  258. if (item.orderStatus == 0 || item.orderStatus == 4) {
  259. let res = await this.$myRequest({
  260. method: "post",
  261. url: `/order/queryByOrderIdNotWork?orderId=${item.orderId}`,
  262. })
  263. // console.log(res)
  264. this.$nextTick(() => {
  265. this.info = res.data
  266. this.info.orderImages = this.info.orderImages.split(";")
  267. })
  268. } else {
  269. let res = await this.$myRequest({
  270. method: "post",
  271. url: `/order/queryByOrderId?orderId=${item.orderId}`,
  272. })
  273. // console.log(res)
  274. this.$nextTick(() => {
  275. this.info = res.data
  276. this.info.orderImages = this.info.orderImages.split(";")
  277. })
  278. }
  279. },
  280. // 点击图片放大
  281. handleBig(index) {
  282. this.activeIndex = index
  283. this.$refs.popup2.open()
  284. },
  285. // 撤回订单请求
  286. handleDelete(item) {
  287. uni.showModal({
  288. title: '提示',
  289. content: '确定撤回订单吗?',
  290. success: async (res) => {
  291. if (res.confirm) {
  292. let res = await this.$myRequest({
  293. url: `/order/deleteOrderById?orderId=${item.orderId}`,
  294. method: "post"
  295. })
  296. // console.log(res)
  297. if (res.status == 200) {
  298. uni.showToast({
  299. title: "撤回成功",
  300. icon: "success"
  301. })
  302. this.Studentlist = []
  303. this.pageNum = 1
  304. uni.pageScrollTo({
  305. scrollTop: 0
  306. });
  307. this.getStudentlist()
  308. } else {
  309. uni.showToast({
  310. title: "撤回失败",
  311. icon: "error"
  312. })
  313. }
  314. } else if (res.cancel) {
  315. // console.log('用户点击取消');
  316. }
  317. }
  318. });
  319. }
  320. },
  321. }
  322. </script>
  323. <style lang="scss">
  324. #dialog {
  325. position: absolute;
  326. top: 0;
  327. right: 0;
  328. bottom: 0;
  329. left: 0;
  330. width: 80%;
  331. height: 180px;
  332. text-align: center;
  333. margin: auto;
  334. background-color: white;
  335. border-radius: 10px;
  336. }
  337. textarea {
  338. height: 100px;
  339. width: 90%;
  340. margin-top: 5px;
  341. margin-left: 5%;
  342. text-align: left;
  343. border: 1px solid rgba(229, 229, 229, 0.62);
  344. font-size: 14px;
  345. }
  346. .box {
  347. position: fixed;
  348. top: 0;
  349. left: 0;
  350. margin: 0;
  351. width: 100%;
  352. height: 100%;
  353. background: rgba(0, 0, 0, 0.3);
  354. }
  355. .replace {
  356. width: 100%;
  357. height: 16%;
  358. margin-top: 4%;
  359. font-size: 28rpx;
  360. color: rgba(80, 80, 80, 1);
  361. }
  362. .cancle {
  363. position: absolute;
  364. top: 78%;
  365. width: 50%;
  366. height: 22%;
  367. line-height: 2;
  368. background-color: white;
  369. border-radius: 0 0 0 16rpx;
  370. border-top: 1px solid rgba(229, 229, 229, 0.62);
  371. border-right: 1px solid rgba(229, 229, 229, 0.62);
  372. }
  373. .agree {
  374. position: absolute;
  375. top: 78%;
  376. width: 50%;
  377. height: 22%;
  378. right: 0;
  379. line-height: 2;
  380. background-color: white;
  381. border-top: 1px solid rgba(229, 229, 229, 0.62);
  382. border-left: 1px solid rgba(229, 229, 229, 0.62);
  383. border-radius: 0 0 16rpx 0;
  384. }
  385. .head {
  386. position: relative;
  387. height: 350rpx;
  388. background-color: rgba(42, 130, 228, 1);
  389. border-radius: 0rpx 0rpx 20rpx 20rpx;
  390. }
  391. .location {
  392. position: absolute;
  393. top: 38rpx;
  394. left: 260rpx;
  395. font-size: 24rpx;
  396. color: rgba(255, 255, 255, 1);
  397. }
  398. .notice {
  399. position: absolute;
  400. margin-top: 126rpx;
  401. margin-left: 18rpx;
  402. /* top: 63px;
  403. left: 11px; */
  404. width: 716rpx;
  405. height: 110rpx;
  406. font-size: 24rpx;
  407. background-color: rgba(255, 255, 255, 0.21);
  408. border-radius: 22rpx 20rpx 20rpx 20rpx;
  409. }
  410. .notice-first {
  411. margin-left: 20rpx;
  412. color: rgba(255, 255, 255, 1);
  413. }
  414. .notice-first image {
  415. height: 28rpx;
  416. width: 28rpx;
  417. font-size: 28rpx;
  418. vertical-align: bottom;
  419. }
  420. .notice-second {
  421. float: right;
  422. margin-right: 48rpx;
  423. color: rgba(255, 255, 255, 1);
  424. width: 76%;
  425. height: 70rpx;
  426. }
  427. .nav {
  428. position: absolute;
  429. top: 282rpx;
  430. width: 718rpx;
  431. height: 236rpx;
  432. margin-left: 16rpx;
  433. background-color: rgba(255, 255, 255, 1);
  434. border-radius: 28rpx 28rpx 0rpx 0rpx;
  435. }
  436. .nav1 image {
  437. position: absolute;
  438. left: 218rpx;
  439. top: 70rpx;
  440. width: 48rpx;
  441. height: 48rpx;
  442. font-size: 48rpx;
  443. }
  444. .nav1 view {
  445. position: absolute;
  446. left: 200rpx;
  447. top: 136rpx;
  448. font-size: 24rpx;
  449. }
  450. .nav2 image {
  451. position: absolute;
  452. left: 450rpx;
  453. width: 48rpx;
  454. height: 48rpx;
  455. font-size: 48rpx;
  456. top: 72rpx;
  457. }
  458. .nav2 view {
  459. position: absolute;
  460. left: 426rpx;
  461. top: 136rpx;
  462. font-size: 24rpx;
  463. }
  464. .nav .nav1 {
  465. width: 108rpx;
  466. height: 120rpx;
  467. margin-top: 64rpx;
  468. margin-left: 186rpx;
  469. }
  470. .nav .nav2 {
  471. width: 108rpx;
  472. height: 120rpx;
  473. margin-top: -126rpx;
  474. margin-left: 420rpx;
  475. }
  476. .content {
  477. margin-top: 170rpx;
  478. height: 1200rpx;
  479. background-color: rgba(255, 255, 255, 1);
  480. }
  481. .point {
  482. height: 14rpx;
  483. background-color: rgba(229, 229, 229, 0.62);
  484. }
  485. .list-text {
  486. margin-top: 30rpx;
  487. font-size: 24rpx;
  488. text-align: center;
  489. color: rgba(80, 80, 80, 0.27);
  490. }
  491. .content-list {
  492. position: relative;
  493. height: 290rpx;
  494. margin-top: 22rpx;
  495. padding-left: 20rpx;
  496. font-size: 24rpx;
  497. border-radius: 28rpx 28rpx 0rpx 0rpx;
  498. background-color: rgba(229, 229, 229, 0.62);
  499. }
  500. .num {
  501. float: left;
  502. margin-left: 14rpx;
  503. margin-top: 18rpx;
  504. font-size: 28rpx;
  505. font-weight: 700;
  506. color: rgba(42, 130, 228, 1);
  507. }
  508. .newList {
  509. float: right;
  510. margin-top: 20rpx;
  511. margin-right: 32rpx;
  512. color: rgba(255, 141, 26, 1);
  513. }
  514. .readyList {
  515. float: right;
  516. margin-top: 20rpx;
  517. margin-right: 4rpx;
  518. color: rgba(212, 48, 48, 1);
  519. }
  520. .waitList {
  521. float: right;
  522. margin-top: 20rpx;
  523. margin-right: 4rpx;
  524. color: rgba(212, 48, 48, 1);
  525. }
  526. .finishList {
  527. float: right;
  528. margin-top: 20rpx;
  529. margin-right: 4rpx;
  530. color: yellowgreen;
  531. }
  532. .refuseList {
  533. float: right;
  534. margin-top: 20rpx;
  535. margin-right: 4rpx;
  536. color: rgba(212, 48, 48, 1);
  537. }
  538. .list {
  539. float: left;
  540. margin-left: -328rpx;
  541. margin-top: 72rpx;
  542. font-size: 28rpx;
  543. }
  544. .content-list button {
  545. position: absolute;
  546. bottom: 20rpx;
  547. right: 42rpx;
  548. line-height: 36rpx;
  549. }
  550. .content-list .sug {
  551. position: absolute;
  552. bottom: 30rpx;
  553. right: 42rpx;
  554. color: #333333;
  555. }
  556. .content-list .sug_left {
  557. position: absolute;
  558. bottom: 16rpx;
  559. left: -450rpx;
  560. width: 160rpx;
  561. height: 36rpx;
  562. font-size: 24rpx;
  563. border-radius: 32rpx;
  564. background-color: orange;
  565. }
  566. .isOver {
  567. width: 100%;
  568. height: 100rpx;
  569. line-height: 100rpx;
  570. text-align: center;
  571. font-size: 24rpx;
  572. color: rgba(80, 80, 80, 0.27);
  573. }
  574. .popup_view {
  575. box-sizing: border-box;
  576. width: 600rpx;
  577. height: 860rpx;
  578. padding: 50rpx;
  579. overflow-y: auto;
  580. image {
  581. width: 100%;
  582. height: 100%;
  583. }
  584. .popup_title {
  585. font-size: 20px;
  586. }
  587. .popup_item {
  588. margin: 20rpx 0;
  589. }
  590. .popup_img {
  591. display: flex;
  592. image {
  593. margin: 0 6rpx;
  594. width: 100rpx;
  595. height: 200rpx;
  596. background-color: #eee;
  597. }
  598. }
  599. }
  600. </style>