index.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477
  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. <van-col span="5" class="dcrText" style="margin-top:0">点餐人:</van-col>
  23. <van-col offset="1" span="18" class="dcr" style="margin-top:0">{{item.orderUserName}}</van-col>
  24. <van-col span="5" class="scAddressText">送餐地址:</van-col>
  25. <van-col offset="1" span="18" class="scAddress">{{item.address}}</van-col>
  26. <van-col span="5" class="statusText">当前状态:</van-col>
  27. <van-col offset="1" span="18" :class="item.orderStatus == '3' ? 'status' : 'status1'">
  28. {{item.orderStatus == "0" ? "待接单" : item.orderStatus == "1" ? "配餐中" : item.orderStatus == "2" ? "送餐中" : "已完成"}}
  29. </van-col>
  30. <van-steps :active="item.orderStatus == '0' ? '-1' : item.orderStatus" v-if="item.orderStatus != '3'" active-color="#D7000F" 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. <van-col span="5" class="dcrText" style="margin-top:0">点餐人:</van-col>
  41. <van-col offset="1" span="18" class="dcr" style="margin-top:0">{{item.orderUserName}}</van-col>
  42. <van-col span="5" class="scAddressText" >送餐地址:</van-col>
  43. <van-col offset="1" span="18" class="scAddress">{{item.address || "-"}}</van-col>
  44. <van-col span="5" class="statusText">当前状态:</van-col>
  45. <van-col offset="1" span="18" :class="item.orderStatus == '3' ? 'status' : 'status1'">
  46. {{item.orderStatus == "0" ? "待接单" : item.orderStatus == "1" ? "配餐中" : item.orderStatus == "2" ? "送餐中" : "已完成"}}
  47. </van-col>
  48. <!-- <van-steps :active="item.orderStatus == '0' ? '-1' : item.orderStatus" v-if="item.orderStatus != '3'" active-color="#D7000F" 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. <van-col span="7" style="margin-top:0">订餐人:</van-col>
  61. <van-col offset="1" span="16" style="margin-top:0">{{orderDetails.orderUserName || '-'}}</van-col>
  62. <van-col span="7">餐别:</van-col>
  63. <van-col offset="1" span="16">{{orderDetails.mType || '-'}}</van-col>
  64. <van-col span="7">手机号:</van-col>
  65. <van-col offset="1" span="16">{{orderDetails.phone || '-'}}</van-col>
  66. <van-col span="7">送餐地址:</van-col>
  67. <van-col offset="1" span="16">{{orderDetails.address || "-"}}</van-col>
  68. <van-col span="7">下单时间:</van-col>
  69. <van-col offset="1" span="16">{{orderDetails.orderTime || '-'}}</van-col>
  70. <van-col span="7">备注:</van-col>
  71. <van-col offset="1" span="16">{{orderDetails.remark || '-'}}</van-col>
  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. console.log(this.$route.query.id)
  125. this.orderStatus()
  126. setTimeout(()=>{
  127. for(let i =0;i<this.order.length;i++){
  128. if(this.order[i].id = this.$route.query.id){
  129. this.orderOne(this.order[i])
  130. }
  131. }
  132. },50)
  133. }else{
  134. this.orderStatus()
  135. }
  136. },
  137. methods: {
  138. //返回上级
  139. fanhuiBtn() {
  140. this.$router.push({ path: "/home"})
  141. },
  142. //订单查询
  143. orderStatus(id){
  144. let data = {
  145. current:1,
  146. size:500,
  147. orderStatus:undefined,
  148. statusList:undefined
  149. }
  150. if(id){
  151. data.orderStatus = id
  152. //历史订单
  153. axios.post(`https://smartpark.caih.com/dxapi/dreOrder/page`,data).then(res => {
  154. const data = res.data.data.records
  155. this.order = data
  156. this.status = true
  157. })
  158. }else{
  159. data.statusList = [0,1,2]
  160. //历史订单
  161. axios.post(`https://smartpark.caih.com/dxapi/dreOrder/page`,data).then(res => {
  162. const data = res.data.data.records
  163. this.number = data.length
  164. if(this.number == "0"){
  165. this.number = undefined
  166. }
  167. if(data.length>99){
  168. this.number = data.length
  169. }
  170. this.order = data
  171. this.status = true
  172. })
  173. }
  174. },
  175. //active切换
  176. activeSelect(){
  177. if(this.active == "0"){
  178. this.orderStatus()
  179. }else{
  180. this.orderStatus(3)
  181. }
  182. },
  183. // //订单详情
  184. // orderOne(row){
  185. // this.orderDetails = row
  186. // axios.get(`https://smartpark.caih.com/dxapi/system/config/configKey/dre_urgency_phone`).then(res => {
  187. // this.orderDetails.jjPhone = res.data.data
  188. // //订单详情
  189. // axios.get(`https://smartpark.caih.com/dxapi/dreOrderDetail/listByOrder?orderId=${row.id}`).then(res => {
  190. // this.dishes = res.data.data
  191. // this.show = true
  192. // })
  193. // })
  194. // },
  195. //订单详情
  196. orderOne(row){
  197. this.orderDetails = row
  198. axios.get(`https://smartpark.caih.com/dxapi/system/config/configKey/dre_urgency_phone`).then(res => {
  199. this.orderDetails.jjPhone = res.data.data
  200. //订单详情
  201. axios.get(`https://smartpark.caih.com/dxapi/dreOrderDetail/listByOrder?orderId=${row.id}`).then(res => {
  202. this.dishes = res.data.data
  203. this.show = true
  204. })
  205. })
  206. },
  207. //状态变更
  208. statusChange(id){
  209. if(id){
  210. let time = getNowTime()
  211. let data = {
  212. id:this.orderDetails.id,
  213. orderStatus:id,
  214. receiveUserName:undefined,
  215. receiveUserId:undefined,
  216. receiveTime:undefined,
  217. sendUserName:undefined,
  218. sendUserId:undefined,
  219. sendTime:undefined,
  220. sendEndTime:undefined,
  221. }
  222. let sid = undefined
  223. axios.get("https://smartpark.caih.com/dxapi/dxtop/staff/one",{
  224. params:{
  225. id:Cookies.get("userId57")
  226. }
  227. }).then(res2 =>{
  228. sid = res2.data.data.sid
  229. if(id == "1"){
  230. data.receiveUserName = Cookies.get("nickName57")
  231. data.receiveUserId = sid
  232. data.receiveTime = time
  233. }
  234. if(id == "2"){
  235. data.sendUserName= Cookies.get("nickName57")
  236. data.sendUserId = sid
  237. data.sendTime = time
  238. }
  239. if(id == "3"){
  240. data.sendEndTime = time
  241. }
  242. axios.put(`https://smartpark.caih.com/dxapi/dreOrder/`,data).then(res => {
  243. console.log(res)
  244. if(res.data.status == "SUCCESS"){
  245. if(id == "3"){
  246. this.active = 1
  247. this.number = this.number - 1
  248. if(this.number == "0"){
  249. this.number = undefined
  250. }
  251. this.orderStatus(3)
  252. }else{
  253. this.active = 0
  254. this.orderStatus()
  255. }
  256. }else{
  257. Toast(res.data.msg)
  258. this.orderStatus()
  259. }
  260. this.show = false
  261. })
  262. })
  263. }
  264. },
  265. //关闭
  266. close(id){
  267. this.show = false
  268. }
  269. },
  270. };
  271. </script>
  272. <style lang="scss" scoped>
  273. .mianBox{
  274. width:100%;
  275. height:100%;
  276. overflow: scroll;
  277. background-color: #F9F9F9 !important;
  278. .top{
  279. position: relative;
  280. .pc{
  281. height:48px;
  282. line-height: 48px;
  283. }
  284. .lineP{
  285. position: absolute;
  286. top:12px;
  287. left:50%;
  288. width:1px;
  289. height:20px;
  290. background-color: #E8E8E8;
  291. }
  292. }
  293. .bottom{
  294. background-color: #fff;
  295. margin-top:10px;
  296. .orderList{
  297. .order{
  298. padding:15px;
  299. .dcrText,.scAddressText,.statusText{
  300. color:#999999;
  301. }
  302. .dcr,.scAddress,.status{
  303. color:#333;
  304. text-align: right;
  305. }
  306. div{
  307. font-size: 14px;
  308. margin-top:8px;
  309. line-height: 20px;
  310. }
  311. .status1{
  312. color:#D7000F;
  313. text-align: right;
  314. }
  315. .van-steps{
  316. background:transparent;
  317. height:40px;
  318. padding-bottom:20px;
  319. width:100%;
  320. }
  321. }
  322. .order:nth-child(odd){
  323. background-color: #fff;
  324. }
  325. .order:nth-child(even){
  326. background-color: #F9F9F9;
  327. }
  328. }
  329. .noMore{
  330. background-color: #F0F0F0;
  331. color:#999999;
  332. text-align: center;
  333. padding:20px 0;
  334. font-size: 12px;
  335. }
  336. }
  337. .pcDialog{
  338. border-radius: 5px;
  339. width:85%;
  340. padding:20px 0;
  341. .orderDetails{
  342. .order{
  343. padding:0px 16px 20px;
  344. border-bottom:1px solid #F0F0F0;
  345. div{
  346. margin-top:8px;
  347. line-height: 20px;
  348. }
  349. div:nth-child(odd){
  350. text-align: left;
  351. color:#999999;
  352. }
  353. div:nth-child(even){
  354. text-align: right;
  355. color:#333;
  356. }
  357. }
  358. }
  359. .detailsText,.jjPhone{
  360. font-size: 15px;
  361. margin:20px 16px 8px;
  362. font-weight: 700;
  363. }
  364. .jjPhone{
  365. margin:20px 16px 0;
  366. }
  367. .dishes{
  368. max-height:calc(100vh - 550px);
  369. overflow-y: scroll;
  370. padding:0px 16px;
  371. .list{
  372. color:#333;
  373. font-size: 15px;
  374. height:40px;
  375. line-height: 40px;
  376. width:100%;
  377. div:nth-child(odd){
  378. text-align: left;
  379. padding-left:10px;
  380. }
  381. div:nth-child(even){
  382. text-align: right;
  383. padding-right:10px;
  384. }
  385. }
  386. .list:nth-child(odd){
  387. background: #F9F9F9;
  388. }
  389. .list:nth-child(even){
  390. background: #F0F0F0;
  391. }
  392. }
  393. .statusSelect{
  394. margin:20px 16px 0;
  395. .select{
  396. width:65px;
  397. height:44px;
  398. line-height: 44px;
  399. font-size: 17px;
  400. text-align: center;
  401. border-radius: 5px;
  402. }
  403. .select:nth-child(1),.select:nth-child(2),.select:nth-child(3){
  404. margin-right:8.2px;
  405. }
  406. .zt{
  407. color: #fff;
  408. background:#D7000F;
  409. }
  410. .gb{
  411. color: #D7000F;
  412. background:#fff;
  413. border:1px solid #D7000F;
  414. }
  415. .overTime{
  416. background-color: #ccc;
  417. color:#fff;
  418. }
  419. }
  420. }
  421. }
  422. </style>
  423. <style>
  424. .van-steps__items{
  425. margin-top:-10px !important;
  426. }
  427. .van-steps--horizontal{
  428. padding:0;
  429. }
  430. .van-step__title{
  431. position: absolute !important;
  432. top:40px;
  433. font-size: 12px !important;
  434. margin-left:-50px;
  435. }
  436. .van-step--horizontal:last-child .van-step__title{
  437. margin-left:-40px;
  438. }
  439. .van-info{
  440. width:18px;
  441. height:18px;
  442. line-height: 18px;
  443. top:8px;
  444. left:24px;
  445. color:#fff;
  446. margin-left:20px;
  447. background-color: #D7000F;
  448. font-size: 10px;
  449. }
  450. .pcDialog .van-dialog__footer{
  451. display: none;
  452. }
  453. .pc .van-tab__text{
  454. font-size: 15px;
  455. }
  456. .pc .van-tabs__line{
  457. width:45px !important;
  458. }
  459. </style>