myRepairs.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743
  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(item.id)">催单</view>
  122. <view class="btn_box type" v-if="item.state === '待确认'" @click="handleBackOffice(item)">转后勤</view>
  123. <view class="btn_box type" v-if="item.state === '待确认'" @click="handlePay(item)">支付</view>
  124. <view class="btn_box type2" v-if="item.state === '待接单' || item.state === '维修中' || item.state === '待确认'" @click="handleRepeal(item.id)">撤销</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. // 当前操作的记录Id
  178. recordId: ''
  179. }
  180. },
  181. mounted() {
  182. console.log('我的报修页面加载')
  183. this.userId = uni.getStorageSync('repairsUserInfo').userId
  184. this.getRepairCount()
  185. this.getRepairList()
  186. },
  187. methods: {
  188. // 获取每个状态的订单总数量
  189. async getRepairCount() {
  190. const res = await this.$myRequest_repairs({
  191. url: '/repairRecord/getRepairRecordCountByUserId',
  192. data: {
  193. userId: this.userId
  194. }
  195. })
  196. // console.log(res)
  197. if (res.code === '200') {
  198. this.items = [`未完成(${res.data.incomplete})`, `待确认(${res.data.confirmed})`, `已完成(${res.data.finished})`]
  199. }
  200. },
  201. // 获取订单列表数据
  202. async getRepairList() {
  203. const res = await this.$myRequest_repairs({
  204. url: '/repairRecord/getRepairRecordsByUserId',
  205. data: {
  206. userId: this.userId,
  207. currentPage: this.currentPage,
  208. pageCount: this.pageCount,
  209. state: this.current - 0 + 1
  210. }
  211. })
  212. // console.log(res)
  213. if (res.code === '200') {
  214. this.list = [...this.list, ...res.data.list]
  215. this.total = res.data.totalCount
  216. // 当页面没有数据时,页面禁止滚动
  217. if (this.list.length === 0) {
  218. this.scrollY = false
  219. } else {
  220. this.scrollY = true
  221. }
  222. } else {
  223. // 请求数据失败页面禁止滚动
  224. this.scrollY = false
  225. }
  226. },
  227. // 滚动到底部触发回调
  228. scrolltolower() {
  229. console.log('页面触底了')
  230. if (this.total > this.list.length) {
  231. this.currentPage++
  232. this.getRepairList()
  233. } else {
  234. console.log('没有更多数据了')
  235. this.showBottomText = true
  236. }
  237. },
  238. // 分段器切换回调
  239. onClickItem(index) {
  240. // 清空数组
  241. this.list = []
  242. // 重置当前页面可以滚动
  243. this.scrollY = true
  244. // 重置请求数据当前页参数
  245. this.currentPage = 1
  246. // 改变分段器索引
  247. this.current = index
  248. this.getRepairList()
  249. },
  250. // 转后勤弹窗确定按钮回调
  251. async handleLogisticsConfirm() {
  252. if (!this.logisticsValue) {
  253. uni.showToast({
  254. title: '留言不能为空',
  255. icon: 'none'
  256. })
  257. return
  258. }
  259. const res = await this.$myRequest_repairs({
  260. url: '/repairLeaveMessage/transferToLogistics',
  261. method: 'post',
  262. data: {
  263. recordId: this.recordId,
  264. userId: this.userId,
  265. content: this.logisticsValue
  266. }
  267. })
  268. // console.log(res)
  269. if (res.code === '200') {
  270. uni.showToast({
  271. title: '转后勤成功',
  272. icon: 'success'
  273. })
  274. this.$refs.popup_logistics[0].close()
  275. } else {
  276. uni.showToast({
  277. title: res.message,
  278. icon: 'fail'
  279. })
  280. }
  281. },
  282. // 催单按钮回调
  283. handleExpedite(id) {
  284. uni.showModal({
  285. title: '提示',
  286. content: '确定催单吗?',
  287. success: async (res) => {
  288. if (res.confirm) {
  289. const res = await this.$myRequest_repairs({
  290. url: '/repairRecord/repairRecordReminder',
  291. data: {
  292. recordId: id
  293. }
  294. })
  295. // console.log(res)
  296. if (res.code === '200') {
  297. uni.showToast({
  298. title: '催单成功',
  299. icon: 'success'
  300. })
  301. }
  302. }
  303. }
  304. })
  305. },
  306. // 撤销按钮回调
  307. handleRepeal(id) {
  308. uni.showModal({
  309. title: '提示',
  310. content: '确定撤销吗?',
  311. success: async (res) => {
  312. if (res.confirm) {
  313. const res = await this.$myRequest_repairs({
  314. url: '/repairRecord/revokeRepairRecordById',
  315. method: 'get',
  316. data: {
  317. id
  318. }
  319. })
  320. // console.log(res)
  321. if (res.code === '200') {
  322. uni.showToast({
  323. title: '撤销成功',
  324. icon: 'success'
  325. })
  326. setTimeout(() => {
  327. this.list = []
  328. this.currentPage = 1
  329. this.getRepairList()
  330. }, 1500)
  331. }
  332. }
  333. }
  334. })
  335. },
  336. // 查看维修费用回调
  337. checkFeeDetail(item) {
  338. this.$refs.popup_fee[0].open('center')
  339. this.consumables = item.consumables
  340. },
  341. // 转后勤按钮回调
  342. handleBackOffice(item) {
  343. this.recordId = item.id
  344. this.$refs.popup_logistics[0].open('center')
  345. },
  346. // 去评价按钮回调
  347. handleEvaluate(item) {
  348. let recordId = item.id
  349. uni.navigateTo({
  350. url: `/pagesRepairs/evaluate/evaluate?recordId=${recordId}`
  351. })
  352. },
  353. // 点击工单编号区域回调
  354. handleLookDetail(item) {
  355. const detailInfo = encodeURIComponent(JSON.stringify(item))
  356. // console.log(detailInfo)
  357. uni.navigateTo({
  358. url: `/pagesRepairs/repairDetails/repairDetails?detailInfo=${detailInfo}`
  359. })
  360. },
  361. // 点击电话号码回调
  362. handleCallPhone(phone) {
  363. uni.makePhoneCall({
  364. phoneNumber: phone
  365. })
  366. },
  367. // 点击图片回调
  368. handleLookImgs(img) {
  369. uni.previewImage({
  370. urls: img
  371. })
  372. },
  373. // 点击支付按钮回调
  374. async handlePay(item) {
  375. console.log(item)
  376. const res = await this.$myRequest_repairs({
  377. url: '/repairPayRecord/repairPayment',
  378. method: 'post',
  379. data: {
  380. recordId: item.id,
  381. userId: this.userId,
  382. price: item.price
  383. }
  384. })
  385. console.log(res)
  386. }
  387. }
  388. }
  389. </script>
  390. <style lang="scss" scoped>
  391. .container {
  392. display: flex;
  393. flex-direction: column;
  394. box-sizing: border-box;
  395. padding: 0 30rpx;
  396. width: 100vw;
  397. height: calc(100vh - 152rpx);
  398. overflow-y: auto;
  399. // 隐藏滚动条
  400. ::-webkit-scrollbar {
  401. width: 0;
  402. height: 0;
  403. color: transparent;
  404. }
  405. .control {
  406. display: flex;
  407. box-sizing: border-box;
  408. margin: 26rpx 0 29rpx;
  409. padding: 6rpx;
  410. width: 100%;
  411. height: 88rpx;
  412. border-radius: 18rpx;
  413. background-color: #f2f2f2;
  414. .control_item {
  415. flex: 1;
  416. display: flex;
  417. justify-content: center;
  418. align-items: center;
  419. height: 76rpx;
  420. font-size: 32rpx;
  421. }
  422. .active {
  423. border-radius: 18rpx;
  424. background-color: #fff;
  425. }
  426. }
  427. .body {
  428. // height: calc(100vh - 190rpx);
  429. // overflow-y: auto;
  430. padding-bottom: 25rpx;
  431. .body_item {
  432. margin: 10rpx 10rpx 30rpx;
  433. // height: 799rpx;
  434. border-radius: 11rpx;
  435. box-shadow: 0 0 8rpx #d9d9d9;
  436. .item_title {
  437. display: flex;
  438. align-items: center;
  439. padding: 0 30rpx;
  440. height: 87rpx;
  441. border-bottom: 1rpx solid #e6e6e6;
  442. img {
  443. width: 30rpx;
  444. height: 30rpx;
  445. }
  446. .title_info {
  447. margin: 0 21rpx 0 13rpx;
  448. font-size: 28rpx;
  449. }
  450. .title_type {
  451. width: 137rpx;
  452. height: 47rpx;
  453. line-height: 47rpx;
  454. text-align: center;
  455. border-radius: 136rpx;
  456. color: #ff5733;
  457. font-size: 24rpx;
  458. border: 1rpx solid #ff5733;
  459. }
  460. }
  461. .item_time {
  462. display: flex;
  463. justify-content: space-between;
  464. align-items: center;
  465. padding: 0 30rpx;
  466. height: 79rpx;
  467. .time_msg {
  468. font-size: 28rpx;
  469. color: #808080;
  470. text {
  471. color: #000000;
  472. }
  473. }
  474. .time_type {
  475. font-size: 32rpx;
  476. color: #ff5733;
  477. }
  478. .color_type {
  479. color: #1e7dfb;
  480. }
  481. .color_type2 {
  482. color: #6fb6b8;
  483. }
  484. }
  485. .item_box {
  486. display: flex;
  487. padding: 0 30rpx;
  488. height: 60rpx;
  489. font-size: 28rpx;
  490. .box_key {
  491. color: #808080;
  492. }
  493. .box_value {
  494. display: flex;
  495. img {
  496. margin-top: 5rpx;
  497. margin-left: 10rpx;
  498. width: 28rpx;
  499. height: 28rpx;
  500. }
  501. }
  502. .box_value2 {
  503. display: flex;
  504. img {
  505. margin-top: -2rpx;
  506. margin-left: 14rpx;
  507. width: 46rpx;
  508. height: 46rpx;
  509. }
  510. }
  511. .phone {
  512. color: #6fb6b8;
  513. }
  514. }
  515. .item_img {
  516. display: flex;
  517. align-items: center;
  518. padding: 0 30rpx;
  519. height: 120rpx;
  520. color: #808080;
  521. font-size: 28rpx;
  522. .img_key {
  523. }
  524. .img_value {
  525. width: 120rpx;
  526. height: 120rpx;
  527. border-radius: 14rpx;
  528. }
  529. }
  530. .item_btn {
  531. display: flex;
  532. align-items: center;
  533. justify-content: flex-end;
  534. padding: 0 30rpx;
  535. height: 153rpx;
  536. .btn_box {
  537. display: flex;
  538. justify-content: center;
  539. align-items: center;
  540. margin-left: 16rpx;
  541. width: 174rpx;
  542. height: 68rpx;
  543. font-size: 28rpx;
  544. border-radius: 11rpx;
  545. }
  546. .type {
  547. color: #fff;
  548. background-color: #6fb6b8;
  549. }
  550. .type2 {
  551. color: #6fb6b8;
  552. background-color: #fff;
  553. border: 1rpx solid #6fb6b8;
  554. }
  555. }
  556. .item_btn2 {
  557. height: 50rpx;
  558. }
  559. .pop_fee {
  560. padding-bottom: 50rpx;
  561. border-radius: 19rpx;
  562. background-color: #fff;
  563. .fee_title {
  564. display: flex;
  565. justify-content: space-between;
  566. align-items: center;
  567. box-sizing: border-box;
  568. padding: 0 31rpx 0 42rpx;
  569. width: 690rpx;
  570. height: 110rpx;
  571. font-size: 32rpx;
  572. font-weight: bold;
  573. border-radius: 19rpx 19rpx 0 0;
  574. border-bottom: 1rpx solid #e6e6e6;
  575. text {
  576. font-size: 45rpx;
  577. font-weight: 400;
  578. color: #808080;
  579. }
  580. }
  581. .fee_list {
  582. height: 40vh;
  583. overflow-y: auto;
  584. .fee_item {
  585. border-bottom: 1rpx solid #e6e6e6;
  586. .fee_box {
  587. display: flex;
  588. align-items: center;
  589. padding-left: 42rpx;
  590. height: 80rpx;
  591. font-size: 28rpx;
  592. color: #808080;
  593. text {
  594. color: #000000;
  595. }
  596. }
  597. }
  598. }
  599. }
  600. .pop_logistics {
  601. border-radius: 19rpx;
  602. background-color: #fff;
  603. .logistics_title {
  604. display: flex;
  605. justify-content: center;
  606. align-items: center;
  607. width: 690rpx;
  608. height: 110rpx;
  609. font-size: 32rpx;
  610. font-weight: bold;
  611. border-radius: 19rpx 19rpx 0 0;
  612. border-bottom: 1rpx solid #e6e6e6;
  613. }
  614. .logistics_body {
  615. height: 440rpx;
  616. border-bottom: 1rpx solid #e6e6e6;
  617. textarea {
  618. box-sizing: border-box;
  619. margin: 35rpx 40rpx;
  620. padding: 20rpx;
  621. width: 610rpx;
  622. height: 370rpx;
  623. font-size: 28rpx;
  624. border-radius: 14rpx;
  625. border: 1rpx solid #e6e6e6;
  626. }
  627. }
  628. .logistics_btn {
  629. display: flex;
  630. align-items: center;
  631. justify-content: space-evenly;
  632. height: 121rpx;
  633. .btn_box {
  634. display: flex;
  635. justify-content: center;
  636. align-items: center;
  637. width: 203rpx;
  638. height: 72rpx;
  639. border-radius: 9rpx;
  640. font-size: 32rpx;
  641. }
  642. .cancel {
  643. background-color: #e5e5e5;
  644. color: #6fb6b8;
  645. }
  646. .confirm {
  647. background-color: #6fb6b8;
  648. color: #fff;
  649. }
  650. }
  651. }
  652. }
  653. .body_no_data {
  654. text-align: center;
  655. color: #b3b3b3;
  656. font-size: 24rpx;
  657. img {
  658. margin: 150rpx auto 50rpx;
  659. width: 480rpx;
  660. height: 508rpx;
  661. }
  662. }
  663. .body_text {
  664. text-align: center;
  665. color: #b3b3b3;
  666. font-size: 24rpx;
  667. }
  668. }
  669. }
  670. </style>