pending.vue 10 KB

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