home.vue 14 KB

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