myRepairs.vue 18 KB

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