list-center.vue 9.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459
  1. <template>
  2. <view>
  3. <view class="head">
  4. <view class="location">
  5. 维修中心<image class="loc" src="../../static/钳子.svg" mode=""></image>
  6. </view>
  7. </view>
  8. <view class="nav">
  9. <navigator url="../feedback/feedback" hover-class="navigator-hover">
  10. <image src="../../static/建议.svg" mode=""></image>
  11. <view>评价建议</view>
  12. </navigator>
  13. </view>
  14. <view class="content">
  15. <view class="point"></view>
  16. <view class="list-text">
  17. 报修订单
  18. </view>
  19. <view class="content-list" v-for="(item,key,index) in workerList":key="item">
  20. <text class="num">订单号:{{item.orderId}}</text>
  21. <text class="newList">{{item.orderStatus==0?show:''}} </text> <!-- 新订单 -->
  22. <text class="waitList">{{item.orderStatus==1?show2:''}} </text> <!-- 待接单 -->
  23. <text class="readyList">{{item.orderStatus==2?show3:''}} </text> <!-- 已接单 -->
  24. <text class="finishList">{{item.orderStatus==3?show4:''}} </text> <!-- 维修完成 -->
  25. <text class="refuseList">{{item.orderStatus==4?show5:''}} </text> <!-- 已退单 -->
  26. <view class="list">
  27. <view class="">
  28. 故障类型:{{item.repairsFault.faultName}}
  29. </view>
  30. <view class="">
  31. 维修时间:{{item.orderExpectedTime}}
  32. </view>
  33. <view class="">
  34. 维修人员:高××
  35. </view>
  36. </view>
  37. <button class="agreeIt" @click="openRefuse();getorderId(item)" v-if="item.orderStatus == 1"
  38. style="width: 152rpx; height: 50rpx; background-color:rgba(42, 130, 228, 1); color: white;font-size: 24rpx; border-radius: 28rpx;">接受</button>
  39. <button class="refuse" v-if="item.orderStatus == 1"
  40. @click="openRefuse();getorderStatus(item);getorderId(item);"
  41. style="width: 152rpx; height: 50rpx; background-color:rgba(42, 130, 228, 1); color: white;font-size: 24rpx; border-radius: 28rpx;">拒绝</button>
  42. </view>
  43. <view class="isOver" v-if="flag">
  44. ----我是有底线的----
  45. </view>
  46. </view>
  47. <!-- 是否拒绝单子 -->
  48. <view class="box" v-if="vm.dialogShows">
  49. <view id="dialog">
  50. <view class="replace">
  51. 通知
  52. </view>
  53. <view class="uni-textarea">
  54. 确定拒绝此单?
  55. </view>
  56. <view class="cancle" @click="closeRefuse">
  57. 取消
  58. </view>
  59. <view class="agree" @click="closeRefuse();refuseList()">
  60. 确定
  61. </view>
  62. </view>
  63. </view>
  64. <!-- 是否接受单子 -->
  65. <view class="box" v-if="vm.dialogShow">
  66. <view id="dialog">
  67. <view class="replace">
  68. 选择维修时间
  69. </view>
  70. <view class="uni-textarea">
  71. <view @click="onShowDatePicker('datetime')" class="uni-list-cell-db-2">
  72. <text style="margin-left: 20rpx;">{{timeValue}}</text>
  73. </view>
  74. <mx-date-picker :show="showPicker" :type="type" :value="timeValue" :show-tips="true"
  75. :begin-text="'开始'" :end-text="'截至'" :show-seconds="true" @confirm="onSelected"
  76. @cancel="onSelected" />
  77. </view>
  78. <view class="cancle" @click="close">
  79. 取消
  80. </view>
  81. <view class="agree" @click="close();agreeList()">
  82. 确定
  83. </view>
  84. </view>
  85. </view>
  86. </view>
  87. </template>
  88. <script>
  89. import MxDatePicker from "../../util/mx-datepicker/mx-datepicker"
  90. export default {
  91. components: {
  92. MxDatePicker
  93. },
  94. data() {
  95. return {
  96. vm: {
  97. dialogShow: false,
  98. dialogShows: false
  99. },
  100. orderId: '',
  101. orderStatus: null,
  102. workerList: [],
  103. flag: false,
  104. flags: true,
  105. pageNum: 1,
  106. show: '新订单',
  107. show2: '待接单',
  108. show3: '已接单',
  109. show4: '维修完成',
  110. show5: '退单',
  111. title: 'picker-view',
  112. visible: true,
  113. showPicker: false,
  114. datetime: '2022-03-27 15:00:12',
  115. range: ['2022-03-27', '2022-03-27'],
  116. rangetime: '',
  117. type: 'rangetime',
  118. timeValue: '',
  119. homeUrl: "https://jtishfw.ncjti.edu.cn/baoxiu/repairApi"
  120. }
  121. },
  122. onLoad() {
  123. this.getworkList()
  124. this.refuseList()
  125. this.agreeList()
  126. },
  127. methods: {
  128. onShowDatePicker(type) {
  129. this.type = type;
  130. this.showPicker = true;
  131. this.timeValue = this[type];
  132. },
  133. onSelected(e) {
  134. this.showPicker = false;
  135. if (e) {
  136. this[this.type] = e.value;
  137. this.timeValue = e.value;
  138. //选择的值
  139. console.log('value => ' + e.value);
  140. //原始的Date对象
  141. console.log('date => ' + e.date);
  142. }
  143. },
  144. // 获取订单编号
  145. getorderId(item) {
  146. this.orderId = item.orderId
  147. },
  148. //获取订单状态
  149. getorderStatus(item) {
  150. this.orderStatus = item.orderStatus
  151. console.log(this.orderStatus)
  152. },
  153. onReachBottom() {
  154. console.log(this.workerList.length)
  155. console.log(this.pageNum * 5)
  156. if (this.workerList.length < this.pageNum * 5)
  157. return this.flag = true
  158. this.pageNum++
  159. this.getworkList()
  160. },
  161. onPullDownRefresh() {
  162. console.log('refresh');
  163. setTimeout(() => {
  164. uni.stopPullDownRefresh();
  165. }, 1000);
  166. },
  167. // 是否接受单子
  168. open() {
  169. this.vm.dialogShow = true
  170. },
  171. close() {
  172. this.vm.dialogShow = false
  173. },
  174. // 接受订单
  175. async agreeList() {
  176. const res = await uni.request({
  177. method: 'POST',
  178. url: `${this.homeUrl}/order/updateOrderAccept?orderId=` + this.orderId + `&completeTime=` +
  179. this.timeValue,
  180. success: (res) => {
  181. console.log(this.timeValue)
  182. console.log("hahah----------")
  183. this.workerList.forEach(item => {
  184. if (item.orderId == this.orderId) {
  185. item.orderExpectedTime = this[this.type]
  186. item.orderStatus = 4
  187. }
  188. })
  189. }
  190. })
  191. },
  192. // 是否拒绝单子
  193. openRefuse() {
  194. this.vm.dialogShows = true
  195. },
  196. closeRefuse() {
  197. this.vm.dialogShows = false
  198. },
  199. // 拒绝订单
  200. async refuseList() {
  201. const res = await uni.request({
  202. method: 'POST',
  203. url: `${this.homeUrl}/order/updateOrderRefused?orderId=${this.orderId}`,
  204. success: (res) => {
  205. console.log('========')
  206. console.log(this.orderId)
  207. this.workerList.forEach(item => {
  208. if (item.orderId == this.orderId) {
  209. item.orderStatus = 4
  210. }
  211. })
  212. }
  213. })
  214. },
  215. // 获取订单列表
  216. async getworkList() {
  217. this.$http.post(`${this.homeUrl}/order/queryAllOrderByWorkId?pageNum` + this.pageNum).then(result => {
  218. console.log(result.data)
  219. console.log(result.data.list)
  220. this.workerList = [...this.workerList, ...result.data.list]
  221. this.workerList.forEach((item, index) => {
  222. this.$set(item, 'isShow', true);
  223. })
  224. }, err => {})
  225. }
  226. }
  227. }
  228. </script>
  229. <style>
  230. .picker-view {
  231. width: 750rpx;
  232. height: 600rpx;
  233. margin-top: 20rpx;
  234. }
  235. .item {
  236. height: 100rpx;
  237. align-items: center;
  238. justify-content: center;
  239. text-align: center;
  240. }
  241. .head {
  242. position: relative;
  243. height: 350rpx;
  244. border-radius: 0rpx 0rpx 20rpx 20rpx;
  245. background-color: rgba(42, 130, 228, 1);
  246. }
  247. .location {
  248. position: absolute;
  249. top: 38rpx;
  250. left: 300rpx;
  251. font-size: 30rpx;
  252. font-weight: bold;
  253. color: rgba(255, 255, 255, 1);
  254. }
  255. .loc {
  256. font-size: 24rpx;
  257. width: 40rpx;
  258. height: 40rpx;
  259. vertical-align: bottom;
  260. }
  261. .nav {
  262. position: absolute;
  263. top: 144rpx;
  264. width: 718rpx;
  265. height: 236rpx;
  266. margin-left: 18rpx;
  267. background-color: rgba(255, 255, 255, 1);
  268. border-radius: 28rpx 28rpx 0rpx 0rpx;
  269. }
  270. .nav image {
  271. display: block;
  272. width: 48rpx;
  273. height: 48rpx;
  274. margin: 64rpx auto;
  275. font-size: 48rpx;
  276. }
  277. .nav view {
  278. position: absolute;
  279. left: 308rpx;
  280. top: 136rpx;
  281. font-size: 24rpx;
  282. }
  283. .nav navigator {
  284. width: 108rpx;
  285. height: 120rpx;
  286. margin-top: 64rpx;
  287. margin-left: 304rpx;
  288. }
  289. .content {
  290. margin-top: 30rpx;
  291. height: 1200rpx;
  292. background-color: rgba(255, 255, 255, 1);
  293. }
  294. .point {
  295. height: 14rpx;
  296. background-color: rgba(229, 229, 229, 0.62);
  297. }
  298. .list-text {
  299. margin-top: 30rpx;
  300. font-size: 24rpx;
  301. text-align: center;
  302. color: rgba(80, 80, 80, 0.27);
  303. }
  304. .content-list {
  305. position: relative;
  306. margin-top: 22rpx;
  307. height: 250rpx;
  308. border-radius: 28rpx 28rpx 0rpx 0rpx;
  309. font-size: 24rpx;
  310. background-color: rgba(229, 229, 229, 0.62);
  311. }
  312. .num {
  313. float: left;
  314. margin-left: 14rpx;
  315. margin-top: 18rpx;
  316. font-weight: 700;
  317. color: rgba(42, 130, 228, 1);
  318. }
  319. .list {
  320. float: left;
  321. margin-left: -280rpx;
  322. margin-top: 64rpx;
  323. }
  324. .content-list .agreeIt {
  325. position: absolute;
  326. bottom: 20rpx;
  327. right: 42rpx;
  328. line-height: 50rpx;
  329. }
  330. .content-list .refuse {
  331. position: absolute;
  332. bottom: 20rpx;
  333. right: 220rpx;
  334. line-height: 50rpx;
  335. }
  336. .isOver {
  337. width: 100%;
  338. height: 100rpx;
  339. line-height: 100rpx;
  340. text-align: center;
  341. font-size: 24rpx;
  342. color: rgba(80, 80, 80, 0.27);
  343. }
  344. #dialog {
  345. position: absolute;
  346. top: 0;
  347. right: 0;
  348. bottom: 0;
  349. left: 0;
  350. width: 80%;
  351. height: 25%;
  352. margin: auto;
  353. border-radius: 16rpx;
  354. text-align: center;
  355. background-color: white;
  356. }
  357. .uni-textarea {
  358. margin-top: 50rpx;
  359. color: rgba(80, 80, 80, 1);
  360. }
  361. .box {
  362. position: fixed;
  363. top: 0;
  364. left: 0;
  365. width: 100%;
  366. height: 100%;
  367. background: rgba(0, 0, 0, 0.3);
  368. }
  369. .replace {
  370. margin-top: 4%;
  371. font-size: 28rpx;
  372. color: #4CD964;
  373. }
  374. .cancle {
  375. position: absolute;
  376. top: 78%;
  377. width: 50%;
  378. height: 22%;
  379. border: 2rpx solid rgba(229, 229, 229, 0.62);
  380. border-radius: 0 0 0 16rpx;
  381. line-height: 2;
  382. background-color: white;
  383. }
  384. .agree {
  385. position: absolute;
  386. right: 0;
  387. top: 78%;
  388. width: 50%;
  389. height: 22%;
  390. border-radius: 0 0 16rpx 0;
  391. border: 2rpx solid rgba(229, 229, 229, 0.62);
  392. line-height: 2;
  393. background-color: white;
  394. }
  395. .newList {
  396. float: right;
  397. margin-top: 20rpx;
  398. margin-right: 32rpx;
  399. color: rgba(255, 141, 26, 1);
  400. }
  401. .readyList {
  402. float: right;
  403. margin-top: 20rpx;
  404. margin-right: 4rpx;
  405. color: rgba(212, 48, 48, 1);
  406. }
  407. .waitList {
  408. float: right;
  409. margin-top: 20rpx;
  410. margin-right: 4rpx;
  411. color: yellow;
  412. }
  413. .finishList {
  414. float: right;
  415. margin-top: 20rpx;
  416. margin-right: 4rpx;
  417. color: blue;
  418. }
  419. .refuseList {
  420. float: right;
  421. margin-top: 20rpx;
  422. margin-right: 4rpx;
  423. color: rgba(212, 48, 48, 1);
  424. }
  425. </style>