list-center.vue 9.4 KB

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