pending.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487
  1. <template>
  2. <scroll-view class="container" :scroll-y="scrollY" @scrolltolower="scrolltolower">
  3. <view class="top_bg" v-if="dataList.length"></view>
  4. <view class="body" v-if="dataList.length">
  5. <!-- 每一个订单区域 -->
  6. <view class="body_item" v-for="item in dataList" :key="item.id">
  7. <!-- 工单编号 -->
  8. <view class="item_title">
  9. <img src="../../static/images/repairsImg/order.png" />
  10. <view class="title_info">工单编号:{{ item.recordNo }}</view>
  11. </view>
  12. <!-- 报修时间 -->
  13. <view class="item_time">
  14. <view class="time_msg">
  15. 报修时间:
  16. <text>{{ item.reportTime }}</text>
  17. </view>
  18. <view class="time_type">{{ item.state }}</view>
  19. </view>
  20. <!-- 报修姓名 -->
  21. <view class="item_box">
  22. <view class="box_key">报修姓名:</view>
  23. <view class="box_value">{{ item.userName }}</view>
  24. </view>
  25. <!-- 报修电话 -->
  26. <view class="item_box">
  27. <view class="box_key">报修电话:</view>
  28. <view class="box_value phone" @click="handleCallPhone(item.userPhone)">
  29. {{ item.userPhone }}
  30. <img src="../../static/images/repairsImg/phone.png" />
  31. </view>
  32. </view>
  33. <!-- 报修区域 -->
  34. <view class="item_box">
  35. <view class="box_key">报修区域:</view>
  36. <view class="box_value">{{ item.areaName }}</view>
  37. </view>
  38. <!-- 详细地址 -->
  39. <view class="item_box">
  40. <view class="box_key">详细地址:</view>
  41. <view class="box_value">{{ item.address }}</view>
  42. </view>
  43. <!-- 报修物品 -->
  44. <view class="item_box">
  45. <view class="box_key">报修物品:</view>
  46. <view class="box_value">{{ item.articleName }}</view>
  47. </view>
  48. <!-- 故障描述 -->
  49. <view class="item_box" v-if="item.description">
  50. <view class="box_key">故障描述:</view>
  51. <view class="box_value">{{ item.description }}</view>
  52. </view>
  53. <!-- 上传图片 -->
  54. <view class="item_img">
  55. <view class="img_key">上传图片:</view>
  56. <img class="img_value" mode="aspectFill" :src="item.images[0]" @click="handleLookImgs(item.images)" />
  57. </view>
  58. <!-- 按钮区域 -->
  59. <view class="item_btn">
  60. <img src="../../static/images/repairsImg/close.png" @click="handleClose(item)" />
  61. <view class="btn_box type" v-if="btns.includes('延时')" @click="handleDelay(item)">延时</view>
  62. <view class="btn_box type" v-if="btns.includes('接单')" @click="handleOrderReceiving(item)">接单</view>
  63. <view class="btn_box type2" v-if="btns.includes('派单')" @click="handleSendOrder(item)">派单</view>
  64. </view>
  65. <!-- 关闭按钮弹窗 -->
  66. <uni-popup ref="popup_close" :is-mask-click="false">
  67. <view class="popup_close">
  68. <view
  69. :class="[{ active: activeIndex === index }, { radius: index === 0 }]"
  70. class="close_box"
  71. v-for="(ele, index) in closeList"
  72. :key="ele.id"
  73. @click="handleChangeItem(index)"
  74. >
  75. {{ ele.name }}
  76. </view>
  77. <view class="close_btn">
  78. <view class="btn_box cancel" @click="$refs.popup_close[0].close()">取消</view>
  79. <view class="btn_box confirm" @click="handleCloseConfirm">确定</view>
  80. </view>
  81. </view>
  82. </uni-popup>
  83. </view>
  84. </view>
  85. <!-- 没有数据时展示的图片 -->
  86. <view class="no_data" v-if="dataList.length === 0">
  87. <img src="../../pagesClockIn/static/imgs/nodata.png" />
  88. <view>暂无数据</view>
  89. </view>
  90. </scroll-view>
  91. </template>
  92. <script>
  93. export default {
  94. data() {
  95. return {
  96. scrollY: true,
  97. // 按钮权限
  98. btns: [],
  99. // 关闭按钮弹窗当前索引
  100. activeIndex: 0,
  101. // 关闭按钮弹窗选项数组
  102. closeList: [],
  103. // 工单数据数组
  104. dataList: [],
  105. // 当前页
  106. currentPage: 1,
  107. // 每页多少条
  108. pageCount: 4,
  109. // 总条数
  110. total: null,
  111. // 用户ID
  112. userId: '',
  113. // 订单id
  114. orderId: ''
  115. }
  116. },
  117. mounted() {
  118. console.log('待处理池页面加载')
  119. const repairsUserInfo = uni.getStorageSync('repairsUserInfo')
  120. this.userId = repairsUserInfo.userId
  121. this.btns = repairsUserInfo.btns
  122. console.log(this.btns)
  123. this.getData()
  124. this.getCloseList()
  125. },
  126. methods: {
  127. // 滚动到底部触发回调
  128. scrolltolower() {
  129. if (this.total > this.dataList.length) {
  130. this.currentPage++
  131. this.getData()
  132. } else {
  133. uni.showToast({
  134. title: '没有更多数据了',
  135. icon: 'none'
  136. })
  137. }
  138. },
  139. // 获取关闭订单原因数组
  140. async getCloseList() {
  141. const res = await this.$myRequest_repairs({
  142. url: '/repairClose/queryRepairCloses'
  143. })
  144. // console.log(res)
  145. if (res.code === '200') {
  146. this.closeList = res.data
  147. }
  148. },
  149. // 获取待处理订单数据
  150. async getData() {
  151. const res = await this.$myRequest_repairs({
  152. url: '/repairRecord/queryPendingOrder',
  153. data: {
  154. currentPage: this.currentPage,
  155. pageCount: this.pageCount
  156. }
  157. })
  158. // console.log(res)
  159. if (res.code === '200') {
  160. this.total = res.data.totalCount
  161. this.dataList = [...this.dataList, ...res.data.list]
  162. }
  163. },
  164. // 接单按钮回调
  165. handleOrderReceiving(item) {
  166. uni.showModal({
  167. content: '确定接单吗?',
  168. title: '提示',
  169. success: async (res) => {
  170. if (res.confirm) {
  171. const res = await this.$myRequest_repairs({
  172. url: '/repairRecord/receiveOrders',
  173. data: {
  174. recordId: item.id,
  175. userId: this.userId
  176. }
  177. })
  178. // console.log(res)
  179. if (res.code === '200') {
  180. uni.showToast({
  181. title: '接单成功',
  182. icon: 'success'
  183. })
  184. setTimeout(() => {
  185. this.dataList = []
  186. this.currentPage = 1
  187. this.getData()
  188. }, 1500)
  189. }
  190. }
  191. }
  192. })
  193. },
  194. // 关闭图标点击回调
  195. handleClose(item) {
  196. this.orderId = item.id
  197. this.activeIndex = 0
  198. this.$refs.popup_close[0].open('center')
  199. },
  200. // 关闭弹窗确定按钮回调
  201. handleCloseConfirm() {
  202. uni.showModal({
  203. title: '提示',
  204. content: '确定关闭订单吗?',
  205. success: async (res) => {
  206. if (res.confirm) {
  207. const res = await this.$myRequest_repairs({
  208. url: '/repairRecord/closeOrder',
  209. data: {
  210. recordId: this.orderId,
  211. userId: this.userId,
  212. reason: this.closeList[this.activeIndex].name
  213. }
  214. })
  215. // console.log(res)
  216. if (res.code === '200') {
  217. uni.showToast({
  218. title: '关单成功',
  219. icon: 'success'
  220. })
  221. this.$refs.popup_close[0].close()
  222. setTimeout(() => {
  223. this.dataList = []
  224. this.currentPage = 1
  225. this.getData()
  226. }, 1500)
  227. }
  228. }
  229. }
  230. })
  231. },
  232. // 关闭按钮弹窗选中按钮时回调
  233. handleChangeItem(val) {
  234. this.activeIndex = val
  235. },
  236. // 延时按钮回调
  237. handleDelay(item) {
  238. uni.navigateTo({
  239. url: `/pagesRepairs/delay/delay?id=${item.id}`
  240. })
  241. },
  242. // 派单按钮回调
  243. handleSendOrder(item) {
  244. uni.navigateTo({
  245. url: `/pagesRepairs/helpPeople/helpPeople?type=1&id=${item.id}`
  246. })
  247. },
  248. // 点击电话号码回调
  249. handleCallPhone(phone) {
  250. // console.log(phone)
  251. uni.makePhoneCall({
  252. phoneNumber: phone
  253. })
  254. },
  255. // 点击图片回调
  256. handleLookImgs(img) {
  257. // console.log(img)
  258. uni.previewImage({
  259. urls: img
  260. })
  261. }
  262. }
  263. }
  264. </script>
  265. <style lang="scss" scoped>
  266. .container {
  267. width: 100vw;
  268. height: calc(100vh - 152rpx);
  269. font-size: 32rpx;
  270. overflow-y: auto;
  271. .top_bg {
  272. height: 165rpx;
  273. background-color: #6fb6b8;
  274. }
  275. .body {
  276. box-sizing: border-box;
  277. margin: auto;
  278. margin-top: -100rpx;
  279. padding: 2rpx;
  280. width: 690rpx;
  281. border-radius: 11rpx 11rpx 0 0;
  282. background-color: #fff;
  283. overflow-y: auto;
  284. .body_item {
  285. margin-bottom: 20rpx;
  286. border-radius: 11rpx;
  287. box-shadow: 0 0 8rpx #d9d9d9;
  288. .item_title {
  289. display: flex;
  290. align-items: center;
  291. padding: 0 30rpx;
  292. height: 87rpx;
  293. border-bottom: 1rpx solid #e6e6e6;
  294. img {
  295. width: 30rpx;
  296. height: 30rpx;
  297. }
  298. .title_info {
  299. margin: 0 21rpx 0 13rpx;
  300. // font-size: 28rpx;
  301. }
  302. }
  303. .item_time {
  304. display: flex;
  305. justify-content: space-between;
  306. align-items: center;
  307. padding: 0 30rpx;
  308. height: 79rpx;
  309. .time_msg {
  310. // font-size: 28rpx;
  311. color: #808080;
  312. text {
  313. color: #000000;
  314. }
  315. }
  316. .time_type {
  317. font-size: 32rpx;
  318. color: #ff5733;
  319. }
  320. }
  321. .item_box {
  322. display: flex;
  323. padding: 0 30rpx;
  324. height: 60rpx;
  325. // font-size: 28rpx;
  326. .box_key {
  327. color: #808080;
  328. }
  329. .box_value {
  330. display: flex;
  331. img {
  332. margin-left: 10rpx;
  333. width: 45rpx;
  334. height: 45rpx;
  335. }
  336. }
  337. .phone {
  338. color: #6fb6b8;
  339. }
  340. }
  341. .item_img {
  342. display: flex;
  343. align-items: center;
  344. padding: 0 30rpx;
  345. height: 120rpx;
  346. color: #808080;
  347. // font-size: 28rpx;
  348. .img_key {
  349. }
  350. .img_value {
  351. width: 120rpx;
  352. height: 120rpx;
  353. border-radius: 14rpx;
  354. }
  355. }
  356. .item_btn {
  357. display: flex;
  358. align-items: center;
  359. justify-content: flex-end;
  360. padding: 0 30rpx;
  361. height: 153rpx;
  362. img {
  363. margin-right: auto;
  364. width: 56rpx;
  365. height: 56rpx;
  366. }
  367. .btn_box {
  368. display: flex;
  369. justify-content: center;
  370. align-items: center;
  371. margin-left: 16rpx;
  372. width: 174rpx;
  373. height: 68rpx;
  374. // font-size: 28rpx;
  375. border-radius: 11rpx;
  376. }
  377. .type {
  378. color: #fff;
  379. background-color: #6fb6b8;
  380. }
  381. .type2 {
  382. color: #6fb6b8;
  383. background-color: #fff;
  384. border: 1rpx solid #6fb6b8;
  385. }
  386. }
  387. .popup_close {
  388. width: 690rpx;
  389. border-radius: 19rpx;
  390. background-color: #fff;
  391. .close_box {
  392. height: 100rpx;
  393. line-height: 100rpx;
  394. text-align: center;
  395. font-size: 32rpx;
  396. border: 1rpx solid #e6e6e6;
  397. }
  398. .radius {
  399. border-radius: 19rpx 19rpx 0 0;
  400. }
  401. .active {
  402. color: #fff;
  403. background-color: #6fb6b8;
  404. }
  405. .close_btn {
  406. display: flex;
  407. align-items: center;
  408. justify-content: space-evenly;
  409. margin-top: 100rpx;
  410. height: 121rpx;
  411. .btn_box {
  412. display: flex;
  413. justify-content: center;
  414. align-items: center;
  415. width: 203rpx;
  416. height: 72rpx;
  417. border-radius: 9rpx;
  418. font-size: 32rpx;
  419. }
  420. .cancel {
  421. background-color: #e5e5e5;
  422. color: #6fb6b8;
  423. }
  424. .confirm {
  425. background-color: #6fb6b8;
  426. color: #fff;
  427. }
  428. }
  429. }
  430. }
  431. }
  432. .no_data {
  433. text-align: center;
  434. color: #b3b3b3;
  435. font-size: 24rpx;
  436. img {
  437. margin: 215rpx auto 0;
  438. width: 480rpx;
  439. height: 508rpx;
  440. }
  441. }
  442. }
  443. </style>