myRepairs.vue 17 KB

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