orderInfo.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557
  1. <template>
  2. <view class="page" :style="{'height':(h)+'px','padding-top':mt+'px'}">
  3. <c-nav-bar title="订单详情" showIcon="true" :titleStyle="titleStyle"></c-nav-bar>
  4. <view class="body" v-if="orderInfo.detailFormList[0]">
  5. <!-- 个人信息 -->
  6. <view class="uname">
  7. <text class="dtitle" style="margin-right: 50rpx;">{{orderInfo.guestName}}</text>
  8. <text class="dtitle" style="margin-right: 20rpx;">{{orderInfo.guestPhoneCopy}}</text>
  9. <image class="callphone"
  10. src="https://fsy.shengsi.gov.cn/file/20240605/20affd94bb514035b654823fefcaba2e.png"
  11. @click="callPhone(orderInfo.guestPhone)"></image>
  12. </view>
  13. <!-- 房间信息 -->
  14. <view class="room">
  15. <!-- 房间/预定信息 -->
  16. <view class="reservations">
  17. <text class="dtitle">{{orderInfo.houseBaseName}}-{{orderInfo.detailFormList[0].roomNumber}}</text>
  18. <text class="r_status"
  19. :style="{'background': scolor[orderInfo.orderStatus]}">{{getStatusText()}}</text>
  20. </view>
  21. <!-- 时间/价格 -->
  22. <view class="time-price">
  23. <text style="font-size: 30rpx; color: #777;">{{orderInfo.arriveDate}}入住 {{orderInfo.num}}晚</text>
  24. <text style="font-size: 30rpx;font-weight: bold; color: #111;">¥{{orderInfo.orderAmount}}</text>
  25. </view>
  26. <!-- 入住成人人数 -->
  27. <view class="house-person">
  28. <text style="font-size: 30rpx; color: #777;">入住成人数量</text>
  29. <view class="right">
  30. <text style="font-size: 30rpx;font-weight: bold; color: #111; ">{{orderInfo.checkinGuests}}人
  31. </text>
  32. </view>
  33. </view>
  34. <!-- 入住儿童人数 -->
  35. <view class="house-person">
  36. <text style="font-size: 30rpx; color: #777;">入住儿童数量</text>
  37. <view class="right">
  38. <text style="font-size: 30rpx;font-weight: bold; color: #111; ">{{orderInfo.childCheckinNums}}人
  39. </text>
  40. </view>
  41. </view>
  42. <!-- 订单信息 -->
  43. <view class="r_line"></view>
  44. <view class="house-person">
  45. <text style="font-size: 30rpx; color: #777;">订单号</text>
  46. <view class="right">
  47. <text style="font-size: 30rpx; color: #111; text-align: right;">
  48. {{orderInfo.orderCode}}
  49. </text>
  50. </view>
  51. </view>
  52. <view class="house-person">
  53. <text style="font-size: 30rpx; color: #777;">创建时间</text>
  54. <view class="right">
  55. <text style="font-size: 30rpx; color: #111; text-align: right;">
  56. {{orderInfo.orderTime}}
  57. </text>
  58. </view>
  59. </view>
  60. <view class="house-person" v-if="orderInfo.orderStatus==4">
  61. <text style="font-size: 30rpx; color: #777;">取消原因</text>
  62. <view class="right">
  63. <text style="font-size: 30rpx; color: #111; text-align: right;">
  64. {{orderInfo.refundReason}}
  65. </text>
  66. </view>
  67. </view>
  68. <view class="house-person">
  69. <text style="font-size: 30rpx; color: #777;">备注</text>
  70. <view class="right">
  71. <text style="font-size: 30rpx; color: #111; text-align: right;">
  72. {{orderInfo.remarks}}
  73. </text>
  74. </view>
  75. </view>
  76. </view>
  77. <!-- 其他消费 -->
  78. <view class="room" v-if="breakFastList.length>0||otherList.length>0">
  79. <view class="reservations">
  80. <text class="dtitle">其他消费</text>
  81. </view>
  82. <view class="house-person" v-for="(item,index) in breakFastList" :key="index"
  83. v-if="breakFastList.length>0">
  84. <text style="font-size: 30rpx; color: #777;">{{item.breakfastName}} X{{item.num}}</text>
  85. <view class="right">
  86. <text style="font-size: 30rpx;font-weight: bold; color: #111; ">
  87. ¥{{item.price*item.num}}
  88. </text>
  89. </view>
  90. </view>
  91. <view class="house-person" v-for="(item,index) in otherList" :key="index" v-if="otherList.length>0">
  92. <text style="font-size: 30rpx; color: #777;">{{item.projectName}} X{{item.num}}</text>
  93. <view class="right">
  94. <text style="font-size: 30rpx;font-weight: bold; color: #111; ">
  95. ¥{{item.defaultPrice*item.num}}
  96. </text>
  97. </view>
  98. </view>
  99. </view>
  100. <block v-if="orderInfo.repastList&&orderInfo.repastList.length>0">
  101. <view class="room" v-for="(item,index) in orderInfo.repastList" :key="index">
  102. <view class="dtitle" style="margin: 6rpx 0 40rpx;">餐饮订单详情</view>
  103. <view class="reservations">
  104. <text class="dtitle" style="color: #111;">{{item.comboName}}</text>
  105. <text class="r_status"
  106. :style="{'background': scolor[item.orderStatus]}">{{repastStr[item.orderStatus]}}</text>
  107. </view>
  108. <view class="time-price">
  109. <text style="font-size: 28rpx; color: #717171;">预约时间 {{item.repastTime}}</text>
  110. <text style="font-size: 30rpx;font-weight: bold; color: #111;">¥{{item.orderAmount}}</text>
  111. </view>
  112. <view class="r_line"></view>
  113. <view class="house-person">
  114. <text style="font-size: 30rpx; color: #777;">预约人姓名</text>
  115. <view class="right">
  116. <text style="font-size: 30rpx; color: #111; text-align: right;">
  117. {{item.guestName}}
  118. </text>
  119. </view>
  120. </view>
  121. <block v-if="item.comboType==1">
  122. <view class="house-person">
  123. <text style="font-size: 30rpx; color: #777;">成人人数</text>
  124. <view class="right">
  125. <text style="font-size: 30rpx; color: #111; text-align: right;">
  126. {{item.num}}
  127. </text>
  128. </view>
  129. </view>
  130. <view class="house-person">
  131. <text style="font-size: 30rpx; color: #777;">儿童人数</text>
  132. <view class="right">
  133. <text style="font-size: 30rpx; color: #111; text-align: right;">
  134. {{item.repastNum}}
  135. </text>
  136. </view>
  137. </view>
  138. </block>
  139. <block v-if="item.comboType==2">
  140. <view class="house-person">
  141. <text style="font-size: 30rpx; color: #777;">就餐份数</text>
  142. <view class="right">
  143. <text style="font-size: 30rpx; color: #111; text-align: right;">
  144. {{item.num}}份
  145. </text>
  146. </view>
  147. </view>
  148. </block>
  149. <view class="house-person">
  150. <text style="font-size: 30rpx; color: #777;">订单编号</text>
  151. <view class="right">
  152. <text style="font-size: 30rpx; color: #111; text-align: right;">
  153. {{item.orderCode}}
  154. </text>
  155. </view>
  156. </view>
  157. <view class="house-person">
  158. <text style="font-size: 30rpx; color: #777;">备注</text>
  159. <view class="right">
  160. <text style="font-size: 30rpx; color: #111; text-align: right;">
  161. {{item.remarks}}
  162. </text>
  163. </view>
  164. </view>
  165. </view>
  166. </block>
  167. <!-- 按钮 -->
  168. <view class="button" v-if="orderInfo.orderStatus==-1||orderInfo.orderStatus==1||orderInfo.orderStatus==2">
  169. <!-- 待确认 -->
  170. <template v-if="orderInfo.orderStatus==-1">
  171. <button class="edit" @click="cancle()">取消订单</button>
  172. <button class="goRoom" @click="show2=true">确认订单</button>
  173. </template>
  174. <!-- 已预订 -->
  175. <template v-if="orderInfo.orderStatus==1">
  176. <button class="edit" @click="edit()">编辑订单</button>
  177. <button class="goRoom" @click="checkIn(2)" v-if="showRuzhu">办理入住</button>
  178. </template>
  179. <!-- 已入住 -->
  180. <template v-if="orderInfo.orderStatus==2">
  181. <button class="edit" @click="edit()">编辑订单</button>
  182. <button class="goRoom" @click="show3=true">办理退房</button>
  183. </template>
  184. </view>
  185. </view>
  186. <!-- 取消订单 -->
  187. <u-modal :show="show" @confirm="confirmCheck" :show-cancel-button="true" @cancel="show=false">
  188. <view class="slot-content">
  189. <input type="text" v-model="check.refundReason" placeholder="请输入原因" />
  190. <!-- <u-cell-group :border="false" customStyle="margin:0 -30rpx">
  191. <u-cell>
  192. <view slot="title" class="title">
  193. <u--input border="none" class="input" inputAlign="right" placeholderStyle="font-size:26rpx"
  194. placeholder="请输入原因" v-model="check.refundReason"></u--input>
  195. </view>
  196. </u-cell>
  197. </u-cell-group> -->
  198. </view>
  199. </u-modal>
  200. <!-- 确认订单 -->
  201. <u-modal :show="show2" content="确定该操作?" @confirm="confirmOrder" :show-cancel-button="true"
  202. @cancel="show2=false">
  203. </u-modal>
  204. <!-- 办理退房 -->
  205. <u-modal :show="show3" content="确定该操作?" @confirm="checkoutRoom" :show-cancel-button="true"
  206. @cancel="show3=false">
  207. </u-modal>
  208. </view>
  209. </template>
  210. <script>
  211. export default {
  212. data() {
  213. return {
  214. titleStyle: {
  215. fontSize: '34rpx',
  216. fontWeight: "bold",
  217. },
  218. h: uni.getSystemInfoSync().windowHeight,
  219. mt: uni.getSystemInfoSync().statusBarHeight + 44,
  220. show: false,
  221. show2: false,
  222. show3: false,
  223. check: {
  224. initiator: 1,
  225. refundReason: "",
  226. status: -1,
  227. orderCode: "",
  228. },
  229. showRuzhu: false,
  230. orderId: '',
  231. orderInfo: {
  232. detailFormList: []
  233. },
  234. id: '',
  235. scolor: {
  236. '-2': '#FF4141',
  237. '-1': '#FEA400',
  238. '1': '#FEA400',
  239. '2': '#A9B4C1',
  240. '3': '#A9B4C1',
  241. '4': '#A9B4C1',
  242. '5': '#A9B4C1',
  243. },
  244. repastStr: {
  245. '-2': '待支付',
  246. '1': '未核销',
  247. '2': '已核销',
  248. '4': '已取消',
  249. '5': '已退款'
  250. },
  251. breakFastList: [],
  252. otherList: [],
  253. }
  254. },
  255. onLoad(opt) {
  256. if (opt.orderId) {
  257. if (opt.orderType == 201) {
  258. this.id = opt.orderId;
  259. this.getrepast()
  260. } else {
  261. this.orderId = opt.orderId;
  262. this.getOrderInfo()
  263. }
  264. }
  265. },
  266. methods: {
  267. callPhone(phoneNumber) {
  268. uni.makePhoneCall({
  269. phoneNumber
  270. })
  271. },
  272. // 获取数据
  273. getOrderInfo() {
  274. this.$api.get(`/merchant/hotel/order/getOrderDetail/${this.orderId}`).then((res) => {
  275. if (res.data.code == 0) {
  276. this.orderInfo = res.data.data;
  277. this.breakFastList = this.orderInfo.detailFormList[0].breakfastData || [];
  278. this.otherList = this.orderInfo.detailFormList[0].otherData || [];
  279. if (this.orderInfo.guestPhone) this.orderInfo.guestPhoneCopy = this.$aesTm.tuomin(this
  280. .orderInfo.guestPhone, 2)
  281. if (new Date(this.orderInfo.arriveDate).Format('yyyy-MM-dd') == new Date().Format(
  282. 'yyyy-MM-dd')) {
  283. this.showRuzhu = true;
  284. }
  285. }
  286. })
  287. },
  288. // 获取数据
  289. getrepast() {
  290. this.$api.get(`/merchant/hotel/repast${this.id}`).then((res) => {
  291. if (res.data.code == 0) {
  292. this.orderInfo = res.data.data;
  293. this.breakFastList = this.orderInfo.detailFormList[0].breakfastData || [];
  294. this.otherList = this.orderInfo.detailFormList[0].otherData || [];
  295. if (this.orderInfo.guestPhone) this.orderInfo.guestPhoneCopy = this.$aesTm.tuomin(this
  296. .orderInfo.guestPhone, 2)
  297. if (new Date(this.orderInfo.arriveDate).Format('yyyy-MM-dd') == new Date().Format(
  298. 'yyyy-MM-dd')) {
  299. this.showRuzhu = true;
  300. }
  301. }
  302. })
  303. },
  304. // 客房状态
  305. getStatusText() {
  306. if (this.orderInfo.orderStatus === -1) {
  307. return '待确定'
  308. } else if (this.orderInfo.orderStatus === 1) {
  309. return '已预订'
  310. } else if (this.orderInfo.orderStatus === 2) {
  311. return '已入住'
  312. } else if (this.orderInfo.orderStatus === -2) {
  313. return '待支付'
  314. } else if (this.orderInfo.orderStatus === 3) {
  315. return '已退房'
  316. } else if (this.orderInfo.orderStatus === 4) {
  317. return '已取消'
  318. } else if (this.orderInfo.orderStatus === 5) {
  319. return '已退款'
  320. } else {
  321. return '状态异常'
  322. }
  323. },
  324. //添加入住人
  325. goStayCheck() {
  326. let list = JSON.stringify(this.orderInfo);
  327. uni.navigateTo({
  328. url: '/pages/house/stayCheck?orderInfo=' + list,
  329. events: {
  330. addSuccess: data => {
  331. this.orderInfo.detailFormList[0].checkInPersonList = data.data || [];
  332. }
  333. },
  334. })
  335. },
  336. // 确认订单
  337. confirmOrder() {
  338. this.$api
  339. .get(`/merchant/hotel/order/confirm/${this.orderInfo.id}`)
  340. .then((res) => {
  341. if (res.data.code !== 0) {
  342. return this.$showToast(res.data.msg);
  343. }
  344. this.show2 = false;
  345. this.$showToast('操作成功');
  346. setTimeout(() => {
  347. uni.reLaunch({
  348. url: '/pagesMy/orderList/orderList'
  349. })
  350. }, 1500)
  351. });
  352. },
  353. //取消订单
  354. cancle() {
  355. this.show = true;
  356. this.check.orderCode = this.orderInfo.orderCode;
  357. },
  358. //取消订单
  359. confirmCheck() {
  360. this.$api.post("/merchant/hotel/order/cancelOrder", this.check)
  361. .then((res) => {
  362. if (res.data.code !== 0) {
  363. return this.$showToast(res.data.msg);
  364. }
  365. this.show = false;
  366. this.$showToast('操作成功');
  367. setTimeout(() => {
  368. uni.reLaunch({
  369. url: '/pagesMy/orderList/orderList'
  370. })
  371. }, 1500)
  372. });
  373. },
  374. //办理入住
  375. checkIn(orderStatus) {
  376. uni.navigateTo({
  377. url: "/pages/house/createOrder?id=" + this.orderInfo.id + '&orderStatus=' + orderStatus
  378. })
  379. },
  380. // 编辑
  381. edit() {
  382. uni.navigateTo({
  383. url: "/pages/house/createOrder?id=" + this.orderInfo.id
  384. })
  385. },
  386. //办理退房
  387. checkoutRoom() {
  388. this.$api.get("/merchant/hotel/order/checkout/" + this.orderInfo.id)
  389. .then((res) => {
  390. if (res.data.code !== 0) {
  391. return this.$showToast(res.data.msg);
  392. }
  393. this.show = false;
  394. this.$showToast('操作成功');
  395. setTimeout(() => {
  396. uni.reLaunch({
  397. url: '/pagesMy/orderList/orderList'
  398. })
  399. }, 1500)
  400. });
  401. }
  402. },
  403. computed: {
  404. isOrderPanding() {
  405. return this.orderInfo.orderStatus === 1
  406. }
  407. }
  408. }
  409. </script>
  410. <style lang="scss">
  411. .page {
  412. background: #F3F4F4;
  413. padding-bottom: 260rpx;
  414. box-sizing: border-box;
  415. overflow-y: auto;
  416. overflow-x: auto;
  417. }
  418. .body {
  419. padding-top: 20rpx;
  420. padding-left: 30rpx;
  421. padding-right: 30rpx;
  422. }
  423. .uname {
  424. width: 100%;
  425. height: 100rpx;
  426. line-height: 100rpx;
  427. background-color: #fff;
  428. padding-left: 30rpx;
  429. font-size: 30rpx;
  430. border-radius: 10rpx;
  431. box-sizing: border-box;
  432. position: relative;
  433. .callphone {
  434. width: 48rpx;
  435. height: 48rpx;
  436. position: absolute;
  437. top: 50%;
  438. margin-top: -24rpx;
  439. right: 30rpx;
  440. }
  441. }
  442. .dtitle {
  443. font-family: PingFang-SC, PingFang-SC;
  444. font-weight: bold;
  445. font-size: 36rpx;
  446. color: #333333;
  447. line-height: 40rpx;
  448. width: calc(100% - 100rpx);
  449. }
  450. .room {
  451. margin-top: 20rpx;
  452. width: 100%;
  453. background-color: #fff;
  454. margin-bottom: 20rpx;
  455. border-radius: 10rpx;
  456. padding: 30rpx;
  457. box-sizing: border-box;
  458. .r_line {
  459. width: 100%;
  460. height: 1rpx;
  461. background: #efefef;
  462. margin: 24rpx 0;
  463. }
  464. }
  465. .orderTip {
  466. padding: 30rpx;
  467. padding-top: 0;
  468. width: 690rpx;
  469. height: 514rpx;
  470. background-color: #fff;
  471. border-radius: 10rpx;
  472. }
  473. .button {
  474. position: fixed;
  475. bottom: 0;
  476. height: 96rpx;
  477. width: 100%;
  478. margin-top: 20rpx;
  479. display: flex;
  480. justify-content: space-between;
  481. border-radius: 10rpx;
  482. z-index: 9;
  483. background-color: #fff;
  484. left: 0;
  485. padding: 24rpx 0;
  486. }
  487. .goRoom {
  488. // border-radius: ;
  489. width: 330rpx;
  490. height: 96rpx;
  491. border-radius: 48rpx;
  492. font-size: 34rpx;
  493. background-color: #1372FF;
  494. color: #fff;
  495. }
  496. .edit {
  497. width: 330rpx;
  498. height: 96rpx;
  499. border-radius: 48rpx;
  500. font-size: 34rpx;
  501. background-color: #E2EDFC;
  502. color: #1372FF;
  503. }
  504. .reservations {
  505. display: flex;
  506. position: relative;
  507. .r_status {
  508. font-family: PingFang-SC, PingFang-SC;
  509. font-weight: bold;
  510. font-size: 24rpx;
  511. color: #FFFFFF;
  512. line-height: 33rpx;
  513. color: #fff;
  514. padding: 4rpx 9rpx;
  515. border-radius: 8rpx;
  516. position: absolute;
  517. right: 0;
  518. top: 50%;
  519. margin-top: -22rpx;
  520. }
  521. }
  522. .time-price {
  523. display: flex;
  524. justify-content: space-between;
  525. margin-top: 30rpx;
  526. }
  527. .house-person {
  528. display: flex;
  529. justify-content: space-between;
  530. margin-top: 30rpx;
  531. }
  532. .right {
  533. display: flex;
  534. }
  535. </style>