list-center.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643
  1. <template>
  2. <view>
  3. <view class="head">
  4. <view class="location">
  5. 维修中心<image class="loc" src="../../static/rep.svg" mode=""></image>
  6. </view>
  7. </view>
  8. <view class="nav">
  9. <navigator url="../feedback/feedback" hover-class="navigator-hover">
  10. <image src="../../static/sug.svg" mode=""></image>
  11. <view>评价建议</view>
  12. </navigator>
  13. </view>
  14. <view class="content">
  15. <view class="point"></view>
  16. <view class="list-text" v-if="workerList.length!==0">
  17. ---- 报修订单 ----
  18. </view>
  19. <view v-if="item.orderStatus" class="content-list" v-for="(item,index) in workerList" :key="item.orderId"
  20. @click="handleLookInfo(item)">
  21. <text class="num">订单号:{{item.orderId}}</text>
  22. <text class="newList">{{item.orderStatus==0?"新订单":''}} </text> <!-- 新订单 -->
  23. <text class="waitList">{{item.orderStatus==1?"待接单":''}} </text> <!-- 待接单 -->
  24. <text class="readyList">{{item.orderStatus==2?"已接单":''}} </text> <!-- 已接单 -->
  25. <text class="finishList">{{item.orderStatus==3?"维修完成":''}} </text> <!-- 维修完成 -->
  26. <text class="refuseList">{{item.orderStatus==4?"退单":''}} </text> <!-- 已退单 -->
  27. <view class="list">
  28. <view>故障类型:{{item.repairsFault.faultName}}</view>
  29. <view>维修人员:{{item.repairsWork.workName}}</view>
  30. <view>预约时间:{{item.orderExpectedTime}}</view>
  31. <view v-if="item.orderStatus==1">派单时间:{{item.orderCompleteTime}}</view>
  32. <view v-if="item.orderStatus==2">维修时间:{{item.orderCompleteTime}}</view>
  33. <view v-if="item.orderStatus==3">完成时间:{{item.orderCompleteTime}}</view>
  34. </view>
  35. <button class="agreeIt2" v-if="item.orderStatus == 1" @click.stop="open(item,1)">
  36. 接受
  37. </button>
  38. <button class="refuse" v-if="item.orderStatus == 1" @click.stop="open(item,2)">
  39. 拒绝
  40. </button>
  41. <button class="agreeIt" v-if="item.orderStatus == 2" @click.stop="handleFinish(item.orderId)">
  42. 完成维修
  43. </button>
  44. </view>
  45. <view class="isOver" v-if="flag">
  46. ----我是有底线的----
  47. </view>
  48. <view class="isOver" v-if="workerList.length==0">
  49. ----暂无订单----
  50. </view>
  51. </view>
  52. <!-- 查看详情弹窗 -->
  53. <uni-popup ref="popup" background-color="#fff">
  54. <view class="popup_view" v-if="info">
  55. <view class="popup_title">订单信息</view>
  56. <view class="popup_item">订单号:{{info.orderId}}</view>
  57. <view class="popup_item">报修类型:{{info.repairsFault.faultName}}</view>
  58. <view class="popup_item">宿舍楼栋:{{info.repairsStudent.dormNumber}}</view>
  59. <view class="popup_item">预约时间:{{info.orderExpectedTime}}</view>
  60. <view v-if="info.orderStatus==1">派单时间:{{info.orderCompleteTime}}</view>
  61. <view v-if="info.orderStatus==2">维修时间:{{info.orderCompleteTime}}</view>
  62. <view v-if="info.orderStatus==3">完成时间:{{info.orderCompleteTime}}</view>
  63. <view class="popup_item">联系电话:{{info.repairsStudent.studentPhone}}</view>
  64. <view class="popup_item">备选电话:{{info.repairsStudent.studentOtherPhone}}</view>
  65. <view class="popup_img">
  66. <text>故障图片:</text>
  67. <image v-for="(item,index) in info.orderImages" :key="index" :src="item?item:'../../static/no-image.gif'" mode="aspectFit" @click="handleBig(index)"></image>
  68. </view>
  69. </view>
  70. </uni-popup>
  71. <!-- 图片放大弹窗 -->
  72. <uni-popup ref="popup2">
  73. <view class="popup_view" v-if="info" style="padding: 0px;">
  74. <image
  75. v-for="(item,index) in info.orderImages" :key="index" :src="item?item:'../../static/no-image.gif'" v-if="index==activeIndex">
  76. </image>
  77. </view>
  78. </uni-popup>
  79. <!-- 是否拒绝单子 -->
  80. <view class="box" v-if="dialogShows">
  81. <view id="dialog">
  82. <view class="replace">
  83. 通知
  84. </view>
  85. <view class="uni-textarea">
  86. 确定拒绝此单?
  87. </view>
  88. <view class="cancle" @click="dialogShows = false">
  89. 取消
  90. </view>
  91. <view class="agree" @click="handleRefuse">
  92. 确定
  93. </view>
  94. </view>
  95. </view>
  96. <!-- 是否接受单子 -->
  97. <view class="box" v-if="dialogShow">
  98. <view id="dialog">
  99. <view class="replace">
  100. 选择维修时间
  101. </view>
  102. <view class="uni-textarea">
  103. <view @click="onShowDatePicker('datetime')" class="uni-list-cell-db-2">
  104. <text style="margin-left: 20rpx;">{{timeValue}}</text>
  105. </view>
  106. <mx-date-picker :show="showPicker" :type="type" :value="timeValue" :show-tips="true"
  107. :begin-text="'开始'" :end-text="'截至'" :show-seconds="true" @confirm="onSelected"
  108. @cancel="onSelected" />
  109. </view>
  110. <view class="cancle" @click="cancleclose">
  111. 取消
  112. </view>
  113. <view class="agree" @click="agreeList">
  114. 确定
  115. </view>
  116. </view>
  117. </view>
  118. </view>
  119. </template>
  120. <script>
  121. import MxDatePicker from "../../util/mx-datepicker/mx-datepicker"
  122. export default {
  123. components: {
  124. MxDatePicker
  125. },
  126. data() {
  127. return {
  128. dialogShow: false,
  129. dialogShows: false,
  130. orderId: '',
  131. orderStatus: null,
  132. workerList: [],
  133. flag: false,
  134. pageNum: 1,
  135. pageSize: 6,
  136. total: "",
  137. title: 'picker-view',
  138. visible: true,
  139. showPicker: false,
  140. datetime: '',
  141. range: ['2022-03-27', '2022-03-27'],
  142. rangetime: '',
  143. type: 'rangetime',
  144. timeValue: '请点击选择时间',
  145. info: null,
  146. activeIndex:null
  147. }
  148. },
  149. onLoad() {
  150. this.getworkList()
  151. this.getTime()
  152. },
  153. methods: {
  154. // 初始化时间
  155. getTime() {
  156. let date = new Date(),
  157. year = date.getFullYear(),
  158. month = date.getMonth() + 1,
  159. day = date.getDate(),
  160. hour = date.getHours() < 10 ? "0" + date.getHours() : date.getHours(),
  161. minute = date.getMinutes() < 10 ? "0" + date.getMinutes() : date.getMinutes(),
  162. second = date.getSeconds() < 10 ? "0" + date.getSeconds() : date.getSeconds();
  163. month >= 1 && month <= 9 ? (month = "0" + month) : "";
  164. day >= 0 && day <= 9 ? (day = "0" + day) : "";
  165. let timer = year + '-' + month + '-' + day + ' ' + hour + ':' + minute + ':' + second;
  166. this.datetime = timer
  167. },
  168. // 获取报修订单列表
  169. async getworkList() {
  170. let res = await this.$myRequest({
  171. method: "post",
  172. url: `/order/queryAllOrderByWorkId?pageNum=${this.pageNum}&pageSize=${this.pageSize}`
  173. })
  174. // console.log(res)
  175. if (res.status == 200) {
  176. this.total = res.data.total
  177. this.workerList = [...this.workerList, ...res.data.list]
  178. uni.hideLoading()
  179. } else {
  180. uni.hideLoading()
  181. }
  182. },
  183. // 接受订单
  184. async agreeList() {
  185. if (this.timeValue == "请点击选择时间") {
  186. uni.showToast({
  187. title: "请选择时间"
  188. })
  189. } else {
  190. this.dialogShow = false
  191. let res = await this.$myRequest({
  192. method: "post",
  193. url: `/order/updateOrderAccept?orderId=${this.orderId}&completeTime=${this.timeValue}`,
  194. })
  195. // console.log(res)
  196. if (res.status == 200) {
  197. uni.showToast({
  198. title: "接单成功",
  199. icon: "success"
  200. })
  201. this.workerList = []
  202. this.pageNum = 1
  203. uni.pageScrollTo({
  204. scrollTop: 0
  205. });
  206. this.getworkList()
  207. }
  208. this.timeValue = '请点击选择时间'
  209. }
  210. },
  211. // 拒绝订单
  212. async handleRefuse() {
  213. this.dialogShows = false
  214. let res = await this.$myRequest({
  215. method: "post",
  216. url: `/order/updateOrderRefused?orderId=${this.orderId}`,
  217. })
  218. // console.log(res)
  219. if (res.status == 200) {
  220. uni.showToast({
  221. title: "拒单成功",
  222. icon: "success",
  223. })
  224. this.workerList = []
  225. this.pageNum = 1
  226. uni.pageScrollTo({
  227. scrollTop: 0
  228. });
  229. this.getworkList()
  230. }
  231. },
  232. onShowDatePicker(type) {
  233. this.type = type;
  234. this.showPicker = true;
  235. this.timeValue = this[type];
  236. },
  237. onSelected(e) {
  238. this.showPicker = false;
  239. if (e) {
  240. this[this.type] = e.value;
  241. this.timeValue = e.value;
  242. }
  243. },
  244. // 页面拉到底部触发事件
  245. onReachBottom() {
  246. if (this.workerList.length < this.total) {
  247. uni.showLoading({
  248. title: "数据加载中"
  249. })
  250. this.pageNum++
  251. this.getworkList()
  252. } else {
  253. this.flag = true
  254. }
  255. },
  256. // 下拉页面刷新函数
  257. onPullDownRefresh() {
  258. this.flag = false
  259. this.workerList = []
  260. this.pageNum = 1
  261. this.getworkList()
  262. setTimeout(() => {
  263. uni.stopPullDownRefresh();
  264. }, 1000);
  265. },
  266. // 控制 接受或者拒绝弹窗 打开
  267. open(item, num) {
  268. this.orderId = item.orderId
  269. this.orderStatus = item.orderStatus
  270. if (num == 1) {
  271. this.dialogShow = true
  272. } else {
  273. this.dialogShows = true
  274. }
  275. },
  276. cancleclose() {
  277. this.dialogShow = false
  278. this.timeValue = '请点击选择时间'
  279. },
  280. // 完成维修按钮回调
  281. handleFinish(orderId) {
  282. uni.showModal({
  283. title: '提示',
  284. content: '确定完成维修了吗?',
  285. success: async (res) => {
  286. if (res.confirm) {
  287. let res = await this.$myRequest({
  288. method: "post",
  289. url: `/order/updateOrderFinish?orderId=${orderId}`,
  290. })
  291. // console.log(res)
  292. if (res.status == 200) {
  293. uni.showToast({
  294. title: res.message,
  295. icon: "success",
  296. })
  297. this.workerList = []
  298. this.pageNum = 1
  299. uni.pageScrollTo({
  300. scrollTop: 0
  301. });
  302. this.getworkList()
  303. }
  304. } else if (res.cancel) {
  305. // uni.showToast({
  306. // title: "已取消"
  307. // })
  308. }
  309. }
  310. });
  311. },
  312. // 查看详情回调
  313. async handleLookInfo(item) {
  314. this.info = null
  315. this.$refs.popup.open()
  316. if (item.orderStatus == 0) {
  317. let res = await this.$myRequest({
  318. method: "post",
  319. url: `/order/queryByOrderIdNotWork?orderId=${item.orderId}`,
  320. })
  321. // console.log(res)
  322. this.$nextTick(() => {
  323. this.info = res.data
  324. this.info.orderImages=this.info.orderImages.split(";")
  325. })
  326. } else {
  327. let res = await this.$myRequest({
  328. method: "post",
  329. url: `/order/queryByOrderId?orderId=${item.orderId}`,
  330. })
  331. // console.log(res)
  332. this.$nextTick(() => {
  333. this.info = res.data
  334. this.info.orderImages=this.info.orderImages.split(";")
  335. })
  336. }
  337. },
  338. // 点击图片放大
  339. handleBig(index) {
  340. this.activeIndex=index
  341. this.$refs.popup2.open()
  342. }
  343. }
  344. }
  345. </script>
  346. <style lang="scss">
  347. .picker-view {
  348. width: 750rpx;
  349. height: 600rpx;
  350. margin-top: 20rpx;
  351. }
  352. .item {
  353. height: 100rpx;
  354. align-items: center;
  355. justify-content: center;
  356. text-align: center;
  357. }
  358. .head {
  359. position: relative;
  360. height: 350rpx;
  361. border-radius: 0rpx 0rpx 20rpx 20rpx;
  362. background-color: rgba(42, 130, 228, 1);
  363. }
  364. .location {
  365. position: absolute;
  366. top: 38rpx;
  367. left: 300rpx;
  368. font-size: 30rpx;
  369. font-weight: bold;
  370. color: rgba(255, 255, 255, 1);
  371. }
  372. .loc {
  373. font-size: 24rpx;
  374. width: 40rpx;
  375. height: 40rpx;
  376. vertical-align: bottom;
  377. }
  378. .nav {
  379. position: absolute;
  380. top: 144rpx;
  381. width: 718rpx;
  382. height: 236rpx;
  383. margin-left: 18rpx;
  384. background-color: rgba(255, 255, 255, 1);
  385. border-radius: 28rpx 28rpx 0rpx 0rpx;
  386. }
  387. .nav image {
  388. display: block;
  389. width: 48rpx;
  390. height: 48rpx;
  391. margin: 64rpx auto;
  392. font-size: 48rpx;
  393. }
  394. .nav view {
  395. position: absolute;
  396. left: 308rpx;
  397. top: 136rpx;
  398. font-size: 24rpx;
  399. }
  400. .nav navigator {
  401. width: 108rpx;
  402. height: 120rpx;
  403. margin-top: 64rpx;
  404. margin-left: 304rpx;
  405. }
  406. .content {
  407. margin-top: 30rpx;
  408. height: 1200rpx;
  409. background-color: rgba(255, 255, 255, 1);
  410. }
  411. .point {
  412. height: 14rpx;
  413. background-color: rgba(229, 229, 229, 0.62);
  414. }
  415. .list-text {
  416. margin-top: 30rpx;
  417. font-size: 24rpx;
  418. text-align: center;
  419. color: rgba(80, 80, 80, 0.27);
  420. }
  421. .content-list {
  422. position: relative;
  423. margin-top: 22rpx;
  424. padding-left: 20rpx;
  425. height: 250rpx;
  426. border-radius: 28rpx 28rpx 0rpx 0rpx;
  427. font-size: 24rpx;
  428. background-color: rgba(229, 229, 229, 0.62);
  429. }
  430. .num {
  431. float: left;
  432. margin-left: 14rpx;
  433. margin-top: 18rpx;
  434. font-weight: 700;
  435. color: rgba(42, 130, 228, 1);
  436. }
  437. .list {
  438. float: left;
  439. margin-left: -280rpx;
  440. margin-top: 64rpx;
  441. }
  442. .content-list .agreeIt {
  443. position: absolute;
  444. bottom: 20rpx;
  445. right: 42rpx;
  446. line-height: 50rpx;
  447. width: 152rpx;
  448. height: 50rpx;
  449. background-color: rgba(42, 130, 228, 1);
  450. color: white;
  451. font-size: 24rpx;
  452. border-radius: 28rpx;
  453. }
  454. .agreeIt2{
  455. position: absolute;
  456. bottom: 20rpx;
  457. right: 42rpx;
  458. line-height: 50rpx;
  459. width: 122rpx;
  460. height: 50rpx;
  461. background-color: rgba(42, 130, 228, 1);
  462. color: white;
  463. font-size: 24rpx;
  464. border-radius: 28rpx;
  465. }
  466. .content-list .refuse {
  467. position: absolute;
  468. bottom: 20rpx;
  469. right: 190rpx;
  470. line-height: 50rpx;
  471. width: 122rpx;
  472. height: 50rpx;
  473. background-color: rgba(42, 130, 228, 1);
  474. color: white;
  475. font-size: 24rpx;
  476. border-radius: 28rpx;
  477. }
  478. .isOver {
  479. width: 100%;
  480. height: 100rpx;
  481. line-height: 100rpx;
  482. text-align: center;
  483. font-size: 24rpx;
  484. color: rgba(80, 80, 80, 0.27);
  485. }
  486. #dialog {
  487. position: absolute;
  488. top: 0;
  489. right: 0;
  490. bottom: 0;
  491. left: 0;
  492. width: 80%;
  493. height: 25%;
  494. margin: auto;
  495. border-radius: 16rpx;
  496. text-align: center;
  497. background-color: white;
  498. }
  499. .uni-textarea {
  500. margin-top: 70rpx;
  501. color: rgba(80, 80, 80, 1);
  502. }
  503. .box {
  504. position: fixed;
  505. top: 0;
  506. left: 0;
  507. width: 100%;
  508. height: 100%;
  509. background: rgba(0, 0, 0, 0.3);
  510. }
  511. .replace {
  512. margin-top: 4%;
  513. font-size: 28rpx;
  514. color: #4CD964;
  515. }
  516. .cancle {
  517. position: absolute;
  518. top: 78%;
  519. width: 50%;
  520. height: 22%;
  521. border: 2rpx solid rgba(229, 229, 229, 0.62);
  522. border-radius: 0 0 0 16rpx;
  523. line-height: 2.7;
  524. background-color: white;
  525. }
  526. .agree {
  527. position: absolute;
  528. right: 0;
  529. top: 78%;
  530. width: 50%;
  531. height: 22%;
  532. border-radius: 0 0 16rpx 0;
  533. border: 2rpx solid rgba(229, 229, 229, 0.62);
  534. line-height: 2.7;
  535. background-color: white;
  536. }
  537. .newList {
  538. float: right;
  539. margin-top: 20rpx;
  540. margin-right: 32rpx;
  541. color: rgba(255, 141, 26, 1);
  542. }
  543. .readyList {
  544. float: right;
  545. margin-top: 20rpx;
  546. margin-right: 4rpx;
  547. color: rgba(212, 48, 48, 1);
  548. }
  549. .waitList {
  550. float: right;
  551. margin-top: 20rpx;
  552. margin-right: 4rpx;
  553. color: orange;
  554. }
  555. .finishList {
  556. float: right;
  557. margin-top: 20rpx;
  558. margin-right: 4rpx;
  559. color: blue;
  560. }
  561. .refuseList {
  562. float: right;
  563. margin-top: 20rpx;
  564. margin-right: 4rpx;
  565. color: rgba(212, 48, 48, 1);
  566. }
  567. .popup_view {
  568. box-sizing: border-box;
  569. width: 600rpx;
  570. height: 840rpx;
  571. padding: 50rpx;
  572. image {
  573. width: 100%;
  574. height: 100%;
  575. }
  576. .popup_title {
  577. font-size: 20px;
  578. }
  579. .popup_item {
  580. margin: 20rpx 0;
  581. }
  582. .popup_img {
  583. display: flex;
  584. image {
  585. margin: 0 6rpx;
  586. width: 100rpx;
  587. height: 200rpx;
  588. background-color: #eee;
  589. }
  590. }
  591. }
  592. </style>