pending.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483
  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">
  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">派单</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. console.log('滚动到底部')
  130. if (this.total > this.dataList.length) {
  131. this.currentPage++
  132. this.getData()
  133. } else {
  134. uni.showToast({
  135. title: '没有更多数据了',
  136. icon: 'none'
  137. })
  138. }
  139. },
  140. // 获取关闭订单原因数组
  141. async getCloseList() {
  142. const res = await this.$myRequest_repairs({
  143. url: '/repairClose/queryRepairCloses'
  144. })
  145. // console.log(res)
  146. if (res.code === '200') {
  147. this.closeList = res.data
  148. }
  149. },
  150. // 获取待处理订单数据
  151. async getData() {
  152. const res = await this.$myRequest_repairs({
  153. url: '/repairRecord/queryPendingOrder',
  154. data: {
  155. currentPage: this.currentPage,
  156. pageCount: this.pageCount
  157. }
  158. })
  159. // console.log(res)
  160. if (res.code === '200') {
  161. this.total = res.data.totalCount
  162. this.dataList = [...this.dataList, ...res.data.list]
  163. }
  164. },
  165. // 接单按钮回调
  166. handleOrderReceiving(item) {
  167. uni.showModal({
  168. content: '确定接单吗?',
  169. title: '提示',
  170. success: async (res) => {
  171. if (res.confirm) {
  172. const res = await this.$myRequest_repairs({
  173. url: '/repairRecord/receiveOrders',
  174. data: {
  175. recordId: item.id,
  176. userId: this.userId
  177. }
  178. })
  179. // console.log(res)
  180. if (res.code === '200') {
  181. uni.showToast({
  182. title: '接单成功',
  183. icon: 'success'
  184. })
  185. }
  186. }
  187. }
  188. })
  189. },
  190. // 关闭图标点击回调
  191. handleClose(item) {
  192. this.orderId = item.id
  193. this.activeIndex = 0
  194. this.$refs.popup_close[0].open('center')
  195. },
  196. // 关闭弹窗确定按钮回调
  197. handleCloseConfirm() {
  198. uni.showModal({
  199. title: '提示',
  200. content: '确定关闭订单吗?',
  201. success: async (res) => {
  202. if (res.confirm) {
  203. const res = await this.$myRequest_repairs({
  204. url: '/repairRecord/closeOrder',
  205. data: {
  206. recordId: this.orderId,
  207. userId: this.userId,
  208. reason: this.closeList[this.activeIndex].name
  209. }
  210. })
  211. // console.log(res)
  212. if (res.code === '200') {
  213. uni.showToast({
  214. title: '关单成功',
  215. icon: 'success'
  216. })
  217. this.$refs.popup_close[0].close()
  218. setTimeout(() => {
  219. this.dataList = []
  220. this.currentPage = 1
  221. this.getData()
  222. }, 1500)
  223. }
  224. }
  225. }
  226. })
  227. },
  228. // 关闭按钮弹窗选中按钮时回调
  229. handleChangeItem(val) {
  230. this.activeIndex = val
  231. },
  232. // 延时按钮回调
  233. handleDelay(item) {
  234. uni.navigateTo({
  235. url: `/pagesRepairs/delay/delay?id=${item.id}`
  236. })
  237. },
  238. // 派单按钮回调
  239. handleSendOrder() {
  240. uni.navigateTo({
  241. url: '/pagesRepairs/helpPeople/helpPeople?type=2'
  242. })
  243. },
  244. // 点击电话号码回调
  245. handleCallPhone(phone) {
  246. console.log(phone)
  247. uni.makePhoneCall({
  248. phoneNumber: phone
  249. })
  250. },
  251. // 点击图片回调
  252. handleLookImgs(img) {
  253. // console.log(img)
  254. uni.previewImage({
  255. urls: img
  256. })
  257. }
  258. }
  259. }
  260. </script>
  261. <style lang="scss" scoped>
  262. .container {
  263. width: 100vw;
  264. height: calc(100vh - 152rpx);
  265. font-size: 32rpx;
  266. overflow-y: auto;
  267. .top_bg {
  268. height: 165rpx;
  269. background-color: #6fb6b8;
  270. }
  271. .body {
  272. box-sizing: border-box;
  273. margin: auto;
  274. margin-top: -100rpx;
  275. padding: 2rpx;
  276. width: 690rpx;
  277. border-radius: 11rpx 11rpx 0 0;
  278. background-color: #fff;
  279. overflow-y: auto;
  280. .body_item {
  281. margin-bottom: 20rpx;
  282. border-radius: 11rpx;
  283. box-shadow: 0 0 8rpx #d9d9d9;
  284. .item_title {
  285. display: flex;
  286. align-items: center;
  287. padding: 0 30rpx;
  288. height: 87rpx;
  289. border-bottom: 1rpx solid #e6e6e6;
  290. img {
  291. width: 30rpx;
  292. height: 30rpx;
  293. }
  294. .title_info {
  295. margin: 0 21rpx 0 13rpx;
  296. // font-size: 28rpx;
  297. }
  298. }
  299. .item_time {
  300. display: flex;
  301. justify-content: space-between;
  302. align-items: center;
  303. padding: 0 30rpx;
  304. height: 79rpx;
  305. .time_msg {
  306. // font-size: 28rpx;
  307. color: #808080;
  308. text {
  309. color: #000000;
  310. }
  311. }
  312. .time_type {
  313. font-size: 32rpx;
  314. color: #ff5733;
  315. }
  316. }
  317. .item_box {
  318. display: flex;
  319. padding: 0 30rpx;
  320. height: 60rpx;
  321. // font-size: 28rpx;
  322. .box_key {
  323. color: #808080;
  324. }
  325. .box_value {
  326. display: flex;
  327. img {
  328. margin-left: 10rpx;
  329. width: 45rpx;
  330. height: 45rpx;
  331. }
  332. }
  333. .phone {
  334. color: #6fb6b8;
  335. }
  336. }
  337. .item_img {
  338. display: flex;
  339. align-items: center;
  340. padding: 0 30rpx;
  341. height: 120rpx;
  342. color: #808080;
  343. // font-size: 28rpx;
  344. .img_key {
  345. }
  346. .img_value {
  347. width: 120rpx;
  348. height: 120rpx;
  349. border-radius: 14rpx;
  350. }
  351. }
  352. .item_btn {
  353. display: flex;
  354. align-items: center;
  355. justify-content: flex-end;
  356. padding: 0 30rpx;
  357. height: 153rpx;
  358. img {
  359. margin-right: auto;
  360. width: 56rpx;
  361. height: 56rpx;
  362. }
  363. .btn_box {
  364. display: flex;
  365. justify-content: center;
  366. align-items: center;
  367. margin-left: 16rpx;
  368. width: 174rpx;
  369. height: 68rpx;
  370. // font-size: 28rpx;
  371. border-radius: 11rpx;
  372. }
  373. .type {
  374. color: #fff;
  375. background-color: #6fb6b8;
  376. }
  377. .type2 {
  378. color: #6fb6b8;
  379. background-color: #fff;
  380. border: 1rpx solid #6fb6b8;
  381. }
  382. }
  383. .popup_close {
  384. width: 690rpx;
  385. border-radius: 19rpx;
  386. background-color: #fff;
  387. .close_box {
  388. height: 100rpx;
  389. line-height: 100rpx;
  390. text-align: center;
  391. font-size: 32rpx;
  392. border: 1rpx solid #e6e6e6;
  393. }
  394. .radius {
  395. border-radius: 19rpx 19rpx 0 0;
  396. }
  397. .active {
  398. color: #fff;
  399. background-color: #6fb6b8;
  400. }
  401. .close_btn {
  402. display: flex;
  403. align-items: center;
  404. justify-content: space-evenly;
  405. margin-top: 100rpx;
  406. height: 121rpx;
  407. .btn_box {
  408. display: flex;
  409. justify-content: center;
  410. align-items: center;
  411. width: 203rpx;
  412. height: 72rpx;
  413. border-radius: 9rpx;
  414. font-size: 32rpx;
  415. }
  416. .cancel {
  417. background-color: #e5e5e5;
  418. color: #6fb6b8;
  419. }
  420. .confirm {
  421. background-color: #6fb6b8;
  422. color: #fff;
  423. }
  424. }
  425. }
  426. }
  427. }
  428. .no_data {
  429. text-align: center;
  430. color: #b3b3b3;
  431. font-size: 24rpx;
  432. img {
  433. margin: 215rpx auto 0;
  434. width: 480rpx;
  435. height: 508rpx;
  436. }
  437. }
  438. }
  439. </style>