index.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501
  1. <template>
  2. <div class="mianBox" v-if="status">
  3. <van-row class="headerBox" >
  4. <van-col class="returnWrap" @click="fanhuiBtn">
  5. <van-image class="arrow-left"
  6. :src="require('../../assets/image/left.png')"
  7. />
  8. <van-col class="return">返回</van-col>
  9. </van-col>
  10. <van-col class="title">{{title}}</van-col>
  11. </van-row>
  12. <van-row class="top">
  13. <van-tabs v-model="active" @click="activeSelect" class="pc">
  14. <van-tab title="待配餐" :badge="number"></van-tab>
  15. <van-tab title="已完成"></van-tab>
  16. </van-tabs>
  17. <div class="lineP"></div>
  18. </van-row>
  19. <van-row class="bottom">
  20. <van-row class="orderList" v-if="active==0">
  21. <van-col span="24" v-for="(item,index) in order" :key="index" class="order" @click="orderOne(item)">
  22. <div class="left dcrText" style="margin-top:0">点餐人:</div>
  23. <div class="right dcr" style="margin-top:0">{{item.orderUserName}}</div>
  24. <div class="left scAddressText">送餐地址:</div>
  25. <div span="18" class="right scAddress">{{item.address}}</div>
  26. <div class="left statusText">当前状态:</div>
  27. <div class="right" :class="item.orderStatus == '3' ? 'status' : 'status1'">
  28. {{item.orderStatus == "0" ? "待接单" : item.orderStatus == "1" ? "配餐中" : item.orderStatus == "2" ? "送餐中" : "已完成"}}
  29. </div>
  30. <van-steps :active="item.orderStatus == '0' ? '-1' : item.orderStatus" v-if="item.orderStatus != '3'" active-color="#ee0a24" inactive-color="#999999">
  31. <van-step>{{ item.orderStatus == 0 ? '待接单' : item.orderStatus == 1 ? '已接单' : item.orderStatus == 2 ? '已接单' : '接单' }}</van-step>
  32. <van-step>{{ item.orderStatus == 1 ? '配餐中' : item.orderStatus == 2 ? '已配餐' : '配餐' }}</van-step>
  33. <van-step>{{ item.orderStatus == 2 ? '送餐中' : '送餐' }}</van-step>
  34. </van-steps>
  35. </van-col>
  36. <van-col span="24" class="noMore">没有更多数据了</van-col>
  37. </van-row>
  38. <van-row class="orderList" v-if="active==1">
  39. <van-col span="24" v-for="(item,index) in order" :key="index" class="order" @click="orderOne(item)">
  40. <div class="left dcrText" style="margin-top:0">点餐人:</div>
  41. <div class="right dcr" style="margin-top:0">{{item.orderUserName}}</div>
  42. <div class="left scAddressText" >送餐地址:</div>
  43. <div class="right scAddress">{{item.address || "-"}}</div>
  44. <div class="left statusText">当前状态:</div>
  45. <div class="right" :class="item.orderStatus == '3' ? 'status' : 'status1'">
  46. {{item.orderStatus == "0" ? "待接单" : item.orderStatus == "1" ? "配餐中" : item.orderStatus == "2" ? "送餐中" : "已完成"}}
  47. </div>
  48. <!-- <van-steps :active="item.orderStatus == '0' ? '-1' : item.orderStatus" v-if="item.orderStatus != '3'" active-color="#ee0a24" inactive-color="#999999">
  49. <van-step>{{ item.orderStatus == 0 ? '待接单' : item.orderStatus == 1 ? '已接单' : item.orderStatus == 2 ? '已接单' : '接单' }}</van-step>
  50. <van-step>{{ item.orderStatus == 1 ? '配餐中' : item.orderStatus == 2 ? '已配餐' : '配餐' }}</van-step>
  51. <van-step>{{ item.orderStatus == 2 ? '送餐中' : '送餐' }}</van-step>
  52. </van-steps> -->
  53. </van-col>
  54. <van-col span="24" class="noMore">没有更多数据了</van-col>
  55. </van-row>
  56. </van-row>
  57. <van-dialog v-model="show" class="pcDialog">
  58. <van-row class="orderDetails">
  59. <van-col class="order" span="24">
  60. <div class="left" style="margin-top:0">订餐人:</div>
  61. <div class="right" style="margin-top:0">{{orderDetails.orderUserName || '-'}}</div>
  62. <div class="left">餐别:</div>
  63. <div class="right">{{orderDetails.mType || '-'}}</div>
  64. <div class="left">手机号:</div>
  65. <div class="right">{{orderDetails.phone || '-'}}</div>
  66. <div class="left">送餐地址:</div>
  67. <div class="right">{{orderDetails.address || "-"}}</div>
  68. <div class="left">下单时间:</div>
  69. <div class="right">{{orderDetails.orderTime || '-'}}</div>
  70. <div class="left">备注:</div>
  71. <div class="right">{{orderDetails.remark || '-'}}</div>
  72. </van-col>
  73. <van-col class="detailsText">配餐明细</van-col>
  74. <van-col span="24" class="dishes">
  75. <van-col span="24" v-for="(item,index) in dishes" :key="index" class="list">
  76. <van-col span="12" class="name">{{item.mName}}</van-col>
  77. <van-col span="12" class="num">{{item.mCount}}份</van-col>
  78. </van-col>
  79. </van-col>
  80. <van-col class="statusSelect">
  81. <van-col class="select" :class="orderDetails.orderStatus == '0' ? 'zt' : 'overTime'" @click="statusChange(orderDetails.orderStatus == '0' ? 1 : undefined)" >
  82. 接单
  83. </van-col>
  84. <van-col class="select" :class="orderDetails.orderStatus == '1' ? 'zt' : 'overTime'" @click="statusChange(orderDetails.orderStatus == '1' ? 2 : undefined)">
  85. 送餐
  86. </van-col>
  87. <van-col class="select" :class="orderDetails.orderStatus == '2' ? 'zt' : 'overTime'" @click="statusChange(orderDetails.orderStatus == '2' ? 3 : undefined)">
  88. 完成
  89. </van-col>
  90. <van-col class="select gb" @click="close">
  91. 关闭
  92. </van-col>
  93. </van-col>
  94. <van-col class="jjPhone">紧急联系人:{{orderDetails.jjPhone}}</van-col>
  95. </van-row>
  96. </van-dialog>
  97. </div>
  98. </template>
  99. <script>
  100. import { Toast } from "vant";
  101. import Cookies from "js-cookie";
  102. import { getNowTime } from "@/assets/js/dataFormate.js";
  103. export default {
  104. data() {
  105. return {
  106. show:false,
  107. number:undefined,
  108. status:false,
  109. active:0,
  110. order:[],
  111. orderDetails:{},
  112. dishes:[],
  113. title:"配餐清单",
  114. orderId:undefined,
  115. };
  116. },
  117. components: {
  118. [Toast.name]: Toast,
  119. },
  120. mounted(){
  121. document.title = '中国东信智慧园区'
  122. this.orderStatus()
  123. if(this.$route.query.id){
  124. this.orderStatus2()
  125. setTimeout(()=>{
  126. for(let i =0;i<this.order.length;i++){
  127. if(this.order[i].id == this.$route.query.id){
  128. if(this.order[i].orderStatus == '1' || this.order[i].orderStatus == '2'|| this.order[i].orderStatus == '0'){
  129. this.active= 0
  130. }else{
  131. this.active= 1
  132. }
  133. this.orderOne(this.order[i])
  134. }
  135. }
  136. },1000)
  137. }else{
  138. this.orderStatus()
  139. }
  140. },
  141. methods: {
  142. //返回上级
  143. fanhuiBtn() {
  144. window.href = "https://smartpark.caih.com/h5/#/home/feature"
  145. // this.$router.go(-1)
  146. },
  147. //订单查询
  148. orderStatus(id){
  149. let data = {
  150. current:1,
  151. size:500,
  152. orderStatus:undefined,
  153. statusList:undefined
  154. }
  155. if(id){
  156. data.orderStatus = id
  157. //历史订单
  158. axios.post(`https://smartpark.caih.com/dxapi/dreOrder/page`,data).then(res => {
  159. const data = res.data.data.records
  160. this.order = data
  161. this.status = true
  162. })
  163. }else{
  164. data.statusList = [0,1,2]
  165. //历史订单
  166. axios.post(`https://smartpark.caih.com/dxapi/dreOrder/page`,data).then(res => {
  167. const data = res.data.data.records
  168. this.number = data.length
  169. if(this.number == "0"){
  170. this.number = undefined
  171. }
  172. if(data.length>99){
  173. this.number = data.length
  174. }
  175. this.order = data
  176. this.status = true
  177. })
  178. }
  179. },
  180. //订单查询
  181. orderStatus2(){
  182. let data = {
  183. current:1,
  184. size:500,
  185. orderStatus:undefined,
  186. statusList:[0,1,2,3]
  187. }
  188. //历史订单
  189. axios.post(`https://smartpark.caih.com/dxapi/dreOrder/page`,data).then(res => {
  190. const data = res.data.data.records
  191. this.number = data.length
  192. if(this.number == "0"){
  193. this.number = undefined
  194. }
  195. if(data.length>99){
  196. this.number = data.length
  197. }
  198. this.order = data
  199. this.status = true
  200. })
  201. },
  202. //active切换
  203. activeSelect(){
  204. if(this.active == "0"){
  205. this.orderStatus()
  206. }else{
  207. this.orderStatus(3)
  208. }
  209. },
  210. //订单详情
  211. orderOne(row){
  212. this.orderDetails = row
  213. axios.get(`https://smartpark.caih.com/dxapi/system/config/configKey/dre_urgency_phone`).then(res => {
  214. this.orderDetails.jjPhone = res.data.data
  215. //订单详情
  216. axios.get(`https://smartpark.caih.com/dxapi/dreOrderDetail/listByOrder?orderId=${row.id}`).then(res => {
  217. this.dishes = res.data.data
  218. this.show = true
  219. })
  220. })
  221. },
  222. //状态变更
  223. statusChange(id){
  224. if(id){
  225. let time = getNowTime()
  226. let data = {
  227. id:this.orderDetails.id,
  228. orderStatus:id,
  229. receiveUserName:undefined,
  230. receiveUserId:undefined,
  231. receiveTime:undefined,
  232. sendUserName:undefined,
  233. sendUserId:undefined,
  234. sendTime:undefined,
  235. sendEndTime:undefined,
  236. }
  237. let sid = undefined
  238. axios.get("https://smartpark.caih.com/dxapi/dxtop/staff/one",{
  239. params:{
  240. id:Cookies.get("userId57")
  241. }
  242. }).then(res2 =>{
  243. sid = res2.data.data.sid
  244. if(id == "1"){
  245. data.receiveUserName = Cookies.get("nickName57")
  246. data.receiveUserId = sid
  247. data.receiveTime = time
  248. }
  249. if(id == "2"){
  250. data.sendUserName= Cookies.get("nickName57")
  251. data.sendUserId = sid
  252. data.sendTime = time
  253. }
  254. if(id == "3"){
  255. data.sendEndTime = time
  256. }
  257. axios.put(`https://smartpark.caih.com/dxapi/dreOrder/`,data).then(res => {
  258. console.log(res)
  259. if(res.data.status == "SUCCESS"){
  260. if(id == "3"){
  261. this.active = 1
  262. this.number = this.number - 1
  263. if(this.number == "0"){
  264. this.number = undefined
  265. }
  266. this.orderStatus(3)
  267. }else{
  268. this.active = 0
  269. this.orderStatus()
  270. }
  271. }else{
  272. Toast(res.data.msg)
  273. this.orderStatus()
  274. }
  275. this.show = false
  276. })
  277. })
  278. }
  279. },
  280. //关闭
  281. close(id){
  282. this.show = false
  283. }
  284. },
  285. };
  286. </script>
  287. <style lang="scss" scoped>
  288. .mianBox{
  289. width:100%;
  290. height:100%;
  291. overflow: scroll;
  292. background-color: #F9F9F9 !important;
  293. .top{
  294. position: relative;
  295. .pc{
  296. height:48px;
  297. line-height: 48px;
  298. }
  299. .lineP{
  300. position: absolute;
  301. top:12px;
  302. left:50%;
  303. width:1px;
  304. height:20px;
  305. background-color: #E8E8E8;
  306. }
  307. }
  308. .bottom{
  309. background-color: #fff;
  310. margin-top:10px;
  311. .orderList{
  312. .order{
  313. padding:15px;
  314. div{
  315. font-size: 14px;
  316. float:left;
  317. line-height:26px;
  318. }
  319. .left{
  320. width:30%;
  321. display: inline-block;
  322. color:#999999;
  323. text-align: left;
  324. }
  325. .right{
  326. width:70%;
  327. display: inline-block;
  328. color:#333;
  329. text-align: right;
  330. }
  331. .status1{
  332. color:#ee0a24;
  333. text-align: right;
  334. }
  335. .van-steps{
  336. background:transparent;
  337. height:40px;
  338. padding-bottom:20px;
  339. width:100%;
  340. }
  341. }
  342. .order:nth-child(odd){
  343. background-color: #fff;
  344. }
  345. .order:nth-child(even){
  346. background-color: #F9F9F9;
  347. }
  348. }
  349. .noMore{
  350. background-color: #F0F0F0;
  351. color:#999999;
  352. text-align: center;
  353. padding:20px 0;
  354. font-size: 12px;
  355. }
  356. }
  357. .pcDialog{
  358. border-radius: 5px;
  359. width:85%;
  360. padding:20px 0;
  361. .orderDetails{
  362. .order{
  363. padding:0px 16px 20px;
  364. border-bottom:1px solid #F0F0F0;
  365. div{
  366. float:left;
  367. line-height:26px;
  368. }
  369. .left{
  370. width:40%;
  371. display: inline-block;
  372. text-align: left;
  373. color:#999999;
  374. vertical-align: top;
  375. }
  376. .right{
  377. width:60%;
  378. display: inline-block;
  379. text-align: right;
  380. color:#333;
  381. vertical-align: top;
  382. }
  383. }
  384. }
  385. .detailsText,.jjPhone{
  386. font-size: 15px;
  387. margin:20px 16px 8px;
  388. font-weight: 700;
  389. }
  390. .jjPhone{
  391. margin:20px 16px 0;
  392. }
  393. .dishes{
  394. max-height:calc(100vh - 550px);
  395. overflow-y: scroll;
  396. padding:0px 16px;
  397. .list{
  398. color:#333;
  399. font-size: 15px;
  400. height:40px;
  401. line-height: 40px;
  402. width:100%;
  403. div:nth-child(odd){
  404. text-align: left;
  405. padding-left:10px;
  406. }
  407. div:nth-child(even){
  408. text-align: right;
  409. padding-right:10px;
  410. }
  411. }
  412. .list:nth-child(odd){
  413. background: #F9F9F9;
  414. }
  415. .list:nth-child(even){
  416. background: #F0F0F0;
  417. }
  418. }
  419. .statusSelect{
  420. margin:20px 16px 0;
  421. .select{
  422. width:65px;
  423. height:44px;
  424. line-height: 44px;
  425. font-size: 17px;
  426. text-align: center;
  427. border-radius: 5px;
  428. }
  429. .select:nth-child(1),.select:nth-child(2),.select:nth-child(3){
  430. margin-right:8.2px;
  431. }
  432. .zt{
  433. color: #fff;
  434. background:#ee0a24;
  435. }
  436. .gb{
  437. color: #ee0a24;
  438. background:#fff;
  439. border:1px solid #ee0a24;
  440. }
  441. .overTime{
  442. background-color: #ccc;
  443. color:#fff;
  444. }
  445. }
  446. }
  447. }
  448. </style>
  449. <style>
  450. .van-steps__items{
  451. margin-top:-10px !important;
  452. }
  453. .van-steps--horizontal{
  454. padding:0;
  455. }
  456. .van-step__title{
  457. position: absolute !important;
  458. top:40px;
  459. font-size: 12px !important;
  460. margin-left:-50px;
  461. }
  462. .van-step--horizontal:last-child .van-step__title{
  463. margin-left:-40px;
  464. }
  465. .van-info{
  466. width:18px;
  467. height:18px;
  468. line-height: 18px;
  469. top:8px;
  470. left:24px;
  471. color:#fff;
  472. margin-left:20px;
  473. background-color: #ee0a24;
  474. font-size: 10px;
  475. }
  476. .pcDialog .van-dialog__footer{
  477. display: none;
  478. }
  479. .pc .van-tab__text{
  480. font-size: 15px;
  481. }
  482. .pc .van-tabs__line{
  483. width:45px !important;
  484. }
  485. </style>