myRepairs.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674
  1. <template>
  2. <scroll-view class="container" :scroll-y="scrollY" @scrolltolower="scrolltolower">
  3. <!-- 顶部分段器区域 -->
  4. <view class="control">
  5. <view class="control_item" :class="{ active: current === index }" v-for="(item, index) in items" :key="index" @click="onClickItem(index)">{{ item }}</view>
  6. </view>
  7. <!-- 主体内容区域 -->
  8. <view class="body">
  9. <!-- 每一个记录区域 -->
  10. <view class="body_item" v-for="item in list" :key="item.id">
  11. <!-- 工单编号 -->
  12. <view class="item_title" @click="handleLookDetail(item)">
  13. <img src="../../static/images/repairsImg/order.png" />
  14. <view class="title_info">工单编号:{{ item.recordNo }}</view>
  15. <view class="title_type" v-if="item.timeoutStr">{{ item.timeoutStr }}</view>
  16. </view>
  17. <!-- 报修时间 -->
  18. <view class="item_time">
  19. <view class="time_msg">
  20. 报修时间:
  21. <text>{{ item.reportTime }}</text>
  22. </view>
  23. <view class="time_type" v-if="item.state === '待接单'">待接单</view>
  24. <view class="time_type color_type" v-if="item.state === '维修中'">维修中</view>
  25. <view class="time_type" v-if="item.state === '待确认'">待确认</view>
  26. <view class="time_type color_type2" v-if="item.state === '已完成'">已完成</view>
  27. <view class="time_type" v-if="item.state === '已取消'">已取消</view>
  28. </view>
  29. <!-- 报修姓名 -->
  30. <view class="item_box">
  31. <view class="box_key">报修姓名:</view>
  32. <view class="box_value">{{ item.userName }}</view>
  33. </view>
  34. <!-- 报修电话 -->
  35. <view class="item_box">
  36. <view class="box_key">报修电话:</view>
  37. <view class="box_value phone" @click="handleCallPhone(item.userPhone)">
  38. {{ item.userPhone }}
  39. <img src="../../static/images/repairsImg/phone.png" />
  40. </view>
  41. </view>
  42. <!-- 报修区域 -->
  43. <view class="item_box">
  44. <view class="box_key">报修区域:</view>
  45. <view class="box_value">{{ item.areaName }}</view>
  46. </view>
  47. <!-- 详细地址 -->
  48. <view class="item_box">
  49. <view class="box_key">详细地址:</view>
  50. <view class="box_value">{{ item.address }}</view>
  51. </view>
  52. <!-- 报修物品 -->
  53. <view class="item_box">
  54. <view class="box_key">报修物品:</view>
  55. <view class="box_value">{{ item.articleName }}</view>
  56. </view>
  57. <!-- 故障描述 -->
  58. <view class="item_box">
  59. <view class="box_key">故障描述:</view>
  60. <view class="box_value">{{ item.descript }}</view>
  61. </view>
  62. <!-- 上传图片 -->
  63. <view class="item_img">
  64. <view class="img_key">上传图片:</view>
  65. <img class="img_value" mode="aspectFill" :src="item.images[0]" @click="handleLookImgs(item.images)" />
  66. </view>
  67. <!-- 维修师傅 -->
  68. <view class="item_time" v-if="item.maintenancerName">
  69. <view class="time_msg">
  70. 维修师傅:
  71. <text>{{ item.maintenancerName }}</text>
  72. </view>
  73. </view>
  74. <!-- 师傅电话 -->
  75. <view class="item_box" v-if="item.maintenancerPhone">
  76. <view class="box_key">师傅电话:</view>
  77. <view class="box_value phone" @click="handleCallPhone(item.maintenancerPhone)">
  78. {{ item.maintenancerPhone }}
  79. <img src="../../static/images/repairsImg/phone.png" />
  80. </view>
  81. </view>
  82. <!-- 维修费用 -->
  83. <view class="item_box" v-if="item.money">
  84. <view class="box_key">维修费用:</view>
  85. <view class="box_value2 phone" @click="checkFeeDetail(item)">
  86. {{ item.price }}元
  87. <img src="../../static/images/repairsImg/eye.png" />
  88. </view>
  89. </view>
  90. <!-- 维修费用弹窗 -->
  91. <uni-popup :is-mask-click="false" ref="popup_fee">
  92. <view class="pop_fee">
  93. <view class="fee_title">
  94. 维修费用
  95. <text @click="$refs.popup_fee[0].close()">×</text>
  96. </view>
  97. <view class="fee_list">
  98. <view class="fee_item" v-for="ele in consumables" :key="ele.id">
  99. <view class="fee_box">
  100. 耗材:
  101. <text>{{ ele.consumeName }}</text>
  102. </view>
  103. <view class="fee_box">
  104. 耗材单价:
  105. <text>{{ ele.price }}元</text>
  106. </view>
  107. <view class="fee_box">
  108. 耗材数量:
  109. <text>{{ ele.number }}</text>
  110. </view>
  111. <view class="fee_box">
  112. 耗材费用:
  113. <text>{{ ele.totalPrice }}元</text>
  114. </view>
  115. </view>
  116. </view>
  117. </view>
  118. </uni-popup>
  119. <!-- 按钮 -->
  120. <view class="item_btn" v-if="item.state !== '已取消'">
  121. <view class="btn_box type" v-if="item.state === '待接单' || item.state === '维修中'" @click="handleExpedite">催单</view>
  122. <view class="btn_box type" v-if="item.state === '待确认'" @click="handleBackOffice">转后勤</view>
  123. <view class="btn_box type" v-if="item.state === '待确认'">支付</view>
  124. <view class="btn_box type2" v-if="item.state === '待接单' || item.state === '维修中' || item.state === '待确认'" @click="handleRepeal">撤销</view>
  125. <view class="btn_box type" v-if="item.state === '已完成'" @click="handleEvaluate(item)">去评价</view>
  126. </view>
  127. <view class="item_btn2" v-else></view>
  128. <!-- 转后勤弹窗 -->
  129. <uni-popup ref="popup_logistics" :is-mask-click="false">
  130. <view class="pop_logistics">
  131. <view class="logistics_title">转后勤</view>
  132. <view class="logistics_body">
  133. <textarea placeholder-style="color:#CCCCCC" placeholder="请输入您宝贵的留言" v-model="logisticsValue"></textarea>
  134. </view>
  135. <view class="logistics_btn">
  136. <view class="btn_box cancel" @click="$refs.popup_logistics[0].close()">取消</view>
  137. <view class="btn_box confirm" @click="handleLogisticsConfirm">确定</view>
  138. </view>
  139. </view>
  140. </uni-popup>
  141. </view>
  142. <!-- 没有数据时展示的图片 -->
  143. <view class="body_no_data" v-if="list.length === 0">
  144. <img src="../../pagesClockIn/static/imgs/nodata.png" />
  145. <view>暂无数据</view>
  146. </view>
  147. <view class="body_text" v-if="list.length && showBottomText">---我是有底线的---</view>
  148. </view>
  149. </scroll-view>
  150. </template>
  151. <script>
  152. export default {
  153. data() {
  154. return {
  155. // 后勤弹窗输入框绑定数据
  156. logisticsValue: '',
  157. // 顶部分段器数组
  158. items: ['未完成(0)', '待确认(0)', '已完成(0)'],
  159. // 分段器数组当前索引
  160. current: 0,
  161. // 订单列表
  162. list: [],
  163. // 是否可以Y轴滚动
  164. scrollY: true,
  165. // 是否显示底部文字
  166. showBottomText: false,
  167. // 用户id,请求接口时的参数
  168. userId: '',
  169. // 当前页
  170. currentPage: 1,
  171. // 每页多少条数据
  172. pageCount: 5,
  173. // 列表总数据
  174. total: 0,
  175. // 维修费用耗材明细列表
  176. consumables: []
  177. }
  178. },
  179. mounted() {
  180. console.log('我的报修页面加载')
  181. this.userId = uni.getStorageSync('repairsUserInfo').userId
  182. this.getRepairCount()
  183. this.getRepairList()
  184. },
  185. methods: {
  186. // 获取每个状态的订单总数量
  187. async getRepairCount() {
  188. const res = await this.$myRequest_repairs({
  189. url: '/repairRecord/getRepairRecordCountByUserId',
  190. data: {
  191. userId: this.userId
  192. }
  193. })
  194. // console.log(res)
  195. if (res.code === '200') {
  196. this.items = [`未完成(${res.data.incomplete})`, `待确认(${res.data.confirmed})`, `已完成(${res.data.finished})`]
  197. }
  198. },
  199. // 获取订单列表数据
  200. async getRepairList() {
  201. const res = await this.$myRequest_repairs({
  202. url: '/repairRecord/getRepairRecordsByUserId',
  203. data: {
  204. userId: this.userId,
  205. currentPage: this.currentPage,
  206. pageCount: this.pageCount,
  207. state: this.current - 0 + 1
  208. }
  209. })
  210. console.log(res)
  211. if (res.code === '200') {
  212. this.list = [...this.list, ...res.data.list]
  213. this.total = res.data.totalCount
  214. // 当页面没有数据时,页面禁止滚动
  215. if (this.list.length === 0) {
  216. this.scrollY = false
  217. }
  218. }
  219. },
  220. // 滚动到底部触发回调
  221. scrolltolower() {
  222. console.log('页面触底了')
  223. if (this.total > this.list.length) {
  224. this.currentPage++
  225. this.getRepairList()
  226. } else {
  227. console.log('没有更多数据了')
  228. this.showBottomText = true
  229. }
  230. },
  231. // 分段器切换回调
  232. onClickItem(index) {
  233. // 清空数组
  234. this.list = []
  235. // 重置当前页面可以滚动
  236. this.scrollY = true
  237. // 重置请求数据当前页参数
  238. this.currentPage = 1
  239. // 改变分段器索引
  240. this.current = index
  241. this.getRepairList()
  242. },
  243. // 转后勤弹窗确定按钮回调
  244. handleLogisticsConfirm() {
  245. console.log(this.logisticsValue)
  246. uni.showToast({
  247. title: '留言成功',
  248. icon: 'success'
  249. })
  250. this.$refs.popup_logistics[0].close()
  251. },
  252. // 催单按钮回调
  253. handleExpedite() {
  254. uni.showModal({
  255. title: '提示',
  256. content: '确定催单吗?',
  257. success: (res) => {
  258. if (res.confirm) {
  259. uni.showToast({
  260. title: '催单成功',
  261. icon: 'success'
  262. })
  263. }
  264. }
  265. })
  266. },
  267. // 撤销按钮回调
  268. handleRepeal() {
  269. uni.showModal({
  270. title: '提示',
  271. content: '确定撤销吗?',
  272. success: (res) => {
  273. if (res.confirm) {
  274. uni.showToast({
  275. title: '撤销成功',
  276. icon: 'success'
  277. })
  278. }
  279. }
  280. })
  281. },
  282. // 查看维修费用回调
  283. checkFeeDetail(item) {
  284. this.$refs.popup_fee[0].open('center')
  285. this.consumables = item.consumables
  286. },
  287. // 转后勤按钮回调
  288. handleBackOffice() {
  289. this.$refs.popup_logistics[0].open('center')
  290. },
  291. // 去评价按钮回调
  292. handleEvaluate(item) {
  293. let recordId = item.id
  294. uni.navigateTo({
  295. url: `/pagesRepairs/evaluate/evaluate?recordId=${recordId}`
  296. })
  297. },
  298. // 点击工单编号区域回调
  299. handleLookDetail(item) {
  300. const detailInfo = encodeURIComponent(JSON.stringify(item))
  301. // console.log(detailInfo)
  302. uni.navigateTo({
  303. url: `/pagesRepairs/repairDetails/repairDetails?detailInfo=${detailInfo}`
  304. })
  305. },
  306. // 点击电话号码回调
  307. handleCallPhone(phone) {
  308. uni.makePhoneCall({
  309. phoneNumber: phone
  310. })
  311. },
  312. // 点击图片回调
  313. handleLookImgs(img) {
  314. uni.previewImage({
  315. urls: img
  316. })
  317. }
  318. }
  319. }
  320. </script>
  321. <style lang="scss" scoped>
  322. .container {
  323. display: flex;
  324. flex-direction: column;
  325. box-sizing: border-box;
  326. padding: 0 30rpx;
  327. width: 100vw;
  328. height: calc(100vh - 152rpx);
  329. overflow-y: auto;
  330. // 隐藏滚动条
  331. ::-webkit-scrollbar {
  332. width: 0;
  333. height: 0;
  334. color: transparent;
  335. }
  336. .control {
  337. display: flex;
  338. box-sizing: border-box;
  339. margin: 26rpx 0 29rpx;
  340. padding: 6rpx;
  341. width: 100%;
  342. height: 88rpx;
  343. border-radius: 18rpx;
  344. background-color: #f2f2f2;
  345. .control_item {
  346. flex: 1;
  347. display: flex;
  348. justify-content: center;
  349. align-items: center;
  350. height: 76rpx;
  351. font-size: 32rpx;
  352. }
  353. .active {
  354. border-radius: 18rpx;
  355. background-color: #fff;
  356. }
  357. }
  358. .body {
  359. // height: calc(100vh - 190rpx);
  360. // overflow-y: auto;
  361. padding-bottom: 25rpx;
  362. .body_item {
  363. margin: 10rpx 10rpx 30rpx;
  364. // height: 799rpx;
  365. border-radius: 11rpx;
  366. box-shadow: 0 0 8rpx #d9d9d9;
  367. .item_title {
  368. display: flex;
  369. align-items: center;
  370. padding: 0 30rpx;
  371. height: 87rpx;
  372. border-bottom: 1rpx solid #e6e6e6;
  373. img {
  374. width: 30rpx;
  375. height: 30rpx;
  376. }
  377. .title_info {
  378. margin: 0 21rpx 0 13rpx;
  379. font-size: 28rpx;
  380. }
  381. .title_type {
  382. width: 137rpx;
  383. height: 47rpx;
  384. line-height: 47rpx;
  385. text-align: center;
  386. border-radius: 136rpx;
  387. color: #ff5733;
  388. font-size: 24rpx;
  389. border: 1rpx solid #ff5733;
  390. }
  391. }
  392. .item_time {
  393. display: flex;
  394. justify-content: space-between;
  395. align-items: center;
  396. padding: 0 30rpx;
  397. height: 79rpx;
  398. .time_msg {
  399. font-size: 28rpx;
  400. color: #808080;
  401. text {
  402. color: #000000;
  403. }
  404. }
  405. .time_type {
  406. font-size: 32rpx;
  407. color: #ff5733;
  408. }
  409. .color_type {
  410. color: #1e7dfb;
  411. }
  412. .color_type2 {
  413. color: #6fb6b8;
  414. }
  415. }
  416. .item_box {
  417. display: flex;
  418. padding: 0 30rpx;
  419. height: 60rpx;
  420. font-size: 28rpx;
  421. .box_key {
  422. color: #808080;
  423. }
  424. .box_value {
  425. display: flex;
  426. img {
  427. margin-top: 5rpx;
  428. margin-left: 10rpx;
  429. width: 28rpx;
  430. height: 28rpx;
  431. }
  432. }
  433. .box_value2 {
  434. display: flex;
  435. img {
  436. margin-top: -2rpx;
  437. margin-left: 14rpx;
  438. width: 46rpx;
  439. height: 46rpx;
  440. }
  441. }
  442. .phone {
  443. color: #6fb6b8;
  444. }
  445. }
  446. .item_img {
  447. display: flex;
  448. align-items: center;
  449. padding: 0 30rpx;
  450. height: 120rpx;
  451. color: #808080;
  452. font-size: 28rpx;
  453. .img_key {
  454. }
  455. .img_value {
  456. width: 120rpx;
  457. height: 120rpx;
  458. border-radius: 14rpx;
  459. }
  460. }
  461. .item_btn {
  462. display: flex;
  463. align-items: center;
  464. justify-content: flex-end;
  465. padding: 0 30rpx;
  466. height: 153rpx;
  467. .btn_box {
  468. display: flex;
  469. justify-content: center;
  470. align-items: center;
  471. margin-left: 16rpx;
  472. width: 174rpx;
  473. height: 68rpx;
  474. font-size: 28rpx;
  475. border-radius: 11rpx;
  476. }
  477. .type {
  478. color: #fff;
  479. background-color: #6fb6b8;
  480. }
  481. .type2 {
  482. color: #6fb6b8;
  483. background-color: #fff;
  484. border: 1rpx solid #6fb6b8;
  485. }
  486. }
  487. .item_btn2 {
  488. height: 50rpx;
  489. }
  490. .pop_fee {
  491. padding-bottom: 50rpx;
  492. border-radius: 19rpx;
  493. background-color: #fff;
  494. .fee_title {
  495. display: flex;
  496. justify-content: space-between;
  497. align-items: center;
  498. box-sizing: border-box;
  499. padding: 0 31rpx 0 42rpx;
  500. width: 690rpx;
  501. height: 110rpx;
  502. font-size: 32rpx;
  503. font-weight: bold;
  504. border-radius: 19rpx 19rpx 0 0;
  505. border-bottom: 1rpx solid #e6e6e6;
  506. text {
  507. font-size: 45rpx;
  508. font-weight: 400;
  509. color: #808080;
  510. }
  511. }
  512. .fee_list {
  513. height: 40vh;
  514. overflow-y: auto;
  515. .fee_item {
  516. border-bottom: 1rpx solid #e6e6e6;
  517. .fee_box {
  518. display: flex;
  519. align-items: center;
  520. padding-left: 42rpx;
  521. height: 80rpx;
  522. font-size: 28rpx;
  523. color: #808080;
  524. text {
  525. color: #000000;
  526. }
  527. }
  528. }
  529. }
  530. }
  531. .pop_logistics {
  532. border-radius: 19rpx;
  533. background-color: #fff;
  534. .logistics_title {
  535. display: flex;
  536. justify-content: center;
  537. align-items: center;
  538. width: 690rpx;
  539. height: 110rpx;
  540. font-size: 32rpx;
  541. font-weight: bold;
  542. border-radius: 19rpx 19rpx 0 0;
  543. border-bottom: 1rpx solid #e6e6e6;
  544. }
  545. .logistics_body {
  546. height: 440rpx;
  547. border-bottom: 1rpx solid #e6e6e6;
  548. textarea {
  549. box-sizing: border-box;
  550. margin: 35rpx 40rpx;
  551. padding: 20rpx;
  552. width: 610rpx;
  553. height: 370rpx;
  554. font-size: 28rpx;
  555. border-radius: 14rpx;
  556. border: 1rpx solid #e6e6e6;
  557. }
  558. }
  559. .logistics_btn {
  560. display: flex;
  561. align-items: center;
  562. justify-content: space-evenly;
  563. height: 121rpx;
  564. .btn_box {
  565. display: flex;
  566. justify-content: center;
  567. align-items: center;
  568. width: 203rpx;
  569. height: 72rpx;
  570. border-radius: 9rpx;
  571. font-size: 32rpx;
  572. }
  573. .cancel {
  574. background-color: #e5e5e5;
  575. color: #6fb6b8;
  576. }
  577. .confirm {
  578. background-color: #6fb6b8;
  579. color: #fff;
  580. }
  581. }
  582. }
  583. }
  584. .body_no_data {
  585. text-align: center;
  586. color: #b3b3b3;
  587. font-size: 24rpx;
  588. img {
  589. margin: 150rpx auto 50rpx;
  590. width: 480rpx;
  591. height: 508rpx;
  592. }
  593. }
  594. .body_text {
  595. text-align: center;
  596. color: #b3b3b3;
  597. font-size: 24rpx;
  598. }
  599. }
  600. }
  601. </style>